[OpenMap Users] multishapelayer

From: Rachel Knickmeyer <rknickm@cc.gatech.edu>
Date: Fri Mar 19 2004 - 14:45:50 EST

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"

 

Suggestions?

 

-Rachel

 

    public EVMap() {

                

             // Prevent the BasicMapPanel from creating a
PropertyHandler with no

             // properties, which would cause it to look for an
openmap.properties file:

   

             super(new PropertyHandler(new Properties()));

             

             try {

 

                 // Get the default MapBean that the BasicMapPanel
created.

                 MapBean mapBean = getMapBean();

                 select_layer = new Select_Layer();

                 

                 // Set the map's center

                 mapBean.setCenter(new LatLonPoint(43.0f, -95.0f));

                 // Set the map's scale 1:120 million

                 mapBean.setScale(3000000000f);

                 

                 MouseDelegator md = new MouseDelegator(mapBean);

                 InformationDelegator id = new InformationDelegator();

                 

                 id.setMap(mapBean);

                 NavMouseMode nm = new NavMouseMode();

                 SelectMouseMode sm = new SelectMouseMode();

                 sm.setInfoDelegator(id);

                 nm.setInfoDelegator(id);

                 

                 md.addMouseMode(sm);

                 md.addMouseMode(nm);

                   

                 

                 addMapComponent(new LayerHandler());

                 addMapComponent(select_layer);

                 

                 map_layer = new ScaleFilterLayer();

                 Vector view_list = new Vector();

                 float scales[];

                 scales = new float[1];

                 scales[0] = 51220880;

                 

                 ShapeLayer world_view = new ShapeLayer();

 

                 //Create the World Map

                 

                 Properties shapeLayerProps = new Properties();

                 

                 shapeLayerProps.put("prettyName", "World View");

                 shapeLayerProps.put("lineColor", "000000");

                 shapeLayerProps.put("fillColor", "FFFFFF");

                 shapeLayerProps.put("shapeFile",
"C:/openmap-4.6/EgoMap/ESGData/world.shp");

                 world_view.setProperties(shapeLayerProps);

                 world_view.setVisible(true);

                 

                 

                 

                 MultiShapeLayer usa_view = new MultiShapeLayer();

                 

                 shapeLayerProps = new Properties();

                 shapeLayerProps.put("prettyName", "USA View");

                 shapeLayerProps.put("shapeFileList", "usa world");

                 shapeLayerProps.put("lineColor", "000000");

                 shapeLayerProps.put("fillColor", "FFFFFF");

                 shapeLayerProps.put("shapeFile",
"C:/openmap-4.6/EgoMap/ESGData/world.shp");

                 shapeLayerProps.put("enabled", "true");

                 shapeLayerProps.put("lineColor", "000000");

                 shapeLayerProps.put("fillColor", "FFFFFF");

                 shapeLayerProps.put("shapeFile",
"C:/openmap-4.6/EgoMap/ESGData/usa.shp");

                 shapeLayerProps.put("enabled", "true");

                 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 14:49:56 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT