Hello All.
I'm trying to show radar picture together with a
background image and some catchments on a map. The
radar picture is rotated 11 degrees compared to the
normal north and therefor the north of the background
image..
So far I have not been able to show two GridCoverages
with different angles on a map.
I have tried to supply a MathTransform to my
gridCoverage, this has no effect and I can see that in
the DefaultMapContext the information is lost, ie. on
information about the Envelope is considered. Therefor
I have tried to set up different CRS for the two
GridCoverages here is my code:
MapContext context = new DefaultMapContext();
JMapPane mp = new JMapPane();
int width = 5;
int height = 10;
GridCoverageFactory gridCoverageFactory = new
GridCoverageFactory();
AffineTransform affineTransform = new
AffineTransform();
affineTransform.rotate(135.0/180.0*Math.PI);
MathTransform transform =
ProjectiveTransform.create(affineTransform);
float[][] raster = new float[height][width];
for(int x = 0;x<height;x++){
for(int y = 0;y<width;y++){
raster[x][y] = x*y;
}
}
DefaultEngineeringCRS defaultCRS =
DefaultEngineeringCRS.CARTESIAN_2D;
DefaultCartesianCS cartesianCS =
DefaultCartesianCS.GENERIC_2D;
DefaultOperationMethod method = new
DefaultOperationMethod(transform);
DefaultDerivedCRS derivedCRS = new
DefaultDerivedCRS("Test",method,defaultCRS,transform,cartesianCS);
Envelope2D envelope2D = new
Envelope2D(derivedCRS,100,100,100+width,100+height);
Envelope2D envelope2D1 = new
Envelope2D(defaultCRS,100,100,100+width,100+height);
GridCoverage gridCoverage =
gridCoverageFactory.create("Raster",raster,envelope2D);
GridCoverage gridCoverage1 =
gridCoverageFactory.create("Raster",raster,envelope2D1);
StyleBuilder sb = new StyleBuilder();
Style rasterStyle =
sb.createStyle(sb.createRasterSymbolizer());
context.addLayer(gridCoverage,rasterStyle);
context.addLayer(gridCoverage1,rasterStyle);
com.vividsolutions.jts.geom.Envelope env =
null;
if(fs[0]!=null){
env = fs[0].getBounds();
}else{
env = new Envelope(0,0,300,300);
}
context.setAreaOfInterest(env,defaultCRS);
mp.setMapArea(env);
mp.setHighlightLayer(context.getLayer(0));
GTRenderer renderer;
renderer = new StreamingRenderer();
mp.setRenderer(renderer);
mp.setContext(context);
mp.setReset(true);
I can see that the rotation which I specify does have
an effect, i.e. the two GridCoverages are not painted
in the same place on the map, but their sides are
always parallel which is not the desired effect.
I hope someone can point me in the right direction
here since I'm running my head against the wall..
Sincerly Kasper Kaergaard
__________________________________________________
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