Re: [OpenMap Users] problem with properties prefix in layers

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Tue, 30 Aug 2011 19:20:14 -0400

Hi Guy,

If you use a property prefix, you have to change the property keys as well. For instance, with a property prefix of shapeLayer, you'd have to use shapeLayer.prettyName in the properties for that property:

> shapeLayerProps.put("shapeLayer.prettyName", "Political Solid");

and so on, for all props. You can use a single Properties object to hold properties for many layers, and the prefix scopes the props for a particular layer.

Hope this helps,

-- Don

On Aug 29, 2011, at 3:56 PM, guy <guy.chatel_at_laposte.net> wrote:

> 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
> --
> <linux_user.jpg>

--
[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 30 2011 - 19:51:16 EDT

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