[OpenMap Users] Layer ordering and disappearing LocationLayer

From: Oystein E. Thorvaldsen <oysteine_at_pvv.org>
Date: Tue, 29 Aug 2006 13:29:00 +0200

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"]
Received on Tue Aug 29 2006 - 07:55:58 EDT

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