|
|||||||||||
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
Used to be the base class of OpenMap graphics, but now inherits from BasicGeometry, which now contains all the information about the geometry of the OMGraphic. The OMGraphic also contains information about how the geometry should be drawn.
The OMGraphics are raster and vector graphic objects that know how to position and render themselves on a given x-y window or lat-lon map projection. All you have to do is supply the location data (x/y, lat/lon) and drawing information (color, line width) and the graphic handles the rest.
This class contains parameters that are common to most types of graphics. If a parameter doesn't make sense for a particular graphic type, it is ignored.
The OMGraphics are being updated to be able to provide java.awt.Shape representations of themselves after they have been generated(). The getShape() method returns a java.awt.Shape object. With the Shape object, you can do some spatial analysis (object operations) on the projected OMGraphics. NOTES:
OMBitmap
,
OMCircle
,
OMLine
,
OMPoly
,
OMRect
,
OMRaster
,
OMText
,
OMGraphicList
,
Projection
,
Serialized FormField Summary | |
protected int |
declutterType
Decluttering is not supported by OpenMap yet. |
protected java.awt.Paint |
displayPaint
The color that the object is displayed with. |
protected boolean |
edgeMatchesFill
Flag to note if the current edge color matches the fill color. |
protected java.awt.Paint |
fillPaint
This color is the fill color of the object. |
protected boolean |
hasLabel
The flag set in generate that causes the OMGraphic to look for an OMLabeler attribute in render. |
protected java.awt.Paint |
linePaint
This color is the real foreground color of the object. |
protected boolean |
matted
Flag for determining when the matting around the edge of an OMGraphic. |
protected java.awt.Paint |
mattingPaint
This paint is used for the matting area around the edge of an OMGraphic painted when the matted variable is set to true. |
protected int |
renderType
The renderType describes the relation of the object to the window. |
protected boolean |
selected
Flag to indicate that the object has/hasnot been put in a special mode as a result of some event. |
protected java.awt.Paint |
selectPaint
This color is the highlight color that can be used when the object is selected. |
protected boolean |
showEditablePalette
A flag for whether an EditableOMGraphic should show it's palette if the OMGraphic is modified. |
protected java.awt.Stroke |
stroke
The Java2D Stroke. |
protected java.awt.TexturePaint |
textureMask
This Paint object is the fill texture mask of the object. |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible |
Constructor Summary | |
protected |
OMGraphic()
Construct a default OMGraphic. |
protected |
OMGraphic(int rType,
int lType,
int dcType)
Construct an OMGraphic. |
|
OMGraphic(int rType,
int lType,
int dcType,
java.awt.Color lc,
java.awt.Color fc,
java.awt.Color sc)
Construct an OMGraphic. |
Method Summary | |
java.lang.Object |
clone()
Generic return of SinkGraphic for subclasses that don't implement clone properly for some reason. |
void |
deselect()
Set the selected attribute to false, sets the color to the line color. |
float |
distance(int x,
int y)
Return the shortest distance from the graphic to an XY-point. |
abstract boolean |
generate(Projection proj)
Prepare the graphic for rendering. |
int |
getDeclutterType()
Return the declutter type. |
java.lang.String |
getDescription()
OMGraphic method for returning a simple description of the OMGraphic. |
java.lang.String |
getDescription(int level)
OMGraphic method for returning a simple description of the OMGraphic. |
java.awt.Color |
getDisplayColor()
Return the color that should be used for display. |
java.awt.Paint |
getDisplayPaint()
Return the Paint that should be used for display. |
boolean |
getEdgeMatchesFill()
|
java.awt.Color |
getFillColor()
Return the background color of the graphic object. |
java.awt.Paint |
getFillPaint()
Return the fill Paint for this graphic. |
boolean |
getHasLabel()
Quick check of the flag to see if a label attribute has been set. |
java.awt.Color |
getLineColor()
Return the normal foreground color of the object. |
java.awt.Paint |
getLinePaint()
Get the normal line Paint used for the graphic. |
java.awt.Paint |
getMattingPaint()
Get the Paint used for matting. |
int |
getRenderType()
Return the render type. |
java.awt.Color |
getSelectColor()
Return the selected color, which is the line or foreground color used when the graphic is "selected". |
java.awt.Paint |
getSelectPaint()
Get the normal select Paint used for the graphic. |
boolean |
getShowEditablePalette()
Get whether an EditableOMGraphic modifying this graphic should show it's palette. |
java.awt.Stroke |
getStroke()
Get the Stroke used for the graphic edge. |
java.awt.TexturePaint |
getTextureMask()
Return the texture mask Paint for this graphic. |
protected boolean |
hasLineTypeChoice()
Used by the GraphicAttributes object to provide a choice on whether the line type choice can be changed. |
protected void |
initLabelingDuringGenerate()
The method only needs to be called in an OMGraphic's generate method if the setShape() method isn't called there. |
static boolean |
isClear(java.awt.Paint paint)
Checks if the Paint is clear. |
boolean |
isMatted()
Return whether the OMGraphic has matting around the edge. |
boolean |
isSelected()
Return whether the OMGraphic is selected. |
float |
normalizeDistanceForLineWidth(float distance)
A function that takes a float distance, which presumably represents the pixel distance from a point to a graphic, and subtracts half of the line width of the graphic from the distance if the graphic line width is greater than one. |
boolean |
regenerate(Projection proj)
Invoke this to regenerate a "dirty" graphic. |
void |
render(java.awt.Graphics g)
Paint the graphic. |
void |
renderLabel(java.awt.Graphics g)
Checks to see if a label should be painted based on what methods were called in generate(), and renders the label if necessary. |
void |
select()
Set the selected attribute to true, and sets the color to the select color. |
void |
setDeclutterType(int value)
Set the declutter setting for the graphic. |
protected void |
setEdgeMatchesFill()
|
void |
setFillColor(java.awt.Color value)
Deprecated. Use setFillPaint instead. Now taking advantage of the Java2D API. |
void |
setFillPaint(java.awt.Paint paint)
Set the fill Paint for this graphic. |
void |
setGraphicsColor(java.awt.Graphics g,
java.awt.Paint paint)
Set the Paint in the given Graphics. |
void |
setGraphicsForEdge(java.awt.Graphics g)
Given a java.awt.Graphics object, set the Stroke and Paint parameters of it to match the OMGraphic's edge settings. |
void |
setGraphicsForFill(java.awt.Graphics g)
Given a java.awt.Graphics object, set the Paint to be the OMGraphic's fillPaint setting. |
protected void |
setHasLabel(boolean val)
|
void |
setLabelLocation(java.awt.geom.GeneralPath gp)
Sets the label location at the center of the bounding box of the path. |
void |
setLabelLocation(int[] xpoints,
int[] ypoints)
Sets the label location at the center of the polygon points. |
void |
setLabelLocation(java.awt.Point p)
Sets the label location at the given point. |
void |
setLineColor(java.awt.Color value)
Deprecated. Use setLinePaint instead. Now taking advantage of the Java2D API. |
void |
setLinePaint(java.awt.Paint paint)
Set the line Paint. |
void |
setMatted(boolean set)
Set whether the OMGraphic should have matting around the edge. |
void |
setMattingPaint(java.awt.Paint mPaint)
Set the Paint used for matting. |
void |
setRenderType(int value)
Set the render type of the graphic. |
void |
setSelectColor(java.awt.Color value)
Deprecated. Use setSelectPaint instead. Now taking advantage of the Java2D API. |
void |
setSelected(boolean set)
Calls select() or deselect() depending on the boolean (select is true). |
void |
setSelectPaint(java.awt.Paint paint)
Set the select Paint. |
void |
setShape(java.awt.geom.GeneralPath gp)
Calls super.setShape(), but also checks the attributes for a label and moves the label accordingly. |
void |
setShowEditablePalette(boolean set)
Set whether an EditableOMGraphic modifying this graphic should show it's palette. |
void |
setStroke(java.awt.Stroke s)
Set the Stroke that should be used for the graphic edges. |
void |
setTextureMask(java.awt.TexturePaint texture)
Set the texture mask for the OMGraphic. |
boolean |
shouldRenderEdge()
Return true if the edge color/paint should be rendered (not clear, or doesn't match the fill color). |
boolean |
shouldRenderFill()
Return true of the fill color/paint should be rendered (not clear). |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
_distance, 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, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible |
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, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible |
Field Detail |
protected transient java.awt.Stroke stroke
protected java.awt.Paint linePaint
protected java.awt.Paint mattingPaint
protected java.awt.Paint displayPaint
protected java.awt.Paint fillPaint
protected java.awt.TexturePaint textureMask
protected java.awt.Paint selectPaint
protected boolean selected
protected boolean showEditablePalette
protected boolean edgeMatchesFill
protected int renderType
protected int declutterType
protected boolean matted
protected transient boolean hasLabel
Constructor Detail |
protected OMGraphic()
protected OMGraphic(int rType, int lType, int dcType)
rType
- render typelType
- line typedcType
- declutter typepublic OMGraphic(int rType, int lType, int dcType, java.awt.Color lc, java.awt.Color fc, java.awt.Color sc)
rType
- render typelType
- line typedcType
- declutter typelc
- line colorfc
- fill colorsc
- select colorMethod Detail |
public static boolean isClear(java.awt.Paint paint)
paint
- Paint or null.
public void setRenderType(int value)
value
- the rendertype for the object.public int getRenderType()
getRenderType
in interface OMGeometry
getRenderType
in class BasicGeometry
public java.lang.String getDescription(int level)
level
- used by OMGraphicLists to provide an offset, or a
notion of embedding.public java.lang.String getDescription()
public void setDeclutterType(int value)
Right now, this is unimplemented in OpenMap. But for information, DECLUTTERTYPE_NONE means the object has no impact on the placement of objects. DECLUTTERTYPE_SPACE means the object shouldn't have things placed on it, but to draw it where the coordinates dictate. DECLUTTERTYPE_MOVE means to put the object in an open space, and DELCUTTERTYPE_LINE adds the feature that if the object is not drawn where it's coordinates say it should be, then a line should be drawn showing where the original position is.
Decluttering of geometries is not supported. This flag is not used.
value
- the declutter type value.public int getDeclutterType()
public void setGraphicsForEdge(java.awt.Graphics g)
g
- java.awt.GraphicssetGraphicsColor(java.awt.Graphics, java.awt.Paint)
public void setGraphicsForFill(java.awt.Graphics g)
g
- java.awt.GraphicssetGraphicsColor(java.awt.Graphics, java.awt.Paint)
public void setGraphicsColor(java.awt.Graphics g, java.awt.Paint paint)
g
- java.awt.Graphicspaint
- java.awt.Paintpublic void setLineColor(java.awt.Color value)
selected
boolean attribute is
false.
value
- the real line colorpublic java.awt.Color getLineColor()
public void setLinePaint(java.awt.Paint paint)
selected
boolean attribute is false.
paint
- the real line Paintpublic java.awt.Paint getLinePaint()
public void setSelectColor(java.awt.Color value)
selected
boolean attribute is
true.
value
- the selected color.public java.awt.Color getSelectColor()
public void setSelectPaint(java.awt.Paint paint)
selected
boolean attribute is true.
paint
- the real select Paintpublic java.awt.Paint getSelectPaint()
public java.awt.Color getDisplayColor()
selected
boolean attribute.
public java.awt.Paint getDisplayPaint()
selected
boolean attribute.
public void select()
select
in interface OMGeometry
select
in class BasicGeometry
public void deselect()
deselect
in interface OMGeometry
deselect
in class BasicGeometry
public boolean isSelected()
public void setSelected(boolean set)
public boolean isMatted()
public void setMatted(boolean set)
public void setFillColor(java.awt.Color value)
value
- java.awt.Color.public java.awt.Color getFillColor()
public void setFillPaint(java.awt.Paint paint)
paint
- the Paint object.public void setTextureMask(java.awt.TexturePaint texture)
public java.awt.Paint getFillPaint()
public java.awt.TexturePaint getTextureMask()
protected void setEdgeMatchesFill()
public boolean getEdgeMatchesFill()
public void setMattingPaint(java.awt.Paint mPaint)
public java.awt.Paint getMattingPaint()
public void setStroke(java.awt.Stroke s)
s
- the stroke to use for the graphic edge.Stroke
,
BasicStroke
public java.awt.Stroke getStroke()
public void setShowEditablePalette(boolean set)
public boolean getShowEditablePalette()
public float normalizeDistanceForLineWidth(float distance)
distance
- pixel distance to the graphic edge with a line
width of one.
public abstract boolean generate(Projection proj)
render()
! If a vector graphic has
lat-lon components, then we project these vertices into x-y
space. For raster graphics we prepare in a different fashion.
If the generate is unsuccessful, it's usually because of some
oversight, (for instance if proj
is null), and
if debugging is enabled, a message may be output to the
controlling terminal.
generate
in interface OMGeometry
generate
in class BasicGeometry
proj
- Projection
regenerate(com.bbn.openmap.proj.Projection)
public void render(java.awt.Graphics g)
paint()
function of
java.awt.Components. Note that if the graphic has not been
generated, it will not be rendered.
This method used to be abstract, but with the conversion of OMGraphics to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGraphic hasn't been updated to use Shape objects, it should have its own render method.
g
- Graphics2D context to render into.public void setShape(java.awt.geom.GeneralPath gp)
setShape
in interface OMGeometry
setShape
in class BasicGeometry
gp
- java.awt.geom.GeneralPath (Shape), or null if the
graphic needs to be cleared or regenerated.protected void setHasLabel(boolean val)
public boolean getHasLabel()
protected void initLabelingDuringGenerate()
public void setLabelLocation(int[] xpoints, int[] ypoints)
xpoints
- ypoints
- public void setLabelLocation(java.awt.Point p)
p
- public void setLabelLocation(java.awt.geom.GeneralPath gp)
gp
- public void renderLabel(java.awt.Graphics g)
g
- public boolean shouldRenderFill()
public boolean shouldRenderEdge()
public float distance(int x, int y)
This method used to be abstract, but with the conversion of OMGraphics to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGraphic hasn't been updated to use Shape objects, it should have its own distance method.
distance
in interface OMGeometry
distance
in class BasicGeometry
x
- X coordinate of the point.y
- Y coordinate of the point.
public boolean regenerate(Projection proj)
generate()
method. It invokes
generate()
only if needToRegenerate()
on the graphic returns true. To force a graphic to be
generated, call generate()
directly.
regenerate
in interface OMGeometry
regenerate
in class BasicGeometry
proj
- the Projection
generate(com.bbn.openmap.proj.Projection)
protected boolean hasLineTypeChoice()
public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |