com.bbn.openmap.layer.link
Class LinkProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by com.bbn.openmap.layer.link.LinkProperties
All Implemented Interfaces:
LinkGraphicConstants, LinkPropertiesConstants, java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class LinkProperties
extends java.util.Properties
implements LinkPropertiesConstants, LinkGraphicConstants

A LinkProperties object is a set of key-value strings that are going to be sent over the link. In java-land, they are handled with the Properties object. In link-land, they are handled like an array of strings. Requests have a properties section, and graphic objects have them as well.

See Also:
Serialized Form

Field Summary
static LinkProperties EMPTY_PROPERTIES
          Used by the graphics if no properties were sent with it.
protected  java.util.Hashtable renderAttributesCache
           
protected  java.lang.Boolean reuseProperties
           
 
Fields inherited from class java.util.Properties
defaults
 
Fields inherited from interface com.bbn.openmap.layer.link.LinkPropertiesConstants
LPC_BACKWARD_DIAG_PATTERN, LPC_CENTER_LAT, LPC_CENTER_LONG, LPC_CLEAR_PROPERTIES, LPC_CLEAR_PROPERTIES_CHAR, LPC_CROSS_PATTERN, LPC_DASH, LPC_DASH_DOT, LPC_DASH_DOT_DOT, LPC_DIAG_CROSS_PATTERN, LPC_DOT, LPC_FILLCOLOR, LPC_FILLPATTERN, LPC_FORWARD_DIAG_PATTERN, LPC_GRAPHICID, LPC_HEIGHT, LPC_HIGHLIGHTCOLOR, LPC_HORIZONTAL_PATTERN, LPC_HTML, LPC_INFO, LPC_LATMAX, LPC_LATMIN, LPC_LINECOLOR, LPC_LINESTYLE, LPC_LINEWIDTH, LPC_LINKRASTERIMAGEURL, LPC_LINKROTATION, LPC_LINKTEXTBASELINE, LPC_LINKTEXTFONT, LPC_LINKTEXTSTRING, LPC_LONG_DASH, LPC_LONMAX, LPC_LONMIN, LPC_MESSAGE, LPC_OLD_FILLCOLOR, LPC_OLD_FILLPATTERN, LPC_OLD_HIGHLIGHTCOLOR, LPC_OLD_LINECOLOR, LPC_OLD_LINESTYLE, LPC_OLD_LINEWIDTH, LPC_OLD_LINKTEXTFONT, LPC_OLD_LINKTEXTSTRING, LPC_PROJECTION, LPC_PROPERY_MANAGEMENT_POLICY, LPC_PROPERY_MANAGEMENT_POLICY_CHAR, LPC_REUSE_PROPERTIES, LPC_REUSE_PROPERTIES_CHAR, LPC_SCALE, LPC_SOLID, LPC_SOLID_PATTERN, LPC_TIME, LPC_URL, LPC_VERTICAL_PATTERN, LPC_WIDTH
 
Fields inherited from interface com.bbn.openmap.layer.link.LinkGraphicConstants
BASELINE_BOTTOM, BASELINE_MIDDLE, BASELINE_TOP, BLACK_COLOR_STRING, CLEAR_COLOR_STRING, COLORMODEL_DIRECT, COLORMODEL_INDEXED, COLORMODEL_URL, COLUMN_MAJOR, COORDMODE_ORIGIN, COORDMODE_PREVIOUS, DECIMAL_DEGREES, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, KM, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, MILES, NMILES, RADIANS, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, ROW_MAJOR
 
Constructor Summary
LinkProperties()
           
LinkProperties(java.io.DataInput dis)
          Create a LinkProperties, and read it's contents off a link.
LinkProperties(Link link)
          Create a LinkProperties, and read it's contents off a link.
LinkProperties(LinkProperties settings)
           
LinkProperties(java.lang.String keyString, java.lang.String valueString)
          Create a LinkProperties object with it's first pair.
 
Method Summary
 java.awt.Paint getFillPaint()
           
 java.awt.Paint getPaint(java.lang.String paintProperty, java.lang.String defaultPaintString)
           
 java.lang.Boolean getReuseProperties()
           
 java.awt.Stroke getStroke()
           
static LinkProperties loadPropertiesIntoOMGraphic(java.io.DataInput dis, OMGraphic omg, LinkProperties propertiesBuffer)
          New, static method for more efficient property handling and loading the properties into the OMGraphic.
 void read(java.io.DataInput dis)
          Read the link to create the properties object.
static LinkProperties read(java.io.DataInput dis, LinkProperties props)
          New, static method for more efficient property handling.
 void readArgs(int numArgs, java.io.DataInput dis)
          Read the link to fetch properties for this LinkProperties object.
 void setProperties(OMGraphic omg)
          Method to call on the LinkProperties object to set the DrawingAttributes properties on an OMGraphic.
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Calls the hashtable method put.
 void setReuseProperties(java.lang.Boolean reuseProperties)
          A flag that controls how LinkProperties are managed.
 void write(java.io.DataOutputStream dos)
          Write the properties as several strings.
 void write(Link link)
          Write the properties as several strings.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_PROPERTIES

public static final LinkProperties EMPTY_PROPERTIES
Used by the graphics if no properties were sent with it. No properties can be set on this LinkProperties object.


reuseProperties

protected java.lang.Boolean reuseProperties

renderAttributesCache

protected java.util.Hashtable renderAttributesCache
Constructor Detail

LinkProperties

public LinkProperties()

LinkProperties

public LinkProperties(LinkProperties settings)

LinkProperties

public LinkProperties(java.lang.String keyString,
                      java.lang.String valueString)
Create a LinkProperties object with it's first pair.

Parameters:
keyString - the key for the pair.
valueString - the value for the pair.

LinkProperties

public LinkProperties(Link link)
               throws java.io.IOException
Create a LinkProperties, and read it's contents off a link. Assumes the properties are the next thing to be read, starting with the string count.

Parameters:
link - the Link to read properties from
Throws:
java.io.IOException

LinkProperties

public LinkProperties(java.io.DataInput dis)
               throws java.io.IOException
Create a LinkProperties, and read it's contents off a link.

Parameters:
dis - DataInput to read from.
Throws:
java.io.IOException
Method Detail

getReuseProperties

public java.lang.Boolean getReuseProperties()

setReuseProperties

public void setReuseProperties(java.lang.Boolean reuseProperties)
A flag that controls how LinkProperties are managed. Setting this object to Boolean.TRUE will indicate that the LinkProperties object decoded previously should be reused, with any properties currently set in this object overwriting the same property previously received. Setting it to Boolean.FALSE, or setting it to null, will indicate than any buffered LinkProperty object should be cleared before these properties are read.

Parameters:
reuseProperties -

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Calls the hashtable method put. Provided to provide a similar interface in jdk1.1.x or jdk1.2.x, enforcing that only strings can be in properties files.

Overrides:
setProperty in class java.util.Properties

write

public void write(Link link)
           throws java.io.IOException
Write the properties as several strings. There is a string count (Key count + value count), and then for each key and value string, a character count, and the characters.

Parameters:
link - the link to write to.
Throws:
java.io.IOException

write

public void write(java.io.DataOutputStream dos)
           throws java.io.IOException
Write the properties as several strings. There is a string count (Key count + value count), and then for each key and value string, a character count, and the characters.

Parameters:
dos - the DataOutputStream to write to.
Throws:
java.io.IOException

read

public void read(java.io.DataInput dis)
          throws java.io.IOException
Read the link to create the properties object. Assumes the properties are the next thing to be read, starting with the string count.

Parameters:
dis - DataInput to read from.
Throws:
java.io.IOException

readArgs

public void readArgs(int numArgs,
                     java.io.DataInput dis)
              throws java.io.IOException
Read the link to fetch properties for this LinkProperties object. Assumes the property count has been read and is being provided to this method

Parameters:
numArgs - the number of key + value strings to read.
dis - DataInput to read from.
Throws:
java.io.IOException

read

public static LinkProperties read(java.io.DataInput dis,
                                  LinkProperties props)
                           throws java.io.IOException
New, static method for more efficient property handling.

Parameters:
dis -
props -
Returns:
if there are no properties, the EMPTY_PROPERTIES object is returned. If there are properties and props == null, then a new LinkProperties object is allocated and returned, otherwise, props is returned.
Throws:
java.io.IOException

loadPropertiesIntoOMGraphic

public static LinkProperties loadPropertiesIntoOMGraphic(java.io.DataInput dis,
                                                         OMGraphic omg,
                                                         LinkProperties propertiesBuffer)
                                                  throws java.io.IOException
New, static method for more efficient property handling and loading the properties into the OMGraphic.

Parameters:
dis -
omg -
Returns:
if there are no properties, the EMPTY_PROPERTIES object is returned. If there are properties and props == null, then a new LinkProperties object is allocated and returned, otherwise, props is returned. The OMGraphic appObject is set with the read properties.
Throws:
java.io.IOException

setProperties

public void setProperties(OMGraphic omg)
Method to call on the LinkProperties object to set the DrawingAttributes properties on an OMGraphic. Will set the line and select colors, fill paints (including patterns) and stroke based on the properties contained in this LinkProperties object. Will set default values in the OMGraphic if the applicable properties aren't defined, and will set the LinkProperties in the AppObject of the OMGraphic.


getStroke

public java.awt.Stroke getStroke()

getPaint

public java.awt.Paint getPaint(java.lang.String paintProperty,
                               java.lang.String defaultPaintString)

getFillPaint

public java.awt.Paint getFillPaint()


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details