## com.bbn.openmap.dataAccess.shape
Class DbfHandler

    java.lang.Object
      com.bbn.openmap.MapHandlerChild
          com.bbn.openmap.OMComponent
              com.bbn.openmap.dataAccess.shape.DbfHandler

All Implemented Interfaces:
  java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, LightMapHandlerChild, PropertyConsumer

public class DbfHandler
extends OMComponent

The DbfHandler manages OMGraphics based on DBF file settings. It uses Rules to evaluate DBF record information for each OMGraphic that is given to it, and can set rendering settings, labels, visibility and information text based on those rules. If rules aren't defined, then the dbf file won't be read for each entry and any evaluation attempt will just return the OMGraphic as it was provided.

Properties as an example used within the ShapeLayer:

     neroads.class=com.bbn.openmap.layer.shape.ShapeLayer
     neroads.prettyName=Roads
     neroads.shapeFile=roads.shp
     neroads.mouseModes=Gestures
     # Rule marker names specified in space-separated list
     neroads.rules=rule0 rule1
     # global scale settings can be used so work is only performed within scale range of minScale/maxScale
     neroads.maxScale=1000000f

     # rule0 definition:
     # CLASS_RTE is a DBF column name
     neroads.rule0.key=CLASS_RTE
     # operation, if key value is less than 2
     neroads.rule0.op=lt
     neroads.rule0.val=2
     # If rule is met, then actions can be performed:
     # Column names can be added together in a label by specifying them in a space-separated list
     neroads.rule0.label=PREFIX PRETYPE NAME TYPE SUFFIX
     # Labels can have scale limits imposed, so they don't appear if map scale is
     # greater than maxScale or less than minScale
     neroads.rule0.label.maxScale=1000000
     # Visibility can be controlled with respect to scale as well
     neroads.rule0.render=true
     neroads.rule0.render.maxScale=1000000
     # Rendering attributes can be specified.
     neroads.rule0.lineColor=FFFA73
     neroads.rule0.lineWidth=4
     neroads.rule0.mattingColor=55AAAAAA

     # rule1 definition:
     neroads.rule1.key=CLASS_RTE
     neroads.rule1.op=all
     neroads.rule1.label=PREFIX PRETYPE NAME TYPE SUFFIX
     neroads.rule1.label.maxScale=200000
     neroads.rule1.render=true
     neroads.rule1.render.maxScale=500000
     neroads.rule1.lineColor=FFFFFF
     neroads.rule1.lineWidth=3
     neroads.rule1.mattingColor=55AAAAAA

Author:
  dietrick

Nested Class Summary
`static class` `DbfHandler.Op` The Op class (operation) is used by the Rules to evaluate a rule key value against a OMGraphics key value.
`class` `DbfHandler.Rule`

Field Summary
`protected DbfFile` `dbf`
`protected DrawingAttributes` `defaultDA`
`protected java.lang.String` `lastLabel` Used to help prevent consecutive repeat label values.
`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` `RuleKeyColumnProperty`
`static java.lang.String` `RuleListProperty`
`static java.lang.String` `RuleOperatorProperty`
`protected java.util.List` `rules`
`static java.lang.String` `RuleValueProperty`

Fields inherited from class com.bbn.openmap.OMComponent
`i18n, propertyPrefix`

Fields inherited from class com.bbn.openmap.MapHandlerChild
`beanContextChildSupport`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`protected` `DbfHandler()`
`` `DbfHandler(BinaryFile bf)`
`` `DbfHandler(java.lang.String dbfFilePath)`

Method Summary
`void` `addRule(DbfHandler.Rule rule)`
`void` `clearRules()`
`OMGraphic` `evaluate(int index, OMGraphic omg, OMGraphicList labelList, Projection proj)` This is the main call that a layer would use to modify/update an OMGraphic based on dbf file contents.
`OMGraphic` `evaluate(OMGraphic omg, OMGraphicList labelList, Projection proj)` This is the main call that a layer would use to modify/update an OMGraphic based on dbf file contents.
`java.lang.String` `getContentFromIndicies(int[] indicies, java.util.List record)` Returns a String of concatenated record values.
`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.Iterator` `getRuleIterator()` Return an iterator for all of the Rules that the DbfHandler knows about.
`boolean` `removeRule(DbfHandler.Rule rule)`
`void` `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the OMComponent.

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, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dbf

    protected DbfFile dbf

### rules

    protected java.util.List rules

### defaultDA

    protected DrawingAttributes defaultDA

### RuleListProperty

    public static final java.lang.String RuleListProperty

See Also:
  Constant Field Values

### RuleKeyColumnProperty

    public static final java.lang.String RuleKeyColumnProperty

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

### lastLabel

    protected java.lang.String lastLabel

  Used to help prevent consecutive repeat label values.

Constructor Detail

### DbfHandler

    protected DbfHandler()

### DbfHandler

    public DbfHandler(java.lang.String dbfFilePath)
               throws java.io.IOException,
                      FormatException

### DbfHandler

    public DbfHandler(BinaryFile bf)
               throws java.io.IOException,
                      FormatException

Method Detail

### 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 propery 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.

### addRule

    public void addRule(DbfHandler.Rule rule)

### removeRule

    public boolean removeRule(DbfHandler.Rule rule)

### clearRules

    public void clearRules()

### getRuleIterator

    public java.util.Iterator getRuleIterator()

  Return an iterator for all of the Rules that the DbfHandler knows about.

  Returns:

### evaluate

    public OMGraphic evaluate(OMGraphic omg,
                              OMGraphicList labelList,
                              Projection proj)

  This is the main call that a layer would use to modify/update an OMGraphic based on dbf file contents. Trys to retrieve the index from the attributes of the OMGraphic, and then checks the index and OMGraphic to see how/if it should be rendered, as determined by the rules.

  Parameters:
    `omg` - the OMGraphic in question
    `labelList` - an OMGraphicList to add the label to, so it gets rendered on top.
    `proj` - the current map projection, for scale appropriateness determinations.
  Returns:
    OMGraphic if it should be displayed, null if it shouldn't.

### evaluate

    public OMGraphic evaluate(int index,
                              OMGraphic omg,
                              OMGraphicList labelList,
                              Projection proj)

  This is the main call that a layer would use to modify/update an OMGraphic based on dbf file contents. Checks the index and OMGraphic to see how/if it should be rendered, as determined by the rules.

  Parameters:
    `index` - the index of the OMGraphic in the shape/dbf file.
    `omg` - the OMGraphic in question
    `labelList` - an OMGraphicList to add the label to, so it gets rendered on top.
    `proj` - the current map projection, for scale appropriateness determinations.
  Returns:
    OMGraphic if it should be displayed, null if it shouldn't.

### getContentFromIndicies

    public java.lang.String getContentFromIndicies(int[] indicies,
                                                   java.util.List record)

  Returns a String of concatenated record values.

  Parameters:
    `indicies` - column indexes of values to be contatenated in return value
    `record` - List to use for return value
  Returns:
    String

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