OMGeometry (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
Interface OMGeometry

All Known Subinterfaces:
  OMGraphic, TemporalOMGraphic

All Known Implementing Classes:
  BasicGeometry, 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, PolygonGeometry, PolygonGeometry.LL, PolygonGeometry.Offset, PolygonGeometry.XY, PolylineGeometry, PolylineGeometry.LL, PolylineGeometry.Offset, PolylineGeometry.XY, 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 OMGeometry

Base class of OpenMap OMGraphics geometry.

The geometry classes are intended to pull the object location data out of the OMGraphics. If you have a bunch of OMGraphics that are all rendered with common attributes, you can create a bunch of OMGeometry objects to plavce in a OMGeometryList that will render them all alike.

See Also:
  `OMGeometryList`, `Projection`

Method Summary
`void` | `clearAttributes()` Clear attributes from the OMGeometry.
`boolean` | `contains(double x, double y)` Answsers the question whether or not the OMGeometry contains the given pixel point.
`void` | `deselect()` Let the geometry object know that it is not selected.
`float` | `distance(double x, double y)` Return the shortest distance from the graphic to an XY-point.
`float` | `distanceToEdge(double x, double y)` Return the shortest distance from the edge of a geometry to an XY-point.
`void` | `draw(java.awt.Graphics g)` Paint the graphic.
`void` | `draw(java.awt.Graphics g, java.awt.Shape s)` Paint the graphic, as an outlined shape.
`void` | `fill(java.awt.Graphics g)` Paint the graphic.
`void` | `fill(java.awt.Graphics g, java.awt.Shape s)` Paint the graphic, as a filled shape.
`boolean` | `generate(Projection proj)` Prepare the geometry for rendering.
`java.lang.Object` | `getAppObject()` For backward compatibility, retrieves object stored in attribute map under OMGraphic.APP_OBJECT key.
`java.lang.Object` | `getAttribute(java.lang.Object key)` Get an attribute from an OMGeometry.
`java.util.Map<java.lang.Object,java.lang.Object>` | `getAttributes()` Get all attributes from the OMGeometry.
`java.lang.String` | `getDescription()` OMGeometry method for returning a simple description of itself, for debugging purposes.
`int` | `getLineType()` Return the line type.
`boolean` | `getNeedToRegenerate()` Return the regeneration status.
`int` | `getRenderType()` Return the render type.
`java.awt.geom.GeneralPath` | `getShape()` Get the java.awt.Shape object that represents the projected graphic.
`boolean` | `isRenderable()` Self-discovery of internal Shape object used for check, or implemented if a Shape object doesn't matter.
`boolean` | `isRenderable(java.awt.Shape s)` Shape object provided for Shape-readiness check.
`boolean` | `isVisible()` Get the visibility variable.
`void` | `putAttribute(java.lang.Object key, java.lang.Object value)` Set an attribute in an OMGeometry.
`boolean` | `regenerate(Projection proj)` Invoke this to regenerate a "dirty" graphic.
`java.lang.Object` | `removeAttribute(java.lang.Object key)` Remove an attribute from the OMGeometry.
`void` | `render(java.awt.Graphics g)` Paint the graphic.
`void` | `restore(OMGeometry source)` Replace the member variables of this OMGraphic with copies of member variables from another one.
`void` | `select()` Let the geometry object know that it is selected.
`void` | `setAppObject(java.lang.Object obj)` For backward compatibility, stores object in attribute map under OMGraphic.APP_OBJECT key.
`void` | `setAttributes(java.util.Map<java.lang.Object,java.lang.Object> attributes)` Set all attributes on the OMGeometry.
`void` | `setLineType(int value)` Set the line type for the graphic, which will affect how the lines will be drawn.
`void` | `setNeedToRegenerate(boolean value)` Sets the regenerate flag for the graphic.
`void` | `setShape(java.awt.geom.GeneralPath gp)` Set the java.awt.Shape object that represents the projected graphic.
`void` | `setVisible(boolean visible)` Set the visibility variable.

Method Detail

### setLineType

    void setLineType(int value)

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

  Parameters:
    `value` - the line type of the graphic.

### getLineType

    int getLineType()

  Return the line type.

  Returns:
    the linetype - LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_GREATCIRCLE or LINETYPE_UNKNOWN.

### getRenderType

    int getRenderType()

  Return the render type.

  Returns:
    the rendertype of the object - RENDERTYPE_LATLON, RENDERTYPE_XY, RENDERTYPE_OFFSET and RENDERTYPE_UNKNOWN.

### setNeedToRegenerate

    void setNeedToRegenerate(boolean value)

  Sets the regenerate flag for the graphic. This flag is used to determine if extra work needs to be done to prepare the object for rendering.

  Parameters:
    `value` - boolean

### getNeedToRegenerate

    boolean getNeedToRegenerate()

  Return the regeneration status.

  Returns:
    boolean

### setVisible

    void setVisible(boolean visible)

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

  Parameters:
    `visible` - boolean

### isVisible

    boolean isVisible()

  Get the visibility variable.

  Returns:
    boolean

### select

    void select()

  Let the geometry object know that it is selected. No action mandated.

### deselect

    void deselect()

  Let the geometry object know that it is not selected. No action mandated.

### setAppObject

    void setAppObject(java.lang.Object obj)

  For backward compatibility, stores object in attribute map under OMGraphic.APP_OBJECT key.

  Parameters:
    `obj` - Object

### getAppObject

    java.lang.Object getAppObject()

  For backward compatibility, retrieves object stored in attribute map under OMGraphic.APP_OBJECT key.

  Returns:
    Object

### putAttribute

    void putAttribute(java.lang.Object key,
                      java.lang.Object value)

  Set an attribute in an OMGeometry.

### getAttribute

    java.lang.Object getAttribute(java.lang.Object key)

  Get an attribute from an OMGeometry.

### removeAttribute

    java.lang.Object removeAttribute(java.lang.Object key)

  Remove an attribute from the OMGeometry.

### clearAttributes

    void clearAttributes()

  Clear attributes from the OMGeometry.

### setAttributes

    void setAttributes(java.util.Map<java.lang.Object,java.lang.Object> attributes)

  Set all attributes on the OMGeometry.

### getAttributes

    java.util.Map<java.lang.Object,java.lang.Object> getAttributes()

  Get all attributes from the OMGeometry.

### generate

    boolean generate(Projection proj)

  Prepare the geometry for rendering. This must be done before calling `render()`! If a vector graphic has lat-lon components, then we project these vertices into x-y space. For raster graphics we prepare in a different fashion.

  If the generate is unsuccessful, it's usually because of some oversight, (for instance if `proj` is null), and if debugging is enabled, a message may be output to the controlling terminal.

  Parameters:
    `proj` - Projection
  Returns:
    boolean true if successful, false if not.
  See Also:
    `regenerate(com.bbn.openmap.proj.Projection)`

### isRenderable

    boolean isRenderable()

  Self-discovery of internal Shape object used for check, or implemented if a Shape object doesn't matter.

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

### isRenderable

    boolean isRenderable(java.awt.Shape s)

  Shape object provided for Shape-readiness check.

  Parameters:
    `s` - Shape to check if ready for rendering
  Returns:
    true if the OMGeometry should be rendered - it's visible and the projected shape is created and reflects the current location settings of the geometry.

### render

    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 should not be rendered.

  It's expected that this method will call fill and draw, respectively.

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

### fill

    void fill(java.awt.Graphics g,
              java.awt.Shape s)

  Paint the graphic, as a filled shape. This method has been broken out of render as a way to allow OMGeometries to fine-tune their rendering process.

  This paints the graphic into the Graphics context. This is similar to `paint()` function of java.awt.Components. Note that if the graphic has not been generated or if it isn't visible, it will not be rendered.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.

  Parameters:
    `g` - Graphics2D context to render into.
    `s` - Shape object to use for fill.

### fill

    void fill(java.awt.Graphics g)

  Paint the graphic. This method has been broken out of render as a way to allow OMGeometries to fine-tune their rendering process.

  This paints the graphic into the Graphics context. This is similar to `paint()` function of java.awt.Components. Note that if the graphic has not been generated or if it isn't visible, it will not be rendered.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.

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

### draw

    void draw(java.awt.Graphics g,
              java.awt.Shape s)

  Paint the graphic, as an outlined shape. This method has been broken out of render as a way to allow OMGeometries to fine-tune their rendering process.

  This paints the graphic into the Graphics context. This is similar to `paint()` function of java.awt.Components. Note that if the graphic has not been generated or if it isn't visible, it will not be rendered.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.

  Parameters:
    `g` - Graphics2D context to render into.
    `s` - Shape object to use for drawing.

### draw

    void draw(java.awt.Graphics g)

  Paint the graphic. This method has been broken out of render as a way to allow OMGeometries to fine-tune their rendering process.

  This paints the graphic into the Graphics context. This is similar to `paint()` function of java.awt.Components. Note that if the graphic has not been generated or if it isn't visible, it will not be rendered.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own render method.

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

### distance

    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 OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own distance method.

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

### distanceToEdge

    float distanceToEdge(double x,
                         double y)

  Return the shortest distance from the edge of a geometry to an XY-point.

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

### contains

    boolean contains(double x,
                     double y)

  Answsers the question whether or not the OMGeometry contains the given pixel point.

  This method used to be abstract, but with the conversion of OMGeometrys to internally represent themselves as java.awt.Shape objects, it's a more generic method. If the OMGeometry hasn't been updated to use Shape objects, it should have its own contains method.

  This method duplicates a java.awt.Shape method, with some protection wrapped around it. If you have other queries for the internal Shape object, just ask for it and then ask it directly. This method is provided because it is the most useful, used when determining if a mouse event is occurring over an object on the map.

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

### regenerate

    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.

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

### getShape

    java.awt.geom.GeneralPath getShape()

  Get the java.awt.Shape object that represents the projected graphic.

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

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

### setShape

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

  Set the java.awt.Shape object that represents the projected graphic. Ideally, the OMGeometry will set this internally. This method is provided to clear out the object to save memory, or to allow manipulations if the situation dictates.

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

  Parameters:
    `gp` - java.awt.geom.GeneralPath (Shape), or null if the graphic needs to be cleared or regenerated.

### getDescription

    java.lang.String getDescription()

  OMGeometry method for returning a simple description of itself, for debugging purposes.

### restore

    void restore(OMGeometry source)

  Replace the member variables of this OMGraphic with copies of member variables from another one.

  Parameters:
    `source` -

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