[OpenMap Users] BasicMapPanel

From: Rachel Lee Knickmeyer <rknickm@cc.gatech.edu>
Date: Thu Feb 19 2004 - 12:09:41 EST

I want to create a map widget that can be used across a variety of
applications, thus it should be bundled as a simple JPanel that can be
easily added to other interfaces.

However, I can't seem to figure out a way to create a JPanel that displays
the map functionality at all. It always requires use of an OpenMapFrame
that is added to the MapHandler. the code is below. how can i make this
into a working JPanel extension widget?

public class TestFile {

    /** Creates a new instance of TestFile */
    public static void main(String args[]) {

        //BackgroundMap map = new BackgroundMap();
        EVMap ev = new EVMap();

        JFrame frame = new JFrame("Experiential Systems Group Map
Interface");

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.getContentPane().add(ev);

        frame.setVisible(true);

    }

}

public class EVMap extends JPanel {

        public EVMap() {

        try {

            MapPanel mapPanel = new BasicMapPanel();

            // Get the default MapHandler the BasicMapPanel created.
            MapHandler mapHandler = mapPanel.getMapHandler();

            // Get the default MapBean that the BasicMapPanel created.
            MapBean mapBean = mapPanel.getMapBean();

            // Set the map's center
            mapBean.setCenter(new LatLonPoint(43.0f, -95.0f));

            // Set the map's scale 1:120 million
            mapBean.setScale(120000000f);

            mapHandler.add(new LayerHandler());

            mapHandler.add(new GraticuleLayer());

            ShapeLayer shapeLayer = new ShapeLayer();

            Properties shapeLayerProps = new Properties();
            shapeLayerProps.put("prettyName", "Political Solid");
            shapeLayerProps.put("lineColor", "000000");
            shapeLayerProps.put("fillColor", "BDDE83");
            shapeLayerProps.put("shapeFile",
"C:/openmap-4.6/ESGData/world.shp");
            shapeLayer.setProperties(shapeLayerProps);
            shapeLayer.setVisible(true);

            mapHandler.add(shapeLayer);

            // Create the directional and zoom control tool
            OMToolSet omts = new OMToolSet();
            // Create an OpenMap toolbar
            ToolPanel toolBar = new ToolPanel();

            mapHandler.add(omts);
            mapHandler.add(toolBar);
            // Display the frame
            setVisible(true);

        } catch (MultipleSoloMapComponentException msmce) {

        }
    }

--
[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 Thu Feb 19 12:10:35 2004

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