com.bbn.openmap.omGraphics
Interface OMGraphic

All Superinterfaces:
java.lang.Cloneable, OMGeometry, OMGraphicConstants
All Known Subinterfaces:
TemporalOMGraphic
All Known Implementing Classes:
BasicLocation, ByteRasterLocation, ContainerGraphic, CustomGraphic, DTEDCoverageManager, ErrImageTile, EsriGraphicList, EsriIconPoint, EsriPoint, EsriPointList, EsriPolygon, EsriPolygonList, EsriPolygonM, EsriPolygonMList, EsriPolygonZ, EsriPolygonZList, EsriPolyline, EsriPolylineList, EsriPolylineM, EsriPolylineMList, EsriPolylineZ, EsriPolylineZList, EsriTextPoint, FeatureCacheGraphicList, FeatureCacheGraphicList.AREA, FeatureCacheGraphicList.DEFAULT, FeatureCacheGraphicList.EDGE, FeatureCacheGraphicList.POINT, FeatureCacheGraphicList.TEXT, GLPoint, GrabPoint, HorizontalGrabPoint, ImageTile, Intersection.Graphic, LabeledOMPoly, LabeledOMSpline, Line, Link, LinkOMGraphicList, Location, MIFPoint, MIFText, Node, OffsetGrabPoint, OMAbstractLine, OMArc, OMAreaList, OMBitmap, OMCircle, OMColdSurfaceFront, OMDecoratedSpline, OMDistance, OMDTEDGrid, OMEllipse, OMGeo, OMGeo.Line, OMGeo.Polygon, OMGeo.Polyline, OMGeo.Pt, OMGeometryList, OMGraphicAdapter, OMGraphicHash, OMGraphicList, OMGrid, OMHotSurfaceFront, OMLine, OMList, OMOcclusion, OMPoint, OMPoint.Image, OMPoly, OMRangeRings, OMRaster, OMRasterObject, OMRect, OMScalingIcon, OMScalingRaster, OMShape, OMShape.PROJECTED, OMSpline, OMSubtraction, OMText, OMTextLabeler, OMWarpingImage, PathGLPoint, RoadFinder.BlueLine, RoadFinder.RedPoint, RoadFinder.YellowLine, RoadFinder.YellowPoint, RoadLine.Graphic, RoadPoint.Graphic, RpfCoverage, RpfCoverage.RpfCoverageControl, SinkGraphic, TemporalOMGraphicList, TemporalOMPoint, TemporalOMScalingIcon, TimelineLayer.CurrentTimeMarker, TimelineLayer.EventMarkerLine, TimelineLayer.PlayFilter, TimelineLayer.SelectionArea, TimelineLayer.SelectionArea.PlayFilterSection, TimelineLayer.SelectionArea.PostTime, TimelineLayer.SelectionArea.PreTime, TimelineLayer.SelectionArea.RatingArea, TimelineLayer.TimeHashMarks, TimelineLayer.TimeHashMarks.Days, TimelineLayer.TimeHashMarks.Hours, TimelineLayer.TimeHashMarks.Minutes, TimelineLayer.TimeHashMarks.Seconds, TimelineLayer.TimeHashMarks.Years, TimeSliderLayer.TimeDrape, TX7, URLRasterLocation, VerticalGrabPoint, Waypoint.Graphic

public interface OMGraphic
extends OMGeometry, OMGraphicConstants, java.lang.Cloneable

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:

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

Field Summary
 
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
 
Method Summary
 java.lang.Object clone()
          To support clone operations.
 void deselect()
          Set the selected attribute to false, sets the color to the line color.
 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.
 java.awt.Color getFillColor()
          Return the background color of the graphic object.
 java.awt.Paint getFillPaint()
          Return the fill Paint for this graphic.
 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.
 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 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.
 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.
 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.geom.Point2D p)
          Sets the label location at the given point.
 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 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).
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
clearAttributes, contains, distance, distanceToEdge, draw, draw, fill, fill, generate, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, render, restore, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible
 

Method Detail

setRenderType

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

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.

setDeclutterType

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

int getDeclutterType()
Return the declutter type.

Returns:
declutter type, see above.

setGraphicsForEdge

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

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

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

getLineColor

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

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.

Parameters:
paint - the real line Paint

getLinePaint

java.awt.Paint getLinePaint()
Get the normal line Paint used for the graphic.

Returns:
Line Paint.

getSelectColor

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

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.

Parameters:
paint - the real select Paint

getSelectPaint

java.awt.Paint getSelectPaint()
Get the normal select Paint used for the graphic.

Returns:
Select Paint.

getDisplayColor

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

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

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

Specified by:
select in interface OMGeometry

deselect

void deselect()
Set the selected attribute to false, sets the color to the line color.

Specified by:
deselect in interface OMGeometry

isSelected

boolean isSelected()
Return whether the OMGraphic is selected.


setSelected

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


isMatted

boolean isMatted()
Return whether the OMGraphic has matting around the edge.


setMatted

void setMatted(boolean set)
Set whether the OMGraphic should have matting around the edge.


getFillColor

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

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

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

java.awt.Paint getFillPaint()
Return the fill Paint for this graphic.


getTextureMask

java.awt.TexturePaint getTextureMask()
Return the texture mask Paint for this graphic.


setMattingPaint

void setMattingPaint(java.awt.Paint mPaint)
Set the Paint used for matting.


getMattingPaint

java.awt.Paint getMattingPaint()
Get the Paint used for matting.


setStroke

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

java.awt.Stroke getStroke()
Get the Stroke used for the graphic edge.


setShowEditablePalette

void setShowEditablePalette(boolean set)
Set whether an EditableOMGraphic modifying this graphic should show it's palette.


getShowEditablePalette

boolean getShowEditablePalette()
Get whether an EditableOMGraphic modifying this graphic should show it's palette.


normalizeDistanceForLineWidth

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.

setLabelLocation

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

void setLabelLocation(java.awt.geom.Point2D p)
Sets the label location at the given point. If the hasLabel variable hasn't been set, it no-ops.

Parameters:
p -

setLabelLocation

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

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

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


shouldRenderEdge

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


regenerate

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:
OMGeometry.generate(com.bbn.openmap.proj.Projection)

hasLineTypeChoice

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


clone

java.lang.Object clone()
To support clone operations. Might not be implemented to the depth desired.

Returns:
Object cloned from this OMGraphic


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