|
|||||||||||
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.OMGraphic | +--com.bbn.openmap.omGraphics.OMGraphicList | +--com.bbn.openmap.omGraphics.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 independing 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 inherited from class com.bbn.openmap.omGraphics.OMGraphicList |
OMGraphicList.OMDist |
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.OMGraphicList |
allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphic |
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible |
Constructor Summary | |
OMGeometryList()
Construct an OMGeometryList. |
|
OMGeometryList(int initialCapacity)
Construct an OMGeometryList with an initial capacity. |
|
OMGeometryList(java.util.List list)
Construct an OMGeometryList around a List of OMGeometries. |
Method Summary | |
protected float |
_distance(int x,
int y)
Return the shortest distance from the graphic to an XY-point. |
protected OMGraphicList.OMDist |
_findClosest(int x,
int y,
float limit,
boolean resetSelect)
Find the closest Object and its distance. |
void |
add(OMGeometry g)
Add an OMGeometry to the GraphicList. |
void |
doAction(OMGeometry geometry,
OMAction action)
Perform an action on the provided geometry. |
OMGraphic |
findClosest(int x,
int y,
float limit)
This method returns an OMGraphic if the thing that is found closest to the coordinates is an OMGraphic. |
OMGeometry |
findClosestGeometry(int x,
int y)
Finds the object located the closest to the point, regardless of how far away it is. |
OMGeometry |
findClosestGeometry(int x,
int y,
float limit)
Finds the object located the closest to the point, if the object distance away is within the limit. |
void |
generate(Projection p,
boolean forceProjectAll)
Prepare the geometries for rendering. |
OMGeometry |
getAt(int location)
Get the geometry at the location number on the list. |
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). |
OMGeometry |
getContains(int x,
int y)
Finds the first OMGeometry (the one on top) that is under this pixel. |
OMGraphic |
getOMGraphicThatContains(int x,
int y)
Returns this list if x, y is inside the bounds of the contents of this list. |
OMGeometry |
getWithAppObject(java.lang.Object appObj)
Get the geometry with the appObject. |
int |
indexOf(OMGeometry geometry)
Return the index of the OMGeometry in the list. |
void |
insertAt(OMGeometry geometry,
int location)
Insert the geometry at the location number. |
void |
readGraphics(java.io.ObjectInputStream objstream)
Read a cache of OMGeometries, given a ObjectInputStream. |
boolean |
remove(OMGeometry geometry)
Remove the geometry from the list. |
java.lang.Object |
removeAt(int location)
Remove the geometry at the location number. |
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)
|
OMGraphic |
selectClosest(int x,
int y,
float limit)
This method returns an OMGraphic if the thing that is found closest to the coordinates is an OMGraphic. |
OMGeometry |
selectClosestGeometry(int x,
int y)
Finds the object located the closest to the coordinates, regardless of how far away it is. |
OMGeometry |
selectClosestGeometry(int x,
int y,
float limit)
Finds the object located the closest to the point, if the object distance away is within the limit, and sets the paint of that geometry to its select paint. |
void |
setAt(OMGeometry geometry,
int index)
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). |
void |
setFillPaint(java.awt.Paint paint)
Set the fill paint for this list object. |
void |
setLinePaint(java.awt.Paint paint)
Set the line paint for this list object. |
void |
setMatted(boolean value)
Set the matting flag for all the list. |
void |
setMattingPaint(java.awt.Paint paint)
Set the matting paint for all the objects on the list. |
void |
setSelectPaint(java.awt.Paint paint)
Set the select paint for this list object. |
void |
setStroke(java.awt.Stroke s)
Set the stroke for this list object. |
void |
setTextureMask(java.awt.TexturePaint texture)
Set the texture mask for the OMGeometries on the list. |
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.geom.BasicGeometry |
appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry |
clearAttributes, contains, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate |
Field Detail |
protected boolean connectParts
Constructor Detail |
public OMGeometryList()
public OMGeometryList(int initialCapacity)
initialCapacity
- the initial capacity of the listpublic OMGeometryList(java.util.List list)
list
- List of OMGeometries.Method Detail |
public void add(OMGeometry g)
g
- the non-null OMGeometry to add
java.lang.IllegalArgumentException
- if OMGeometry is nullpublic boolean remove(OMGeometry geometry)
geometry
- the geometry to remove.
public int indexOf(OMGeometry geometry)
geometry
- the geometry to look for
public void setAt(OMGeometry geometry, int index)
geometry
- OMGeometryindex
- index of the OMGeometry to return
java.lang.ArrayIndexOutOfBoundsException
- if index is
out-of-boundspublic OMGeometry getAt(int location)
location
- the location of the OMGeometry to return
java.lang.ArrayIndexOutOfBoundsException
- if
location < 0
or
location >=
this.size()
public OMGeometry getWithAppObject(java.lang.Object appObj)
appObj
- appObject of the wanted geometry.
Object.equals(java.lang.Object)
,
OMGeometry.setAppObject(java.lang.Object)
,
OMGeometry.getAppObject()
public java.lang.Object removeAt(int location)
location
- the location of the OMGeometry to removepublic void insertAt(OMGeometry geometry, int location)
geometry
- the OMGeometry to insert.location
- the location of the OMGeometry to insert
java.lang.ArrayIndexOutOfBoundsException
- if index is
out-of-boundspublic void setStroke(java.awt.Stroke s)
setStroke
in class OMGraphicList
s
- the stroke object to use.public void setFillPaint(java.awt.Paint paint)
setFillPaint
in class OMGraphicList
paint
- java.awt.Paintpublic void setTextureMask(java.awt.TexturePaint texture)
setTextureMask
in class OMGraphicList
public void setLinePaint(java.awt.Paint paint)
setLinePaint
in class OMGraphicList
paint
- Set the line paint for all the objects on the
list.public void setSelectPaint(java.awt.Paint paint)
setSelectPaint
in class OMGraphicList
paint
- java.awt.Paintpublic void setMattingPaint(java.awt.Paint paint)
setMattingPaint
in class OMGraphicList
paint
- java.awt.Paintpublic void setMatted(boolean value)
setMatted
in class OMGraphicList
public 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 class OMGraphicList
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 OMGraphicList
gr
- the AWT Graphics contextpublic void generate(Projection p, boolean forceProjectAll)
render()
! This recursively calls
generate() on the OMGeometries on the list.
generate
in class OMGraphicList
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 trueOMGeometry.generate(com.bbn.openmap.proj.Projection)
,
OMGeometry.regenerate(com.bbn.openmap.proj.Projection)
protected void updateShape(OMGeometry geometry, Projection p, boolean forceProject)
protected float _distance(int x, int y)
_distance was added so subclasses could make this call if their geometries/attributes require this action (when fill color doesn't matter).
_distance
in class BasicGeometry
x
- X coordinate of the point.y
- Y coordinate of the point.
protected OMGraphicList.OMDist _findClosest(int x, int y, float limit, boolean resetSelect)
OMGraphicList
_findClosest
in class OMGraphicList
x
- x coordy
- y coordlimit
- the max distance that a graphic has to be within
to be returned, in pixels.resetSelect
- deselect any OMGraphic touched.
public OMGeometry findClosestGeometry(int x, int y, float limit)
isVisible()
returns false are not considered.
x
- the x coordinate on the component the geometries are
displayed on.y
- the y coordinate on the component the geometries are
displayed on.limit
- the max distance that a geometry has to be within
to be returned, in pixels.
public OMGraphic findClosest(int x, int y, float limit)
findClosest
in class OMGraphicList
x
- the x coordinate on the component the graphics are
displayed on.y
- the y coordinate on the component the graphics are
displayed on.limit
- the max distance that a graphic has to be within
to be returned, in pixels.
public OMGraphic selectClosest(int x, int y, float limit)
selectClosest
in class OMGraphicList
x
- the horizontal pixel position of the window, from the
left of the window.y
- the vertical pixel position of the window, from the
top of the window.limit
- the max distance that a graphic has to be within
to be returned, in pixels.
public OMGeometry findClosestGeometry(int x, int y)
findClosest(x, y, Float.MAX_VALUE)
.
x
- the horizontal pixel position of the window, from the
left of the window.y
- the vertical pixel position of the window, from the
top of the window.
findClosest(int, int, float)
public OMGeometry selectClosestGeometry(int x, int y)
x
- the x coordinate on the component the graphics are
displayed on.y
- the y coordinate on the component the graphics are
displayed on.
public OMGeometry selectClosestGeometry(int x, int y, float limit)
isVisible()
returns false are not considered.
x
- the horizontal pixel position of the window, from the
left of the window.y
- the vertical pixel position of the window, from the
top of the window.limit
- the max distance that a geometry has to be within
to be returned, in pixels.
public OMGeometry getContains(int x, int y)
x
- the horizontal pixel position of the window, from the
left of the window.y
- the vertical pixel position of the window, from the
top of the window.
public OMGraphic getOMGraphicThatContains(int x, int y)
getOMGraphicThatContains
in class OMGraphicList
x
- the horizontal pixel position of the window, from the
left of the window.y
- the vertical pixel position of the window, from the
top of the window.
public void doAction(OMGeometry geometry, OMAction action)
public void readGraphics(java.io.ObjectInputStream objstream) throws java.io.IOException
readGraphics
in class OMGraphicList
objstream
- ObjectInputStream of geometry list.
java.io.IOException
public void setConnectParts(boolean value)
public boolean getConnectParts()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |