public class OMGraphicList extends OMList<OMGraphic> implements java.io.Serializable
There are several things that this list does that make it better that any ol' List. You can make several common OMGraphic modification calls on the list, and the list handles the iteration and changing of all the graphics while taking into account a travese order.
An additional benefit is that because the OMGraphicList extends OMGraphic it can contain other instances of OMGraphicList. This way you can manage groupings of graphics, (for instance, an OMGraphicList of OMGraphicLists which each have an OMRaster and OMText).
Many methods, such as generate() and findClosest() traverse the items in the GraphicsList recursively. The direction that the list is traversed is controlled by then traverseMode variable. The traverseMode mode lets you set whether the first or last object added to the list (FIRST_ADDED_ON_TOP or LAST_ADDED_ON_TOP) is drawn on top of the list and considered first for searches.
OMList.OMDist<T>
allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible
ADD_GRAPHIC_MASK, 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, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, 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 and Description |
---|
OMGraphicList()
Construct an OMGraphicList.
|
OMGraphicList(java.util.Collection<OMGraphic> c)
Construct an OMGraphicList to include a Collection of OMGraphics.
|
OMGraphicList(int initialCapacity)
Construct an OMGraphicList with an initial capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
OMGraphic element) |
boolean |
add(OMGraphic g)
Add an OMGraphic to the list.
|
boolean |
addAll(java.util.Collection<? extends OMGraphic> c) |
boolean |
addAll(int index,
java.util.Collection<? extends OMGraphic> c) |
java.lang.Object |
clone()
Generic return of SinkGraphic for subclasses that don't implement clone
properly.
|
OMList<OMGraphic> |
create() |
protected OMList.OMDist<OMGraphic> |
createDist() |
OMGraphic |
get(int location)
Get the geometry at the location number on the list.
|
OMGraphic |
getOMGraphicAt(int index) |
java.util.List<OMGraphic> |
getTargets()
Get a reference to the graphics vector.
|
java.util.Iterator<OMGraphic> |
iteratorCopy()
Returns a iterator of a shallow copy of the current list, to avoid
concurrent modification exceptions if the list is being generated or
rendered while the list is being reviewed for other reasons.
|
java.util.ListIterator<OMGraphic> |
listIteratorCopy()
Returns a iterator of a shallow copy of the current list, to avoid
concurrent modification exceptions if the list is being generated or
rendered while the list is being reviewed for other reasons.
|
java.util.ListIterator<OMGraphic> |
listIteratorCopy(int size)
Returns a iterator of a shallow copy of the current list, to avoid
concurrent modification exceptions if the list is being generated or
rendered while the list is being reviewed for other reasons.
|
protected OMGraphic |
objectToOMGraphic(java.lang.Object obj)
Convenience method to cast an object to an OMGraphic if it is one.
|
void |
readGraphics(java.io.ObjectInputStream objstream)
Read a cache of OMGraphics, given a ObjectInputStream.
|
void |
readGraphics(java.net.URL cacheURL)
Read a cache of OMGraphics, given an URL.
|
OMGraphic |
remove(int location)
Remove the geometry at the location number.
|
OMGraphic |
set(int index,
OMGraphic element) |
void |
setFillPaint(java.awt.Paint paint)
Set the fill paint for all the objects on the list.
|
void |
setGridGenerator(OMGridGenerator generator,
Projection proj)
Goes through the list, finds the OMGrid objects, and sets the generator
for all of them.
|
void |
setLinePaint(java.awt.Paint paint)
Set the line paint for all the objects on the list.
|
void |
setMatted(boolean value)
Set the matting flag for all the objects on the list.
|
void |
setMattingPaint(java.awt.Paint paint)
Set the matting paint for all the objects on the list.
|
void |
setOMGraphicAt(OMGraphic graphic,
int index)
Set the graphic at the specified location.
|
void |
setSelectPaint(java.awt.Paint paint)
Set the selection paint for all the objects on the list.
|
void |
setStroke(java.awt.Stroke stroke)
Set the stroke of all the graphics on the list.
|
void |
setTargets(java.util.List<OMGraphic> list)
Set the List used to hold the OMGraphics.
|
void |
setTextureMask(java.awt.TexturePaint texture)
Set the texture mask for the OMGraphics on the list.
|
void |
sort()
This sort method is a place-holder for OMGraphicList extensions to
implement their own particular criteria for sorting an OMGraphicList.
|
void |
writeGraphics(java.io.ObjectOutputStream objectstream)
Write the graphics out to a ObjectOutputStream
|
void |
writeGraphics(java.lang.String graphicsSaveFile)
Write the graphics out to a file
|
checkForDuplicate, clear, contains, contains, containsAll, deselect, distance, doAction, findAll, findAll, findAllTest, findClosest, findClosest, findClosest, findClosestTest, findIndexOfClosest, findIndexOfClosest, generate, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, getWithObject, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, project, project, remove, removeAll, render, renderAllAsSelected, restore, retainAll, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, subList, toArray, toArray
getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, regenerate, renderLabel, setDeclutterType, setEdgeMatchesFill, setFillColor, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setRenderType, setSelectColor, setSelected, setShape, setShowEditablePalette, shouldRenderEdge, shouldRenderFill, writeStroke
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
clearAttributes, contains, distanceToEdge, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape
public OMGraphicList()
public OMGraphicList(int initialCapacity)
initialCapacity
- the initial capacity of the listpublic OMGraphicList(java.util.Collection<OMGraphic> c)
c
- Collection of OMGraphics.public java.util.Iterator<OMGraphic> iteratorCopy()
public java.util.ListIterator<OMGraphic> listIteratorCopy()
public java.util.ListIterator<OMGraphic> listIteratorCopy(int size)
public boolean add(OMGraphic g)
public void setOMGraphicAt(OMGraphic graphic, int index)
graphic
- OMGraphicindex
- index of the OMGraphic to returnjava.lang.ArrayIndexOutOfBoundsException
- if index is out-of-boundspublic OMGraphic getOMGraphicAt(int index)
public OMGraphic get(int location)
get
in interface java.util.List<OMGraphic>
location
- the location of the OMGraphic to returnjava.lang.ArrayIndexOutOfBoundsException
- if location < 0
or location >=
this.size()
public void setStroke(java.awt.Stroke stroke)
setStroke
in interface OMGraphic
setStroke
in class OMGraphicAdapter
stroke
- the stroke object to use.Stroke
,
BasicStroke
public void setFillPaint(java.awt.Paint paint)
setFillPaint
in interface OMGraphic
setFillPaint
in class OMGraphicAdapter
paint
- java.awt.Paintpublic void setTextureMask(java.awt.TexturePaint texture)
setTextureMask
in interface OMGraphic
setTextureMask
in class OMGraphicAdapter
public void setLinePaint(java.awt.Paint paint)
setLinePaint
in interface OMGraphic
setLinePaint
in class OMGraphicAdapter
paint
- java.awt.Paintpublic void setSelectPaint(java.awt.Paint paint)
setSelectPaint
in interface OMGraphic
setSelectPaint
in class OMGraphicAdapter
paint
- java.awt.Paintpublic void setMattingPaint(java.awt.Paint paint)
setMattingPaint
in interface OMGraphic
setMattingPaint
in class OMGraphicAdapter
paint
- java.awt.Paintpublic void setMatted(boolean value)
setMatted
in interface OMGraphic
setMatted
in class OMGraphicAdapter
public void setGridGenerator(OMGridGenerator generator, Projection proj)
generator
- an OMGridGenerator to create a renderable graphic from
the OMGrid.proj
- a projection to use to generate the graphic. If null, the
generator will create a renderable graphic the next time a
projection is handed to the list.public java.util.List<OMGraphic> getTargets()
HACK this method should either return a clone of the graphics list or a quick reference. Currently it returns the latter for simplicity and minor speed improvement. We should allow a way for the user to set the desired behavior, depending on whether they want responsibility for list synchronization. Right now, the user is responsible for synchronizing the OMGraphicList if it's being used in two or more threads...
public void setTargets(java.util.List<OMGraphic> list)
public void readGraphics(java.net.URL cacheURL) throws java.io.IOException
cacheURL
- URL of serialized graphic list.java.io.IOException
public void readGraphics(java.io.ObjectInputStream objstream) throws java.io.IOException
objstream
- ObjectInputStream of graphic list.java.io.IOException
public void writeGraphics(java.lang.String graphicsSaveFile) throws java.io.IOException
graphicsSaveFile
- java.io.IOException
public void writeGraphics(java.io.ObjectOutputStream objectstream) throws java.io.IOException
objectstream
- ObjectOutputStreamjava.io.IOException
public void sort()
protected OMGraphic objectToOMGraphic(java.lang.Object obj)
objectToOMGraphic
in class OMList<OMGraphic>
public java.lang.Object clone()
OMGraphicAdapter
clone
in interface OMGraphic
clone
in class OMGraphicAdapter
protected OMList.OMDist<OMGraphic> createDist()
createDist
in class OMList<OMGraphic>
public void add(int index, OMGraphic element)
public boolean addAll(java.util.Collection<? extends OMGraphic> c)
public boolean addAll(int index, java.util.Collection<? extends OMGraphic> c)
addAll
in interface java.util.List<OMGraphic>
public OMGraphic set(int index, OMGraphic element)
set
in interface java.util.List<OMGraphic>
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details