NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I am new to visad objects and i am trying to customize the contour coloring. The ranges are irregular and parsed from an xml configuration file. The first and last 7-8 ranges have got no data. When i use the following commands, the coloring extended to all the ranges. There must be something i miss. Thanks in advance. <code> //Create the maps tempIsoMap = new ScalarMap( temperature, Display.IsoContour ); tempRGBMap = new ScalarMap( temperature, Display.RGB ); //Add maps to the display display.addMap( tempIsoMap ); display.addMap( tempRGBMap ); ContourControl isoControl = (ContourControl) tempIsoMap.getControl(); //iso control ColorControl rgbControl = (ColorControl) tempRGBMap.getControl(); double[][] range = ...; //parsed from xml file float[] levels = new float[range.length]; Color[] cs = ...;//parsed from xml file for (int i = 0; i < range.length; i++) { levels[i] = (float) range[range.length - i - 1][0]; } float[][] myColorTable = new float[3][cs.length]; for (int i = 0; i < cs.length; i++) { float[] rgbs = new float[3]; rgbs = cs[cs.length - i - 1].getRGBColorComponents(rgbs); myColorTable[0][i] = rgbs[0]; myColorTable[1][i] = rgbs[1]; myColorTable[2][i] = rgbs[2]; } rgbControl.setTable(myColorTable); isoControl.setLevels(levels, 0, true); isoControl.setContourFill(true); </code>
idvdevelopers
archives: