[OpenMap Users] Re: Overriding createCoordinateInformationLine did not work, same coordinates displayed as before

From: Steve Frierdich <sfrierdich_at_custom-mfg-eng.com>
Date: Fri, 10 Dec 2004 12:44:50 -0500

Steve Frierdich wrote:

> Piotr Kamiński wrote:
>
> The overriding of the createCoordinateInformationLine function did
> not work. The steps taken to override the function were:
>
> * Override the createCoordinateInformationLine by deriving a
> SaidsCoordMouseMode from the NavMouseMode2 class, and
> overriding the CreateCoordinateInformationLine function in the
> derived class so it returns a string of UTM or MGRS coordinated
>
> * Derived Nav Mouse Mode varaible from the SaidsCoordMouseMode
> class instead of the NavMouseMode2 class and add this variable
> to the mouse delegator.
>
> <> private SaidsCoordMouseMode /*NavMouseMode2*/ navMouseMode2;
> navMouseMode2 = new SaidsCoordMouseMode();
> mouseDelegator.addMouseMode(navMouseMode2);
>
>
>
> * To set the navMouseNode like is done in openamaps.property
> file. The name of the project is saids, and the
> SaidsCoordMouseMode is the class that is inherited from the
> NavMouseMode2 class.
>
> <>Code in saids.properties file to set nav mouse mode:
> saids.components=navMouseMode
> navMouseMode.class=com.cme.mirss.saids.mapdisplayj.SaidsCoordMouseMode
>
> The steps above did not work. Did I do something wrong in the projects
> property file?
> Thanks
>
> Steve
> Piotr Kamiński wrote:
>
>>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 - 12:45:16 EST

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