Hi Ed -
Here's how we have our application structured. We have several
different OpenMap layers which are used to display information
from a simulation. We are treating these as views into the data
models (classic MVC architecture). Each layer will register
itself as a listener for one or several data models that are
available.
We have a poller thread which gets kicked off from the main
application (we've customized the OpenMap.java app) which
retrieves data from the simulation source and populates the
data models. When the data models change, the layer is
notified and can query the data model for the data objects
it needs to display. The OMGraphic objects are created in the
method that is required to be implemented for the layer to act
as a listener to the model. An example is our RedInfoLayer
implements the InformationModelListener which declares an
informationModelChanged() method. Inside this method is where
the OMGraphic objects are created that will be displayed for
that layer. We are using the OMRaster object so that we can
specify an IconImage object which corresponds to a GIF file.
For the time being, I'm just recreating a OMGraphicList
object each time the model changes and creating new
graphics objects to be displayed. This makes it easy since
you can just call generate() and render() on the OMGraphicList
object and OpenMap takes care of rendering everyting inside
that list. As you are doing, the lat/lon of the data
object translates to the lat/lon of the OMRaster object I'm
creating. Then, after all the objects have been instantiated
and placed into the OMGraphicList, I call repaint().
This is also the way we show movement on the map. The lat/lon of
a particular object may change when the data model changes so by
recreating the graphic list and repainting, the previous position
is cleared and the new position is drawn. Not exactly the most
efficient approach but it works for the time being (and was the
easiest to do to get the demo working). ;)
Good luck.
Chris Hopkins
AI Software Engineer
Charles River Analytics
> -----Original Message-----
> From: Ed MacKerrow [mailto:mackerrow@lanl.gov]
> Sent: Monday, April 29, 2002 11:40 PM
> To: openmap-users@bbn.com
> Subject: Basic question -- I am missing the "big picture" ...
>
>
> Dear OpenMappers,
>
> I am still on the steep end of the OM learning curve and I think I
> missing out on the "bigger picture".
>
> I have built a few layers that I have been able to display my objects
> on, however, I did this by instantiating the objects, which are
> displayed by association with a OMGraphic that has the same (lat,lon)
> as the App objs. The mistake that I believe I have done, is to
> instantiate these objects and OMGraphics by calling a "buildObjs()"
> method from inside the constructor for the layer. The layer constructor
> is invoked from the properties file call (i.e. like in the OpenMap app).
> Should I be instantiating these objects from a mapHandler instead?
>
> The reason I am asking is that I don't know how to update the positions
> of those objects on the layer, since I do not have an instantiated
> object that represents my layer class. I guess my basic question is:
>
> How do I update the position values of objects that are displayed on a
> layer? ( are there any simple examples of updating the positions of
> objects that are displayed on a layer out there?)
>
> Thanks for your help,
>
> ed
>
>
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Tue Apr 30 10:07:51 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT