viper.descriptors.attributes
Class Attribute_bbox

java.lang.Object
  extended byviper.descriptors.attributes.AbstractAttribute
      extended byviper.descriptors.attributes.Attribute
          extended byviper.descriptors.attributes.Attribute_polygon
              extended byviper.descriptors.attributes.Attribute_bbox
All Implemented Interfaces:
java.lang.Cloneable, Filterable

public class Attribute_bbox
extends Attribute_polygon

This attribute represents a rectangle or Bounding Box. It has dice, overlap, and equality metrics.


Nested Class Summary
protected static class Attribute_bbox.Bbox
           
protected static class Attribute_bbox.Crops
          Crops all rectangles to be within the given rectangle Returns false when the rectangle is without the window.
protected static class Attribute_bbox.ProportionalResizer
          Modifies the boxes widths and heights about the center.
protected static class Attribute_bbox.Resizer
          Adds to the boxes size by some fixed number of pixels.
 
Nested classes inherited from class viper.descriptors.attributes.Attribute_polygon
Attribute_polygon.Sizer
 
Nested classes inherited from class viper.filters.Filterable
Filterable.Rule
 
Field Summary
 
Fields inherited from class viper.descriptors.attributes.Attribute
composition, compositionTolerance, compositionType, errors, value
 
Constructor Summary
Attribute_bbox()
          Create an empty Attribute. toString will return an empty String until more is known.
Attribute_bbox(Attribute old)
          Constructs a new copy of the old bbox value.
Attribute_bbox(boolean mobile)
          Attributes for OBJECT type should use this constructor, with mobile set to true.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this Attribute.
 Filterable.Rule convertRule(java.lang.String unparsedRule, java.util.List unparsedValues, ErrorWriter err)
          This converts a string into a rule, writing out errors in the format to err.
 java.lang.String getType()
          Returns the Attribute type, eg lvalue or bbox.
 boolean isCompositionType(java.lang.String s)
          This allows attributes to define their own composition types in addition to the default ones.
 boolean isValidRule(java.lang.String ruleName)
          Tell if a name is a valid rule or not
 boolean possibleValueOf(java.lang.String S)
          Determines if this Attribute can take the value specified.
 
Methods inherited from class viper.descriptors.attributes.Attribute_polygon
getArea, getAreaOfIntersectionWith, setArchetype, setArchetype
 
Methods inherited from class viper.descriptors.attributes.Attribute
compareTo, compose, crop, getCompositionType, getExtraConfig, getStaticValue, getValue, getValues, getValueToString, getXMLFormat, getXMLFormat, isType, nullXML, nullXML, parseExtraConfig, passes, possibleValueOf, setCompositionType, setDefaultValue, setDefaultValue, setExtraConfig, setFrameSpan, setName, setOutputWidth, setStaticValue, setValue, setValue, setValue, setValue, setValue, toString
 
Methods inherited from class viper.descriptors.attributes.AbstractAttribute
getArchetype, getDefault, getExtraConfigInXML, getExtraConfigString, getName, isDynamic, loadAttributeType, named, named, parseAnInt, resetDefault, setArchetype, setDynamic
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute_bbox

public Attribute_bbox()
Create an empty Attribute. toString will return an empty String until more is known.


Attribute_bbox

public Attribute_bbox(boolean mobile)
Attributes for OBJECT type should use this constructor, with mobile set to true. Other Descriptor types can use this with mobile set to false.

Parameters:
mobile - Descriptor that holds this Attribute is of type OBJECT

Attribute_bbox

public Attribute_bbox(Attribute old)
Constructs a new copy of the old bbox value.

Parameters:
old - the old value.
Method Detail

isCompositionType

public boolean isCompositionType(java.lang.String s)
Description copied from class: Attribute
This allows attributes to define their own composition types in addition to the default ones. The compose (Object, Object) methods of the subclasses should call this one first to see if the superclass can handle the composition.

Overrides:
isCompositionType in class Attribute
Parameters:
s - the name of composition type to test
Returns:
if the type is union, perimeter, or one of the parent types

getType

public java.lang.String getType()
Description copied from class: AbstractAttribute
Returns the Attribute type, eg lvalue or bbox.

Overrides:
getType in class Attribute_polygon
Returns:
"bbox"

clone

public java.lang.Object clone()
Description copied from class: Attribute
Returns a clone of this Attribute.

Overrides:
clone in class Attribute_polygon

possibleValueOf

public boolean possibleValueOf(java.lang.String S)
Determines if this Attribute can take the value specified. Relations are not yet supported.

Overrides:
possibleValueOf in class Attribute
Parameters:
S - the string to be tested
Returns:
whether or not the string is valid

isValidRule

public boolean isValidRule(java.lang.String ruleName)
Description copied from interface: Filterable
Tell if a name is a valid rule or not

Specified by:
isValidRule in interface Filterable
Overrides:
isValidRule in class Attribute_polygon
Returns:
if this rule is valid for the parent type, or if is resize, propresize, or cropTo

convertRule

public Filterable.Rule convertRule(java.lang.String unparsedRule,
                                   java.util.List unparsedValues,
                                   ErrorWriter err)
                            throws BadDataException
Description copied from class: Attribute_polygon
This converts a string into a rule, writing out errors in the format to err.

Specified by:
convertRule in interface Filterable
Overrides:
convertRule in class Attribute_polygon
Parameters:
unparsedRule - A string containing a single rule.
unparsedValues - A string containing values.
err - A place to log the errors.
Returns:
A List containing a rule (String) and value (Object) pair.
Throws:
BadDataException