[OpenMap Users] How would you modify crew example to override the createCoordinateInformationLine function using a derived class inherited from the NavMouseMode2 class

From: Steve Frierdich <sfrierdich_at_custom-mfg-eng.com>
Date: Fri, 10 Dec 2004 15:48:04 -0500

Don
 All I am trying to is override the createCoordinateInformationLine
function. As stated before I derived a class that inherits from the
NavMouseMode2 class and placed and the
overriding createCoordinateInformationLine in the class. I create a new
instance if the derived class and added to the mousedelegator. Just
doing this alone did not accomplish the createCoordinateInformationLine
derive function being called. The project has an its own properties
file. Is there something that has to be done in its own properties? Make
it even simpler how would you the derived function in one of the
examples like the crew example the createCoordinateInformationLine
would be overridden? What would you do in the crew example
property example to make it work.
Thanks
Steve

Don Dietrick wrote:

> I have no idea how your components work.
>
> - Don
>
> On Dec 10, 2004, at 1:53 PM, Steve Frierdich wrote:
>
>> Don
>> The saids projects has it owns property file. I thought if the a
>> project uses its own property file then the openmap's property file
>> has no effect at all on the project are openmap in the project. Am I
>> incorrect?
>> Thanks
>> Steve
>>
>> Don Dietrick wrote:
>>
>>>
>>> On Dec 10, 2004, at 12:43 PM, 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);
>>>
>>>
>>> ///////////////////
>>>
>>> You don't have to do this part if you are creating MouseModes in
>>> the openmap.properties file. The method above is a failsafe in
>>> case the mouse modes aren't added to the openmap.components
>>> properties and the MouseDelegator is.
>>>
>>>> • 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.SaidsCoordMouseMod
>>>> e
>>>
>>>
>>>
>>>
>>> What's looking for the saids.components property?
>>>
>>> - Don
>>>
>>>>
>>>> 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"]
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>> Don Dietrick, dietrick_at_bbn.com
>>> BBN Technologies, Cambridge, MA
>>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>
>>>
>>
>>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>

--
[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 - 15:49:35 EST

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