com.bbn.openmap.omGraphics.geom
Class BasicGeometry

java.lang.Object
  extended bycom.bbn.openmap.omGraphics.geom.BasicGeometry
All Implemented Interfaces:
OMGeometry, OMGraphicConstants, java.io.Serializable
Direct Known Subclasses:
OMGraphic, 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 infomration 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 static java.lang.String APP_OBJECT_KEY
           
protected  java.lang.Object appObject
          Space for an application to associate geometry with an application object.
protected static java.lang.String ATT_MAP_KEY
           
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 reprojected.
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, 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, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, 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
 
Constructor Summary
BasicGeometry()
           
 
Method Summary
protected  float _distance(int x, int y)
          Return the shortest distance from the graphic to an XY-point.
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.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, int[] xpoints, int[] ypoints)
          Convenience method to add the coordinates to the given GeneralPath.
static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape, int[] xpoints, int[] ypoints, int startIndex, int length)
          Convenience method to add the coordinates to the given GeneralPath.
protected  boolean checkAttributeMap()
          Returns true if the appObject is a Map and if it's the attribute Map, false if the appObject is something different or null.
protected  boolean checkAttributeMap(java.lang.Object obj)
          Returns true of the Object is a Map and is pointing to itself in the Map under the ATT_MAP_KEY.
 void clearAttributes()
          Removes all of the objects stored in a Map stored in the appObject.
 boolean contains(int x, int y)
          Answsers the question whether or not the OMGeometry contains the given pixel point.
protected  java.util.Map createAttributeMap()
          Method to extend if you don't like Hashtables used for attribute table.
static java.awt.geom.GeneralPath createBoxShape(int x, int y, int width, int height)
          Create a general path from a point plus a height and width;
static java.awt.geom.GeneralPath createShape(int[] xpoints, int[] ypoints, boolean isPolygon)
          Create a Shape object given an array of x points and y points.
static java.awt.geom.GeneralPath createShape(int[] xpoints, int[] 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(int x, int y)
          Return the shortest distance from the graphic to an XY-point.
 float distanceToEdge(int x, int y)
          Return the shortest distance from the edge of a 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.
abstract  boolean generate(Projection proj)
          Prepare the geometry for rendering.
 java.lang.Object getAppObject()
          Gets the application's object pointer.
protected  java.lang.Object getAppObject(boolean checkForObjOnMap)
          Same as getAppObject, with the option of disabling the attribute Map management.
 java.lang.Object getAttribute(java.lang.Object key)
          Returns the object stored in a Map stored in the appObject.
protected  java.util.Map getAttributeMap()
          Returns a Map that is being used as an attribute holder.
 java.util.Map getAttributes()
          Returns the 'official' attribute Map, null if it hasn't been set.
 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()
           
 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.
protected  void replaceAppObjectWithAttributeMap()
          A call used by the BasicGeometry to replace a current appication object with an Object Map while also adding that application object to the Map under the APP_OBJECT_KEY key value.
 void select()
          Let the geometry object know it's selected.
 void setAppObject(java.lang.Object obj)
          Holds an application specific object for later access.
protected  void setAppObject(java.lang.Object obj, boolean checkToReplaceObjWithMap)
          Same as setAppObject with the option for disabling the attribute Map management.
 void setAttributes(java.util.Map 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 boolean needToRegenerate
Flag to indicate that the object needs to be reprojected.


appObject

protected java.lang.Object appObject
Space for an application to associate geometry with an application object. This object can contain attribute information about the geometry.

See Also:
setAppObject(java.lang.Object), getAppObject()

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.


APP_OBJECT_KEY

protected static final java.lang.String APP_OBJECT_KEY
See Also:
Constant Field Values

ATT_MAP_KEY

protected static final java.lang.String ATT_MAP_KEY
See Also:
Constant Field Values
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.

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

setAppObject

public void setAppObject(java.lang.Object obj)
Holds an application specific object for later access. This can be used to associate an application object with an OMGeometry for later retrieval. For instance, when the graphic is clicked on, the application gets the OMGeometry object back from the OMGeometryList, and can then get back to the application level object through this pointer.

The BasicGeometry has been updated to use an attribute Object Map to hold multiple attributes. If no attributes have been added, then the appObject will just hold any object passed in here. If attributes have already been added, then calling this method will add the object to the Map under the APP_OBJECT_KEY key. getAppObject() will return the object set in this method.

Specified by:
setAppObject in interface OMGeometry
Parameters:
obj - Object

setAppObject

protected void setAppObject(java.lang.Object obj,
                            boolean checkToReplaceObjWithMap)
Same as setAppObject with the option for disabling the attribute Map management.

Parameters:
checkToReplaceObjWithMap - if false, just sets obj to appObject.

getAppObject

public java.lang.Object getAppObject()
Gets the application's object pointer. If an attribute Map object is being used, returns the object stored in that map under the APP_OBJECT_KEY key.

Specified by:
getAppObject in interface OMGeometry
Returns:
Object

getAppObject

protected java.lang.Object getAppObject(boolean checkForObjOnMap)
Same as getAppObject, with the option of disabling the attribute Map management.

Parameters:
checkForObjOnMap - if false, just returns the appObject.

replaceAppObjectWithAttributeMap

protected void replaceAppObjectWithAttributeMap()
A call used by the BasicGeometry to replace a current appication object with an Object Map while also adding that application object to the Map under the APP_OBJECT_KEY key value.


checkAttributeMap

protected boolean checkAttributeMap()
Returns true if the appObject is a Map and if it's the attribute Map, false if the appObject is something different or null.


checkAttributeMap

protected boolean checkAttributeMap(java.lang.Object obj)
Returns true of the Object is a Map and is pointing to itself in the Map under the ATT_MAP_KEY.


getAttributeMap

protected java.util.Map getAttributeMap()
Returns a Map that is being used as an attribute holder. If a Map doesn't exist, one will be created. If the current appObject isn't the map, a Map will be created and the appObject will be added to it under the APP_OBJECT_KEY. Regardless, the attribute map will be returned from this method call.


createAttributeMap

protected java.util.Map 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 getAttributes()
Returns the 'official' attribute Map, null if it hasn't been set.

Specified by:
getAttributes in interface OMGeometry

setAttributes

public void setAttributes(java.util.Map 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

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()
Specified by:
isRenderable in interface OMGeometry

fill

public void fill(java.awt.Graphics g)
Paint the graphic, as a filled shape.

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.

draw

public void draw(java.awt.Graphics g)
Paint the graphic, as an outlined shape.

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.

distanceToEdge

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

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

public float distance(int x,
                      int 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(int x,
                          int 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(int x,
                        int y)
Answsers 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 occuring 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(int[] xpoints,
                                                    int[] 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(int[] xpoints,
                                                    int[] 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,
                                                        int[] xpoints,
                                                        int[] 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 coordiantes.
ypoints - vertical pixel coordiantes.
Returns:
toShape, with coordinates appended.

appendShapeEdge

public static java.awt.geom.GeneralPath appendShapeEdge(java.awt.geom.GeneralPath toShape,
                                                        int[] xpoints,
                                                        int[] 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 coordiantes.
ypoints - vertical pixel coordiantes.
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(int x,
                                                       int y,
                                                       int width,
                                                       int height)
Create a general path from a point plus a height and width;



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