Hi,
I understand that the GridCoverage stuff is in a state of change (and
the rendering stuff, also, for that matter) , but I was trying to
figure out, what the problem with the following snippet is. My data
has values from 0 - 100 and I wanted to ramp up to 40 by 10's.
Thanks in advance for any suggestions.
MapContext context = new DefaultMapContext();
ArcGridReader reader = new
ArcGridReader(ShapefileRepository.class
.getResource("rastert_ictil_g1.txt"));
GridCoverage2D grid = (GridCoverage2D) reader.read(null);
ColorMap cm = builder.createColorMap(
new double[] { 0, 10, 20, 30, 40 }, new Color[] {
new Color(1, 1, 1, 1),
Color.BLUE, Color.GREEN,
Color.YELLOW, Color.RED
}, ColorMap.TYPE_RAMP);
symbolizer = builder.createRasterSymbolizer(cm, 1);
style = builder.createStyle("population", symbolizer);
context.addLayer(grid, style);
BufferedImage image = new BufferedImage(500, 500,
BufferedImage.TYPE_INT_ARGB);
LiteRenderer2 rend = new LiteRenderer2(context);
Graphics2D g2d = (Graphics2D) image.getGraphics();
rend.paint(g2d, new Rectangle(500, 500),
context.getLayerBounds());
JLabel label = new JLabel();
label.setIcon(new ImageIcon(image));
label.setSize(500, 500);
label.setPreferredSize(new Dimension(500, 500));
JFrame frame = new JFrame();
frame.add(label, BorderLayout.CENTER);
frame.setSize(600, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
-Tom
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users