当前位置: 首页>>代码示例>>Java>>正文


Java ShapeLayer类代码示例

本文整理汇总了Java中com.bbn.openmap.layer.shape.ShapeLayer的典型用法代码示例。如果您正苦于以下问题:Java ShapeLayer类的具体用法?Java ShapeLayer怎么用?Java ShapeLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ShapeLayer类属于com.bbn.openmap.layer.shape包,在下文中一共展示了ShapeLayer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setProperties

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
public void setProperties(String prefix, Properties props) {
    super.setProperties(prefix, props);

    prefix = PropUtils.getScopedPropertyPrefix(prefix);

    landAttributes.setProperties(prefix + LAND_ATTRIBUTES_PROPERTY, props);

    String shapeFileName = props.getProperty(prefix + SHP_FILE_PROPERTY);
    if (shapeFileName != null) {
        shapeStuff = new ShapeLayer(shapeFileName);
        shapeStuff.setDrawingAttributes(landAttributes);

        // If noCoverageZoom property is not set and the shape file is, then
        // make the default action to show the shape file.
        if (props.getProperty(prefix + NO_COVERAGE_ZOOM_PROPERTY) == null) {
            noCoverageZoom = 20;
        }
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:20,代码来源:ShpFileEmptyTileHandler.java

示例2: main

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
/** A main() method that just brings up a JFrame containing the MapPanel. */
public static void main(String argv[]) {
   SwingUtilities.invokeLater(new Runnable() {

      public void run() {
         JFrame f = new JFrame("Map");
         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         OverlayMapPanel map = new OverlayMapPanel(new PropertyHandler(new Properties()), true);
         map.create();

         map.getMapBean().setBackgroundColor(new Color(0x99b3cc));
         map.addMapComponent(new LayerHandler());
         map.addMapComponent(new MouseDelegator());
         map.addMapComponent(new OMMouseMode());
         ShapeLayer shapeLayer = new ShapeLayer("share/data/shape/cntry02/cntry02.shp");
         // shapeLayer.setAddAsBackground(true);
         map.addMapComponent(shapeLayer);
         map.includeExitMenuItem();
         f.setJMenuBar(map.getMapMenuBar());
         f.getContentPane().add(map);
         f.setSize(800, 600);
         f.setVisible(true);
      }

   });

}
 
开发者ID:d2fn,项目名称:passage,代码行数:28,代码来源:OverlayMapPanel.java

示例3: setProperties

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
/**
 * Initializes this object from the given properties
 * 
 * @param props
 *            the <code>Properties</code> holding settings for this object
 */
public void setProperties(String prefix, Properties props) {
    if (Debug.debugging("areas")) {
        Debug.output("AreaHandler: setting properties");
    }

    setPropertyPrefix(prefix);
    originalProperties = props;

    // These will get initialized when someone asks for it.
    // Otherwise, it delays the startup of the map.
    politicalAreas = null;

    String realPrefix = PropUtils.getScopedPropertyPrefix(prefix);

    String transClassName = props.getProperty(realPrefix
            + ShapeLayer.TransformProperty);
    if (transClassName != null) {
        try {
            coordTransform = (GeoCoordTransformation) ComponentFactory.create(
                                                                              transClassName,
                                                                              realPrefix
                                                                                      + ShapeLayer.TransformProperty,
                                                                              props);
        } catch (ClassCastException cce) {

        }
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:35,代码来源:AreaHandler.java

示例4: main

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
public static void main(String args[]) {

        // Create a Swing frame
        JFrame frame = new JFrame("Simple Map");

        // Size the frame appropriately
        frame.setSize(640, 480);

        // Create a MapBean
        MapBean mapBean = new MapBean();

        // Create a ShapeLayer to show world political boundaries.
        // Set the properties of the layer. This assumes that the
        // datafiles "dcwpo-browse.shp" and "dcwpo-browse.ssx" are in
        // a path specified in the CLASSPATH variable. These files
        // are distributed with OpenMap and reside in the toplevel
        // "share" subdirectory.
        ShapeLayer shapeLayer = new ShapeLayer();
        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);

        // Add the political layer to the map
        mapBean.add(shapeLayer);

        // Add the map to the frame
        frame.getContentPane().add(mapBean);

        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        // Display the frame
        frame.setVisible(true);
    }
 
开发者ID:d2fn,项目名称:passage,代码行数:42,代码来源:SimpleMap.java

示例5: getShapeStuff

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
public ShapeLayer getShapeStuff() {
    return shapeStuff;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:4,代码来源:ShpFileEmptyTileHandler.java

示例6: setShapeStuff

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
public void setShapeStuff(ShapeLayer shapeStuff) {
    this.shapeStuff = shapeStuff;
}
 
开发者ID:d2fn,项目名称:passage,代码行数:4,代码来源:ShpFileEmptyTileHandler.java

示例7: main

import com.bbn.openmap.layer.shape.ShapeLayer; //导入依赖的package包/类
/**
 * This main function basically reads in the data sources (the shape file
 * and the csv information file, and creates a serialized graphics file that
 * will act like a cache later.
 */
public static void main(String[] argv) {
    String propertiesFile = null;
    String prefix = null;
    String outputFile = null;

    Debug.init();

    if (argv.length < 6)
        printUsage();

    for (int i = 0; i < argv.length; i++) {
        if (argv[i].equalsIgnoreCase("-props")) {
            propertiesFile = argv[++i];
        } else if (argv[i].equalsIgnoreCase("-prefix")) {
            prefix = argv[++i];
        } else if (argv[i].equalsIgnoreCase("-file")) {
            outputFile = argv[++i];
        }
    }

    if (propertiesFile == null || prefix == null || outputFile == null) {
        printUsage();
    }

    try {
        Properties properties = new Properties();
        // Read in the properties.
        URL propertiesURL = new URL(propertiesFile);
        InputStream is = propertiesURL.openStream();
        properties.load(is);

        // Let's make a file
        ShapeLayer sl = new ShapeLayer();
        sl.setProperties(prefix, properties);

        AreaHandler ah = new AreaHandler(sl.getSpatialIndex(),
                sl.getDrawingAttributes());

        // Set the properties in the handler.
        ah.setProperties(prefix, properties);
        // Write the saved graphics.
        ah.getGraphics().writeGraphics(outputFile);

    } catch (java.net.MalformedURLException murle) {
        Debug.error("Bad URL for properties file : " + propertiesFile);
        printUsage();
    } catch (java.io.IOException ioe) {
        Debug.error("IOException creating cached graphics file: " + outputFile);
        printUsage();
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:57,代码来源:AreaHandler.java


注:本文中的com.bbn.openmap.layer.shape.ShapeLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。