RE: [OpenMap Users] Moving Blip

From: Potter, Mark A (UK Rochester) <"Potter,>
Date: Wed, 05 Jan 2005 17:25:02 +0000

Perfect I have that working very well now, thank you! You wouldn't believe how close I have been to getting it working in the past...

-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: 16 December 2004 22:54
To: Potter, Mark A (UK Rochester)
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] Moving Blip


Hi Mark,

I'd suggest creating a layer specifically to display the symbol at a
certain lat/lon. You can extend OMGraphicHandlerLayer and add a method
to the layer to set a symbol at a lat/lon point:

public void setLocation(LatLonPoint llp) {
        OMGraphicList omgl = getList();
        if (omgl == null) {
                omgl = new OMGraphicList();
                setList(omgl);
        }

        OMPoint p = getPoint();
        if (p == null) {
                p = new OMPoint(llp.getLatitude(), llp.getLongitude());
                p.setFillColor(Color.RED);
                omgl.add(p);
                setPoint(p);
        } else {
                p.set(llp.getLatitude(), llp.getLongitude());
        }
        doPrepare();
}

where setPoint/getPoint are methods you add to keep track of the
OMPoint.

It looks like you are currently doing something to the GraticuleLayer,
which clears out it's list every projection change. It will probably
result in unpredictable behavior at some point (but then again, maybe
not).

- Don

On Dec 16, 2004, at 4:02 AM, Potter, Mark A (UK Rochester) wrote:

>
> Don,
>
> I am currently using the following command sequence, but it doesn't
> work:
>
> Projection p = mapBean.getProjection();
> OMGraphicList list = symbolLayer.getList();
>
> point.set(currentPos.getLatitude(),currentPos.getLongitude());
>
> list.add(point);
> list.generate(p);
> symbolLayer.repaint();
>
> I get a null pointer exception at list.add(point). Point is defined
> elsewhere as
>
> point = new com.bbn.openmap.omGraphics.OMPoint();
> point.setFillColor(Color.RED);
>
> point.setRenderType(com.bbn.openmap.omGraphics.OMGraphic.RENDERTYPE_LAT
> LON);
> point.setOval(true);
>
> Symbol layer is
>
> symbolLayer = new com.bbn.openmap.layer.GraticuleLayer();
> symbolLayer.setVisible(true);
> mapHandler.add(symbolLayer);
>
> Here is a little development whilst writing this reply... I've taken
> the paintSymbol() command out of the loop and attached it to a random
> button... Works a treat! The blip looks like it is where it should
> be...
>
> So is it a timing thing? Would symbolLayer.getList() return a null
> reference immediately after calling centreMap()?
>
> public void centreMap() {
> mapBean.setCenter(currentPos);
> }
>
> Should I be trying to synchronise with the redraw of the map?
>
> This is what I hate about programming, what you think the problem is
> never turns out to be the problem! I must have had the right method
> of creating the blip for a week now, and the error is something
> completely different!
>
> Thank you for any help you can provide,
>
> Regards,
>
> Mark.
>
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: 15 December 2004 15:58
> To: Potter, Mark A (UK Rochester)
> Cc: openmap-users_at_bbn.com
> Subject: Re: [OpenMap Users] Moving Blip
>
>
> *** WARNING ***
>
> This mail has originated outside your organization,
> either from an external partner or the Global Internet.
> Keep this in mind if you answer this message.
>
> Hi Mark,
>
> On Dec 15, 2004, at 10:01 AM, Potter, Mark A (UK Rochester) wrote:
>
>>
>> Hello All,
>>
>> I have recently swapped from using another set of map utilities to
>> using OpenMap, and so I am reasonably new to it. I have been really
>> delighted with the capabilities so far, but I have one niggling
>> problem that I am really struggling with, the frustration being how
>> simple it should be to do - I'm sure I'm missing something. I've also
>> being trawling around the OM mailing list archives, and found similar
>> problems but as yet no definitive solution for what I am trying to
>> achieve. Any help you can provide will be greatly appreciated.
>>
>> So far I have used openmap to produce a moving map - receiving
>> lat/long information across a network and re-entering the map to suit.
>> Brilliant, took me a day to do that. Took me a further day to learn
>> how to zoom in and out to set ranges (i.e.. 100m, 200m, 400m and so
>> on). Incidentally I've got a curious problem with that but I'll save
>> that one for later...
>>
>> I have made myself a little application called Map.java that pulls in
>> the necessary objects from open map and diy-builds the layers (I do
>> not use the .properties file)... this is because at a later date I'll
>> need to tell it which map data to pull in depending on a current
>> location (map data will be in different formats - bring on
>> standardisation!)...
>
> That's perfectly fine. Using the openmap.properties file is just a way
> to be able to change things without recompiling.
>
>> I have a loop running (I know its not the best solution but this is a
>> proof-of-concept research project), that does the following:
>>
>> while(true) {
>> System.out.println("Current lat = " +
>> currentPos.getLatitude());
>> System.out.println("Current lng = " +
>> currentPos.getLongitude());
>>
>> getTelemetry();
>> centreMap();
>> paintSymbol();
>
> What happens in paintSymbol()? I mean, how are you drawing the circle
> on the MapBean from a method call in Map.java?
>
> - Don
>
>
>>
>> }
>>
>> I have a global LatLonPoint currentPos, which getTelemetry() populates
>> with the current position (recieved once a second).
>>
>> centreMap() does what it says on the tin, centre-ing the map on the
>> current position.
>>
>> paintSymbol() I just want to put a circle in the middle of the screen
>> (moreover, the current lat lon position), representing the object
>> being tracked.
>>
>> I've tried so many ways of doing this it is unreal... An "OMGraphics
>> guide for Dummies" answer would be delightful - it is such a simple
>> thing to do I'm going insane! I've spent 2 weeks trying to get it
>> right!!!
>>
>> Any more information required just shout. I'm using MapBean and a
>> MapHandler to which I'm adding layers.
>>
>> Thanks,
>>
>>
>> Mark Potter.
>>
>> ********************************************************************
>> This email and any attachments are confidential to the intended
>> recipient and may also be privileged. If you are not the intended
>> recipient please delete it from your system and notify the sender.
>> You should not copy it or use it for any purpose nor disclose or
>> distribute its contents to any other person.
>> ********************************************************************
>> --
>> [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
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
--
[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 Wed Jan 05 2005 - 12:26:21 EST

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