Hello All..
We are trying to display raster data in the JMapPane
using the following code:
public void testRotatedRaster() throws Exception{
final int width = 500;
final int height = 500;
WritableRaster raster =
RasterFactory.createBandedRaster(DataBuffer.TYPE_INT,
width, height, 1, null);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
raster.setSample(x, y, 0, x+y);
}
}
StyleBuilder sb = new StyleBuilder();
Style style =
sb.createStyle(sb.createRasterSymbolizer());
Envelope2D envelope = new
Envelope2D(DefaultGeographicCRS.WGS84,0, 0, 30, 30);
GridCoverageFactory gridCoverageFactory = new
GridCoverageFactory();
GridCoverage2D gc =
gridCoverageFactory.create("test",raster,envelope);
MapContext context = new DefaultMapContext();
context.addLayer(gc,style);
StreamingRenderer renderer = new
StreamingRenderer();
JMapPane mapPane = new JMapPane();
mapPane.setContext(context);
mapPane.setRenderer(renderer);
mapPane.doLayout();
mapPane.validate();
mapPane.repaint();
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.add(mapPane,BorderLayout.CENTER);
frame.setPreferredSize(new
Dimension(500,500));
frame.pack();
frame.setVisible(true);
Thread.sleep(20000);
}
But nothing is showing up on the JFrame..
Any suggestions are greatly appreciated.
- Kasper
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users