com.bbn.openmap.omGraphics
Class OMAreaList

java.lang.Object
  extended by com.bbn.openmap.omGraphics.geom.BasicGeometry
      extended by com.bbn.openmap.omGraphics.OMGraphicAdapter
          extended by com.bbn.openmap.omGraphics.OMList<OMGeometry>
              extended by com.bbn.openmap.omGraphics.OMGeometryList
                  extended by com.bbn.openmap.omGraphics.OMAreaList
All Implemented Interfaces:
OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<OMGeometry>, java.util.Collection<OMGeometry>, java.util.List<OMGeometry>

public class OMAreaList
extends OMGeometryList
implements java.io.Serializable

This class encapsulates a list of OMGeometries that are connected to form one area. Different types of vector OMGeometries can be combined and used to create a unique shape over the map. OMRasterObjects will contribute their shape/size, but not their images. The OMGeometries should be added in a clockwise format.

KNOWN ISSUES: OMAreaLists that wrap around the back of the earth and showing up on both edges of the map are not handled well - you'll end up with lines going horizontally across the map. It's on the to-do list to fix this.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList
OMList.OMDist<T>
 
Field Summary
 
Fields inherited from class com.bbn.openmap.omGraphics.OMGeometryList
connectParts
 
Fields inherited from class com.bbn.openmap.omGraphics.OMList
allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague
 
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask
 
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
attributes, lineType, needToRegenerate, shape, visible
 
Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
ADD_GRAPHIC_MASK, APP_OBJECT, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED
 
Constructor Summary
OMAreaList()
          Construct an OMAreaList.
OMAreaList(int initialCapacity)
          Construct an OMAreaList with a capacity to be combined from an initial amount of OMGeometries.
OMAreaList(java.util.List<OMGeometry> list)
          Construct an OMAreaList around a List of OMGeometries.
 
Method Summary
 OMList.OMDist<OMGeometry> findClosest(double x, double y, float limit, boolean resetSelect)
          Overrides the OMGeometryList and OMGraphicList methods to just call _distance() on the internal shape object.
 boolean generate(Projection p, boolean forceProjectAll)
          Create the GeneralPath used for the internal Shape objects held by the OMGeometries added.
protected  void init()
          Initialization that sets the OMAreaList, which is a modified OMGraphicList, to be vague and constructed in a first added, first used order.
protected  void updateShape(OMGeometry geometry, Projection p, boolean forceProject)
          Given a OMGeometry, it calls generate/regenerate on it, and then adds the GeneralPath shape within it to the OMGeometryList shape object.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGeometryList
add, add, addAll, addAll, addOMGraphic, clear, create, createDist, get, getConnectParts, iteratorCopy, listIteratorCopy, listIteratorCopy, readGraphics, remove, remove, removeAll, render, renderAllAsSelected, renderGeometry, retainAll, set, setConnectParts, updateShape
 
Methods inherited from class com.bbn.openmap.omGraphics.OMList
checkForDuplicate, contains, contains, containsAll, deselect, distance, doAction, findAll, findAll, findAllTest, findClosest, findClosest, findClosestTest, findIndexOfClosest, findIndexOfClosest, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, objectToOMGraphic, project, project, remove, restore, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, sort, subList, toArray, toArray
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
clone, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, renderLabel, renderShape, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill, writeStroke, writeTextureMask
 
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic
clone, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
clearAttributes, contains, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape
 

Constructor Detail

OMAreaList

public OMAreaList()
Construct an OMAreaList.


OMAreaList

public OMAreaList(int initialCapacity)
Construct an OMAreaList with a capacity to be combined from an initial amount of OMGeometries.

Parameters:
initialCapacity - the initial capacity of the list

OMAreaList

public OMAreaList(java.util.List<OMGeometry> list)
Construct an OMAreaList around a List of OMGeometries. The OMAreaList assumes that all the objects on the list are vector OMGeometries, and never does checking. Live with the consequences if you put other stuff in there.

Parameters:
list - List of vector OMGeometries.
Method Detail

init

protected void init()
Initialization that sets the OMAreaList, which is a modified OMGraphicList, to be vague and constructed in a first added, first used order. connectParts, a variable from OMGeometryList, is also set to true.


generate

public boolean generate(Projection p,
                        boolean forceProjectAll)
Create the GeneralPath used for the internal Shape objects held by the OMGeometries added. With the OMAreaList, all of the components are combined to make a single area. So updateShape, which is called from super.generate(), calls appendShapeEdge() instead of appending each part Shape to the main Shape. This method closes off the GeneralPath Shape, so it will be considered a polygon.

Overrides:
generate in class OMGeometryList
Parameters:
p - a Projection
forceProjectAll - if true, all the geometries on the list are generated with the new projection. If false they are only generated if getNeedToRegenerate() returns true
Returns:
true if generation was successful for all objects on list.
See Also:
OMGeometry.generate(com.bbn.openmap.proj.Projection), OMGeometry.regenerate(com.bbn.openmap.proj.Projection)

updateShape

protected void updateShape(OMGeometry geometry,
                           Projection p,
                           boolean forceProject)
Given a OMGeometry, it calls generate/regenerate on it, and then adds the GeneralPath shape within it to the OMGeometryList shape object. The edges of each part are combined to make one big polygon.

Overrides:
updateShape in class OMGeometryList
Parameters:
geometry - the geometry to append
p - the current projection
forceProject - flag to force re-generation

findClosest

public OMList.OMDist<OMGeometry> findClosest(double x,
                                             double y,
                                             float limit,
                                             boolean resetSelect)
Overrides the OMGeometryList and OMGraphicList methods to just call _distance() on the internal shape object.

Overrides:
findClosest in class OMList<OMGeometry>
Parameters:
x - x coordinate
y - y coordinate
limit - the max distance that a graphic has to be within to be returned, in pixels.
resetSelect - deselect any OMGraphic touched.
Returns:
OMDist


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