Hi Bernhard, 

First of all, I have to say that I haven't been keeping up with geotools
development and so I'm a bit hesitant about giving advice. But as I
understand it this is where things have gone wrong for you...

Earlier in this thread it was suggested that "areaOfInterest" in
MapContext refers to the area being displayed - I not sure this is true
(I think it could just be the default area that's displayed when you
start the application or click a 'home' type button). If you look at the
pan/zoom example mentioned below it doesn't use
mapContext.setAreaOfInterest(my_envelope), it creates an AffineTransform
and passes it to the renderer's paint method.

Also, I think the example code Andre has sent you isn't going to help
because it is based on using a different renderer. I think you're code
is based on LiteRenderer and Andre's is based on StyledMapPane - which
is in the org.geotools.gui.swing package and has now been moved to the
migrate module (i.e. it isn't really supported anymore). If you were
using StyledMapPane (or it's super class ZoomPane) you would find it
already contained most/all of the functionality you are looking for. 

People will be bored of hearing this, but it brings us back to a
recurring subject on the list, to quote P.Rizzi:

"what most people actually wants (and I join them)
is a plain and simple StyledMapPane-like UI component that they can
embed
inside whatever Java application or applet they're writing.

uDig is wonderful, but it's far too much for the vast majority of
users."

This is the basis of the geowidgets project but I'm not sure how far
it's progressed (or where to find more info in it). Martin has also
mentioned revitalising StyledMapPane, either as part of geotools or part
of geowidgets (I'm not sure which). Actually, it was because my project
was sort of commited to the j2d renderer (the basis of StyledMapPane)
that I stopped updating my geotools code base. Of course, I'd be willing
to help develop 'geowidgets' - there's no point just moaning about
things and expecting other people to sort them out for you :-)

colin  


 -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Bernhard Kastner
> Sent: 16 January 2006 10:17
> To: [email protected]
> Subject: Re: [Geotools-gt2-users] Pan-function
> 
> 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
> 
This message is intended for the addressee(s) only and should not be read, 
copied or disclosed to anyone else outwith the University without the 
permission of the sender.
It is your responsibility to ensure that this message and any attachments are 
scanned for viruses or other defects. Napier University does not accept 
liability for any loss
or damage which may result from this email or any attachment, or for errors or 
omissions arising after it was sent. Email is not a secure medium. Email 
entering the 
University's system is subject to routine monitoring and filtering by the 
University. 


-------------------------------------------------------
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_idv37&alloc_id865&op=click
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to