OMGraphicAdapter (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.omGraphics
Class OMGraphicAdapter

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

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

Direct Known Subclasses:
  Location, OMAbstractLine, OMArc, OMGeo, OMList, OMPoint, OMRasterObject, OMRect, OMShape, OMSubtraction, OMText, OMWarpingImage, SinkGraphic, TX7

    public abstract class OMGraphicAdapter

extends BasicGeometry
implements OMGraphic, 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
`attributes, lineType, needToRegenerate, shape, 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
`protected` | `OMGraphicAdapter()` Construct a default OMGraphic.
`protected` | `OMGraphicAdapter(int rType, int lType, int dcType)` Construct an OMGraphic.
`` | `OMGraphicAdapter(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.
`void` | `deselect()` Set the selected attribute to false, sets the color to the line color.
`float` | `distance(double x, double 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.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.
`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.
`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.
`protected java.awt.Stroke` | `readStroke(java.io.ObjectInputStream ois, java.awt.Stroke defStroke)`
`protected java.awt.TexturePaint` | `readTextureMask(java.io.ObjectInputStream ois)`
`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.
`protected void` | `renderShape(java.awt.Graphics g)` Called from render, just handles rendering of the java.awt.Shape of the OMGraphic, as it is currently stored in this OMGraphic.
`void` | `restore(OMGeometry source)` Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
`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(float[] xpoints, float[] ypoints)` Deprecated. use the version with the projection.
`void` | `setLabelLocation(float[] xpoints, float[] ypoints, Projection proj)`
`void` | `setLabelLocation(java.awt.geom.GeneralPath gp)` Deprecated. use the version with the Projection
`protected void` | `setLabelLocation(java.awt.geom.GeneralPath gp, Projection proj)` Checks the attributes for a label and moves the label accordingly.
`void` | `setLabelLocation(int[] xpoints, int[] ypoints)` Deprecated. use the version with the projection.
`protected void` | `setLabelLocation(int[] xpoints, int[] ypoints, Projection proj)` Checks the attributes for a label and moves the label accordingly.
`void` | `setLabelLocation(java.awt.geom.Point2D p)` Deprecated. use the version with Projection.
`protected void` | `setLabelLocation(java.awt.geom.Point2D p, Projection proj)` Checks the attributes for a label and moves the label accordingly.
`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` | `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).
`protected void` | `writeStroke(java.io.ObjectOutputStream oos, java.awt.Stroke stroke, java.awt.Stroke defStroke)`
`protected void` | `writeTextureMask(java.io.ObjectOutputStream oos, java.awt.TexturePaint tMask)` Will only write TexturePaint objects that are Serializable.

Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
`_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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 transient 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

### OMGraphicAdapter

    protected OMGraphicAdapter()

  Construct a default OMGraphic.

### OMGraphicAdapter

    protected OMGraphicAdapter(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

### OMGraphicAdapter

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

  Specified by:
    `setRenderType` in interface `OMGraphic`
  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 interface `OMGraphic`
  Specified by:
    `getRenderType` in class `BasicGeometry`
  Returns:
    the rendertype of the object - RENDERTYPE_LATLON, RENDERTYPE_XY, RENDERTYPE_OFFSET and RENDERTYPE_UNKNOWN.

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

  Specified by:
    `setDeclutterType` in interface `OMGraphic`
  Parameters:
    `value` - the declutter type value.

### getDeclutterType

    public int getDeclutterType()

  Return the declutter type.

  Specified by:
    `getDeclutterType` in interface `OMGraphic`
  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.

  Specified by:
    `setGraphicsForEdge` in interface `OMGraphic`
  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.

  Specified by:
    `setGraphicsForFill` in interface `OMGraphic`
  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.

  Specified by:
    `setGraphicsColor` in interface `OMGraphic`
  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 (highlighted). 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.

  Specified by:
    `getLineColor` in interface `OMGraphic`
  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 (highlighted). The display Paint is set to the select Paint in this method if `selected` boolean attribute is false.

  Specified by:
    `setLinePaint` in interface `OMGraphic`
  Parameters:
    `paint` - the real line Paint

### getLinePaint

    public java.awt.Paint getLinePaint()

  Get the normal line Paint used for the graphic.

  Specified by:
    `getLinePaint` in interface `OMGraphic`
  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".

  Specified by:
    `getSelectColor` in interface `OMGraphic`
  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 (highlighted). The display Paint is set to the select Paint in this method if `selected` boolean attribute is true.

  Specified by:
    `setSelectPaint` in interface `OMGraphic`
  Parameters:
    `paint` - the real select Paint

### getSelectPaint

    public java.awt.Paint getSelectPaint()

  Get the normal select Paint used for the graphic.

  Specified by:
    `getSelectPaint` in interface `OMGraphic`
  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.

  Specified by:
    `getDisplayColor` in interface `OMGraphic`
  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.

  Specified by:
    `getDisplayPaint` in interface `OMGraphic`
  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`
  Specified by:
    `select` in interface `OMGraphic`
  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`
  Specified by:
    `deselect` in interface `OMGraphic`
  Overrides:
    `deselect` in class `BasicGeometry`

### isSelected

    public boolean isSelected()

  Return whether the OMGraphic is selected.

  Specified by:
    `isSelected` in interface `OMGraphic`

### setSelected

    public void setSelected(boolean set)

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

  Specified by:
    `setSelected` in interface `OMGraphic`

### isMatted

    public boolean isMatted()

  Return whether the OMGraphic has matting around the edge.

  Specified by:
    `isMatted` in interface `OMGraphic`

### setMatted

    public void setMatted(boolean set)

  Set whether the OMGraphic should have matting around the edge.

  Specified by:
    `setMatted` in interface `OMGraphic`

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

  Specified by:
    `getFillColor` in interface `OMGraphic`
  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.

  Specified by:
    `setFillPaint` in interface `OMGraphic`
  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.

  Specified by:
    `setTextureMask` in interface `OMGraphic`

### getFillPaint

    public java.awt.Paint getFillPaint()

  Return the fill Paint for this graphic.

  Specified by:
    `getFillPaint` in interface `OMGraphic`

### getTextureMask

    public java.awt.TexturePaint getTextureMask()

  Return the texture mask Paint for this graphic.

  Specified by:
    `getTextureMask` in interface `OMGraphic`

### setEdgeMatchesFill

    protected void setEdgeMatchesFill()

### getEdgeMatchesFill

    public boolean getEdgeMatchesFill()

### setMattingPaint

    public void setMattingPaint(java.awt.Paint mPaint)

  Set the Paint used for matting.

  Specified by:
    `setMattingPaint` in interface `OMGraphic`

### getMattingPaint

    public java.awt.Paint getMattingPaint()

  Get the Paint used for matting.

  Specified by:
    `getMattingPaint` in interface `OMGraphic`

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

  Specified by:
    `setStroke` in interface `OMGraphic`
  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.

  Specified by:
    `getStroke` in interface `OMGraphic`

### setShowEditablePalette

    public void setShowEditablePalette(boolean set)

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

  Specified by:
    `setShowEditablePalette` in interface `OMGraphic`

### getShowEditablePalette

    public boolean getShowEditablePalette()

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

  Specified by:
    `getShowEditablePalette` in interface `OMGraphic`

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

  Specified by:
    `normalizeDistanceForLineWidth` in interface `OMGraphic`
  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.

  Specified by:
    `render` in interface `OMGeometry`
  Overrides:
    `render` in class `BasicGeometry`
  Parameters:
    `g` - Graphics2D context to render into.

### renderShape

    protected void renderShape(java.awt.Graphics g)

  Called from render, just handles rendering of the java.awt.Shape of the OMGraphic, as it is currently stored in this OMGraphic.

  Parameters:
    `g` - java.awt.Graphics to render into.

### 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)

  Deprecated. use the version with the projection.

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

  Specified by:
    `setLabelLocation` in interface `OMGraphic`
  Parameters:
    `xpoints` -
    `ypoints` -

### setLabelLocation

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

  Deprecated. use the version with the projection.

  See Also:
    `setLabelLocation(int[], int[])`

### setLabelLocation

    protected void setLabelLocation(int[] xpoints,
                                    int[] ypoints,
                                    Projection proj)

  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.

  Parameters:
    `xpoints` - int[] describing the projected location of the OMGraphic.
    `ypoints` - int[] describing the projected location of the OMGraphic.
    `proj` - the current projection to do further evaluating of placement.

### setLabelLocation

    public void setLabelLocation(float[] xpoints,
                                 float[] ypoints,
                                 Projection proj)

  See Also:
    `setLabelLocation(int[], int[])`

### setLabelLocation

    public void setLabelLocation(java.awt.geom.Point2D p)

  Deprecated. use the version with Projection.

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

  Specified by:
    `setLabelLocation` in interface `OMGraphic`
  Parameters:
    `p` -

### setLabelLocation

    protected void setLabelLocation(java.awt.geom.Point2D p,
                                    Projection proj)

  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.

  Parameters:
    `p` - Point2D describing the projected location of the label.
    `proj` - the current projection to do further evaluating of placement.

### setLabelLocation

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

  Deprecated. use the version with the Projection

  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.

  Specified by:
    `setLabelLocation` in interface `OMGraphic`
  Parameters:
    `gp` - GeneralPath

### setLabelLocation

    protected void setLabelLocation(java.awt.geom.GeneralPath gp,
                                    Projection proj)

  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.

  Parameters:
    `gp` - GeneralPath describing the projected location of the OMGraphic.
    `proj` - the current projection to do further evaluating of placement.

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

  Specified by:
    `renderLabel` in interface `OMGraphic`
  Parameters:
    `g` -

### shouldRenderFill

    public boolean shouldRenderFill()

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

  Specified by:
    `shouldRenderFill` in interface `OMGraphic`

### shouldRenderEdge

    public boolean shouldRenderEdge()

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

  Specified by:
    `shouldRenderEdge` in interface `OMGraphic`

### distance

    public float distance(double x,
                          double 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`
  Specified by:
    `regenerate` in interface `OMGraphic`
  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

    public boolean hasLineTypeChoice()

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

  Specified by:
    `hasLineTypeChoice` in interface `OMGraphic`

### clone

    public java.lang.Object clone()

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

  Specified by:
    `clone` in interface `OMGraphic`
  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    Object cloned from this OMGraphic

### writeStroke

    protected void writeStroke(java.io.ObjectOutputStream oos,
                               java.awt.Stroke stroke,
                               java.awt.Stroke defStroke)
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

### writeTextureMask

    protected void writeTextureMask(java.io.ObjectOutputStream oos,
                                    java.awt.TexturePaint tMask)
                             throws java.io.IOException

  Will only write TexturePaint objects that are Serializable.

  Parameters:
    `oos` - the ObjectOutputStream to write on
    `tMask` - the TexturePaint mask
  Throws:
    `java.io.IOException`

### readStroke

    protected java.awt.Stroke readStroke(java.io.ObjectInputStream ois,
                                         java.awt.Stroke defStroke)
                                  throws java.lang.ClassNotFoundException,
                                         java.io.IOException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`

### readTextureMask

    protected java.awt.TexturePaint readTextureMask(java.io.ObjectInputStream ois)
                                             throws java.lang.ClassNotFoundException,
                                                    java.io.IOException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`

### restore

    public void restore(OMGeometry source)

  Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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