[OpenMap Users] problem with properties prefix in layers

From: guy <guy.chatel_at_laposte.net>
Date: Mon, 29 Aug 2011 21:56:58 +0200

Hi all,

I've got some troubles when using ShapeLayer or LocationLayer from my
own application.

1- shape layer:
I try to se the following code

         ShapeLayer shapeLayer = new ShapeLayer();

         // Since this Properties object is being used just for
         // this layer, the properties do not have to be scoped
         // with marker name, like the layer properties in the
         // ../hello/HelloWorld.properties file.
         Properties shapeLayerProps = new Properties();
         shapeLayerProps.put("prettyName", "Political Solid");
         shapeLayerProps.put("lineColor", "000000");
         shapeLayerProps.put("fillColor", "BDDE83");
         shapeLayerProps.put("shapeFile", "data/shape/dcwpo-browse.shp");
         shapeLayerProps.put("spatialIndex", "data/shape/dcwpo-browse.ssx");
         shapeLayer.setProperties(shapeLayerProps);
         shapeLayer.setVisible(true);
         .....
         mapHandler.add(shapeLayer);

The code above works fine, but when put a prefix string in the
setProperties call (ie: setProperties("shapeLayer", shapeLayerProps) ),
the map is not displayed and i get the following message

     *** ERROR ***
     No Shape file was specified:
     *************

     *** ERROR ***
         shapeLayer.shapeFile
     *************


2- Location layer
With the LocationLayer, it's quite the same behavior

         CSVLocationHandler csvCities = new CSVLocationHandler();
         Properties csvCitiesProps = new Properties();
         csvCitiesProps.put("prettyName", "World Cities");
         csvCitiesProps.put("locationFile", "data/cities.csv");
         csvCitiesProps.put("csvFileHasHeader", "true");
         csvCitiesProps.put("locationColor", "FF0000");
         csvCitiesProps.put("nameColor", "008C54");
         csvCitiesProps.put("showNames", "false");
         csvCitiesProps.put("showLocations", "true");
         csvCitiesProps.put("nameIndex", "0");
         csvCitiesProps.put("latIndex", "5");
         csvCitiesProps.put("lonIndex", "4");
         csvCitiesProps.put("csvFileHasHeader", "true");
         csvCities.setProperties("csvCities", csvCitiesProps);
         mapHandler.add(csvCities);

         LocationLayer cities = new LocationLayer();
         Properties citiesProps = new Properties();
         citiesProps.put("prettyName", "World Cities");
         citiesProps.put("locationHandlers", "csvCities");
         citiesProps.put("useDeclutter", "false");
         citiesProps.put("declutterMatrix",
"com.bbn.openmap.layer.DeclutterMatrix");
         cities.setProperties("cities", citiesProps);
         cities.setVisible(true);

         ................
         mapHandler.add(cities);

With the code above, everything seams to be ok however nothing is
displayed, and when i remove the "cities" string in the
cities.SetProperties line i get the following message :

     *** ERROR ***
     Failed to locate property "csvCities.class"
     Skipping handler "csvCities"
     *************

Thanks a lot for any help.
Guy
-- 
--
[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 Mon Aug 29 2011 - 15:59:21 EDT

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