Re: [OpenMap Users] Layer ordering and disappearing LocationLayer

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 12 Sep 2006 18:02:05 -0400

Hi Øystein,

You need to add your location layer to the LayerHandler. You've
added it to the MapBean, which is OK in some simple situations but
not when you are also using a LayerHandler. The LayerHandler tells
the MapBean to replace the layers the MapBean has with the ones that
the LayerHandler knows about. So the MapBean is dropping your
location layer that way.

It's always better to manage the Layers (for ordering, and for
turning them on/off) using the LayerHandler, and let the MapBean
react to the LayerHandler settings.

Hope this helps (and sorry for the delay in getting back to you),

Don

On Aug 29, 2006, at 7:29 AM, Oystein E. Thorvaldsen wrote:

> Hi,
>
> I'm trying to show several locations on the map, using a
> LocationLayer and CSVLocationHandler. I add the following code to
> main() in the SimpleMap2 example, after the shape layer is added
> (I've disable the route layer):
>
> LocationLayer lolLayer = new LocationLayer();
> CSVLocationHandler[] cityHandlers = new CSVLocationHandler[1];
> CSVLocationHandler ch = new CSVLocationHandler();
>
> //to be properly set in a properties file later
> Properties props = new Properties();
> props.setProperty("locationFile", "testcities.csv");
> props.setProperty("csvFileHasHeader","false");
> props.setProperty("showNames","true");
> props.setProperty("showLocations","true");
> props.setProperty("nameIndex","0");
> props.setProperty("latIndex","5");
> props.setProperty("lonIndex","4");
> props.setProperty("name.lineColor","FF008C54");
> props.setProperty("location.lineColor","FFFF0000");
> props.setProperty("location.fillColor","FFaaaaaa");
> props.setProperty("location.pointRadius","3");
> props.setProperty("location.pointOval","true");
> ch.setProperties(props);
>
> cityHandlers[0] = ch;
> lolLayer.setLocationHandlers(cityHandlers);
> ch.setLayer(lolLayer);
> lolLayer.setVisible(true);
> mapBean.add(lolLayer);
>
> The csv file is on the same format as the cities.csv file in the
> OpenMap application. The locations are shown, but behind the worldmap.
>
> The only way I've found to reorder layers is using
> LayerHandler.moveLayer(Layer int). To get a reference to a
> LayerHandler in SimpleMap2 I've changed the code to:
>
> LayerHandler layerHandler = new LayerHandler();
> //mapHandler.add(new LayerHandler());
> mapHandler.add(layerHandler);
>
> I tried using layerHandler to rearrange the layer order, but both
> getLayers() and getMapLayers() return only two layers, the shape
> layer and the graticule layer. What happened to my location layer??
>
> Is there any other way to order layers? I would have thought that
> the layer most recently added to the mapbean would be on top, but
> that does not seem to be the case.
>
> Any help will be appreciated,
> Øystein
>
> --
> [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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[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 Tue Sep 12 2006 - 18:03:09 EDT

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