Hi Chhaya,
On Wednesday, January 2, 2002, at 04:35 PM, Chhaya Mudgal wrote:
> Hi,
>
> Thanks for your help, it worked for me.
Great!
> I have another questions. In the apps directory I am
> running the openmap demo in which I have added another layer that reads
> the segmented lat/lon points using OMPoly as you suggested. I want
> to know for my knowledge that how does the mercator projection work in
> this case when I select the projection type from the navigate drop down
> in the openmap demo.
Are you adding a layer in the OpenMap.java code? The mercator
projection defined there is a default to use when initializing the
MapBean, in case the openmap.properties file doesn't have a definition
for a projection.
If you are adding your layer in the code, it would be better to add it
in the openmap.properties file as well. The OpenMap.java file is very
generic, and the application is actually configured in the
openmap.properties file settings. The openmap.properties file has
instructions inside it to explain how to modify its settings.
When a layer is added to the MapBean, it becomes a ProjectionListener to
it. When the projection in the MapBean changes (the center lat/lon,
scale, type or pixel height and width) all of the layers receive a
ProjectionEvent, containing the new Projection, in the
projectionChanged() method. This lets the layer know to change the
OMGraphicsList if it needs to, and provides the new projection object
that should be passed to the OMGraphics.generate() method. When the
layer has created the list of graphics for display, and they are all
generated, then the layer can call repaint() on itself, which will cause
Java to call the layer's paint() method, which then puts the graphics on
the map.
This cycle happens every time the map is zoomed, panned, resized, or
when the projection type changes.
When you choose a different projection type from the projection menu, a
new projection is created in the MapBean with a different type, and the
cycle runs.
>
> What I am wondering is can the line of lat/lon drawn using OMPoly be
> projected using Mercator if added as a layer in the openmap example in
> the apps directory. Or that projection works only for the shape
> political
> files.
The projections are data type independent. They are objects that let
you translate lat/lon coordinates to screen x/y coordinates. The
OMGraphics know how to use them to position themselves on the screen,
and those positions are painted on the map in the OMGraphic.render()
method. The layer should only be using the projection that arrives in
the projectionChanged() method. Any other projection may not be the one
that is part of the MapBean.
Hope this helps,
Don
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- [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 Wed Jan 2 18:23:58 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT