📄 vpflayer.java
字号:
// **********************************************************************// // <copyright>// // BBN Technologies// 10 Moulton Street// Cambridge, MA 02138// (617) 873-8000// // Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/layer/vpf/VPFLayer.java,v $// $RCSfile: VPFLayer.java,v $// $Revision: 1.12.2.6 $// $Date: 2005/05/24 18:38:28 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.layer.vpf;import java.awt.Component;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.IOException;import java.io.InputStream;import java.io.Serializable;import java.util.Collection;import java.util.Iterator;import java.util.Properties;import java.util.StringTokenizer;import javax.swing.BoxLayout;import javax.swing.JButton;import javax.swing.JPanel;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.event.ProjectionListener;import com.bbn.openmap.gui.WindowSupport;import com.bbn.openmap.layer.OMGraphicHandlerLayer;import com.bbn.openmap.omGraphics.DrawingAttributes;import com.bbn.openmap.omGraphics.OMGraphic;import com.bbn.openmap.omGraphics.OMGraphicConstants;import com.bbn.openmap.omGraphics.OMGraphicList;import com.bbn.openmap.proj.Projection;import com.bbn.openmap.util.Debug;import com.bbn.openmap.util.PaletteHelper;import com.bbn.openmap.util.PropUtils;/** * Implement an OpenMap Layer for display of NIMA data sources in the * VPF (Mil-Std 2407) format. * <p> * The properties needed to configure this layer to display VPF data * include some "magic" strings specific to the VPF database you are * trying to display. * {@link com.bbn.openmap.layer.vpf.DescribeDB DescribeDB}is a * utility to help you figure out what those strings are. * * <pre> * * * * #----------------------------- * # Properties for a VMAP political layer * #----------------------------- * # Mandatory properties * # Mandatory for all layers * vmapPol.class= com.bbn.openmap.layer.vpf.VPFLayer * vmapPol.prettyName= Political Boundaries from VMAP * # Mandatory - choose .vpfPath or .libraryBean * # .vpfPath specifies a ';' separated list of paths to data, each of these * #directories should have a "lat" or "lat." file in them. * vmapPol.vpfPath= e:/VMAPLV0 * # .libraryBean specifies a separate object in the properties file that * # locates vpf data. You should use this option if you have multiple VPF * # layers displaying the same VPF database. (For example, you have 3 VMAP * # layers, displaying coastlines, railroads and rivers. Each layer would * # then specify the same libraryBean name. This reduces the memory * # consumption of the VPF layers.) * # See {@link com.bbn.openmap.layer.vpf.LibraryBean LibraryBean javadoc} for properties info. (Example below) * vmapPol.libraryBean= VMAPdata * VMAPData.class=com.bbn.openmap.layer.vpf.LibraryBean * VMAPData.vpfPath=e:/VMAPLV0 * # Don't forget to add VMAPData to the openmap.components property list, too. * # * #Optional (default is true) changes how features are located. Should * #use this option for multiple coverage types, or when null pointer errors * #are encountered. * vmapPol.searchByFeature=true * * #Limit which VPF library is used (optional). If not specified, * #all available libraries will be checked and used. * vmapPol.libraryName=noamer * # * # Choose either .defaultLayer or .coverageType * # * # .defaultLayer results in the layer looking up the remainder of the * # properties in the defaultVPFLayers.properties files. * vmapPol.defaultLayer= vmapPolitical * # * # .coverageType continues in this property file - chose the VMAP bnd * # (Boundary) coverage * vmapPol.coverageType= bnd * # Select if we want edges (polylines), areas (filled polygons) or text * # This is a space-separated list of "edge" "area" "text" "epoint" and "cpoint" * vmapPol.featureTypes= edge area * #For DCW, the remaining 3 properties are ignored * #Select the text featureclasses we'd like to display. Since we didn't * #select text above, this is ignored * vmapPol.text= * #Select the edge featureclasses we'd like to display. In this case, * #draw political boundaries and coastline, but skip anything else. * vmapPol.edge=polbndl coastl * #Select the area featureclasses we'd like to display. In this case, * #draw politcal areas, but skip anything else. * vmapPol.area=polbnda * #Selectable drawing attributes - for default values, they don't need to * #be included. A hex ARGB color looks like FF000000 for black. * vmapPol.lineColor=hex ARGB color value - Black is default. * vmapPol.fillColor=hex ARGB color value - Clear is default. * vmapPol.lineWidth=float value, 1f is the default, 10f is the max. * * # The column name in the feature table that should be displayed. The easiest * # way to find out what these columns should be for an application is to run the * # application with the other properties set for the layer, and then bring up * # the layer's palette. When the feature is selected, there are additional * # controls that let you display the coverage column names and display type, * # and the coverage column names in the popup are the ones that can be used * # in the properties (the column names are in parenthesis). NOTE: The features * # have to be added to the map and visible (proper scale setting < 30,000,000) * # in order for the palette controls to be visible. * vmapPol.attribute=na2 * # How the attributes should be displayed, either 'label', 'tooltip', or 'information line' * vmapPol.attributeDisplay=label * * #------------------------------------ * # End of properties for a VMAP political layer * #------------------------------------ * * ### Now a VMAP Coastline layer * vmapCoast.class=com.bbn.openmap.layer.vpf.VPFLayer * vmapCoast.prettyName=VMAP Coastline Layer * vmapCoast.vpfPath=/u5/vmap/vmaplv0 * ## a predefined layer from the VPF predefined layer set found in * ## com/bbn/openmap/layer/vpf/defaultVPFLayers.properties * vmapCoast.defaultLayer=vmapCoastline * * ### Now a DCW Political layer * # Basic political boundaries with DCW * dcwPolitical.class=com.bbn.openmap.layer.vpf.VPFLayer * dcwPolitical.prettyName=DCW Political Boundaries * dcwPolitical.vpfPath=path to data * dcwPolitical.coverageType=po * dcwPolitical.featureTypes=edge area * * * * </pre> */public class VPFLayer extends OMGraphicHandlerLayer implements ProjectionListener, ActionListener, Serializable { /** property extension used to set the VPF root directory */ public static final String pathProperty = "vpfPath"; /** * property extension used to set the desired coverage type. * Examples of coverage types inclue "po" for DCW and "hyd" for * VMAP Level 0. */ public static final String coverageTypeProperty = "coverageType"; /** * Property extension used to set the desired feature types. e.g. * line area text */ public static final String featureTypesProperty = "featureTypes"; /** property extension used to specify a default property set */ public static final String defaultLayerProperty = "defaultLayer"; /** * Property that lets you search for graphics via feature type. * Dangerously slow for features that have many graphics spread * out over several tiles. Set to true to search by feature, false * (default) to get the tiles first, and then look for graphics. */ public static final String searchByFeatureProperty = "searchByFeature"; /** Property method for setting VPF data path */ public static final String libraryProperty = "libraryBean"; /** Property for setting VPF cutoff scale */ public static final String cutoffScaleProperty = "cutoffScale"; /** Property for setting VPF library name to use */ public static final String LibraryNameProperty = "libraryName"; /** the object that knows all the nitty-gritty vpf stuff */ protected transient LibrarySelectionTable lst; /** our own little graphics factory */ protected transient LayerGraphicWarehouseSupport warehouse; /** are we searching by feature table (true) or tile (false) */ protected boolean searchByFeatures = false; /** the name of the data bean to look for in beancontext */ protected String libraryBeanName = null; /** * hang onto prefix used to initialize warehouse in * setProperties() */ protected String prefix; /** hang onto properties file used to initialize warehouse */ protected Properties props; /** the path to the root VPF directory */ protected String[] dataPaths = null; /** the coverage type that we display */ protected String coverageType = "po"; protected int cutoffScale = LibrarySelectionTable.DEFAULT_BROWSE_CUTOFF; /** the library name to focus on */ protected String libraryName = null; /** * Construct a VPF layer. */ public VPFLayer() { setProjectionChangePolicy(new com.bbn.openmap.layer.policy.ListResetPCPolicy(this)); setRenderPolicy(new com.bbn.openmap.layer.policy.BufferedImageRenderPolicy(this)); setMouseModeIDsForEvents(new String[] { "Gestures" }); } /** * Construct a VPFLayer, and sets its name. * * @param name the name of the layer. */ public VPFLayer(String name) { this(); setName(name); } /** * Sets the features (lines, areas, text, points) that get * displayed. * * @param features a whitespace-separated list of features to * display. */ public void setFeatures(String features) { warehouse.setFeatures(features); } /** * Another way to set the parameters of the DcwLayer. * * @see #pathProperty * @see #coverageTypeProperty * @see #featureTypesProperty */ public void setProperties(String prefix, Properties props) { super.setProperties(prefix, props); setAddToBeanContext(true); String realPrefix = PropUtils.getScopedPropertyPrefix(prefix); cutoffScale = PropUtils.intFromProperties(props, realPrefix + cutoffScaleProperty, cutoffScale); libraryBeanName = props.getProperty(realPrefix + libraryProperty, libraryBeanName); libraryName = props.getProperty(realPrefix + LibraryNameProperty, libraryName); String path[] = PropUtils.initPathsFromProperties(props, realPrefix + pathProperty); if (path != null && path.length != 0) { setPath(path); } String defaultProperty = props.getProperty(realPrefix + defaultLayerProperty); if (defaultProperty != null) { prefix = defaultProperty; props = getDefaultProperties(); } //need to save these so we can call setProperties on the // warehouse, //which we probably can't construct yet this.prefix = prefix; this.props = props; String coverage = props.getProperty(realPrefix + coverageTypeProperty); if (coverage != null) { setDataTypes(coverage); } searchByFeatures = PropUtils.booleanFromProperties(props, realPrefix + searchByFeatureProperty, searchByFeatures); checkWarehouse(searchByFeatures);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -