|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Base class of OpenMap OMGraphics geometry.
The geometry classes are intended to pull the object location data out of the OMGraphics. If you have a bunch of OMGraphics that are all rendered with common attributes, you can create a bunch of OMGeometry objects to plavce in a OMGeometryList that will render them all alike.
OMGeometryList
,
Projection
Method Summary | |
void |
clearAttributes()
Clear attributes from the OMGeometry. |
boolean |
contains(int x,
int y)
Answsers the question whether or not the OMGeometry contains the given pixel point. |
void |
deselect()
Let the geometry object know that it is not selected. |
float |
distance(int x,
int y)
Return the shortest distance from the graphic to an XY-point. |
void |
draw(java.awt.Graphics g)
Paint the graphic, as an outlined shape. |
void |
fill(java.awt.Graphics g)
Paint the graphic, as a filled shape. |
boolean |
generate(Projection proj)
Prepare the geometry for rendering. |
java.lang.Object |
getAppObject()
Gets the application's object pointer. |
java.lang.Object |
getAttribute(java.lang.Object key)
Get an attribute from an OMGeometry. |
java.util.Map |
getAttributes()
Get all attributes from the OMGeometry. |
int |
getLineType()
Return the line type. |
boolean |
getNeedToRegenerate()
Return the regeneration status. |
int |
getRenderType()
Return the render type. |
java.awt.geom.GeneralPath |
getShape()
Get the java.awt.Shape object that represents the projected graphic. |
boolean |
isRenderable()
|
boolean |
isVisible()
Get the visibility variable. |
void |
putAttribute(java.lang.Object key,
java.lang.Object value)
Set an attribute in an OMGeometry. |
boolean |
regenerate(Projection proj)
Invoke this to regenerate a "dirty" graphic. |
java.lang.Object |
removeAttribute(java.lang.Object key)
Remove an attribute from the OMGeometry. |
void |
select()
Let the geometry object know that it is selected. |
void |
setAppObject(java.lang.Object obj)
Holds an application specific object for later access. |
void |
setAttributes(java.util.Map attributes)
Set all attributes on the OMGeometry. |
void |
setLineType(int value)
Set the line type for the graphic, which will affect how the lines will be drawn. |
void |
setNeedToRegenerate(boolean value)
Sets the regenerate flag for the graphic. |
void |
setShape(java.awt.geom.GeneralPath gp)
Set the java.awt.Shape object that represents the projected graphic. |
void |
setVisible(boolean visible)
Set the visibility variable. |
Method Detail |
public void setLineType(int value)
value
- the line type of the graphic.public int getLineType()
public int getRenderType()
public void setNeedToRegenerate(boolean value)
value
- booleanpublic boolean getNeedToRegenerate()
public void setVisible(boolean visible)
visible
- booleanpublic boolean isVisible()
public void select()
public void deselect()
public void setAppObject(java.lang.Object obj)
obj
- Objectpublic java.lang.Object getAppObject()
public void putAttribute(java.lang.Object key, java.lang.Object value)
public java.lang.Object getAttribute(java.lang.Object key)
public java.lang.Object removeAttribute(java.lang.Object key)
public void clearAttributes()
public void setAttributes(java.util.Map attributes)
public java.util.Map getAttributes()
public 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.
proj
- Projection
regenerate(com.bbn.openmap.proj.Projection)
public boolean isRenderable()
public void fill(java.awt.Graphics g)
This paints the graphic into the Graphics context. This is
similar to paint()
function of
java.awt.Components. Note that if the graphic has not been
generated or if it isn't visible, it will not be rendered.
This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.
g
- Graphics2D context to render into.public void draw(java.awt.Graphics g)
This paints the graphic into the Graphics context. This is
similar to paint()
function of
java.awt.Components. Note that if the graphic has not been
generated or if it isn't visible, it will not be rendered.
This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.
g
- Graphics2D context to render into.public float distance(int x, int y)
This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own distance method.
x
- X coordinate of the point.y
- Y coordinate of the point.
public boolean contains(int x, int y)
This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own contains method.
This method duplicates a java.awt.Shape method, with some protection wrapped around it. If you have other queries for the internal Shape object, just ask for it and then ask it directly. This method is provided because it is the most useful, used when determining if a mouse event is occuring over an object on the map.
x
- X pixel coordinate of the point.y
- Y pixel 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.
proj
- the Projection
generate(com.bbn.openmap.proj.Projection)
public java.awt.geom.GeneralPath getShape()
The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.
public void setShape(java.awt.geom.GeneralPath gp)
The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.
gp
- java.awt.geom.GeneralPath (Shape), or null if the
graphic needs to be cleared or regenerated.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |