com.bbn.openmap.omGraphics.geom
Class BasicGeometry

java.lang.Object
  extended by com.bbn.openmap.omGraphics.geom.BasicGeometry
All Implemented Interfaces:
OMGeometry, OMGraphicConstants, java.io.Serializable
Direct Known Subclasses:
OMGraphicAdapter, PolygonGeometry

public abstract class BasicGeometry
extends java.lang.Object
implements OMGeometry, java.io.Serializable, OMGraphicConstants

Base class implementation of OpenMap OMGeometry, the super class for all OMGraphics.

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.

The BasicGeometry can hold attributes. Traditionally, there has been an appObject (Application Object) that could be set in the OMGeometry/OMGraphic to maintain a pointer for additional information about the shape. This has been modified so that an attribute Map can be maintained for the BasicGeometry to let it hold on to a bunch of organized attributes. To maintain backward compatibility, the setAppObject() and getAppObject() methods have been modified to manage a java.util.Map along with any Objects stored in the appObject. Using the setAppObject() and getAppObject() methods in conjunction with other attributes will cause that object to be stored in the attribute Map under the APP_OBJECT_KEY Map key.

See Also:
PolygonGeometry, PolylineGeometry, OMGeometryList, Projection, Serialized Form

Field Summary
protected  java.util.Map<java.lang.Object,java.lang.Object> attributes
          Attribute Map for this Geometry/OMGraphic.
protected  int lineType
          The lineType describes the way a line will be drawn between points.
protected  boolean needToRegenerate
          Flag to indicate that the object needs to be re-projected.
protected  java.awt.geom.GeneralPath shape
          The Java 2D containing the Shape of the Graphic.
protected  boolean visible
          A flag to render this geometry visible.
 
Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
ADD_GRAPHIC_MASK, APP_OBJECT, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED
 
Constructor Summary
BasicGeometry()
           
 
Method Summary
protected  float _distance(double x, double y)
          Return the shortest distance from the graphic to an XY-point.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, float[] xpoints, float[] ypoints)
          Convenience method to add the coordinates to the given GeneralPath.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, float[] xpoints, float[] ypoints, int startIndex, int length)
          Convenience method to add the coordinates to the given GeneralPath.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, java.awt.geom.GeneralPath addShape)
          Convenience method to append the edge of a GeneralPath Shape to another GeneralPath Shape.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, java.awt.geom.GeneralPath addShape, boolean lineTo)
          Convenience method to append the edge of a GeneralPath Shape to another GeneralPath Shape.
 void clearAttributes()
          Removes all of the objects stored in a Map stored in the appObject.
 boolean contains(double x, double y)
          Answers the question whether or not the OMGeometry contains the given pixel point.
protected  java.util.Map<java.lang.Object,java.lang.Object> createAttributeMap()
          Method to extend if you don't like Hashtables used for attribute table.
static java.awt.geom.GeneralPath createBoxShape(float x, float y, int width, int height)
          Create a general path from a point plus a height and width;
static java.awt.geom.GeneralPath createShape(float[] xpoints, float[] ypoints, boolean isPolygon)
          Create a Shape object given an array of x points and y points.
static java.awt.geom.GeneralPath createShape(float[] xpoints, float[] ypoints, int startIndex, int length, boolean isPolygon)
          Create a Shape object given an array of x points and y points.
static void describeShapeDetail(java.awt.Shape shape)
          Utility method that iterates over a Shape object and prints out the points.
static void describeShapeDetail(java.awt.Shape shape, double flattening)
          Utility method that iterates over a Shape object and prints out the points.
 void deselect()
          Let the geometry object know it's deselected.
 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 graphic to an XY-point.
static float distanceToEdge(double x, double y, java.awt.Shape shape)
          Return the shortest distance from the edge of a Shape object to an XY-point.
 void draw(java.awt.Graphics g)
          Paint the graphic, as an outlined shape.
 void draw(java.awt.Graphics g, java.awt.Shape s)
          Paint the graphic, as an outlined shape.
 void fill(java.awt.Graphics g)
          Paints the graphic, as a filled shape.
 void fill(java.awt.Graphics g, java.awt.Shape s)
          Paint the graphic, as a filled shape.
abstract  boolean generate(Projection proj)
          Prepare the geometry for rendering.
 java.lang.Object getAppObject()
          For backward compatibility, now returns whatever is saved under the OMGraphic.APP_OBJECT key.
 java.lang.Object getAttribute(java.lang.Object key)
          Returns the object stored in a Map stored in the appObject.
 java.util.Map<java.lang.Object,java.lang.Object> getAttributes()
          Returns the 'official' attribute Map.
 java.lang.String getDescription()
          OMGeometry method for returning a simple description of the OMGraphic.
 int getLineType()
          Return the line type.
 boolean getNeedToRegenerate()
          Return the regeneration status.
abstract  int getRenderType()
          Return the render type.
 java.awt.geom.GeneralPath getShape()
          Get the java.awt.Shape object that represents the projected graphic.
 boolean isRenderable()
          A check to see if the OMGeometry is ready for rendering.
 boolean isRenderable(java.awt.Shape shape)
          A check to see if the OMGeometry is ready for rendering.
 boolean isVisible()
          Get the visibility variable.
 void putAttribute(java.lang.Object key, java.lang.Object value)
          Adds a key-value pair to the attribute Map.
 boolean regenerate(Projection proj)
          Invoke this to regenerate a "dirty" graphic.
 java.lang.Object removeAttribute(java.lang.Object key)
          Removes the object stored in a Map stored in the appObject.
 void render(java.awt.Graphics g)
          Sure it renders, but not with any controllable rendering attributes - the colors and strokes are what are set in the Graphics.
 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 it's selected.
 void setAppObject(java.lang.Object obj)
          For backward compatibility, puts object in attribute table under OMGraphic.APP_OBJECT.
 void setAttributes(java.util.Map<java.lang.Object,java.lang.Object> atts)
          Sets the 'official' attribute Map, moving any appObject that isn't currently the 'official' attribute Map into the map under the APP_OBJECT_KEY.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineType

protected int lineType
The lineType describes the way a line will be drawn between points. LINETYPE_STRAIGHT will mean the line is drawn straight between the pixels of the endpoints of the line, across the window. LINETYPE_GREATCIRCLE means the line will be drawn on the window representing the shortest line along the land. LINETYPE_RHUMB means a line will be drawn along a constant bearing between the two points.


needToRegenerate

protected transient boolean needToRegenerate
Flag to indicate that the object needs to be re-projected.


attributes

protected java.util.Map<java.lang.Object,java.lang.Object> attributes
Attribute Map for this Geometry/OMGraphic.


visible

protected boolean visible
A flag to render this geometry visible.


shape

protected transient java.awt.geom.GeneralPath shape
The Java 2D containing the Shape of the Graphic. There may be several paths appended to each other, in case the graphic wraps around the earth, and we need to show the other edge of the graphic on the other side of the earth.

Constructor Detail

BasicGeometry

public BasicGeometry()
Method Detail

setLineType

public void setLineType(int value)
Set the line type for the graphic, which will affect how the lines will be drawn. See the definition of the lineType parameter. Accepts LINETYPE_RHUMB, LINETYPE_STRAIGHT and LINETYPE_GREATCIRCLE. Any weird values get set to LINETYPE_STRAIGHT.

Specified by:
setLineType in interface OMGeometry
Parameters:
value - the line type of the graphic.

getLineType

public int getLineType()
Return the line type.

Specified by:
getLineType in interface OMGeometry
Returns:
the linetype - LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_GREATCIRCLE or LINETYPE_UNKNOWN.

getRenderType

public abstract int getRenderType()
Return the render type.

Specified by:
getRenderType in interface OMGeometry
Returns:
the rendertype of the object - RENDERTYPE_LATLON, RENDERTYPE_XY, RENDERTYPE_OFFSET and RENDERTYPE_UNKNOWN.

setNeedToRegenerate

public void setNeedToRegenerate(boolean value)
Sets the regenerate flag for the graphic. This flag is used to determine if extra work needs to be done to prepare the object for rendering. This also sets the shape to null;

Specified by:
setNeedToRegenerate in interface OMGeometry
Parameters:
value - boolean

getNeedToRegenerate

public boolean getNeedToRegenerate()
Return the regeneration status.

Specified by:
getNeedToRegenerate in interface OMGeometry
Returns:
boolean

setVisible

public void setVisible(boolean visible)
Set the visibility variable. NOTE:
This is checked by the OMGeometryList when it iterates through its list for render and gesturing. It is not checked by the internal OMGeometry methods, although maybe it should be...

Specified by:
setVisible in interface OMGeometry
Parameters:
visible - boolean

isVisible

public boolean isVisible()
Get the visibility variable.

Specified by:
isVisible in interface OMGeometry
Returns:
boolean

select

public void select()
Let the geometry object know it's selected. No action mandated.

Specified by:
select in interface OMGeometry

deselect

public void deselect()
Let the geometry object know it's deselected. No action mandated.

Specified by:
deselect in interface OMGeometry

createAttributeMap

protected java.util.Map<java.lang.Object,java.lang.Object> createAttributeMap()
Method to extend if you don't like Hashtables used for attribute table.


putAttribute

public void putAttribute(java.lang.Object key,
                         java.lang.Object value)
Adds a key-value pair to the attribute Map. The Map will be created if it doesn't exist.

Specified by:
putAttribute in interface OMGeometry

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Returns the object stored in a Map stored in the appObject. If the appObject is a Map, the key will be passed to it even if the Map isn't considered to be the 'official' attribute Map.

Specified by:
getAttribute in interface OMGeometry

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Removes the object stored in a Map stored in the appObject. If the appObject is a Map, the key will be passed to it even if the Map isn't considered to be the 'official' attribute Map. Returns the removed value from the Map, or null if there wasn't a value for the given key.

Specified by:
removeAttribute in interface OMGeometry

clearAttributes

public void clearAttributes()
Removes all of the objects stored in a Map stored in the appObject. If the appObject is a Map, the clear command will be passed to it even if the Map isn't considered to be the 'official' attribute Map.

Specified by:
clearAttributes in interface OMGeometry

getAttributes

public java.util.Map<java.lang.Object,java.lang.Object> getAttributes()
Returns the 'official' attribute Map.

Specified by:
getAttributes in interface OMGeometry

setAttributes

public void setAttributes(java.util.Map<java.lang.Object,java.lang.Object> atts)
Sets the 'official' attribute Map, moving any appObject that isn't currently the 'official' attribute Map into the map under the APP_OBJECT_KEY.

Specified by:
setAttributes in interface OMGeometry

setAppObject

public void setAppObject(java.lang.Object obj)
For backward compatibility, puts object in attribute table under OMGraphic.APP_OBJECT.

Specified by:
setAppObject in interface OMGeometry
Parameters:
obj - any object

getAppObject

public java.lang.Object getAppObject()
For backward compatibility, now returns whatever is saved under the OMGraphic.APP_OBJECT key.

Specified by:
getAppObject in interface OMGeometry
Returns:
Object

getDescription

public java.lang.String getDescription()
OMGeometry method for returning a simple description of the OMGraphic.

Specified by:
getDescription in interface OMGeometry

generate

public abstract boolean generate(Projection proj)
Prepare the geometry for rendering. This must be done before calling 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.

Specified by:
generate in interface OMGeometry
Parameters:
proj - Projection
Returns:
boolean true if successful, false if not.
See Also:
regenerate(com.bbn.openmap.proj.Projection)

isRenderable

public boolean isRenderable()
A check to see if the OMGeometry is ready for rendering. Calls getShape() to pass to other isRenderable() method.

Specified by:
isRenderable in interface OMGeometry
Returns:
true if the OMGeometry should be rendered - it's visible and the projected shape is created and reflects the current location settings of the geometry.

isRenderable

public boolean isRenderable(java.awt.Shape shape)
A check to see if the OMGeometry is ready for rendering. This is the method you should call, with a the handle to the shape object you're interested in rendering.

Specified by:
isRenderable in interface OMGeometry
Parameters:
shape - the projected shape of the OMGraphic
Returns:
true if draw/fill should be called.

fill

public void fill(java.awt.Graphics g)
Paints the graphic, as a filled shape. The Graphics object should be set for rendering. Calls the getShape() method, which is synchronized, before calling the other fill method. It's better to call the other one after doing renderable check, and then call draw, with a single handle to the current shape object.

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.

Specified by:
fill in interface OMGeometry
Parameters:
g - Graphics2D context to render into.

fill

public void fill(java.awt.Graphics g,
                 java.awt.Shape s)
Paint the graphic, as a filled shape. The Graphics object should be set for rendering.

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.

Specified by:
fill in interface OMGeometry
Parameters:
g - Graphics2D context to render into.
s - Shape object to fill for rendering.

draw

public void draw(java.awt.Graphics g,
                 java.awt.Shape s)
Paint the graphic, as an outlined shape. The Graphics object should be ready for rendering (paint, stroke).

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.

Specified by:
draw in interface OMGeometry
Parameters:
g - Graphics2D context to render into.
s - Shape object to render.

draw

public void draw(java.awt.Graphics g)
Paint the graphic, as an outlined shape. The Graphics object should be ready for rendering (paint, stroke). Calls the getShape() method, which is synchronized, before calling the other fill method. It's better to call the other one after doing renderable check and fill, with a single handle to the current shape object.

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.

Specified by:
draw in interface OMGeometry
Parameters:
g - Graphics2D context to render into.

render

public void render(java.awt.Graphics g)
Sure it renders, but not with any controllable rendering attributes - the colors and strokes are what are set in the Graphics. The OMGeometryList controls this better, this method shouldn't really be called directly.

Specified by:
render in interface OMGeometry
Parameters:
g - Graphics2D context to render into.

distanceToEdge

public float distanceToEdge(double x,
                            double y)
Return the shortest distance from the edge of a graphic to an XY-point.

Specified by:
distanceToEdge in interface OMGeometry
Parameters:
x - X coordinate of the point.
y - Y coordinate of the point.
Returns:
float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

distanceToEdge

public static float distanceToEdge(double x,
                                   double y,
                                   java.awt.Shape shape)
Return the shortest distance from the edge of a Shape object to an XY-point.

Method taken and adapted from distanceToEdge(double, double)

Parameters:
x - X coordinate of the point.
y - Y coordinate of the point.
shape - Shape object to test.
Returns:
float distance, in pixels, from Shape to the point. Returns Float.POSITIVE_INFINITY if the Shape is null.

distance

public float distance(double x,
                      double y)
Return the shortest distance from the graphic to an XY-point. Checks to see of the point is contained within the OMGraphic, which may, or may not be the right thing for clear OMGraphics or lines.

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.

Calls _distance(x, y);

Specified by:
distance in interface OMGeometry
Parameters:
x - X coordinate of the point.
y - Y coordinate of the point.
Returns:
float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

_distance

protected float _distance(double x,
                          double y)
Return the shortest distance from the graphic to an XY-point. Checks to see of the point is contained within the OMGraphic, which may, or may not be the right thing for clear OMGraphics or lines.

_distance was added so subclasses could make this call if their geometries/attributes require this action (when fill color doesn't matter).

Parameters:
x - X coordinate of the point.
y - Y coordinate of the point.
Returns:
float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

contains

public boolean contains(double x,
                        double y)
Answers the question whether or not the OMGeometry contains the given pixel point.

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.

Specified by:
contains in interface OMGeometry
Parameters:
x - X pixel coordinate of the point.
y - Y pixel coordinate of the point.
Returns:
getShape().contains(x, y), false if the OMGraphic hasn't been generated yet.

regenerate

public boolean regenerate(Projection proj)
Invoke this to regenerate a "dirty" graphic. This method is a wrapper around the generate() method. It invokes generate() only if needToRegenerate() on the graphic returns true. To force a graphic to be generated, call generate() directly.

Specified by:
regenerate in interface OMGeometry
Parameters:
proj - the Projection
Returns:
true if generated, false if didn't do it (maybe a problem).
See Also:
generate(com.bbn.openmap.proj.Projection)

getShape

public java.awt.geom.GeneralPath getShape()
Get the java.awt.Shape object that represents the projected graphic. The array will one Shape object even if the object wraps around the earth and needs to show up in more than one place on the map. In conditions like that, the Shape will have multiple parts.

The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.

Specified by:
getShape in interface OMGeometry
Returns:
java.awt.geom.GeneralPath (a java.awt.Shape object), or null if the graphic needs to be generated with the current map projection, or null if the OMGeometry hasn't been updated to use Shape objects for its internal representation.

setShape

public void setShape(java.awt.geom.GeneralPath gp)
Set the java.awt.Shape object that represents the projected graphic. This Shape object should be internally generated, but this method is provided to clear out the object to save memory, or to allow a little customization if your requirements dictate.

The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.

Specified by:
setShape in interface OMGeometry
Parameters:
gp - java.awt.geom.GeneralPath, or null if the graphic needs to be generated with the current map projection or to clear out the object being held by the OMGeometry.

createShape

public static java.awt.geom.GeneralPath createShape(float[] xpoints,
                                                    float[] ypoints,
                                                    boolean isPolygon)
Create a Shape object given an array of x points and y points. The x points a y points should be projected. This method is used by subclasses that get projected coordinates out of the projection classes, and they need to build a Shape object from those coordinates.

Parameters:
xpoints - projected x coordinates
ypoints - projected y coordinates
isPolygon - whether the points make up a polygon, or a polyline. If it's true, the Shape object returned is a Polygon. If false, the Shape returned is a GeneralPath object.
Returns:
The Shape object for the points.

createShape

public static java.awt.geom.GeneralPath createShape(float[] xpoints,
                                                    float[] ypoints,
                                                    int startIndex,
                                                    int length,
                                                    boolean isPolygon)
Create a Shape object given an array of x points and y points. The x points a y points should be projected. This method is used by subclasses that get projected coordinates out of the projection classes, and they need to build a Shape object from those coordinates.

Parameters:
xpoints - projected x coordinates
ypoints - projected y coordinates
startIndex - the starting coordinate index in the array.
length - the number of points to use from the array for the shape.
isPolygon - whether the points make up a polygon, or a polyline. If it's true, the Shape object returned is a Polygon. If false, the Shape returned is a GeneralPath object.
Returns:
The Shape object for the points.

describeShapeDetail

public static void describeShapeDetail(java.awt.Shape shape)
Utility method that iterates over a Shape object and prints out the points.


describeShapeDetail

public static void describeShapeDetail(java.awt.Shape shape,
                                       double flattening)
Utility method that iterates over a Shape object and prints out the points. The flattening is used for a FlatteningPathIterator, controlling the scope of the path traversal.


appendShapeEdge

public static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape,
                                                        float[] xpoints,
                                                        float[] ypoints)
Convenience method to add the coordinates to the given GeneralPath. You need to close the path yourself if you want it to be a polygon.

Parameters:
toShape - the GeneralPath Shape object to add the coordinates to.
xpoints - horizontal pixel coordinates.
ypoints - vertical pixel coordinates.
Returns:
toShape, with coordinates appended.

appendShapeEdge

public static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape,
                                                        float[] xpoints,
                                                        float[] ypoints,
                                                        int startIndex,
                                                        int length)
Convenience method to add the coordinates to the given GeneralPath. You need to close the path yourself if you want it to be a polygon.

Parameters:
toShape - the GeneralPath Shape object to add the coordinates to.
xpoints - horizontal pixel coordinates.
ypoints - vertical pixel coordinates.
startIndex - the index into pixel coordinate array to start reading from.
length - the number of coordinates to add.
Returns:
toShape, with coordinates appended.

appendShapeEdge

public static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape,
                                                        java.awt.geom.GeneralPath addShape)
Convenience method to append the edge of a GeneralPath Shape to another GeneralPath Shape. A PathIterator is used to figure out the points to use to add to the toShape. You need to close the path yourself if you want it to be a polygon. Assumes that the two paths should be connected.

Parameters:
toShape - the GeneralPath Shape object to add the edge to.
addShape - the GeneralPath Shape to add to the toShape.
Returns:
toShape, with coordinates appended. Returns addShape if toShape was null.

appendShapeEdge

public static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape,
                                                        java.awt.geom.GeneralPath addShape,
                                                        boolean lineTo)
Convenience method to append the edge of a GeneralPath Shape to another GeneralPath Shape. A PathIterator is used to figure out the points to use to add to the toShape. You need to close the path yourself if you want it to be a polygon.

Parameters:
toShape - the GeneralPath Shape object to add the edge to.
addShape - the GeneralPath Shape to add to the toShape.
lineTo - specify whether the first point of the appended path is connected to the original path. True to connect.
Returns:
toShape, with coordinates appended. Returns addShape if toShape was null.

createBoxShape

public static java.awt.geom.GeneralPath createBoxShape(float x,
                                                       float y,
                                                       int width,
                                                       int height)
Create a general path from a point plus a height and width;


restore

public void restore(OMGeometry source)
Description copied from interface: OMGeometry
Replace the member variables of this OMGraphic with copies of member variables from another one.

Specified by:
restore in interface OMGeometry


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details