The ImageLab.java file in the "User Guide" for Geotools, if compiled "as it
is", gives the error ...."variable 'style' not found" at the line:

    renderer.paint( g, coverage, style );

....we removed this error by feeding this code before "renderer.paint( g,
coverage, style ); "  :-

 
//---------------------------------------------------------------------------------------------

            StyleFactory factory =
CommonFactoryFinder.getStyleFactory(null);
            StyleBuilder sb = new StyleBuilder(factory);


ColorMap cm = sb.createColorMap(

new String[]{"0", "255"},

new double[]{0, 255},

new Color[]{ new Color(0, 0, 0),new Color(255, 255, 255)}
,ColorMap.TYPE_RAMP);

            RasterSymbolizer sym = sb.createRasterSymbolizer(cm, 1.0);
            Style style = sb.createStyle(sym);
 
//---------------------------------------------------------------------------------------------


But then we got the error :

"The method paint(Graphics2D, GridCoverage2D, RasterSymbolizer) in the type
GridCoverageRenderer is not applicable for the arguments (Graphics2D,
GridCoverage2D, Style)"

So then we added "sym" as a parameter to paint method instead of "style":

//----------------------------------------------------------------------

renderer.paint( g, coverage, sym /**style**/);

//----------------------------------------------------------------------

and now it builds and compiles alright, but instead of displaying the world
image it gives the following error in the display pane:

"Band number 3 is not valid"

....any suggestions? please help!
-Kedar
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to