|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.geom.BasicGeometry com.bbn.openmap.omGraphics.OMGraphicAdapter com.bbn.openmap.omGraphics.OMList<OMGeometry> com.bbn.openmap.omGraphics.OMGeometryList
public class OMGeometryList
This class encapsulates a List of OMGeometries. It's an OMGraphic, so it contains information on how to draw them. It's also a subclass to the OMGraphicList, and relies on many OMGraphicList methods.
The OMGeometryList assumes that all OMGeometries on it should be rendered the same - same fill color, same edge color and stroke, and will create one java.awt.Shape object from all the projected OMGeometries for more efficient rendering. If your individual OMGeometries have independent rendering characteristics, use the OMGraphicList and OMGraphics.
Because the OMGeometryList creates a single java.awt.Shape object for all of its contents, it needs to be generated() if an OMGeometry is added or removed from the list. If you don't regenerate the OMGeometryList, the list will iterate through its contents and render each piece separately.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList |
---|
OMList.OMDist<T> |
Field Summary | |
---|---|
protected boolean |
connectParts
Flag to mark that the parts should be connected, making this OMGeometryList a combination OMGraphic that sums disparate parts. |
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 |
Constructor Summary | |
---|---|
OMGeometryList()
Construct an OMGeometryList. |
|
OMGeometryList(java.util.Collection<OMGeometry> c)
|
|
OMGeometryList(int initialCapacity)
Construct an OMGeometryList with an initial capacity. |
Method Summary | |
---|---|
void |
add(int index,
OMGeometry element)
|
boolean |
add(OMGeometry g)
Add an OMGeometry to the GraphicList. |
boolean |
addAll(java.util.Collection<? extends OMGeometry> c)
|
boolean |
addAll(int index,
java.util.Collection<? extends OMGeometry> c)
|
boolean |
addOMGraphic(OMGraphic omg)
For backward compatibility. |
void |
clear()
|
OMList<OMGeometry> |
create()
|
protected OMList.OMDist<OMGeometry> |
createDist()
|
boolean |
generate(Projection p,
boolean forceProjectAll)
Prepare the geometries for rendering. |
OMGeometry |
get(int index)
|
boolean |
getConnectParts()
Get whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false). |
java.util.Iterator<OMGeometry> |
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<OMGeometry> |
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<OMGeometry> |
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. |
void |
readGraphics(java.io.ObjectInputStream objstream)
Read a cache of OMGeometries, given a ObjectInputStream. |
OMGeometry |
remove(int location)
Remove the geometry at the location number. |
boolean |
remove(OMGeometry geometry)
Remove the geometry from the list. |
boolean |
removeAll(java.util.Collection<?> c)
|
void |
render(java.awt.Graphics gr)
Renders all the objects in the list a geometries context. |
void |
renderAllAsSelected(java.awt.Graphics gr)
Renders all the objects in the list a geometry's context, in their 'selected' mode. |
protected void |
renderGeometry(OMGeometry geometry,
java.awt.Graphics gr)
|
boolean |
retainAll(java.util.Collection<?> c)
|
OMGeometry |
set(int index,
OMGeometry geometry)
Set the geometry at the specified location. |
void |
setConnectParts(boolean value)
Set whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false). |
protected java.awt.geom.GeneralPath |
updateShape(java.awt.geom.GeneralPath currentShape,
OMGeometry geometry,
Projection p,
boolean forceProject)
Given an OMGeometry, check its visibility and if visible, generate it if required and add the result to the provided current shape. |
protected void |
updateShape(OMGeometry geometry,
Projection p,
boolean forceProject)
Deprecated. use the new paradigm from the other updateShape |
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.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 |
---|
protected boolean connectParts
Constructor Detail |
---|
public OMGeometryList()
public OMGeometryList(int initialCapacity)
initialCapacity
- the initial capacity of the listpublic OMGeometryList(java.util.Collection<OMGeometry> c)
Method Detail |
---|
public boolean add(OMGeometry g)
add
in interface java.util.Collection<OMGeometry>
add
in interface java.util.List<OMGeometry>
add
in class OMList<OMGeometry>
g
- the non-null OMGeometry to add
java.lang.IllegalArgumentException
- if OMGeometry is nullpublic boolean addOMGraphic(OMGraphic omg)
omg
-
public boolean remove(OMGeometry geometry)
geometry
- the geometry to remove.
public OMGeometry set(int index, OMGeometry geometry)
set
in interface java.util.List<OMGeometry>
geometry
- OMGeometryindex
- index location of the OMGeometry placement.
java.lang.ArrayIndexOutOfBoundsException
- if index is out-of-boundspublic OMGeometry remove(int location)
remove
in interface java.util.List<OMGeometry>
remove
in class OMList<OMGeometry>
location
- the location of the OMGeometry to removepublic void render(java.awt.Graphics gr)
paint()
for AWT components. The geometries are
rendered in the order of traverseMode. Any geometries where
isVisible()
returns false are not rendered.
render
in interface OMGeometry
render
in class OMList<OMGeometry>
gr
- the AWT Graphics contextprotected void renderGeometry(OMGeometry geometry, java.awt.Graphics gr)
public void renderAllAsSelected(java.awt.Graphics gr)
paint()
for AWT
components. The geometries are rendered in the order of traverseMode. Any
geometries where isVisible()
returns false are not rendered.
All of the geometries on the list are returned to their deselected state.
renderAllAsSelected
in class OMList<OMGeometry>
gr
- the AWT Graphics contextpublic boolean generate(Projection p, boolean forceProjectAll)
render()
! This recursively calls generate() on the
OMGeometries on the list.
generate
in class OMList<OMGeometry>
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
OMGeometry.generate(com.bbn.openmap.proj.Projection)
,
OMGeometry.regenerate(com.bbn.openmap.proj.Projection)
protected void updateShape(OMGeometry geometry, Projection p, boolean forceProject)
geometry
- the geometry to appendp
- the current projectionforceProject
- flag to force re-generationprotected java.awt.geom.GeneralPath updateShape(java.awt.geom.GeneralPath currentShape, OMGeometry geometry, Projection p, boolean forceProject)
currentShape
- the current shapegeometry
- the geometry to testp
- the current projectionforceProject
- flag to force regeneration
public void readGraphics(java.io.ObjectInputStream objstream) throws java.io.IOException
objstream
- ObjectInputStream of geometry list.
java.io.IOException
public void setConnectParts(boolean value)
public boolean getConnectParts()
public java.util.Iterator<OMGeometry> iteratorCopy()
public java.util.ListIterator<OMGeometry> listIteratorCopy()
public java.util.ListIterator<OMGeometry> listIteratorCopy(int size)
public OMList<OMGeometry> create()
create
in class OMList<OMGeometry>
protected OMList.OMDist<OMGeometry> createDist()
createDist
in class OMList<OMGeometry>
public void clear()
clear
in interface java.util.Collection<OMGeometry>
clear
in interface java.util.List<OMGeometry>
clear
in class OMList<OMGeometry>
public void add(int index, OMGeometry element)
add
in interface java.util.List<OMGeometry>
add
in class OMList<OMGeometry>
public boolean addAll(java.util.Collection<? extends OMGeometry> c)
addAll
in interface java.util.Collection<OMGeometry>
addAll
in interface java.util.List<OMGeometry>
public boolean addAll(int index, java.util.Collection<? extends OMGeometry> c)
addAll
in interface java.util.List<OMGeometry>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<OMGeometry>
removeAll
in interface java.util.List<OMGeometry>
removeAll
in class OMList<OMGeometry>
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<OMGeometry>
retainAll
in interface java.util.List<OMGeometry>
retainAll
in class OMList<OMGeometry>
public OMGeometry get(int index)
get
in interface java.util.List<OMGeometry>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |