void setupServerData(LocalDisplay[] dpys) throws RemoteException, VisADException { RealType[] types = {RealType.Latitude, RealType.Longitude}; RealTupleType earth_location = new RealTupleType(types); RealType vis_radiance = RealType.getRealType("vis_radiance"); RealType ir_radiance = RealType.getRealType("ir_radiance"); RealType[] types2 = {vis_radiance, ir_radiance}; RealTupleType radiance = new RealTupleType(types2); FunctionType image_tuple = new FunctionType(earth_location, radiance); int size = 64; FlatField imaget1 = FlatField.makeField(image_tuple, size, false); dpys[0].addMap(new ScalarMap(RealType.Latitude, Display.YAxis)); dpys[0].addMap(new ScalarMap(RealType.Longitude, Display.XAxis)); dpys[0].addMap(new ScalarMap(ir_radiance, Display.Green)); dpys[0].addMap(new ScalarMap(vis_radiance, Display.RGB)); dpys[0].addMap(new ScalarMap(ir_radiance, Display.ZAxis)); dpys[0].addMap(new ConstantMap(0.5, Display.Blue)); dpys[0].addMap(new ConstantMap(0.5, Display.Red)); ScalarMap map1contour; map1contour = new ScalarMap(vis_radiance, Display.IsoContour); dpys[0].addMap(map1contour); if (uneven) { ContourControl control = (ContourControl) map1contour.getControl(); float[] levs = {10.0f, 12.0f, 14.0f, 16.0f, 24.0f, 32.0f, 40.0f}; control.setLevels(levs, 15.0f, true); control.enableLabels(true); } DataReferenceImpl ref_imaget1 = new DataReferenceImpl("ref_imaget1"); ref_imaget1.setData(imaget1); dpys[0].addReference(ref_imaget1, null); }
public void doAction() throws VisADException, RemoteException { if (!init) { init = true; return; } Gridded2DSet set = (Gridded2DSet) rubberBand.getData(); float[] low = set.getLow(); float[] high = set.getHi(); xmap.setRange(low[0], high[0]); ymap.setRange(low[1], high[1]); }
/** check for flow mappings; does not allow flow mapping through CoordinateSystem */ private String findFlow( ShadowTupleType shadow, DisplayImpl display, DisplayTupleType[] tuples, int[] flowToComponent) { ShadowRealType[] components = shadow.getRealComponents(); for (int i = 0; i < components.length; i++) { int num_flow_per_real = 0; Enumeration maps = components[i].getSelectedMapVector().elements(); while (maps.hasMoreElements()) { ScalarMap map = (ScalarMap) maps.nextElement(); DisplayRealType dreal = map.getDisplayScalar(); DisplayTupleType tuple = dreal.getTuple(); if (Display.DisplayFlow1Tuple.equals(tuple) || Display.DisplayFlow2Tuple.equals(tuple)) { if (tuples[0] != null) { if (!tuples[0].equals(tuple)) { return multipleFlowTuples; } } else { tuples[0] = tuple; } num_flow_per_real++; if (num_flow_per_real > 1) { return multipleFlowMapping; } int index = dreal.getTupleIndex(); flowToComponent[index] = i; directMap[index] = map; } else if (Display.DisplayFlow1SphericalTuple.equals(tuple) || Display.DisplayFlow2SphericalTuple.equals(tuple)) { if (tuples[0] != null) { if (!tuples[0].equals(tuple)) { return multipleFlowTuples; } } else { tuples[0] = tuple; coord = tuple.getCoordinateSystem(); } num_flow_per_real++; if (num_flow_per_real > 1) { return multipleFlowMapping; } int index = dreal.getTupleIndex(); flowToComponent[index] = i; directMap[index] = map; } } // while (maps.hasMoreElements()) } return null; }
/** * @throws VisADException VisAD failure. * @throws RemoteException Java RMI failure. */ private void setContourMaps() throws RemoteException, VisADException { ScalarMap oldContourMap = contourMap; contourMap = new ScalarMap(contourRealType, Display.IsoContour); contourMap.addScalarMapListener( new ScalarMapListener() { public void controlChanged(ScalarMapControlEvent event) throws RemoteException, VisADException { int id = event.getId(); if ((id == event.CONTROL_ADDED) || (id == event.CONTROL_REPLACED)) { contourControl = (ContourControl) contourMap.getControl(); contourControl.setSurfaceValue(surfaceValue, true); } } public void mapChanged(ScalarMapEvent event) {} // ignore }); // For now comment this out // applyDisplayUnit (contourMap, contourRealType); replaceScalarMap(oldContourMap, contourMap); // this moved to Grid3dDisplayable; and super is superfluous // super.setRGBRealType(contourRealType); fireScalarMapSetChange(); }
/** ensure that non-Manual components of flow_tuple have equal dataRanges symmetric about 0.0 */ public static void equalizeFlow(Vector mapVector, DisplayTupleType flow_tuple) throws VisADException, RemoteException { double[] range = new double[2]; double low = Double.MAX_VALUE; double hi = -Double.MAX_VALUE; boolean anyAuto = false; Enumeration maps = mapVector.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); DisplayRealType dtype = map.getDisplayScalar(); DisplayTupleType tuple = dtype.getTuple(); if (flow_tuple.equals(tuple) && !map.isManual && !map.badRange()) { anyAuto = true; low = Math.min(low, map.dataRange[0]); hi = Math.max(hi, map.dataRange[1]); } } if (!anyAuto) return; hi = Math.max(hi, -low); low = -hi; maps = mapVector.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); DisplayRealType dtype = map.getDisplayScalar(); DisplayTupleType tuple = dtype.getTuple(); if (flow_tuple.equals(tuple) && !map.isManual && !map.badRange()) { map.setRange(null, low, hi, false); } } }
public static void main(String[] args) throws Exception { DisplayImpl display = new DisplayImplJ2D("display"); display.getDisplayRenderer().setBoxOn(false); double[] matrix = display.getProjectionControl().getMatrix(); matrix[0] = 1.25; matrix[3] = -1.25; display.getProjectionControl().setMatrix(matrix); display.addMap(new ScalarMap(RealType.YAxis, Display.YAxis)); display.addMap(new ScalarMap(RealType.XAxis, Display.XAxis)); float[][] values = new float[3][220]; int l = 0; for (int x = 0; x < 11; x++) { for (int y = 0; y < 20; y++) { values[0][l] = -1.f + y / 10.f; values[1][l] = 1.f - x / 4.f; values[2][l] = l++; } } Gridded3DSet set = new Gridded3DSet(RealTupleType.SpatialCartesian3DTuple, values, l); ScalarMap shapeMap = new ScalarMap(RealType.ZAxis, Display.Shape); display.addMap(shapeMap); ShapeControl sc = (ShapeControl) shapeMap.getControl(); sc.setShapeSet(new Integer1DSet(l)); sc.setShapes(WeatherSymbols.getAllMetSymbols()); sc.setScale(0.1f); DataReference ref = new DataReferenceImpl("ref"); ref.setData(set); display.addReference(ref); JFrame frame = new JFrame("Weather Symbol Plot Test"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.getContentPane().add(display.getComponent()); frame.pack(); frame.setSize(500, 500); frame.setVisible(true); }
/** * prepare for transforming Data into scene graph depictions, including possible auto-scaling of * ScalarMaps * * @param temp Vector of DataRenderers * @param tmap Vector of ScalarMaps * @param go flag indicating whether Data transforms are requested * @param initialize flag indicating whether auto-scaling is requested * @throws VisADException a VisAD error occurred * @throws RemoteException an RMI error occurred */ public void prepareAction(Vector temp, Vector tmap, boolean go, boolean initialize) throws VisADException, RemoteException { DataShadow shadow = null; Enumeration renderers = temp.elements(); while (renderers.hasMoreElements()) { DataRenderer renderer = (DataRenderer) renderers.nextElement(); shadow = renderer.prepareAction(go, initialize, shadow); } if (shadow != null) { // apply RealType ranges and animationSampling Enumeration maps = tmap.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); map.setRange(shadow); } } ScalarMap.equalizeFlow(tmap, Display.DisplayFlow1Tuple); ScalarMap.equalizeFlow(tmap, Display.DisplayFlow2Tuple); }
/** * Set <CODE>Vector</CODE> of <CODE>String</CODE>s describing the cursor location from the cursor * location; this is invoked when the cursor location changes or the cursor display status changes */ public void setCursorStringVector() { synchronized (cursorStringVector) { cursorStringVector.removeAllElements(); float[][] cursor = new float[3][1]; double[] cur = getCursor(); cursor[0][0] = (float) cur[0]; cursor[1][0] = (float) cur[1]; cursor[2][0] = (float) cur[2]; Enumeration maps = display.getMapVector().elements(); while (maps.hasMoreElements()) { try { ScalarMap map = (ScalarMap) maps.nextElement(); DisplayRealType dreal = map.getDisplayScalar(); DisplayTupleType tuple = dreal.getTuple(); int index = dreal.getTupleIndex(); if (tuple != null && (tuple.equals(Display.DisplaySpatialCartesianTuple) || (tuple.getCoordinateSystem() != null && tuple .getCoordinateSystem() .getReference() .equals(Display.DisplaySpatialCartesianTuple)))) { float[] fval = new float[1]; if (tuple.equals(Display.DisplaySpatialCartesianTuple)) { fval[0] = cursor[index][0]; } else { float[][] new_cursor = tuple.getCoordinateSystem().fromReference(cursor); fval[0] = new_cursor[index][0]; } float[] dval = map.inverseScaleValues(fval); RealType real = (RealType) map.getScalar(); // WLH 31 Aug 2000 Real r = new Real(real, dval[0]); Unit overrideUnit = map.getOverrideUnit(); Unit rtunit = real.getDefaultUnit(); // units not part of Time string // DRM 2003-08-19: don't check for equality since toString // may be different if (overrideUnit != null && // !overrideUnit.equals(rtunit) && (!Unit.canConvert(rtunit, CommonUnit.secondsSinceTheEpoch) || rtunit.getAbsoluteUnit().equals(rtunit))) { dval[0] = (float) overrideUnit.toThis((double) dval[0], rtunit); r = new Real(real, dval[0], overrideUnit); } String valueString = r.toValueString(); // WLH 27 Oct 2000 String s = map.getScalarName() + " = " + valueString; // String s = real.getName() + " = " + valueString; cursorStringVector.addElement(s); } // end if (tuple != null && ...) } catch (VisADException e) { } } // end while(maps.hasMoreElements()) } // end synchronized (cursorStringVector) render_trigger(); }
/** * Initialize the lat/lon scalar maps * * @throws RemoteException On badness * @throws VisADException On badness */ public void initLatLonMap() throws VisADException, RemoteException { if (latMap != null) { return; } if (getDisplayMaster() == null) { return; } boolean callScale = (latMap == null); DisplayImpl display = (DisplayImpl) getDisplayMaster().getDisplay(); // find spatial maps for Latitude and Longitude latMap = null; lonMap = null; Vector scalar_map_vector = display.getMapVector(); Enumeration en = scalar_map_vector.elements(); while (en.hasMoreElements()) { ScalarMap map = (ScalarMap) en.nextElement(); DisplayRealType real = map.getDisplayScalar(); DisplayTupleType tuple = real.getTuple(); if ((tuple != null) && (tuple.equals(Display.DisplaySpatialCartesianTuple) || ((tuple.getCoordinateSystem() != null) && tuple .getCoordinateSystem() .getReference() .equals(Display.DisplaySpatialCartesianTuple)))) { // Spatial if (RealType.Latitude.equals(map.getScalar())) { latMap = map; } else if (RealType.Longitude.equals(map.getScalar())) { lonMap = map; } } } if (callScale) { setScale(baseScale); } }
public void displayChanged(final DisplayEvent e) throws VisADException, RemoteException { // TODO: write a method like isChannelUpdate(EVENT_ID)? or maybe just // deal with a super long if-statement and put an "OR MOUSE_RELEASED" // up here? if (e.getId() == DisplayEvent.MOUSE_RELEASED_CENTER) { float val = (float) display.getDisplayRenderer().getDirectAxisValue(domainType); setWaveNumber(val); if (displayControl != null) displayControl.handleChannelChange(val); } else if (e.getId() == DisplayEvent.MOUSE_PRESSED_LEFT) { if (e.getInputEvent().isControlDown()) { xmap.setRange(initialRangeX[0], initialRangeX[1]); ymap.setRange(initialRangeY[0], initialRangeY[1]); } } else if (e.getId() == DisplayEvent.MOUSE_RELEASED) { float val = getSelectorValue(channelSelector); if (val != waveNumber) { // TODO: setWaveNumber needs to be rethought, as it calls // setSelectorValue which is redundant in the cases of dragging // or clicking setWaveNumber(val); if (displayControl != null) displayControl.handleChannelChange(val); } } }
protected void copy(ScalarMap map) throws VisADException, RemoteException { map.isScaled = isScaled; map.isManual = isManual; map.dataRange[0] = dataRange[0]; map.dataRange[1] = dataRange[1]; map.defaultUnitRange[0] = defaultUnitRange[0]; map.defaultUnitRange[1] = defaultUnitRange[1]; map.displayRange[0] = displayRange[0]; map.displayRange[1] = displayRange[1]; map.scale = scale; map.offset = offset; map.axisScale = (axisScale != null) ? axisScale.clone(map) : null; map.scale_flag = scale_flag; map.back_scale_flag = back_scale_flag; if (map.display != null) { map.setControl(); } }
/** * Initialize the color maps * * @throws RemoteException On badness * @throws VisADException On badness */ private void initColorMaps() throws VisADException, RemoteException { setupTypes(); if (doColors) { ScalarMap rmap = new ScalarMap(front_red, Display.Red); rmap.setRange(0.0, 1.0); ScalarMap gmap = new ScalarMap(front_green, Display.Green); gmap.setRange(0.0, 1.0); ScalarMap bmap = new ScalarMap(front_blue, Display.Blue); bmap.setRange(0.0, 1.0); ScalarMapSet maps = getScalarMapSet(); // new ScalarMapSet(); maps.add(rmap); maps.add(bmap); maps.add(gmap); setScalarMapSet(maps); } }
/** * Construct a satellite display using the specified McIDAS map file, image source. The image can * be displayed on a 3D globe or on a flat rectillinear projection. * * @param mapFile location of the McIDAS map file (path or URL) * @param imageSource location of the image source (path or URL) * @param display3D if true, use 3D display, otherwise flat rectillinear * @param remap remap the image into a domain over North America */ public SatDisplay(String mapFile, String imageSource, boolean display3D, boolean remap) { try { // Read in the map file BaseMapAdapter baseMapAdapter; if (mapFile.indexOf("://") > 0) // URL specified { baseMapAdapter = new BaseMapAdapter(new URL(mapFile)); } else // local disk file { baseMapAdapter = new BaseMapAdapter(mapFile); } // Create the display and set up the scalar maps to map // data to the display ScalarMap latMap; // latitude -> YAxis ScalarMap lonMap; // longitude -> XAxis if (display3D) { display = new DisplayImplJ3D("display"); latMap = new ScalarMap(RealType.Latitude, Display.Latitude); lonMap = new ScalarMap(RealType.Longitude, Display.Longitude); } else { display = new DisplayImplJ3D("display", new TwoDDisplayRendererJ3D()); latMap = new ScalarMap(RealType.Latitude, Display.YAxis); lonMap = new ScalarMap(RealType.Longitude, Display.XAxis); } display.addMap(latMap); display.addMap(lonMap); // set the display to a global scale latMap.setRange(-90.0, 90.0); lonMap.setRange(-180.0, 180.0); // create a reference for the map line DataReference maplinesRef = new DataReferenceImpl("MapLines"); maplinesRef.setData(baseMapAdapter.getData()); // set the attributes of the map lines (color, location) ConstantMap[] maplinesConstantMap = new ConstantMap[4]; maplinesConstantMap[0] = new ConstantMap(0., Display.Blue); maplinesConstantMap[1] = new ConstantMap(1., Display.Red); maplinesConstantMap[2] = new ConstantMap(0., Display.Green); maplinesConstantMap[3] = new ConstantMap(1.001, Display.Radius); // just above the image // read in the image AreaAdapter areaAdapter = new AreaAdapter(imageSource); FlatField image = areaAdapter.getData(); // Extract the metadata from the image FunctionType imageFunctionType = (FunctionType) image.getType(); RealTupleType imageDomainType = imageFunctionType.getDomain(); RealTupleType imageRangeType = (RealTupleType) imageFunctionType.getRange(); // remap and resample the image if (remap) { int SIZE = 256; RealTupleType latlonType = ((CoordinateSystem) imageDomainType.getCoordinateSystem()).getReference(); Linear2DSet remapDomainSet = new Linear2DSet(latlonType, -4.0, 70.0, SIZE, -150.0, 5.0, SIZE); image = (FlatField) image.resample(remapDomainSet, Data.NEAREST_NEIGHBOR, Data.NO_ERRORS); } // select which band to show... ScalarMap rgbMap = new ScalarMap((RealType) imageRangeType.getComponent(0), Display.RGB); display.addMap(rgbMap); // set the enhancement to a grey scale ColorControl colorControl = (ColorControl) rgbMap.getControl(); colorControl.initGreyWedge(); // create a data reference for the image DataReferenceImpl imageRef = new DataReferenceImpl("ImageRef"); imageRef.setData(image); // add the data references to the display display.disableAction(); drmap = new DefaultRendererJ3D(); drimage = new DefaultRendererJ3D(); drmap.toggle(false); drimage.toggle(false); display.addDisplayListener(this); display.addReferences(drmap, maplinesRef, maplinesConstantMap); display.addReferences(drimage, imageRef, null); display.enableAction(); } catch (Exception ne) { ne.printStackTrace(); System.exit(1); } }
void setupServerData(LocalDisplay[] dpys) throws RemoteException, VisADException { RealType xr = RealType.getRealType("xr"); RealType yr = RealType.getRealType("yr"); RealType zr = RealType.getRealType("zr"); RealType wr = RealType.getRealType("wr"); RealType[] types3d = {xr, yr, zr}; RealTupleType earth_location3d = new RealTupleType(types3d); FunctionType grid_tuple = new FunctionType(earth_location3d, wr); // int NX = 32; // int NY = 32; // int NZ = 32; int NX = 35; int NY = 35; int NZ = 35; Integer3DSet set = new Integer3DSet(NX, NY, NZ); FlatField grid3d = new FlatField(grid_tuple, set); float[][] values = new float[1][NX * NY * NZ]; int k = 0; for (int iz = 0; iz < NZ; iz++) { // double z = Math.PI * (-1.0 + 2.0 * iz / (NZ - 1.0)); double z = Math.PI * (-1.0 + 2.0 * iz * iz / ((NZ - 1.0) * (NZ - 1.0))); for (int iy = 0; iy < NY; iy++) { double y = -1.0 + 2.0 * iy / (NY - 1.0); for (int ix = 0; ix < NX; ix++) { double x = -1.0 + 2.0 * ix / (NX - 1.0); double r = x - 0.5 * Math.cos(z); double s = y - 0.5 * Math.sin(z); double dist = Math.sqrt(r * r + s * s); values[0][k] = (float) ((dist < 0.1) ? 10.0 : 1.0 / dist); k++; } } } grid3d.setSamples(values); dpys[0].addMap(new ScalarMap(xr, Display.XAxis)); dpys[0].addMap(new ScalarMap(yr, Display.YAxis)); dpys[0].addMap(new ScalarMap(zr, Display.ZAxis)); ScalarMap xrange = new ScalarMap(xr, Display.SelectRange); ScalarMap yrange = new ScalarMap(yr, Display.SelectRange); ScalarMap zrange = new ScalarMap(zr, Display.SelectRange); dpys[0].addMap(xrange); dpys[0].addMap(yrange); dpys[0].addMap(zrange); GraphicsModeControl mode = dpys[0].getGraphicsModeControl(); mode.setScaleEnable(true); if (nice) mode.setTransparencyMode(DisplayImplJ3D.NICEST); mode.setTexture3DMode(texture3DMode); // new RealType duh = RealType.getRealType("duh"); int NT = 32; Linear2DSet set2 = new Linear2DSet(0.0, (double) NX, NT, 0.0, (double) NY, NT); RealType[] types2d = {xr, yr}; RealTupleType domain2 = new RealTupleType(types2d); FunctionType ftype2 = new FunctionType(domain2, duh); float[][] v2 = new float[1][NT * NT]; for (int i = 0; i < NT * NT; i++) { v2[0][i] = (i * i) % (NT / 2 + 3); } // float[][] v2 = {{1.0f,2.0f,3.0f,4.0f}}; FlatField field2 = new FlatField(ftype2, set2); field2.setSamples(v2); dpys[0].addMap(new ScalarMap(duh, Display.RGB)); ScalarMap map1color = new ScalarMap(wr, Display.RGBA); dpys[0].addMap(map1color); ColorAlphaControl control = (ColorAlphaControl) map1color.getControl(); control.setTable(buildTable(control.getTable())); DataReferenceImpl ref_grid3d = new DataReferenceImpl("ref_grid3d"); ref_grid3d.setData(grid3d); DataReferenceImpl ref2 = new DataReferenceImpl("ref2"); ref2.setData(field2); ConstantMap[] cmaps = {new ConstantMap(0.0, Display.TextureEnable)}; dpys[0].addReference(ref2, cmaps); dpys[0].addReference(ref_grid3d, null); }
/** * run 'java visad.bom.ImageRendererJ3D len step' to test animation behavior of ImageRendererJ3D * renders a loop of len at step ms per frame then updates loop by deleting first time and adding * a new last time */ public static void main(String args[]) throws VisADException, RemoteException, IOException { int step = 1000; int len = 3; if (args.length > 0) { try { len = Integer.parseInt(args[0]); } catch (NumberFormatException e) { len = 3; } } if (len < 1) len = 1; if (args.length > 1) { try { step = Integer.parseInt(args[1]); } catch (NumberFormatException e) { step = 1000; } } if (step < 1) step = 1; // create a netCDF reader Plain plain = new Plain(); // open a netCDF file containing an image sequence and adapt // it to a Field Data object Field raw_image_sequence = null; try { // raw_image_sequence = (Field) plain.open("images256x256.nc"); raw_image_sequence = (Field) plain.open("images.nc"); } catch (IOException exc) { String s = "To run this example, the images.nc file must be " + "present in\nthe current directory." + "You can obtain this file from:\n" + " ftp://www.ssec.wisc.edu/pub/visad-2.0/images.nc.Z"; System.out.println(s); System.exit(0); } // just take first half of raw_image_sequence FunctionType image_sequence_type = (FunctionType) raw_image_sequence.getType(); Set raw_set = raw_image_sequence.getDomainSet(); float[][] raw_times = raw_set.getSamples(); int raw_len = raw_times[0].length; if (raw_len != 4) { throw new VisADException("wrong number of images in sequence"); } float raw_span = (4.0f / 3.0f) * (raw_times[0][3] - raw_times[0][0]); double[][] times = new double[1][len]; for (int i = 0; i < len; i++) { times[0][i] = raw_times[0][i % raw_len] + raw_span * (i / raw_len); } Gridded1DDoubleSet set = new Gridded1DDoubleSet(raw_set.getType(), times, len); Field image_sequence = new FieldImpl(image_sequence_type, set); for (int i = 0; i < len; i++) { image_sequence.setSample(i, raw_image_sequence.getSample(i % raw_len)); } // create a DataReference for image sequence final DataReference image_ref = new DataReferenceImpl("image"); image_ref.setData(image_sequence); // create a Display using Java3D DisplayImpl display = new DisplayImplJ3D("image display"); // extract the type of image and use // it to determine how images are displayed FunctionType image_type = (FunctionType) image_sequence_type.getRange(); RealTupleType domain_type = image_type.getDomain(); // map image coordinates to display coordinates display.addMap(new ScalarMap((RealType) domain_type.getComponent(0), Display.XAxis)); display.addMap(new ScalarMap((RealType) domain_type.getComponent(1), Display.YAxis)); // map image brightness values to RGB (default is grey scale) display.addMap(new ScalarMap((RealType) image_type.getRange(), Display.RGB)); RealType hour_type = (RealType) image_sequence_type.getDomain().getComponent(0); ScalarMap animation_map = new ScalarMap(hour_type, Display.Animation); display.addMap(animation_map); AnimationControl animation_control = (AnimationControl) animation_map.getControl(); animation_control.setStep(step); animation_control.setOn(true); /* // link the Display to image_ref ImageRendererJ3D renderer = new ImageRendererJ3D(); display.addReferences(renderer, image_ref); // display.addReference(image_ref); */ // create JFrame (i.e., a window) for display and slider JFrame frame = new JFrame("ImageRendererJ3D test"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // create JPanel in JFrame JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); frame.getContentPane().add(panel); // add display to JPanel panel.add(display.getComponent()); // set size of JFrame and make it visible frame.setSize(500, 500); frame.setVisible(true); System.out.println("first animation sequence"); // link the Display to image_ref ImageRendererJ3D renderer = new ImageRendererJ3D(); display.addReferences(renderer, image_ref); // display.addReference(image_ref); // wait 4 * len seconds new Delay(len * 4000); // substitute a new image sequence for the old one for (int i = 0; i < len; i++) { times[0][i] = raw_times[0][(i + 1) % raw_len] + raw_span * ((i + 1) / raw_len); } set = new Gridded1DDoubleSet(raw_set.getType(), times, len); FieldImpl new_image_sequence = new FieldImpl(image_sequence_type, set); for (int i = 0; i < len; i++) { new_image_sequence.setSample(i, raw_image_sequence.getSample((i + 1) % raw_len)); } System.out.println("second animation sequence"); // tell renderer to resue frames in its scene graph renderer.setReUseFrames(true); image_ref.setData(new_image_sequence); }
/** * run 'java FlowTest middle_latitude' to test with (lat, lon) run 'java FlowTest middle_latitude * x' to test with (lon, lat) adjust middle_latitude for south or north */ public static void main(String args[]) throws VisADException, RemoteException { double mid_lat = -10.0; if (args.length > 0) { try { mid_lat = Double.valueOf(args[0]).doubleValue(); } catch (NumberFormatException e) { } } boolean swap = (args.length > 1); RealType lat = RealType.Latitude; RealType lon = RealType.Longitude; RealType[] types; if (swap) { types = new RealType[] {lon, lat}; } else { types = new RealType[] {lat, lon}; } RealTupleType earth_location = new RealTupleType(types); System.out.println("earth_location = " + earth_location + " mid_lat = " + mid_lat); RealType flowx = RealType.getRealType("flowx", CommonUnit.meterPerSecond); RealType flowy = RealType.getRealType("flowy", CommonUnit.meterPerSecond); RealType red = RealType.getRealType("red"); RealType green = RealType.getRealType("green"); EarthVectorType flowxy = new EarthVectorType(flowx, flowy); TupleType range = null; range = new TupleType(new MathType[] {flowxy, red, green}); FunctionType flow_field = new FunctionType(earth_location, range); DisplayImpl display = new DisplayImplJ3D("display1", new TwoDDisplayRendererJ3D()); ScalarMap xmap = new ScalarMap(lon, Display.XAxis); display.addMap(xmap); ScalarMap ymap = new ScalarMap(lat, Display.YAxis); display.addMap(ymap); ScalarMap flowx_map = new ScalarMap(flowx, Display.Flow1X); display.addMap(flowx_map); flowx_map.setRange(-10.0, 10.0); ScalarMap flowy_map = new ScalarMap(flowy, Display.Flow1Y); display.addMap(flowy_map); flowy_map.setRange(-10.0, 10.0); FlowControl flow_control = (FlowControl) flowy_map.getControl(); flow_control.setFlowScale(0.05f); display.addMap(new ScalarMap(red, Display.Red)); display.addMap(new ScalarMap(green, Display.Green)); display.addMap(new ConstantMap(1.0, Display.Blue)); double lonlow = -10.0; double lonhi = 10.0; double latlow = mid_lat - 10.0; double lathi = mid_lat + 10.0; Linear2DSet set; if (swap) { set = new Linear2DSet(earth_location, lonlow, lonhi, N, latlow, lathi, N); } else { set = new Linear2DSet(earth_location, latlow, lathi, N, lonlow, lonhi, N); } double[][] values = new double[4][N * N]; int m = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { int k = i; int l = j; if (swap) { k = j; l = i; } double u = (N - 1.0) / 2.0 - l; double v = k - (N - 1.0) / 2.0; // double u = 2.0 * k / (N - 1.0) - 1.0; // double v = 2.0 * l / (N - 1.0); double fx = 6.0 * u; double fy = 6.0 * v; values[0][m] = fx; values[1][m] = fy; values[2][m] = u; values[3][m] = v; m++; } } FlatField field = new FlatField(flow_field, set); field.setSamples(values); DataReferenceImpl ref = new DataReferenceImpl("ref"); ref.setData(field); display.addReference(ref); // create JFrame (i.e., a window) for display and slider JFrame frame = new JFrame("test FlowTest"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // create JPanel in JFrame JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); frame.getContentPane().add(panel); // add display to JPanel panel.add(display.getComponent()); // set size of JFrame and make it visible frame.setSize(500, 500); frame.setVisible(true); }
/** * Compares this ScalarMap with another ScalarMap. The ScalarType-s are first compared; if they * compare equal, then the DisplayRealType-s are compared. * * @param that The other ScalarMap. * @return A value that is negative, zero, or positive depending on whether this ScalarMap is * considered less than, equal to, or greater than the other ScalarMap, respectively. */ protected int compareTo(ScalarMap that) { int comp = getScalar().compareTo(that.getScalar()); if (comp == 0) comp = getDisplayScalar().compareTo(that.getDisplayScalar()); return comp; }
/** test BarbManipulationRendererJ3D */ public static void main(String args[]) throws VisADException, RemoteException { System.out.println("BMR.main()"); // construct RealTypes for wind record components RealType lat = RealType.Latitude; RealType lon = RealType.Longitude; RealType windx = RealType.getRealType("windx", CommonUnit.meterPerSecond); RealType windy = RealType.getRealType("windy", CommonUnit.meterPerSecond); RealType red = RealType.getRealType("red"); RealType green = RealType.getRealType("green"); // EarthVectorType extends RealTupleType and says that its // components are vectors in m/s with components parallel // to Longitude (positive east) and Latitude (positive north) EarthVectorType windxy = new EarthVectorType(windx, windy); RealType wind_dir = RealType.getRealType("wind_dir", CommonUnit.degree); RealType wind_speed = RealType.getRealType("wind_speed", CommonUnit.meterPerSecond); RealTupleType windds = null; if (args.length > 0) { System.out.println("polar winds"); windds = new RealTupleType( new RealType[] {wind_dir, wind_speed}, new WindPolarCoordinateSystem(windxy), null); } // construct Java3D display and mappings that govern // how wind records are displayed DisplayImpl display = new DisplayImplJ3D("display1", new TwoDDisplayRendererJ3D()); ScalarMap lonmap = new ScalarMap(lon, Display.XAxis); display.addMap(lonmap); ScalarMap latmap = new ScalarMap(lat, Display.YAxis); display.addMap(latmap); FlowControl flow_control; if (args.length > 0) { ScalarMap winds_map = new ScalarMap(wind_speed, Display.Flow1Radial); display.addMap(winds_map); winds_map.setRange(0.0, 1.0); // do this for barb rendering ScalarMap windd_map = new ScalarMap(wind_dir, Display.Flow1Azimuth); display.addMap(windd_map); windd_map.setRange(0.0, 360.0); // do this for barb rendering flow_control = (FlowControl) windd_map.getControl(); flow_control.setFlowScale(0.15f); // this controls size of barbs } else { ScalarMap windx_map = new ScalarMap(windx, Display.Flow1X); display.addMap(windx_map); windx_map.setRange(-1.0, 1.0); // do this for barb rendering ScalarMap windy_map = new ScalarMap(windy, Display.Flow1Y); display.addMap(windy_map); windy_map.setRange(-1.0, 1.0); // do this for barb rendering flow_control = (FlowControl) windy_map.getControl(); flow_control.setFlowScale(0.15f); // this controls size of barbs } display.addMap(new ScalarMap(red, Display.Red)); display.addMap(new ScalarMap(green, Display.Green)); display.addMap(new ConstantMap(1.0, Display.Blue)); DataReferenceImpl[] refs = new DataReferenceImpl[N * N]; int k = 0; // create an array of N by N winds for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { double u = 2.0 * i / (N - 1.0) - 1.0; double v = 2.0 * j / (N - 1.0) - 1.0; // each wind record is a Tuple (lon, lat, (windx, windy), red, green) // set colors by wind components, just for grins Tuple tuple; double fx = 30.0 * u; double fy = 30.0 * v; if (args.length > 0) { double fd = Data.RADIANS_TO_DEGREES * Math.atan2(-fx, -fy); double fs = Math.sqrt(fx * fx + fy * fy); tuple = new Tuple( new Data[] { new Real(lon, 10.0 * u), new Real(lat, 10.0 * v - 40.0), new RealTuple(windds, new double[] {fd, fs}), new Real(red, u), new Real(green, v) }); } else { tuple = new Tuple( new Data[] { new Real(lon, 10.0 * u), new Real(lat, 10.0 * v - 40.0), new RealTuple(windxy, new double[] {fx, fy}), new Real(red, u), new Real(green, v) }); } // construct reference for wind record refs[k] = new DataReferenceImpl("ref_" + k); refs[k].setData(tuple); // link wind record to display via BarbManipulationRendererJ3D // so user can change barb by dragging it // drag with right mouse button and shift to change direction // drag with right mouse button and no shift to change speed BarbManipulationRendererJ3D renderer = new BarbManipulationRendererJ3D(); renderer.setKnotsConvert(true); display.addReferences(renderer, refs[k]); // link wind record to a CellImpl that will listen for changes // and print them WindGetterJ3D cell = new WindGetterJ3D(flow_control, refs[k]); cell.addReference(refs[k]); k++; } } // instead of linking the wind record "DataReferenceImpl refs" to // the WindGetterJ3Ds, you can have some user interface event (e.g., // the user clicks on "DONE") trigger code that does a getData() on // all the refs and stores the records in a file. // create JFrame (i.e., a window) for display and slider JFrame frame = new JFrame("test BarbManipulationRendererJ3D"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // create JPanel in JFrame JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); frame.getContentPane().add(panel); // add display to JPanel panel.add(display.getComponent()); // set size of JFrame and make it visible frame.setSize(500, 500); frame.setVisible(true); }
/** * transform data into a (Java3D or Java2D) scene graph; add generated scene graph components as * children of group; group is Group (Java3D) or VisADGroup (Java2D); value_array are inherited * valueArray values; default_values are defaults for each display.DisplayRealTypeVector; return * true if need post-process */ public boolean doTransform( Object group, Data data, float[] value_array, float[] default_values, DataRenderer renderer, ShadowType shadow_api) throws VisADException, RemoteException { if (data.isMissing()) return false; if (LevelOfDifficulty == NOTHING_MAPPED) return false; if (!(data instanceof Text)) { throw new DisplayException("data must be Text: " + "ShadowTextType.doTransform"); } // get some precomputed values useful for transform // length of ValueArray int valueArrayLength = display.getValueArrayLength(); // mapping from ValueArray to DisplayScalar int[] valueToScalar = display.getValueToScalar(); // mapping from ValueArray to MapVector int[] valueToMap = display.getValueToMap(); Vector MapVector = display.getMapVector(); // array to hold values for various mappings float[][] display_values = new float[valueArrayLength][]; // ???? // get values inherited from parent; // assume these do not include SelectRange, SelectValue // or Animation values - see temporary hack in // DataRenderer.isTransformControl int[] inherited_values = getInheritedValues(); for (int i = 0; i < valueArrayLength; i++) { if (inherited_values[i] > 0) { display_values[i] = new float[1]; display_values[i][0] = value_array[i]; } } boolean[][] range_select = shadow_api.assembleSelect( display_values, 1, valueArrayLength, valueToScalar, display, shadow_api); if (range_select[0] != null && !range_select[0][0]) { // data not selected return false; } // get any text String and TextControl inherited from parent String text_value = shadow_api.getParentText(); TextControl text_control = shadow_api.getParentTextControl(); boolean anyText = getAnyText(); if (anyText && text_value == null) { // get any text String and TextControl from this Vector maps = getSelectedMapVector(); if (!maps.isEmpty()) { text_value = ((Text) data).getValue(); ScalarMap map = (ScalarMap) maps.firstElement(); text_control = (TextControl) map.getControl(); } } // // never renders text ???? // // add values to value_array according to SelectedMapVector if (getIsTerminal()) { // ???? return terminalTupleOrScalar( group, display_values, text_value, text_control, valueArrayLength, valueToScalar, default_values, inherited_values, renderer, shadow_api); } else { // nothing to render at a non-terminal TextType } return false; }
public static boolean isByRefUsable(DataDisplayLink link, ShadowType shadow) throws VisADException, RemoteException { ShadowFunctionOrSetType shadowType = (ShadowFunctionOrSetType) shadow.getAdaptedShadowType(); CoordinateSystem dataCoordinateSystem = null; FlatField fltField = null; int num_images = 1; FieldImpl field = (FieldImpl) link.getData(); if (!(field instanceof FlatField)) { num_images = field.getDomainSet().getLength(); if (1 == num_images) { // If there is a single image in the animation dont do anything, simply // return true return true; } shadowType = (ShadowFunctionOrSetType) shadowType.getRange(); fltField = (FlatField) field.getSample(0); dataCoordinateSystem = fltField.getDomainCoordinateSystem(); } else { dataCoordinateSystem = ((FlatField) field).getDomainCoordinateSystem(); return true; } // cs might be cached if (dataCoordinateSystem instanceof CachingCoordinateSystem) { dataCoordinateSystem = ((CachingCoordinateSystem) dataCoordinateSystem).getCachedCoordinateSystem(); } ShadowRealType[] DomainComponents = shadowType.getDomainComponents(); ShadowRealTupleType Domain = shadowType.getDomain(); ShadowRealTupleType domain_reference = Domain.getReference(); ShadowRealType[] DC = DomainComponents; if (domain_reference != null && domain_reference.getMappedDisplayScalar()) { DC = shadowType.getDomainReferenceComponents(); } DisplayTupleType spatial_tuple = null; for (int i = 0; i < DC.length; i++) { java.util.Enumeration maps = DC[i].getSelectedMapVector().elements(); ScalarMap map = (ScalarMap) maps.nextElement(); DisplayRealType real = map.getDisplayScalar(); spatial_tuple = real.getTuple(); } CoordinateSystem coord = spatial_tuple.getCoordinateSystem(); if (coord instanceof CachingCoordinateSystem) { coord = ((CachingCoordinateSystem) coord).getCachedCoordinateSystem(); } boolean useLinearTexture = false; if (coord instanceof InverseLinearScaledCS) { InverseLinearScaledCS invCS = (InverseLinearScaledCS) coord; useLinearTexture = (invCS.getInvertedCoordinateSystem()).equals(dataCoordinateSystem); } /** * if useLinearTexture is true at this point, it's true for the first image of a sequence with * numimages > 1. We'll have to assume that byRef will apply until below is resolved. */ /** * more consideration/work needed here. CoordinateSystems might be equal even if they aren't the * same transform (i,j) -> (lon,lat) if (!useLinearTexture) { //If DisplayCoordinateSystem != * DataCoordinateSystem if (num_images > 1) { //Its an animation int lengths[] = * ((visad.GriddedSet) fltField.getDomainSet()).getLengths(); int data_width = lengths[0]; int * data_height = lengths[1]; for (int i = 1; i < num_images; i++) {//Playing safe: go down the * full sequence to find if the full set is Geostaionary or NOT FlatField ff = (FlatField) * field.getSample(i); //Quicker Approach would be to just compare only the first two images in * the sequence. But that may not be safe. CoordinateSystem dcs = * ff.getDomainCoordinateSystem(); // dcs might be cached if (dcs instanceof * CachingCoordinateSystem) { dcs = ((CachingCoordinateSystem) dcs).getCachedCoordinateSystem(); * } int[] lens = ((visad.GriddedSet) ff.getDomainSet()).getLengths(); if (lens[0] != data_width * || lens[1] != data_height || ( (dcs != null) && (dataCoordinateSystem != null) && * !dcs.equals(dataCoordinateSystem))) { useLinearTexture = false; break; } } } } */ return useLinearTexture; }
private void init() throws VisADException, RemoteException { HydraDataSource source = (HydraDataSource) dataChoice.getDataSource(); // TODO revisit this, may want to move method up to base class HydraDataSource if (source instanceof SuomiNPPDataSource) { data = ((SuomiNPPDataSource) source).getMultiSpectralData(dataChoice); } if (source instanceof MultiSpectralDataSource) { data = ((MultiSpectralDataSource) source).getMultiSpectralData(dataChoice); } waveNumber = data.init_wavenumber; try { spectrum = data.getSpectrum(new int[] {1, 1}); } catch (Exception e) { LogUtil.logException("MultiSpectralDisplay.init", e); } domainSet = (Gridded1DSet) spectrum.getDomainSet(); initialRangeX = getXRange(domainSet); initialRangeY = data.getDataRange(); domainType = getDomainType(spectrum); rangeType = getRangeType(spectrum); master = new XYDisplay(DISP_NAME, domainType, rangeType); setDisplayMasterAttributes(master); // set up the x- and y-axis xmap = new ScalarMap(domainType, Display.XAxis); ymap = new ScalarMap(rangeType, Display.YAxis); xmap.setRange(initialRangeX[0], initialRangeX[1]); ymap.setRange(initialRangeY[0], initialRangeY[1]); display = master.getDisplay(); display.addMap(xmap); display.addMap(ymap); display.addDisplayListener(this); new RubberBandBox(this, xmap, ymap); if (displayControl == null) { // - add in a ref for the default spectrum, ie no DisplayControl DataReferenceImpl spectrumRef = new DataReferenceImpl(hashCode() + "_spectrumRef"); spectrumRef.setData(spectrum); addRef(spectrumRef, Color.WHITE); } if (data.hasBandNames()) { bandSelectComboBox = new JComboBox(data.getBandNames().toArray()); bandSelectComboBox.setSelectedItem(data.init_bandName); bandSelectComboBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String bandName = (String) bandSelectComboBox.getSelectedItem(); if (bandName == null) return; HashMap<String, Float> bandMap = data.getBandNameMap(); if (bandMap == null) return; if (!bandMap.containsKey(bandName)) return; setWaveNumber(bandMap.get(bandName)); } }); } }
/** * determine whether the given MathType and collection of ScalarMaps meets the criteria to use * ImageRendererJ3D. Throw a VisADException if ImageRenderer cannot be used, otherwise return * true. */ public static boolean isRendererUsable(MathType type, ScalarMap[] maps) throws VisADException { RealType time = null; RealTupleType domain = null; RealTupleType range = null; RealType x = null, y = null; RealType rx = null, ry = null; // WLH 19 July 2000 RealType r = null, g = null, b = null; RealType rgb = null; // must be a function if (!(type instanceof FunctionType)) { throw new VisADException("Not a FunctionType"); } FunctionType function = (FunctionType) type; RealTupleType functionD = function.getDomain(); MathType functionR = function.getRange(); // time function if (function.equalsExceptName(image_sequence_type) || function.equalsExceptName(image_sequence_type2) || function.equalsExceptName(image_sequence_type3)) { // strip off time RealType time = (RealType) functionD.getComponent(0); function = (FunctionType) functionR; functionD = function.getDomain(); functionR = function.getRange(); } // ((ImageLine, ImageElement) -> ImageValue) // ((ImageLine, ImageElement) -> (ImageValue)) // ((ImageLine, ImageElement) -> (Red, Green, Blue)) if (function.equalsExceptName(image_type) || function.equalsExceptName(image_type2) || function.equalsExceptName(image_type3)) { domain = function.getDomain(); MathType rt = function.getRange(); if (rt instanceof RealType) { range = new RealTupleType((RealType) rt); } else if (rt instanceof RealTupleType) { range = (RealTupleType) rt; } else { // illegal MathType throw new VisADException("Illegal RangeType"); } } else { // illegal MathType throw new VisADException("Illegal MathType"); } // extract x and y from domain x = (RealType) domain.getComponent(0); y = (RealType) domain.getComponent(1); // WLH 19 July 2000 CoordinateSystem cs = domain.getCoordinateSystem(); if (cs != null) { RealTupleType rxy = cs.getReference(); rx = (RealType) rxy.getComponent(0); ry = (RealType) rxy.getComponent(1); } // extract colors from range int dim = range.getDimension(); if (dim == 1) rgb = (RealType) range.getComponent(0); else { // dim == 3 r = (RealType) range.getComponent(0); g = (RealType) range.getComponent(1); b = (RealType) range.getComponent(2); } // verify that collection of ScalarMaps is legal boolean btime = (time == null); boolean bx = false, by = false; boolean brx = false, bry = false; // WLH 19 July 2000 boolean br = false, bg = false, bb = false; boolean dbr = false, dbg = false, dbb = false; Boolean latlon = null; DisplayRealType spatial = null; for (int i = 0; i < maps.length; i++) { ScalarMap m = maps[i]; ScalarType md = m.getScalar(); DisplayRealType mr = m.getDisplayScalar(); boolean ddt = md.equals(time); boolean ddx = md.equals(x); boolean ddy = md.equals(y); boolean ddrx = md.equals(rx); boolean ddry = md.equals(ry); boolean ddr = md.equals(r); boolean ddg = md.equals(g); boolean ddb = md.equals(b); boolean ddrgb = md.equals(rgb); // animation mapping if (ddt) { if (btime) throw new VisADException("Multiple Time mappings"); if (!mr.equals(Display.Animation)) { throw new VisADException("Time mapped to something other than Animation"); } btime = true; } // spatial mapping else if (ddx || ddy || ddrx || ddry) { if (ddx && bx || ddy && by || ddrx && brx || ddry && bry) { throw new VisADException("Duplicate spatial mappings"); } if (((ddx || ddy) && (brx || bry)) || ((ddrx || ddry) && (bx || by))) { throw new VisADException("reference and non-reference spatial mappings"); } RealType q = (ddx ? x : null); if (ddy) q = y; if (ddrx) q = rx; if (ddry) q = ry; boolean ll; if (mr.equals(Display.XAxis) || mr.equals(Display.YAxis) || mr.equals(Display.ZAxis)) { ll = false; } else if (mr.equals(Display.Latitude) || mr.equals(Display.Longitude) || mr.equals(Display.Radius)) { ll = true; } else throw new VisADException("Illegal domain mapping"); if (latlon == null) { latlon = new Boolean(ll); spatial = mr; } else if (latlon.booleanValue() != ll) { throw new VisADException("Multiple spatial coordinate systems"); } // two mappings to the same spatial DisplayRealType are not allowed else if (spatial == mr) { throw new VisADException("Multiple mappings to the same spatial DisplayRealType"); } if (ddx) bx = true; else if (ddy) by = true; else if (ddrx) brx = true; else if (ddry) bry = true; } // rgb mapping else if (ddrgb) { if (br || bg || bb) { throw new VisADException("Duplicate color mappings"); } if (rgb == null || !(mr.equals(Display.RGB) || mr.equals(Display.RGBA))) { throw new VisADException("Illegal RGB/RGBA mapping"); } dbr = dbg = dbb = true; br = bg = bb = true; } // color mapping else if (ddr || ddg || ddb) { if (rgb != null) throw new VisADException("Illegal RGB mapping"); RealType q = (ddr ? r : (ddg ? g : b)); if (mr.equals(Display.Red)) dbr = true; else if (mr.equals(Display.Green)) dbg = true; else if (mr.equals(Display.Blue)) dbb = true; else throw new VisADException("Illegal color mapping"); if (ddr) br = true; else if (ddg) bg = true; else bb = true; } // illegal ScalarMap involving this MathType else if (ddt || ddx || ddy || ddrx || ddry || ddr || ddg || ddb || ddrgb) { throw new VisADException("Illegal mapping: " + m); } } // return true if all conditions for ImageRendererJ3D are met if (!(btime && ((bx && by) || (brx && bry)) && br && bg && bb && dbr && dbg && dbb)) { throw new VisADException("Insufficient mappings"); } return true; }