Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
>I'm developing an application that needs to display several times the >same data model, based on different imput files. This application >creates a new instance of a class, let's call it VisADViewer, for each >file. When the second instance of the class is created, the following >exception is thrown: > >Visad.TypeException : ScalarType: name already used > >This happens in this section of my code: >... >RealType xRT = new RealType("latitude", null, null); >RealType yRT = new RealType("longitude", null, null); >RealType zRT = new RealType("temperature", null, null); >... > >I have nothing declared static... in my code. Did anybody ever >experience something like that ? Any idea to solve the problem ? >(My first thought is that something may be declared static in the visad >package...) Alex, VisAD does maintain a static Vector of ScalarTypes. To reuse the same ScalarType again, use the following code: RealType xRT = (RealType) ScalarType.getScalarTypeByName("latitude"); if (xRT == null) xRT = new RealType("latitude", null, null); This code searches the static Vector for an already existing RealType called latitude. If it can't find it, it creates it. -Curtis
visad
archives: