## com.bbn.openmap.omGraphics
Class OMGraphic

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphic

All Implemented Interfaces:
  java.lang.Cloneable, OMGeometry, OMGraphicConstants, java.io.Serializable

Direct Known Subclasses:
  Location, OMAbstractLine, OMArc, OMGraphicList, OMPoint, OMRasterObject, OMRect, OMSubtraction, OMText, RpfCacheManager.RpfMaps, SinkGraphic, TX7

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

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:

- Color values cannot be set to null, but can be set to OMGraphic.clear. Actually, if you set them to null, they will set themselves to be clear.
- XY Rendering: Java specifies that the origin is the top left of the window, x increases to the right, y increases down.
- LatLon Rendering: Defined by the Projection object. The center of the window usually corresponds to the center of the projection. OMGraphics should project themselves using the appropriate forward() method listed in the Projection interface
- Offset Rendering: same as XY, but with origin set to a projected LatLon point.

See Also:
  `OMBitmap`, `OMCircle`, `OMLine`, `OMPoly`, `OMRect`, `OMRaster`, `OMText`, `OMGraphicList`, `Projection`, Serialized Form

Field 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
`APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, 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
`protected` `OMGraphic()` Construct a default OMGraphic.
`protected` `OMGraphic(int rType, int lType, int dcType)` Construct an OMGraphic.
`` `OMGraphic(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 for some reason.
`void` `deselect()` Set the selected attribute to false, sets the color to the line color.
`float` `distance(int x, int 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.lang.String` `getDescription()` OMGraphic method for returning a simple description of the OMGraphic.
`java.lang.String` `getDescription(int level)` OMGraphic method for returning a simple description of the OMGraphic.
`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.
`protected 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.
`static 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.
`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.
`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(java.awt.geom.GeneralPath gp)` Sets the label location at the center of the bounding box of the path.
`void` `setLabelLocation(int[] xpoints, int[] ypoints)` Sets the label location at the center of the polygon points.
`void` `setLabelLocation(java.awt.Point p)` Sets the label location at the given point.
`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` `setShape(java.awt.geom.GeneralPath gp)` Calls super.setShape(), but also checks the attributes for a label and moves the label accordingly.
`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).

Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry

`_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, 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, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible`

Field Detail

### stroke

    protected transient java.awt.Stroke stroke

  The Java2D Stroke. This is used for lineWidth, and dashing of the lines and polygon edges.

### linePaint

    protected java.awt.Paint linePaint

  This color is the real foreground color of the object. It is kept so that the object knows how to de-highlight itself. It defaults to black.

### mattingPaint

    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.

### displayPaint

    protected java.awt.Paint displayPaint

  The color that the object is displayed with. This color changes back and forth between the selectColor and the lineColor, depending on the if the object is selected or not.

### fillPaint

    protected java.awt.Paint fillPaint

  This color is the fill color of the object. It defaults to a black color that is transparent.

### textureMask

    protected java.awt.TexturePaint textureMask

  This Paint object is the fill texture mask of the object. It defaults to null. If this texture mask is set, the fill paint will still be used to fill the OMGraphic shape, but then this paint will be rendered on top. If the textureMask has transparency, the fill paint still influences appearance.

### selectPaint

    protected java.awt.Paint selectPaint

  This color is the highlight color that can be used when the object is selected. The default color is black, just like the line color.

### selected

    protected boolean selected

  Flag to indicate that the object has/hasnot been put in a special mode as a result of some event. Set through the select()/deselect methods().

### showEditablePalette

    protected boolean showEditablePalette

  A flag for whether an EditableOMGraphic should show it's palette if the OMGraphic is modified.

### edgeMatchesFill

    protected boolean edgeMatchesFill

  Flag to note if the current edge color matches the fill color. Can be used to save from rendering the edge if rendering the filled area already takes care of it.

### renderType

    protected int renderType

  The renderType describes the relation of the object to the window. RENDERTYPE_LATLON means the object is positioned relative to lat/lon points. RENDERTYPE_XY means the object is positioned relative to window pixel coordinates. RENDERTYPE_OFFSET means the object is drawn at a pixel offset to a lat/lon point.

### declutterType

    protected int declutterType

  Decluttering is not supported by OpenMap yet. But, when it is, these parameters will describe the way the object is manipulated on the window relative to its neighbors. DECLUTTERTYPE_NONE means the object will be drawn where its attributes say it should be. DECLUTTERTYPE_SPACE indicates that the window space of the object should be marked as taken, but the object should not be moved. DECLUTTERTYPE_MOVE means the object should be moved to the nearest open location closest to the position indicated by its attributes. DECLUTTERTYPE_LINE is the same as MOVE, but in addition, a line is drawn from the current position to its original position.

### matted

    protected boolean matted

  Flag for determining when the matting around the edge of an OMGraphic. Matting is a line, two pixels wider than the edge, painted under the edge. It makes the OMGraphic stand out on busy backgrounds.

### hasLabel

    protected transient boolean hasLabel

  The flag set in generate that causes the OMGraphic to look for an OMLabeler attribute in render. This flag prevents an unnecessary hashtable lookup every render call.

Constructor Detail

### OMGraphic

    protected OMGraphic()

  Construct a default OMGraphic.

### OMGraphic

    protected OMGraphic(int rType,
                        int lType,
                        int dcType)

  Construct an OMGraphic. Standard simple constructor that the child OMGraphics usually call. All of the other parameters get set to their default values.

Parameters:
  `rType` - render type
  `lType` - line type
  `dcType` - declutter type

### OMGraphic

    public OMGraphic(int rType,
                     int lType,
                     int dcType,
                     java.awt.Color lc,
                     java.awt.Color fc,
                     java.awt.Color sc)

  Construct an OMGraphic. More complex constructor that lets you set the rest of the parameters.

Parameters:
  `rType` - render type
  `lType` - line type
  `dcType` - declutter type
  `lc` - line color
  `fc` - fill color
  `sc` - select color

Method Detail

### isClear

    public static boolean isClear(java.awt.Paint paint)

  Checks if the Paint is clear.

  Parameters:
    `paint` - Paint or null.
  Returns:
    true if Paint is null or is a Color with a 0 alpha value.

### setRenderType

    public void setRenderType(int value)

  Set the render type of the graphic. Accepts RENDERTYPE_LATLON, RENDERTYPE_XY and RENDERTYPE_OFFSET. All weird values get set to RENDERTYPE_XY. See the definition on the renderType parameter.

  Parameters:
    `value` - the rendertype for the object.

### getRenderType

    public int getRenderType()

  Return the render type.

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

### getDescription

    public java.lang.String getDescription(int level)

  OMGraphic method for returning a simple description of the OMGraphic.

  Parameters:
    `level` - used by OMGraphicLists to provide an offset, or a notion of embedding.

### getDescription

    public java.lang.String getDescription()

  OMGraphic method for returning a simple description of the OMGraphic.

### setDeclutterType

    public void setDeclutterType(int value)

  Set the declutter setting for the graphic. Accepts DECLUTTERTYPE_SPACE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_LINE, and DECLUTTERTYPE_NONE. All weird values are set to DECLUTTERTYPE_NONE.

  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.

  Parameters:
    `value` - the declutter type value.

### getDeclutterType

    public int getDeclutterType()

  Return the declutter type.

  Returns:
    declutter type, see above.

### setGraphicsForEdge

    public 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.

  Parameters:
    `g` - java.awt.Graphics
  See Also:
    `setGraphicsColor(java.awt.Graphics, java.awt.Paint)`

### setGraphicsForFill

    public void setGraphicsForFill(java.awt.Graphics g)

  Given a java.awt.Graphics object, set the Paint to be the OMGraphic's fillPaint setting.

  Parameters:
    `g` - java.awt.Graphics
  See Also:
    `setGraphicsColor(java.awt.Graphics, java.awt.Paint)`

### setGraphicsColor

    public void setGraphicsColor(java.awt.Graphics g,
                                 java.awt.Paint paint)

  Set the Paint in the given Graphics. If the Graphics is not an instance of Graphics2D, then the Color of the graphics is set if the Paint is an instance of Color.

  Parameters:
    `g` - java.awt.Graphics
    `paint` - java.awt.Paint

### setLineColor

    public void setLineColor(java.awt.Color value)

  Deprecated. Use setLinePaint instead. Now taking advantage of the Java2D API.

  Set the line color of the graphic object. The line color is the normal display edge color of the object. This color is used as the display color when the object is NOT selected (hightlighted). The display color is set to the select color in this method if `selected` boolean attribute is false.

  Parameters:
    `value` - the real line color

### getLineColor

    public java.awt.Color getLineColor()

  Return the normal foreground color of the object.

  Returns:
    the line color. Returns null if the Paint is not a Color.

### setLinePaint

    public void setLinePaint(java.awt.Paint paint)

  Set the line Paint. The line Paint is the normal display edge paint of the graphic. This Paint is used as the display Paint when the object is NOT selected (hightlighted). The display Paint is set to the select Paint in this method if `selected` boolean attribute is false.

  Parameters:
    `paint` - the real line Paint

### getLinePaint

    public java.awt.Paint getLinePaint()

  Get the normal line Paint used for the graphic.

  Returns:
    Line Paint.

### setSelectColor

    public void setSelectColor(java.awt.Color value)

  Deprecated. Use setSelectPaint instead. Now taking advantage of the Java2D API.

  Set the select color of the graphic object. The selected color is used as the display color when the object is selected (highlighted). The display color is set to the select color in this method if `selected` boolean attribute is true.

  Parameters:
    `value` - the selected color.

### getSelectColor

    public java.awt.Color getSelectColor()

  Return the selected color, which is the line or foreground color used when the graphic is "selected".

  Returns:
    the selected mode line color. Returns null if the select Paint is not a Color.

### setSelectPaint

    public void setSelectPaint(java.awt.Paint paint)

  Set the select Paint. The select Paint is the display edge paint of the graphic. This Paint is used as the display Paint when the object IS selected (hightlighted). The display Paint is set to the select Paint in this method if `selected` boolean attribute is true.

  Parameters:
    `paint` - the real select Paint

### getSelectPaint

    public java.awt.Paint getSelectPaint()

  Get the normal select Paint used for the graphic.

  Returns:
    Select Paint.

### getDisplayColor

    public java.awt.Color getDisplayColor()

  Return the color that should be used for display. This color changes, depending on whether the object is selected or not. The display color is also set when the line color or the select color is set, depending on the statue of the `selected` boolean attribute.

  Returns:
    the color used as the edge color or foreground color, in the present selected state. If the displayPaint is not a Color, this method returns null.

### getDisplayPaint

    public java.awt.Paint getDisplayPaint()

  Return the Paint that should be used for display. This Paint changes, depending on whether the object is selected or not. The display Paint is also set when the line Paint or the select Paint is set, depending on the statue of the `selected` boolean attribute.

  Returns:
    the Paint used as the edge Paint or foreground Paint, in the present selected state.

### select

    public void select()

  Set the selected attribute to true, and sets the color to the select color.

  Specified by:
    `select` in interface `OMGeometry`
  Overrides:
    `select` in class `BasicGeometry`

### deselect

    public void deselect()

  Set the selected attribute to false, sets the color to the line color.

  Specified by:
    `deselect` in interface `OMGeometry`
  Overrides:
    `deselect` in class `BasicGeometry`

### isSelected

    public boolean isSelected()

  Return whether the OMGraphic is selected.

### setSelected

    public void setSelected(boolean set)

  Calls select() or deselect() depending on the boolean (select is true).

### isMatted

    public boolean isMatted()

  Return whether the OMGraphic has matting around the edge.

### setMatted

    public void setMatted(boolean set)

  Set whether the OMGraphic should have matting around the edge.

### setFillColor

    public void setFillColor(java.awt.Color value)

  Deprecated. Use setFillPaint instead. Now taking advantage of the Java2D API.

  Set the background color of the graphic object.

  Parameters:
    `value` - java.awt.Color.

### getFillColor

    public java.awt.Color getFillColor()

  Return the background color of the graphic object. If the fill Paint is not a color, this method will return null.

  Returns:
    the color used for the background.

### setFillPaint

    public void setFillPaint(java.awt.Paint paint)

  Set the fill Paint for this graphic. If the paint value is null, it will be set to OMGraphicConstants.clear.

  Parameters:
    `paint` - the Paint object.

### setTextureMask

    public void setTextureMask(java.awt.TexturePaint texture)

  Set the texture mask for the OMGraphic. If not null, then it will be rendered on top of the fill paint. If the fill paint is clear, the texture mask will not be used. If you just want to render the texture mask as is, set the fill paint of the graphic instead. This is really to be used to have a texture added to the graphic, with the fill paint still influencing appearance.

### getFillPaint

    public java.awt.Paint getFillPaint()

  Return the fill Paint for this graphic.

### getTextureMask

    public java.awt.TexturePaint getTextureMask()

  Return the texture mask Paint for this graphic.

### setEdgeMatchesFill

    protected void setEdgeMatchesFill()

### getEdgeMatchesFill

    public boolean getEdgeMatchesFill()

### setMattingPaint

    public void setMattingPaint(java.awt.Paint mPaint)

  Set the Paint used for matting.

### getMattingPaint

    public java.awt.Paint getMattingPaint()

  Get the Paint used for matting.

### setStroke

    public void setStroke(java.awt.Stroke s)

  Set the Stroke that should be used for the graphic edges. Using a BasicStroke, you can set a stroke that defines the line width, the dash interval and phase. If a null value is passed in, a default BasicStroke will be used.

  Parameters:
    `s` - the stroke to use for the graphic edge.
  See Also:
    `Stroke`, `BasicStroke`

### getStroke

    public java.awt.Stroke getStroke()

  Get the Stroke used for the graphic edge.

### setShowEditablePalette

    public void setShowEditablePalette(boolean set)

  Set whether an EditableOMGraphic modifying this graphic should show it's palette.

### getShowEditablePalette

    public boolean getShowEditablePalette()

  Get whether an EditableOMGraphic modifying this graphic should show it's palette.

### normalizeDistanceForLineWidth

    public 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. This should give a true pixel distance from the graphic, taking into account an embellished line.

  Parameters:
    `distance` - pixel distance to the graphic edge with a line width of one.
  Returns:
    the pixel distance to the true display edge of the graphic.

### generate

    public abstract boolean generate(Projection proj)

  Prepare the graphic 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`
  Specified by:
    `generate` in class `BasicGeometry`
  Parameters:
    `proj` - Projection
  Returns:
    boolean true if successful, false if not.
  See Also:
    `regenerate(com.bbn.openmap.proj.Projection)`

### render

    public void render(java.awt.Graphics g)

  Paint the graphic. 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, 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.

  Parameters:
    `g` - Graphics2D context to render into.

### setShape

    public void setShape(java.awt.geom.GeneralPath gp)

  Calls super.setShape(), but also checks the attributes for a label and moves the label accordingly. The label will be placed in the center of the bounding box around the path.

  Specified by:
    `setShape` in interface `OMGeometry`
  Overrides:
    `setShape` in class `BasicGeometry`
  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.

### setHasLabel

    protected void setHasLabel(boolean val)

### getHasLabel

    public boolean getHasLabel()

  Quick check of the flag to see if a label attribute has been set. Labels are stored in the attribute table, and that table should only be checked in a generate() method call, and not in the render(). The setShape() and initLabelingDuringGenerate() method calls set this flag which is used to opt-out of labeling methods for better performance.

  Returns:
    true if OMGraphic has label set.

### initLabelingDuringGenerate

    protected void initLabelingDuringGenerate()

  The method only needs to be called in an OMGraphic's generate method if the setShape() method isn't called there. The appropriate setLabelLocation method for where the label should be set should be called if this method is going to be used.

### setLabelLocation

    public void setLabelLocation(int[] xpoints,
                                 int[] ypoints)

  Sets the label location at the center of the polygon points. If the hasLabel variable hasn't been set, it no-ops.

  Parameters:
    `xpoints` -
    `ypoints` -

### setLabelLocation

    public void setLabelLocation(java.awt.Point p)

  Sets the label location at the given point. If the hasLabel variable hasn't been set, it no-ops.

  Parameters:
    `p` -

### setLabelLocation

    public void setLabelLocation(java.awt.geom.GeneralPath gp)

  Sets the label location at the center of the bounding box of the path. If the hasLabel variable hasn't been set, it no-ops.

  Parameters:
    `gp` -

### renderLabel

    public 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. If the label wasn't set up, a quick no-op occurs.

  Parameters:
    `g` -

### shouldRenderFill

    public boolean shouldRenderFill()

  Return true of the fill color/paint should be rendered (not clear).

### shouldRenderEdge

    public boolean shouldRenderEdge()

  Return true if the edge color/paint should be rendered (not clear, or doesn't match the fill color).

### distance

    public float distance(int x,
                          int y)

  Return the shortest distance from the graphic to an XY-point.

  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.

  Specified by:
    `distance` in interface `OMGeometry`
  Overrides:
    `distance` in class `BasicGeometry`
  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).

### 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`
  Overrides:
    `regenerate` in class `BasicGeometry`
  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)`

### hasLineTypeChoice

    protected boolean hasLineTypeChoice()

  Used by the GraphicAttributes object to provide a choice on whether the line type choice can be changed.

### clone

    public java.lang.Object clone()

  Generic return of SinkGraphic for subclasses that don't implement clone properly for some reason.

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