com.bbn.openmap.omGraphics.rule
Class Rule<T>

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.omGraphics.rule.Rule<T>
All Implemented Interfaces:
LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener
Direct Known Subclasses:
IndexRule, MapRule

public abstract class Rule<T>
extends OMComponent

A Rule is an attribute inspector that makes decisions about rendering attributes, information line contents, tooltips and visibility based on scale.

Author:
dietrick

Field Summary
protected  float displayMaxScale
           
protected  float displayMinScale
           
protected  DrawingAttributes drawingAttributes
           
protected  java.util.List<java.lang.String> infolineFields
           
protected  java.lang.String keyField
          The property name where the testing value can be found for the rule to compare against the value.
protected  java.util.List<java.lang.String> labelFields
           
protected  float labelMaxScale
           
protected  float labelMinScale
           
protected  RuleOp op
           
static java.lang.String RuleActionInfoline
           
static java.lang.String RuleActionLabel
           
static java.lang.String RuleActionMaxScale
           
static java.lang.String RuleActionMinScale
           
static java.lang.String RuleActionRender
           
static java.lang.String RuleActionTooltip
           
static java.lang.String RuleKeyProperty
           
static java.lang.String RuleListProperty
           layer.rules=rule1 rule2 rule3 layer.rule1.key=CAPITAL layer.rule1.op=equals layer.rule1.val=Y layer.rule1.actions=render tooltip infoline layer.rule1.lineColor=FFFF0000 layer.rule1.minScale=10000 layer.rule1.maxScale=50000 layer.rule1.infoline=CITY_NAME layer.rule1.tooltip=ELEVATION
static java.lang.String RuleOperatorProperty
           
static java.lang.String RuleValueProperty
           
protected  java.util.List<java.lang.String> tooltipFields
           
protected  java.lang.Object val
          The value that the query runs the operation against.
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
Rule()
           
 
Method Summary
abstract  boolean evaluate(T record)
          Asks the Op class to evaluate the retrieved value against the Rules value.
 OMGraphic evaluate(T record, OMGraphic omg, Projection proj)
          Evaluate the record against this rule.
abstract  java.lang.String getContent(java.util.List<java.lang.String> fieldNames, T record)
          Returns a String of concatenated record values.
 float getDisplayMaxScale()
           
 float getDisplayMinScale()
           
 DrawingAttributes getDrawingAttribtues()
           
 java.lang.String getFieldsAsString(java.util.List<java.lang.String> fieldNames)
          Returns a String of concatenated record values.
 java.util.List<java.lang.String> getInfolineFields()
           
 java.lang.String getKeyName()
           
 java.util.List<java.lang.String> getLabelFields()
           
 float getLabelMaxScale()
           
 float getLabelMinScale()
           
 RuleOp getOp()
           
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.List<java.lang.String> getStringFromFields(java.lang.String fieldString)
          Create a List of Strings from a list of space separated strings.
 java.util.List<java.lang.String> getTooltipFields()
           
 java.lang.Object getVal()
           
 void setDisplayMaxScale(float displayMaxScale)
           
 void setDisplayMinScale(float displayMinScale)
           
 void setDrawingAttributes(DrawingAttributes da)
           
 void setInfolineFields(java.util.List<java.lang.String> infolineFields)
           
 void setKeyName(java.lang.String keyName)
           
 void setLabelFields(java.util.List<java.lang.String> labelFields)
           
 void setLabelMaxScale(float labelMaxScale)
           
 void setLabelMinScale(float labelMinScale)
           
 void setOp(RuleOp op)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setTooltipFields(java.util.List<java.lang.String> tooltipFields)
           
 void setVal(java.lang.Object val)
           
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyInfo, getPropertyPrefix, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyField

protected java.lang.String keyField
The property name where the testing value can be found for the rule to compare against the value.


tooltipFields

protected java.util.List<java.lang.String> tooltipFields

infolineFields

protected java.util.List<java.lang.String> infolineFields

labelFields

protected java.util.List<java.lang.String> labelFields

val

protected java.lang.Object val
The value that the query runs the operation against.


op

protected RuleOp op

drawingAttributes

protected DrawingAttributes drawingAttributes

displayMinScale

protected float displayMinScale

displayMaxScale

protected float displayMaxScale

labelMinScale

protected float labelMinScale

labelMaxScale

protected float labelMaxScale

RuleListProperty

public static final java.lang.String RuleListProperty
 layer.rules=rule1 rule2 rule3 
 layer.rule1.key=CAPITAL
 layer.rule1.op=equals
 layer.rule1.val=Y
 layer.rule1.actions=render tooltip infoline 
 layer.rule1.lineColor=FFFF0000
 layer.rule1.minScale=10000
 layer.rule1.maxScale=50000
 layer.rule1.infoline=CITY_NAME
 layer.rule1.tooltip=ELEVATION
 

See Also:
Constant Field Values

RuleKeyProperty

public static final java.lang.String RuleKeyProperty
See Also:
Constant Field Values

RuleOperatorProperty

public static final java.lang.String RuleOperatorProperty
See Also:
Constant Field Values

RuleValueProperty

public static final java.lang.String RuleValueProperty
See Also:
Constant Field Values

RuleActionRender

public static final java.lang.String RuleActionRender
See Also:
Constant Field Values

RuleActionTooltip

public static final java.lang.String RuleActionTooltip
See Also:
Constant Field Values

RuleActionInfoline

public static final java.lang.String RuleActionInfoline
See Also:
Constant Field Values

RuleActionLabel

public static final java.lang.String RuleActionLabel
See Also:
Constant Field Values

RuleActionMinScale

public static final java.lang.String RuleActionMinScale
See Also:
Constant Field Values

RuleActionMaxScale

public static final java.lang.String RuleActionMaxScale
See Also:
Constant Field Values
Constructor Detail

Rule

public Rule()
Method Detail

evaluate

public abstract boolean evaluate(T record)
Asks the Op class to evaluate the retrieved value against the Rules value. The implementation will use the key to pull the testing value out of the record.

Parameters:
record - object to evaluate
Returns:
true of the operation passed

getContent

public abstract java.lang.String getContent(java.util.List<java.lang.String> fieldNames,
                                            T record)
Returns a String of concatenated record values.

Parameters:
fieldNames - a list of string keys for fields to be used.
record - The record object to look up values for the list of keys.
Returns:
String of content

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMComponent
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

evaluate

public OMGraphic evaluate(T record,
                          OMGraphic omg,
                          Projection proj)
Evaluate the record against this rule.

Parameters:
record - A Map of attributes for a particular OMGraphic/map object. The indices for the rule are indexes into this record.
omg - The OMGraphic to evaluate.
proj - The current map projection.
Returns:
the OMGraphic if it should be drawn, null if it shouldn't.

getFieldsAsString

public java.lang.String getFieldsAsString(java.util.List<java.lang.String> fieldNames)
Returns a String of concatenated record values.

Parameters:
fieldNames - names of field properties
Returns:
fields as single string

getStringFromFields

public java.util.List<java.lang.String> getStringFromFields(java.lang.String fieldString)
Create a List of Strings from a list of space separated strings.

Parameters:
fieldString -
Returns:
List if fieldString can be parsed, null if fieldString is null.

getDrawingAttribtues

public DrawingAttributes getDrawingAttribtues()

setDrawingAttributes

public void setDrawingAttributes(DrawingAttributes da)

getDisplayMaxScale

public float getDisplayMaxScale()

setDisplayMaxScale

public void setDisplayMaxScale(float displayMaxScale)

getDisplayMinScale

public float getDisplayMinScale()

setDisplayMinScale

public void setDisplayMinScale(float displayMinScale)

getKeyName

public java.lang.String getKeyName()

setKeyName

public void setKeyName(java.lang.String keyName)

getLabelFields

public java.util.List<java.lang.String> getLabelFields()

setLabelFields

public void setLabelFields(java.util.List<java.lang.String> labelFields)

getInfolineFields

public java.util.List<java.lang.String> getInfolineFields()

setInfolineFields

public void setInfolineFields(java.util.List<java.lang.String> infolineFields)

getTooltipFields

public java.util.List<java.lang.String> getTooltipFields()

setTooltipFields

public void setTooltipFields(java.util.List<java.lang.String> tooltipFields)

getLabelMaxScale

public float getLabelMaxScale()

setLabelMaxScale

public void setLabelMaxScale(float labelMaxScale)

getLabelMinScale

public float getLabelMinScale()

setLabelMinScale

public void setLabelMinScale(float labelMinScale)

getOp

public RuleOp getOp()

setOp

public void setOp(RuleOp op)

getVal

public java.lang.Object getVal()

setVal

public void setVal(java.lang.Object val)


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