public Properties getProperties(Properties props) { props = super.getProperties(props); String prefix = PropUtils.getScopedPropertyPrefix(this); props.put(prefix + NAME_ATTRIBUTE, PropUtils.unnull(name)); props.put(prefix + DESCRIPTION_ATTRIBUTE, PropUtils.unnull(description)); return props; }
public void setProperties(String prefix, Properties props) { super.setProperties(prefix, props); // Important for ToolPanel that controls what it is listening // for, instead of grabbing any Tool. The prefix will be used // as a discriminator. if (prefix != null) { setKey(prefix); } prefix = PropUtils.getScopedPropertyPrefix(prefix); setUseAsTool( PropUtils.booleanFromProperties(props, prefix + UseAsToolProperty, getUseAsTool())); }
public Properties getProperties(Properties props) { props = super.getProperties(props); String prefix = PropUtils.getScopedPropertyPrefix(this); props.put(prefix + WMSServerProperty, PropUtils.unnull(wmsServer)); props.put(prefix + ImageFormatProperty, PropUtils.unnull(imageFormat)); props.put(prefix + TransparentProperty, PropUtils.unnull(transparent)); props.put(prefix + BackgroundColorProperty, PropUtils.unnull(backgroundColor)); props.put(prefix + WMSVersionProperty, PropUtils.unnull(wmsVersion)); props.put(prefix + LayersProperty, PropUtils.unnull(layers)); props.put(prefix + StylesProperty, PropUtils.unnull(styles)); props.put(prefix + VendorSpecificNamesProperty, PropUtils.unnull(vendorSpecificNames)); props.put(prefix + VendorSpecificValuesProperty, PropUtils.unnull(vendorSpecificValues)); return props; }
/** * Method to set the properties in the PropertyConsumer. The prefix is a string that should be * prepended to each property key (in addition to a separating '.') in order for the * PropertyConsumer to uniquely identify properties meant for it, in the midst of Properties meant * for several objects. * * @param prefix a String used by the PropertyConsumer to prepend to each property value it wants * to look up - setList.getProperty(prefix.propertyKey). If the prefix had already been set, * then the prefix passed in should replace that previous value. * @param setList a Properties object that the PropertyConsumer can use to retrieve expected * properties it can use for configuration. */ public void setProperties(String prefix, Properties setList) { super.setProperties(prefix, setList); prefix = PropUtils.getScopedPropertyPrefix(prefix); wmsServer = setList.getProperty(prefix + WMSServerProperty); if (wmsServer == null) { Debug.error("WMSPlugIn needs a WMS server."); } queryHeader = wmsServer; setImageFormat(setList.getProperty(prefix + ImageFormatProperty, getImageFormat())); setTransparent(setList.getProperty(prefix + TransparentProperty, getTransparent())); setBackgroundColor(setList.getProperty(prefix + BackgroundColorProperty, getBackgroundColor())); setWmsVersion(setList.getProperty(prefix + WMSVersionProperty, getWmsVersion())); layers = setList.getProperty(prefix + LayersProperty); styles = setList.getProperty(prefix + StylesProperty); /** Include for vendor specific parameters */ setVendorSpecificNames( setList.getProperty(prefix + VendorSpecificNamesProperty, getVendorSpecificNames())); setVendorSpecificValues( setList.getProperty(prefix + VendorSpecificValuesProperty, getVendorSpecificValues())); } // end setProperties
/** * 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) { } } }
/** * The method needs more information from the properties than the CodePosition version of this * method provides, like getting the base symbol code for the scheme and the hierarchy addition. */ public CodePosition addPositionChoice(int index, String entry, String prefix, Properties props) { CodeScheme cs = (CodeScheme) super.addPositionChoice(index, entry, prefix, props); prefix = PropUtils.getScopedPropertyPrefix(prefix) + entry + "."; String next = props.getProperty(prefix + NextProperty); if (next != null) { String nextClassName = props.getProperty(next + ".class"); if (nextClassName != null) { CodePosition cp = (CodePosition) ComponentFactory.create(nextClassName); if (DEBUG) { Debug.output("CodeScheme created next class(" + next + "), " + nextClassName); } if (cp != null) { cs.nextPosition = cp; cp.parsePositions(next, props); } } else { if (DEBUG) { Debug.output("CodeScheme couldn't create next class(" + next + "), " + nextClassName); } } } cs.defaultSymbolCode = props.getProperty(prefix + DefaultSymbolCodeProperty); cs.hierarchyAddition = props.getProperty(prefix + HierarchyCodeAdditionProperty, ""); // Don't need to add to choices, already done in super class // method. return cs; }
public void setProperties(String prefix, Properties props) { super.setProperties(prefix, props); prefix = PropUtils.getScopedPropertyPrefix(prefix); name = props.getProperty(prefix + NAME_ATTRIBUTE, name); description = props.getProperty(prefix + DESCRIPTION_ATTRIBUTE, description); }
public Properties getProperties(Properties props) { props = super.getProperties(props); String prefix = PropUtils.getScopedPropertyPrefix(this); props.put(prefix + UseAsToolProperty, new Boolean(useAsTool).toString()); return props; }
protected Color getColor(String colorString) { Color result = Color.black; try { result = PropUtils.parseColor(colorString); } catch (NumberFormatException nfe) { result = GetColorFromString(colorString); } return result; }
/** * Read the DataInputStream, and create an OMPoint. Assumes that the LinkPoint header has been * read from the link. * * @param dis DataInputStream * @param propertiesBuffer a LinkProperties object used to cache previous settings that can be set * on the OMPoint being read. * @return OMPoint * @throws IOException * @see com.bbn.openmap.omGraphics.OMPoint */ public static OMPoint read(DataInputStream dis, LinkProperties propertiesBuffer) throws IOException { OMPoint point = null; int x1, y1, radius; float lt, ln; int renderType = dis.readByte(); switch (renderType) { case RENDERTYPE_LATLON: lt = dis.readFloat(); ln = dis.readFloat(); radius = dis.readInt(); point = new OMPoint(lt, ln, radius); break; case RENDERTYPE_XY: x1 = dis.readInt(); y1 = dis.readInt(); radius = dis.readInt(); point = new OMPoint(x1, y1, radius); break; case RENDERTYPE_OFFSET: lt = dis.readFloat(); ln = dis.readFloat(); x1 = dis.readInt(); y1 = dis.readInt(); radius = dis.readInt(); point = new OMPoint(lt, ln, x1, y1, radius); break; default: } if (point != null) { propertiesBuffer = LinkProperties.loadPropertiesIntoOMGraphic(dis, point, propertiesBuffer); if (propertiesBuffer != null) { point.setOval( PropUtils.booleanFromProperties( propertiesBuffer, LPC_POINT_OVAL, OMPoint.DEFAULT_ISOVAL)); } } return point; }
/** * Go through the properties, loading the shapefile, information file and attributes files, and * resolve how everything should be drawn. Might take awhile if the files are large. Called from * getRectangle, which is called when the AreaShapeLayer is added to the map. * * @param prefix property file entry header name * @param props the properties to look through. */ public void initialize(String prefix, Properties props) { if (props == null) { Debug.error( "AreaHandler: initialize received bad input:\n\tprefix: " + prefix + "\n\tproperties: " + (props == null ? "null" : "OK")); politicalAreas = null; return; } prefix = PropUtils.getScopedPropertyPrefix(prefix); politicalAreas = new Hashtable(); // OK, Get the graphics. We are not expecting that all the // graphics in the file are not too much to handle. Also, we // test for the serialized graphics file first, and if it // isn't designated, then look for a shapefile and spatial // index file to create an OMGraphicsList. String cacheFile = props.getProperty(prefix + CacheFileProperty); // First find the resource, if not, then try as a file-URL... try { cacheURL = PropUtils.getResourceOrFileOrURL(this, cacheFile); if (cacheURL != null) { omgraphics = readCachedGraphics(cacheURL); } else { // We'll use the spatial index set from the // ShapeLayer. // Now, get the attribute file String dbfFile = props.getProperty(prefix + dbfFileProperty); URL dbfFileURL = null; if (dbfFile != null) { dbfFileURL = PropUtils.getResourceOrFileOrURL(this, dbfFile); } if (dbfFileURL != null) { InputStream is = dbfFileURL.openStream(); dbfModel = new DbfTableModel(new DbfInputStream(is)); } if (dbfModel == null) { String csvFile = props.getProperty(prefix + csvFileProperty); URL infofileURL = null; if (csvFile != null) { infofileURL = PropUtils.getResourceOrFileOrURL(this, csvFile); } // Read them in. if (infofileURL != null) { infoFile = new CSVShapeInfoFile(csvFile); infoFile.setHeadersExist( PropUtils.booleanFromProperties(props, prefix + csvHeaderProperty, true)); infoFile.loadData(true); } } } } catch (java.net.MalformedURLException murle) { omgraphics = new OMGraphicList(); } catch (java.io.IOException ioe) { omgraphics = new OMGraphicList(); } catch (Exception exc) { omgraphics = new OMGraphicList(); } // This is handled properly yet. The PoliticalArea should be // updated to handle URLs for area points, and have different // icons for different areas. // String defaultPointImageURLString = // props.getProperty(prefix + pointImageURLProperty); // Now, match the attributes to the graphics. Find the // indexes of the name and the search key. Also figure out // which areas have special coloring needs. keyIndex = PropUtils.intFromProperties(props, prefix + keyIndexProperty, keyIndex); nameIndex = PropUtils.intFromProperties(props, prefix + nameIndexProperty, nameIndex); String areas = props.getProperty(prefix + areasProperty); if (areas == null) areas = ""; StringTokenizer tokenizer = new StringTokenizer(areas, " "); // All this uses the properties to set the individual colors // of any area String currentArea; while (tokenizer.hasMoreTokens()) { currentArea = tokenizer.nextToken(); PoliticalArea newParams = new PoliticalArea(currentArea); if (Debug.debugging("areas")) { Debug.output("AreaHandler: setting SPECIALIZED attributes for \"" + newParams.id + "\""); } areasItems.addElement(currentArea); newParams.drawingAttributes = new DrawingAttributes(prefix + areasProperty + "." + currentArea, props); politicalAreas.put(newParams.id.toUpperCase().intern(), newParams); } if (Debug.debugging("areas")) { Debug.output("AreaHandler: finished initialization"); } }
/** Set all the DTED properties from a properties object. */ public void setProperties(String prefix, java.util.Properties properties) { super.setProperties(prefix, properties); prefix = PropUtils.getScopedPropertyPrefix(this); paths = PropUtils.initPathsFromProperties(properties, prefix + DTEDPathsProperty, paths); setOpaqueness( PropUtils.intFromProperties(properties, prefix + OpaquenessProperty, getOpaqueness())); setNumColors( PropUtils.intFromProperties(properties, prefix + NumColorsProperty, getNumColors())); setDtedLevel( PropUtils.intFromProperties(properties, prefix + DTEDLevelProperty, getDtedLevel())); setViewType( PropUtils.intFromProperties(properties, prefix + DTEDViewTypeProperty, getViewType())); setSlopeAdjust( PropUtils.intFromProperties( properties, prefix + DTEDSlopeAdjustProperty, getSlopeAdjust())); setBandHeight( PropUtils.intFromProperties(properties, prefix + DTEDBandHeightProperty, getBandHeight())); // The Layer maxScale is talking the place of the DTEDLayer minScale // property. setMaxScale( PropUtils.floatFromProperties(properties, prefix + DTEDMinScaleProperty, getMaxScale())); setCacheSize( (int) PropUtils.intFromProperties( properties, prefix + DTEDFrameCacheSizeProperty, getCacheSize())); setKillCache( PropUtils.booleanFromProperties( properties, prefix + DTEDKillCacheProperty, getKillCache())); }