Combe, Colin wrote:

Hi

I found the method setAreaOfInterest at the mapContext, but this requires an envelope.
Not only that I'm not really sure of what an envelope is, I also don't
know how to change the area to be displayed at the envelope. There are no such things as setter methods or similar.
Is the envelope like a folder, that contains all the layers of a map?
If yes, how do I tell the folder to only grab my AreaOfInterest?

'envelope' basically means rectangle - an envelope is constructed from
two coordinates, representing diagonally opposite corners of the
rectangle.

By the way, have you looked at the pan/zoom example at http://www.geotools.org/display/GEOTOOLS/How+to+render+a+shape+file,+sty
le+with+SLD,+zoom,+pan+--+jdk+1.5+geotools+2.1.M4


Yes I have. My current class I'm working on is based on this example.
The "pan"-function at this example only shifts the map by clicking on buttons. I want it to shift, as I drag the mouse and am still looking on how to do this...

I now tried to make a zoom-function to zoom into an area, the mouse selected. I use this piece of code to set the preferredArea:

public void mousePressed(MouseEvent e) {
      if (state == ZOOM) {
          dragStart = pixelToWorld(e.getX(), e.getY(), envelope);
      }
}

public void mouseReleased(MouseEvent e) {
      if (state == ZOOM) {
          dragEnd = pixelToWorld(e.getX(), e.getY(), envelope);
          Envelope newenv = new Envelope();
          newenv.expandToInclude(dragStart);
          newenv.expandToInclude(dragEnd);
          mapContext.setAreaOfInterest(newenv);
          this.repaint();
      }
  }

Actually it does not zoom in or even shift the view...


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to