Re: [OpenMap Users] Issue with InformationDelegator

From: Mulone <andrea.ballatore_at_ucd.ie>
Date: Mon, 27 Jul 2009 06:35:48 -0700 (PDT)

Thanks Ruben,
I fixed it myself just by setting infoDelegator to the right pointer
manually.

Cheerio


Ruben DF wrote:
>
> Hi Mulone,
>
>
>
> I had that problem a few months ago.To get the coordinates (in lat long
> format) I used this code successfuly:
>
>
>
> mapPanel.getMapBean().addMouseMotionListener(new
> java.awt.event.MouseMotionAdapter()
>
>         {
>
>
>
>
>
>
>
>             public void mouseMoved(MouseEvent e)
>
>             {
>
>
>
> float latitude = mapPanel.getMapBean().getCoordinates(e).getLatitude();
>
> float longitude = mapPanel.getMapBean().getCoordinates(e).getLongitude();
>
>
>
> }
>
> });
>
>
> where mapPanel is your instance from MapPanel class. Once you have this
> info, if you want to get those coordinates in X, Y format, use this
> code:
>
>
>
> Point p=
> mapPanel.getMapBean().getProjection().forward(latitude,longitude);
>
> float x = p.getX();
>
> float y = p.getY();
>
>
>
> Hope this helps.
>
> Ruben
>
>
>
> --- El vie, 24/7/09, Mulone <andrea.ballatore_at_ucd.ie> escribió:
>
> De: Mulone <andrea.ballatore_at_ucd.ie>
> Asunto: [OpenMap Users] Issue with InformationDelegator
> Para: openmap-users_at_bbn.com
> Fecha: viernes, 24 julio, 2009 2:02
>
>
> Hi guys,
> I'm trying to get the coordinates displayed on the informationDelegator,
> but
> debugging the framework I've noticed that the infoDelegator in the
> fireMouseLocation in CoordMouseMode.java is always null.
> Where that pointer is supposed to be initialised?
>
> Thanks for any hints.
> Mulone
>
> Code:
> public void fireMouseLocation(MouseEvent e) {
>         /** other code /*
>         if (infoDelegator != null) { // ALWAYS NULL!
>             if (e.getSource() instanceof MapBean) {
>                 llp = ((MapBean) e.getSource()).getProjection().inverse(x,
> y);
>             }
>             String infoLine;
>             infoLine = coordFormatter.createCoordinateInformationLine(x,
>                     y,
>                     llp,
>                     this);
>
>             // setup the info event
>             InfoDisplayEvent info = new InfoDisplayEvent(this, infoLine,
> InformationDelegator.COORDINATE_INFO_LINE);
>             // ask the infoDelegator to display the info
>             infoDelegator.requestInfoLine(info);
>         }
>     }
> --
> View this message in context:
> http://www.nabble.com/Issue-with-InformationDelegator-tp24643352p24643352.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
>
>
>
>

-- 
View this message in context: http://www.nabble.com/Issue-with-InformationDelegator-tp24643352p24680836.html
Sent from the OpenMap mailing list archive at Nabble.com.
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Jul 27 2009 - 09:36:46 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT