public interface OMGeometry
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
Modifier and Type | Method and Description |
---|---|
void |
clearAttributes()
Clear attributes from the OMGeometry.
|
boolean |
contains(double x,
double 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(double x,
double y)
Return the shortest distance from the graphic to an XY-point.
|
float |
distanceToEdge(double x,
double y)
Return the shortest distance from the edge of a geometry to an XY-point.
|
void |
draw(java.awt.Graphics g)
Paint the graphic.
|
void |
draw(java.awt.Graphics g,
java.awt.Shape s)
Paint the graphic, as an outlined shape.
|
void |
fill(java.awt.Graphics g)
Paint the graphic.
|
void |
fill(java.awt.Graphics g,
java.awt.Shape s)
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<java.lang.Object,java.lang.Object> |
getAttributes()
Get all attributes from the OMGeometry.
|
java.lang.String |
getDescription()
OMGeometry method for returning a simple description of itself, for
debugging purposes.
|
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()
Self-discovery of internal Shape object used for check, or implemented if
a Shape object doesn't matter.
|
boolean |
isRenderable(java.awt.Shape s)
Shape object provided for Shape-readiness check.
|
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 |
render(java.awt.Graphics g)
Paint the graphic.
|
void |
restore(OMGeometry source)
Replace the member variables of this OMGraphic with copies of member
variables from another one.
|
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<java.lang.Object,java.lang.Object> 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.
|
void setLineType(int value)
value
- the line type of the graphic.int getLineType()
int getRenderType()
void setNeedToRegenerate(boolean value)
value
- booleanboolean getNeedToRegenerate()
void setVisible(boolean visible)
visible
- booleanboolean isVisible()
void select()
void deselect()
void setAppObject(java.lang.Object obj)
obj
- Objectjava.lang.Object getAppObject()
void putAttribute(java.lang.Object key, java.lang.Object value)
java.lang.Object getAttribute(java.lang.Object key)
java.lang.Object removeAttribute(java.lang.Object key)
void clearAttributes()
void setAttributes(java.util.Map<java.lang.Object,java.lang.Object> attributes)
java.util.Map<java.lang.Object,java.lang.Object> getAttributes()
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
- Projectionregenerate(com.bbn.openmap.proj.Projection)
boolean isRenderable()
boolean isRenderable(java.awt.Shape s)
s
- Shape to check if ready for renderingvoid render(java.awt.Graphics g)
paint()
function of java.awt.Components.
Note that if the graphic has not been generated, it should not be
rendered.
It's expected that this method will call fill and draw, respectively.
g
- Graphics2D context to render into.void fill(java.awt.Graphics g, java.awt.Shape s)
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.s
- Shape object to use for fill.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.void draw(java.awt.Graphics g, java.awt.Shape s)
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.s
- Shape object to use for drawing.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.float distance(double x, double 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.float distanceToEdge(double x, double y)
x
- X coordinate of the point.y
- Y coordinate of the point.boolean contains(double x, double 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 occurring over an object on the map.
x
- X pixel coordinate of the point.y
- Y pixel coordinate of the point.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 Projectiongenerate(com.bbn.openmap.proj.Projection)
java.awt.geom.GeneralPath getShape()
The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.
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.java.lang.String getDescription()
void restore(OMGeometry source)
source
- Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details