Hi Valerio,

Here is one way...

    ReferencedEnvelope env = mapPane.getDisplayArea();
    double dx = newCentreX - env.getMedian(0);
    double dy = newCentreY - env.getMedian(1);
    env.translate(dx, dy);
    mapPane.setDisplayArea(env);

Michael


On 1 September 2011 20:04, Valerio Di Gregorio
<[email protected]> wrote:
> Hello,
> I have a JMapPane which shows the map. I also have the coordinates of
> the current position retrieved by the GPS device. I would like to center
> the map on the current position when the current position changes. How
> to do it?
>
> Thanks,
> Valerio
>
> --
>
> Valerio Di Gregorio
> Automotive and Telecommunication Division
> Information Engineer
>
> INTECS Informatica e Tecnologia del Software S.p.A.
> Via Egidio Giannessi, 5
> 56121 - Ospedaletto, Pisa
> Italy
>
> Voice: +39 050 9657 411 (operator)
> Voice: +39 050 9657 455 (direct)
> Fax:   +39 050 9657 400
> Skype: valeriodigregorio.intecs.it
> Email: [email protected]
> Web:   http://www.intecs.it
>
>
>
> LEGAL DISCLAIMER:
> The contents of this email and any transmitted files are confidential and 
> intended solely for the use of the individual or entity to whom they are 
> addressed. We hereby exclude any warranty and any liability as to the quality 
> or accuracy of the contents of this email and any attached transmitted files. 
> If you are not the intended recipient, be advised that you have received this 
> email in error and that any use, dissemination, forwarding, printing or 
> copying of this email is strictly prohibited. If you have received this email 
> in error please contact the sender and delete the material from any computer.
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to