Hi everyone, This is how I do to update a JMapPane. I created an update method taking as arguments the new area of interest and the new CRS (if you wish to change it, to perform a map rotation for instance).
The fixAspectRatio method is the same than the JMapPane one. There is maybe a smarter way to do it but this method works. The only problem is when you decide to resize the window containing the map : at some point, it seems the JMapPane (or is it the StreamingRenderer ?) asks all layers for their bounds and goes back to a view containing all your data (even if you were zoomed in...). Not very convenient... public final Envelope update(final Envelope newBounds, final CoordinateReferenceSystem newCRS) { // Computes the new envelope with the same aspect ratio Envelope newEnv = fixAspectRatio(newBounds); // Applies the transformation mapViewer.setMapArea(newEnv); mapViewer.getContext().setAreaOfInterest(newEnv, newCRS); // Redraw the map mapViewer.repaint(); return newEnv; } Le 27 févr. 09 à 00:15, Michael Bedward a écrit : > Hi Carsten, > > I thought the same as you. The method name, setAreaOfInterest, > certainly implies that it should do what you are expecting, but it > doesn't :-( > > All that happens is that the bounds you set are stored by the context > and can be retrieved (by you) later with the getter method. I think > it would be nicer if the MapContext fired an event when the user > changes the AOI. > > Michael > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San > Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source > code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users