|
||||||||||
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
public abstract class OMGraphicAdapter
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 |
---|
attributes, lineType, needToRegenerate, shape, visible |
Constructor Summary | |
---|---|
protected |
OMGraphicAdapter()
Construct a default OMGraphic. |
protected |
OMGraphicAdapter(int rType,
int lType,
int dcType)
Construct an OMGraphic. |
|
OMGraphicAdapter(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. |
void |
deselect()
Set the selected attribute to false, sets the color to the line color. |
float |
distance(double x,
double 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.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. |
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. |
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. |
protected java.awt.Stroke |
readStroke(java.io.ObjectInputStream ois,
java.awt.Stroke defStroke)
|
protected java.awt.TexturePaint |
readTextureMask(java.io.ObjectInputStream ois)
|
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. |
protected void |
renderShape(java.awt.Graphics g)
Called from render, just handles rendering of the java.awt.Shape of the OMGraphic, as it is currently stored in this OMGraphic. |
void |
restore(OMGeometry source)
Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one. |
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(float[] xpoints,
float[] ypoints)
Deprecated. use the version with the projection. |
void |
setLabelLocation(float[] xpoints,
float[] ypoints,
Projection proj)
|
void |
setLabelLocation(java.awt.geom.GeneralPath gp)
Deprecated. use the version with the Projection |
protected void |
setLabelLocation(java.awt.geom.GeneralPath gp,
Projection proj)
Checks the attributes for a label and moves the label accordingly. |
void |
setLabelLocation(int[] xpoints,
int[] ypoints)
Deprecated. use the version with the projection. |
protected void |
setLabelLocation(int[] xpoints,
int[] ypoints,
Projection proj)
Checks the attributes for a label and moves the label accordingly. |
void |
setLabelLocation(java.awt.geom.Point2D p)
Deprecated. use the version with Projection. |
protected void |
setLabelLocation(java.awt.geom.Point2D p,
Projection proj)
Checks the attributes for a label and moves the label accordingly. |
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 |
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). |
protected void |
writeStroke(java.io.ObjectOutputStream oos,
java.awt.Stroke stroke,
java.awt.Stroke defStroke)
|
protected void |
writeTextureMask(java.io.ObjectOutputStream oos,
java.awt.TexturePaint tMask)
Will only write TexturePaint objects that are Serializable. |
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, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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 transient 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 OMGraphicAdapter()
protected OMGraphicAdapter(int rType, int lType, int dcType)
rType
- render typelType
- line typedcType
- declutter typepublic OMGraphicAdapter(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 boolean isClear(java.awt.Paint paint)
paint
- Paint or null.
public void setRenderType(int value)
setRenderType
in interface OMGraphic
value
- the rendertype for the object.public int getRenderType()
getRenderType
in interface OMGeometry
getRenderType
in interface OMGraphic
getRenderType
in class BasicGeometry
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.
setDeclutterType
in interface OMGraphic
value
- the declutter type value.public int getDeclutterType()
getDeclutterType
in interface OMGraphic
public void setGraphicsForEdge(java.awt.Graphics g)
setGraphicsForEdge
in interface OMGraphic
g
- java.awt.GraphicssetGraphicsColor(java.awt.Graphics, java.awt.Paint)
public void setGraphicsForFill(java.awt.Graphics g)
setGraphicsForFill
in interface OMGraphic
g
- java.awt.GraphicssetGraphicsColor(java.awt.Graphics, java.awt.Paint)
public void setGraphicsColor(java.awt.Graphics g, java.awt.Paint paint)
setGraphicsColor
in interface OMGraphic
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()
getLineColor
in interface OMGraphic
public void setLinePaint(java.awt.Paint paint)
selected
boolean attribute is false.
setLinePaint
in interface OMGraphic
paint
- the real line Paintpublic java.awt.Paint getLinePaint()
getLinePaint
in interface OMGraphic
public void setSelectColor(java.awt.Color value)
selected
boolean attribute is true.
value
- the selected color.public java.awt.Color getSelectColor()
getSelectColor
in interface OMGraphic
public void setSelectPaint(java.awt.Paint paint)
selected
boolean attribute is true.
setSelectPaint
in interface OMGraphic
paint
- the real select Paintpublic java.awt.Paint getSelectPaint()
getSelectPaint
in interface OMGraphic
public java.awt.Color getDisplayColor()
selected
boolean attribute.
getDisplayColor
in interface OMGraphic
public java.awt.Paint getDisplayPaint()
selected
boolean attribute.
getDisplayPaint
in interface OMGraphic
public void select()
select
in interface OMGeometry
select
in interface OMGraphic
select
in class BasicGeometry
public void deselect()
deselect
in interface OMGeometry
deselect
in interface OMGraphic
deselect
in class BasicGeometry
public boolean isSelected()
isSelected
in interface OMGraphic
public void setSelected(boolean set)
setSelected
in interface OMGraphic
public boolean isMatted()
isMatted
in interface OMGraphic
public void setMatted(boolean set)
setMatted
in interface OMGraphic
public void setFillColor(java.awt.Color value)
value
- java.awt.Color.public java.awt.Color getFillColor()
getFillColor
in interface OMGraphic
public void setFillPaint(java.awt.Paint paint)
setFillPaint
in interface OMGraphic
paint
- the Paint object.public void setTextureMask(java.awt.TexturePaint texture)
setTextureMask
in interface OMGraphic
public java.awt.Paint getFillPaint()
getFillPaint
in interface OMGraphic
public java.awt.TexturePaint getTextureMask()
getTextureMask
in interface OMGraphic
protected void setEdgeMatchesFill()
public boolean getEdgeMatchesFill()
public void setMattingPaint(java.awt.Paint mPaint)
setMattingPaint
in interface OMGraphic
public java.awt.Paint getMattingPaint()
getMattingPaint
in interface OMGraphic
public void setStroke(java.awt.Stroke s)
setStroke
in interface OMGraphic
s
- the stroke to use for the graphic edge.Stroke
,
BasicStroke
public java.awt.Stroke getStroke()
getStroke
in interface OMGraphic
public void setShowEditablePalette(boolean set)
setShowEditablePalette
in interface OMGraphic
public boolean getShowEditablePalette()
getShowEditablePalette
in interface OMGraphic
public float normalizeDistanceForLineWidth(float distance)
normalizeDistanceForLineWidth
in interface OMGraphic
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.
render
in interface OMGeometry
render
in class BasicGeometry
g
- Graphics2D context to render into.protected void renderShape(java.awt.Graphics g)
g
- java.awt.Graphics to render into.protected void setHasLabel(boolean val)
public boolean getHasLabel()
protected void initLabelingDuringGenerate()
public void setLabelLocation(int[] xpoints, int[] ypoints)
setLabelLocation
in interface OMGraphic
xpoints
- ypoints
- public void setLabelLocation(float[] xpoints, float[] ypoints)
setLabelLocation(int[], int[])
protected void setLabelLocation(int[] xpoints, int[] ypoints, Projection proj)
xpoints
- int[] describing the projected location of the OMGraphic.ypoints
- int[] describing the projected location of the OMGraphic.proj
- the current projection to do further evaluating of placement.public void setLabelLocation(float[] xpoints, float[] ypoints, Projection proj)
setLabelLocation(int[], int[])
public void setLabelLocation(java.awt.geom.Point2D p)
setLabelLocation
in interface OMGraphic
p
- protected void setLabelLocation(java.awt.geom.Point2D p, Projection proj)
p
- Point2D describing the projected location of the label.proj
- the current projection to do further evaluating of placement.public void setLabelLocation(java.awt.geom.GeneralPath gp)
setLabelLocation
in interface OMGraphic
gp
- GeneralPathprotected void setLabelLocation(java.awt.geom.GeneralPath gp, Projection proj)
gp
- GeneralPath describing the projected location of the OMGraphic.proj
- the current projection to do further evaluating of placement.public void renderLabel(java.awt.Graphics g)
renderLabel
in interface OMGraphic
g
- public boolean shouldRenderFill()
shouldRenderFill
in interface OMGraphic
public boolean shouldRenderEdge()
shouldRenderEdge
in interface OMGraphic
public float distance(double x, double 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 interface OMGraphic
regenerate
in class BasicGeometry
proj
- the Projection
generate(com.bbn.openmap.proj.Projection)
public boolean hasLineTypeChoice()
hasLineTypeChoice
in interface OMGraphic
public java.lang.Object clone()
clone
in interface OMGraphic
clone
in class java.lang.Object
protected void writeStroke(java.io.ObjectOutputStream oos, java.awt.Stroke stroke, java.awt.Stroke defStroke) throws java.io.IOException
java.io.IOException
protected void writeTextureMask(java.io.ObjectOutputStream oos, java.awt.TexturePaint tMask) throws java.io.IOException
oos
- the ObjectOutputStream to write ontMask
- the TexturePaint mask
java.io.IOException
protected java.awt.Stroke readStroke(java.io.ObjectInputStream ois, java.awt.Stroke defStroke) throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
java.io.IOException
protected java.awt.TexturePaint readTextureMask(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
java.io.IOException
public void restore(OMGeometry source)
restore
in interface OMGeometry
restore
in class BasicGeometry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |