Michael,

I searched around on the DirectPosition...  Should I use the following to 
define it:
Di         DirectPosition dp = new DirectPosition2D(crs, lon, lat);

Also I'm confused on getting the area:
double displayAreaWidth = ...

Is this from the ReferencedEnvelope that can be extracted from the 
JMapPane.getDisplayArea?
ReferencedEnvelope re = wrappedPane.getDisplayArea();
double displayAreaWidth = re.getWidth();

wrappedPane is my locally declared JMapPane.

Oliver


-----Original Message-----
From: "Michael Bedward" <[email protected]>
Sent: Wednesday, January 6, 2010 9:22pm
To: "Oliver Gottwald" <[email protected]>
Cc: "geouser" <[email protected]>
Subject: Re: [Geotools-gt2-users] Zoom to Point?

Hi Oliver,

> i was wondering how one would write zoom to point in geotools?
>

Perhaps something like this...

// point to zoom to
DirectPosition pos = ...

// desired map display width (e.g. calculated from scale)
double displayAreaWidth = ...

double dw = displayAreaWidth / 2;

ReferencedEnvelope bounds = new ReferencedEnvelope(
        pos.getX() - dw, pos.getX() + dw,
        pos.getY() - dw, pos.getY() + dw,
        pos.getCoordinateReferenceSystem() );

myMapPane.setDisplayArea( bounds );

Hope this helps,
Michael
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to