RE: [OpenMap Users] Anyone ever overide the createCoordinateInformationLine function is called by the fireMouseLocation method in CoordMouseMode class to effect howcoordinates are displayed

From: Piotr Kamiński <Piotr.Kaminski_at_ctm.gdynia.pl>
Date: Fri, 10 Dec 2004 11:40:43 +0100

Dear Steve,

CoordMouseMode is a base class for other MouseModes (NavMouseMode,
SelectMouseMode, etc)
What I did in my code? Subclassed every mouse mode I use and overrided
method createCoordinateInformationLine().

class MyNavMouseMode extends NavMouseMode {

    public MyNavMouseMode(){
        this(true);
    }

    protected String createCoordinateInformationLine(int x, int y,
LatLonPoint llp) {
        if (llp != null) {
            return InfoLineFormatter.formatUTM(llp);
        } else {
            return InfoLineFormatter.formatXY(x, y);
        }
    }
}

You have to add this new mousemode to openmap.properties instead of original
one (put full package and class name).

InfoLineFormatter class has simple static methods which return String value
displayed in InformationDelegator status line.

Example of UTM formatting:

class InfoLineFormatter {

    private static DecimalFormat myFormat = new DecimalFormat("###.##");

    public static String formatUTM(LatLonPoint llp) {
        // convert lat lon to UTM
        UTMPoint utmPoint = new UTMPoint(llp);
         
        // format UTM coordinates
        StringBuffer sb = new StringBuffer(32);
        sb.append(Integer.toString(utmPoint.zone_number));
        sb.append(String.valueOf(utmPoint.zone_letter));
        sb.append(' ');
        sb.append(myFormat.format(utmPoint.easting));
        sb.append(' ');
        //Locale
        sb.append(myFormat.format(utmPoint.northing));
        return sb.toString();
    }
}

Hope this will help you.


Don,

I think about adding new OpenMap component similar to presented
InfoLineFormatter, but added to BeanContext.
CoordMouseMode (and maybe other MouseModes too) could call its methods to
obtain formatted line. Existance in BeanContext allows changing of
InfoLineFormatter implementation, even at run-time (e.g. user selects he/she
wants now UTM coordinates displayed instead of LatLon). What do you think?

Regards,
Piotr Kaminski



> -----Original Message-----
> From: owner-openmap-users_at_bbn.com
> [mailto:owner-openmap-users_at_bbn.com] On Behalf Of Steve Frierdich
> Sent: Friday, December 10, 2004 2:25 AM
> To: Steve Frierdich
> Cc: Bart Jourquin; Don Dietrick; bruyere_at_gandalf.bbn.com; OpenMap
> Subject: [OpenMap Users] Anyone ever overide the
> createCoordinateInformationLine function is called by the
> fireMouseLocation method in CoordMouseMode class to effect
> howcoordinates are displayed
>
>
> I am trying change what kind of coordinates are displayed
> to,UTM, DMS,
> and MGRS. The createCoordinateInformationLine function is
> called by the
> fireMouseLocation method in CoordMouseMode class to display
> the lat and
> long in degrees if possible , along with the x and y position. Has
> anyone ever overridden this createCoordinateInformationLine called by
> the fireMouseLocation? Can anyone supply me an example of how to
> override this function to affect what is displayed. I would
> like to in
> fact to display whatever string I want to be displayed. Like
> displaying
> the UTM, MGRS, and the lat and long all at the same time in
> one string.
> Does anyone one have some source code to show me how to do this. I am
> new at java and we lost our Java programmer his Java Map project was
> dumped into my lap. My Java experience is about 2 weeks.
>
> Thanks
>
> Steve
>
>
>
> --
> [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"]
>

--
[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 Fri Dec 10 2004 - 05:36:47 EST

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