Hi Rachel,
On Mar 19, 2004, at 2:45 PM, Rachel Knickmeyer wrote:
> I’m trying to use MultiShapeLayer to combine a usa shape file with a
> world shape file. I can see how to do this if I were using the
> openmap.properties file, but how to I make it work in a stand alone
> app?
>
>
>
> My code is below…I just can’t figure out how to set up the properties
> correctly. In this case, I get a runtime error that says “No
> property .shapeFileList found in application properties”
<snip>
> MultiShapeLayer usa_view = new MultiShapeLayer();
>
> shapeLayerProps = new Properties();
> shapeLayerProps.put("prettyName", "USA View");
> shapeLayerProps.put("shapeFileList", "usa world");
It looks like there is a bug in how the properties are being
initialized in MultiShapeLayer. The line (130):
setSpatialIndexes(realPrefix, props);
should be:
setSpatialIndexes(prefix, props);
realPrefix is "", which is getting translated into "." in
setSpatialIndexes(). If you add some marker name string to the
properties above, that would work, too:
shapeLayerProps.put("usa_view.prettyName", "USA View");
appending "usa_view." to all property names, and then calling:
usa_view.setProperties("usa_view", shapeLayerProps);
below. Note that usa_view (your object name) is unrelated to
"usa_view" (the property scoping name).
Also, you need to further scope these properties below so they can be
given to the proper SpatialIndex
shapeLayerProps.put("world.lineColor", "000000");
shapeLayerProps.put("world.fillColor", "FFFFFF");
shapeLayerProps.put("world.shapeFile",
"C:/openmap-4.6/EgoMap/ESGData/world.shp");
shapeLayerProps.put("world.enabled", "true");
shapeLayerProps.put("usa.lineColor", "000000");
shapeLayerProps.put("usa.fillColor", "FFFFFF");
shapeLayerProps.put("usa.shapeFile",
"C:/openmap-4.6/EgoMap/ESGData/usa.shp");
shapeLayerProps.put("usa.enabled", "true");
I put "usa." or "world." in front of each property as appropriate. You
would add "usa_view." in front too if you start adding that to all the
properties.
I've fixed the bug for the next release.
Regards,
Don
>
> usa_view.setProperties(shapeLayerProps);
> usa_view.setVisible(true);
>
> view_list.add(world_view);
> view_list.add(usa_view);
>
> map_layer.setLayersAndScales(view_list, scales);
> addMapComponent(map_layer);
>
> // Create the directional and zoom control tool
> addMapComponent(new OMToolSet());
>
> // Create an OpenMap toolbar
> addMapComponent(new MouseModePanel(md));
> addMapComponent(new ToolPanel());
> addMapComponent(id);
>
> } catch (MultipleSoloMapComponentException msmce) {
> System.out.println(msmce.getMessage());
> }
> }
-- [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 Fri Mar 19 16:22:35 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT