📄 vpflayer.java
字号:
if (warehouse != null) { warehouse.setProperties(prefix, props); warehouse.setUseLibrary(libraryName); box = null; resetPalette(); } try { //force lst and warehosue to re-init with current // properties // LST now set when paths are set. } catch (IllegalArgumentException iae) { Debug.error("VPFLayer.setProperties: Illegal Argument Exception.\n\nPerhaps a file not found. Check to make sure that the paths to the VPF data directories are the parents of \"lat\" or \"lat.\" files. \n\n" + iae); } } public Properties getProperties(Properties props) { props = super.getProperties(props); String realPrefix = PropUtils.getScopedPropertyPrefix(this); props.put(realPrefix + cutoffScaleProperty, Integer.toString(cutoffScale)); if (libraryBeanName != null) { props.put(realPrefix + libraryProperty, libraryBeanName); } else { StringBuffer paths = new StringBuffer(); String[] ps = getPath(); for (int i = 0; ps != null && i < ps.length; i++) { paths.append(ps[i]); if (i < ps.length - 1) paths.append(";"); } props.put(realPrefix + pathProperty, paths.toString()); } // For the library in a vpf package libraryName = props.getProperty(realPrefix + LibraryNameProperty, libraryName); props.put(realPrefix + coverageTypeProperty, getDataTypes()); props.put(realPrefix + searchByFeatureProperty, Boolean.toString(searchByFeatures)); if (warehouse != null) { warehouse.getProperties(props); } return props; } /** Where we store our default properties once we've loaded them. */ private static Properties defaultProps; /** * Return our default properties for vpf land. */ public static Properties getDefaultProperties() { if (defaultProps == null) { try { InputStream in = VPFLayer.class.getResourceAsStream("defaultVPFlayers.properties"); //use a temporary so other threads won't see an //empty properties file Properties tmp = new Properties(); if (in != null) { tmp.load(in); in.close(); } else { Debug.error("VPFLayer: can't load default properties file"); //just use an empty properties file } defaultProps = tmp; } catch (IOException io) { Debug.error("VPFLayer: can't load default properties: " + io); defaultProps = new Properties(); } } return defaultProps; } /** * Set the data path to a single place. */ public void setPath(String newPath) { if (Debug.debugging("vpf")) { Debug.output("VPFLayer setting paths to " + newPath); } setPath(new String[] { newPath }); } /** * Set the data path to multiple places. */ public void setPath(String[] newPaths) { dataPaths = newPaths; lst = null; initLST(); } /** * Returns the list of paths we use to look for data. * * @return the list of paths. Don't modify the array! */ public String[] getPath() { return dataPaths; } /** * Set the coveragetype of the layer. * * @param dataTypes the coveragetype to display. */ public void setDataTypes(String dataTypes) { coverageType = dataTypes; } /** * Get the current coverage type. * * @return the current coverage type. */ public String getDataTypes() { return coverageType; } /** * Enable/Disable the display of areas. */ public void setAreasEnabled(boolean value) { warehouse.setAreaFeatures(value); } /** * Find out if areas are enabled. */ public boolean getAreasEnabled() { return warehouse.drawAreaFeatures(); } /** * Enable/Disable the display of edges. */ public void setEdgesEnabled(boolean value) { warehouse.setEdgeFeatures(value); } /** * Find out if edges are enabled. */ public boolean getEdgesEnabled() { return warehouse.drawEdgeFeatures(); } /** * Enable/Disable the display of entity points. */ public void setEPointsEnabled(boolean value) { warehouse.setEPointFeatures(value); } /** * Find out if entity points are enabled. */ public boolean getEPointsEnabled() { return warehouse.drawEPointFeatures(); } /** * Enable/Disable the display of connected points. */ public void setCPointsEnabled(boolean value) { warehouse.setCPointFeatures(value); } /** * Find out if connected points are enabled. */ public boolean getCPointsEnabled() { return warehouse.drawCPointFeatures(); } /** * Enable/Disable the display of text. */ public void setTextEnabled(boolean value) { warehouse.setTextFeatures(value); } /** * Find out if text is enabled. */ public boolean getTextEnabled() { return warehouse.drawTextFeatures(); } /** * Get the DrawingAttributes used for the coverage type. */ public DrawingAttributes getDrawingAttributes() { return warehouse.getDrawingAttributes(); } /** * Set the drawing attributes for the coverage type. */ public void setDrawingAttributes(DrawingAttributes da) { warehouse.setDrawingAttributes(da); } /** * initialize the library selection table. */ protected void initLST() { if (Debug.debugging("vpf")) { Debug.output("VPFLayer.initLST()"); } try { if (lst == null) { if (libraryBeanName != null) { LibraryBean libraryBean = null; Collection beanContext = getBeanContext(); if (beanContext == null) { //no bean context yet return; } for (Iterator i = beanContext.iterator(); i.hasNext();) { Object obj = i.next(); if (obj instanceof LibraryBean) { LibraryBean lb = (LibraryBean) obj; if (libraryBeanName.equals(lb.getName())) { if (Debug.debugging("vpf")) { Debug.output("VPFLayer|" + getName() + ": setting library bean to " + lb.getName()); } libraryBean = lb; break; } } } if (libraryBean != null) { lst = libraryBean.getLibrarySelectionTable(); warehouse = libraryBean.getWarehouse(); // Set the warehouse with the properties // received when the layer was created. warehouse.setProperties(getPropertyPrefix(), props); searchByFeatures = true; // because it is. box = null;// force GUI to rebuild if (Debug.debugging("vpf")) { Debug.output("VPFLayer.initLST(libraryBean)"); } } else { if (Debug.debugging("vpf")) { // Encasing it in a debug statement, // because we could get here by adding the // LayerHandler to the MapHandler before // the LibraryBean. Debug.output("VPFLayer.init: Couldn't find libraryBean " + libraryBeanName + " to read VPF data"); } } } else { if (dataPaths == null) { Debug.output("VPFLayer|" + getName() + ": path not set"); } else { if (Debug.debugging("vpf")) { Debug.output("VPFLayer.initLST(dataPaths)"); } lst = new LibrarySelectionTable(dataPaths); lst.setCutoffScale(cutoffScale); } } } } catch (com.bbn.openmap.io.FormatException f) { throw new java.lang.IllegalArgumentException(f.getMessage()); // } catch (NullPointerException npe) { // throw new // java.lang.IllegalArgumentException("VPFLayer|" + // getName() + // ": path name not valid"); } } public void setWarehouse(LayerGraphicWarehouseSupport wh) { warehouse = wh; } public LayerGraphicWarehouseSupport getWarehouse() { return warehouse; } /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -