com.bbn.openmap.layer.link
Class LinkOMGraphicList

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<OMGraphic>
              extended by com.bbn.openmap.omGraphics.OMGraphicList
                  extended by com.bbn.openmap.layer.link.LinkOMGraphicList
All Implemented Interfaces:
LinkPropertiesConstants, OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<OMGraphic>, java.util.Collection<OMGraphic>, java.util.List<OMGraphic>

public class LinkOMGraphicList
extends OMGraphicList
implements LinkPropertiesConstants

This class extends the OMGraphicList by allowing searches on the AppObject contained by the OMGraphics on the list. The AppObject is where the LinkGraphics store the graphic ID as defined by the server. It also returns indexes from searches instead of the graphic. This allows for deletions, replacements and graphic location movement from within the list.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList
OMList.OMDist<T>
 
Field Summary
protected  Projection currentProjection
           
 
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.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.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
LinkOMGraphicList()
          Construct an OMGraphicList.
LinkOMGraphicList(int initialCapacity)
          Construct an OMGraphicList with an initial capacity.
 
Method Summary
protected  java.lang.Object _remove(int location)
          Remove the graphic at a location in the list.
protected  boolean _remove(OMGeometry geometry)
          Remove the graphic.
 boolean add(OMGraphic g)
          Add an OMGraphic to the GraphicList.
 void clear()
          Remove all elements from the graphic list.
 boolean getNeedToRegenerate(Projection proj)
          Check whether the list needs to be regenerated, considering the projection that the OMGraphics were projected with when the list was read.
 int getOMGraphicIndexWithId(java.lang.String gid)
          Get the graphic with the graphic ID.
 OMGraphic getOMGraphicWithId(java.lang.String gid)
          Get the graphic with the graphic ID.
 Projection getProjection()
           
 void render(java.awt.Graphics gr)
          Renders all the objects in the list a graphics context.
 void setOMGraphicAt(OMGraphic graphic, int index)
          Set the graphic at the specified location.
 void setProjection(Projection proj)
           
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicList
add, addAll, addAll, clone, create, createDist, get, getOMGraphicAt, getTargets, iteratorCopy, listIteratorCopy, listIteratorCopy, objectToOMGraphic, readGraphics, readGraphics, remove, set, setFillPaint, setGridGenerator, setLinePaint, setMatted, setMattingPaint, setSelectPaint, setStroke, setTargets, setTextureMask, sort, writeGraphics, writeGraphics
 
Methods inherited from class com.bbn.openmap.omGraphics.OMList
checkForDuplicate, contains, contains, containsAll, deselect, distance, doAction, findAll, findAll, findAllTest, findClosest, findClosest, findClosest, findClosestTest, findIndexOfClosest, findIndexOfClosest, generate, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, project, project, remove, removeAll, renderAllAsSelected, restore, retainAll, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, subList, toArray, toArray
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
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, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setRenderType, setSelectColor, setSelected, setShowEditablePalette, 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
getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setRenderType, setSelected, setShowEditablePalette, 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
 

Field Detail

currentProjection

protected Projection currentProjection
Constructor Detail

LinkOMGraphicList

public LinkOMGraphicList()
Construct an OMGraphicList.


LinkOMGraphicList

public LinkOMGraphicList(int initialCapacity)
Construct an OMGraphicList with an initial capacity.

Parameters:
initialCapacity - the initial capacity of the list
Method Detail

setProjection

public void setProjection(Projection proj)

getProjection

public Projection getProjection()

getNeedToRegenerate

public boolean getNeedToRegenerate(Projection proj)
Check whether the list needs to be regenerated, considering the projection that the OMGraphics were projected with when the list was read. The projection equality projection is lazy, just checks objects.


add

public boolean add(OMGraphic g)
Add an OMGraphic to the GraphicList. The OMGraphic must not be null.

Specified by:
add in interface java.util.Collection<OMGraphic>
Specified by:
add in interface java.util.List<OMGraphic>
Overrides:
add in class OMGraphicList
Parameters:
g - the non-null OMGraphic to add
Throws:
java.lang.IllegalArgumentException - if OMGraphic is null

_remove

protected java.lang.Object _remove(int location)
Remove the graphic at a location in the list.

Parameters:
location - the OMGraphic object to remove.
Returns:
true if graphic was on the list, false if otherwise.

_remove

protected boolean _remove(OMGeometry geometry)
Remove the graphic. If this list is not vague, it will also ask sub-OMGraphicLists to remove it if the geometry isn't found on this OMGraphicList.

Parameters:
geometry - the OMGeometry object to remove.
Returns:
true if geometry was on the list, false if otherwise.

setOMGraphicAt

public void setOMGraphicAt(OMGraphic graphic,
                           int index)
Set the graphic at the specified location. The OMGraphic must not be null, the AppObject in the OMGraphic must be null or a LinkProperties object. This method is extended from OMGraphicList so the link id is added to the hashtable for faster searching.

Overrides:
setOMGraphicAt in class OMGraphicList
Parameters:
graphic - OMGraphic
index - index of the OMGraphic to return
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index is out-of-bounds

getOMGraphicWithId

public OMGraphic getOMGraphicWithId(java.lang.String gid)
Get the graphic with the graphic ID.

Parameters:
gid - graphic ID of the wanted graphic.
Returns:
OMGraphic or null if not found

getOMGraphicIndexWithId

public int getOMGraphicIndexWithId(java.lang.String gid)
Get the graphic with the graphic ID. Traverse mode doesn't matter.

Parameters:
gid - graphic ID of the wanted graphic.
Returns:
OMGraphic index or Link.UNKNOWN if not found

clear

public void clear()
Remove all elements from the graphic list.

Specified by:
clear in interface java.util.Collection<OMGraphic>
Specified by:
clear in interface java.util.List<OMGraphic>
Overrides:
clear in class OMList<OMGraphic>

render

public void render(java.awt.Graphics gr)
Renders all the objects in the list a graphics context. This is the same as paint() for AWT components. The graphics are rendered in the order of traverseMode. Any graphics where isVisible() returns false are not rendered.

Specified by:
render in interface OMGeometry
Overrides:
render in class OMList<OMGraphic>
Parameters:
gr - the AWT Graphics context


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