OMRect (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 OMRect

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

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

Direct Known Subclasses:
  TimelineLayer.SelectionArea, TimeSliderLayer.TimeDrape, Waypoint.Graphic

    public class OMRect

extends OMGraphicAdapter
implements OMGraphic

Graphic type that lets you draw four-sided polygons that have corners that share coordinates or window points.

### NOTE:

See the RESTRICTIONS on Lat/Lon polygons/polylines which apply to rectangles as well. Not following the guidelines listed may result in ambiguous/undefined shapes! Similar assumptions apply to the other vector graphics that we define: circles, ellipses, polys, lines.

These assumptions are virtually the same as those on the more generic OMPoly graphic type.

See Also:
  `OMPoly`, Serialized Form

Field Summary
`protected double` | `lat1` Latitude of first corner, decimal degrees.
`protected double` | `lat2` Latitude of second corner, decimal degrees.
`protected double` | `lon1` Longitude of first corner, decimal degrees.
`protected double` | `lon2` Longitude of second corner, decimal degrees.
`protected int` | `nsegs` Number of segments to draw (used only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB lines).
`protected int` | `x1` Horizontal window position of first corner, in pixels from left side of window.
`protected int` | `x2` Horizontal window position of second corner, in pixels from left side of window.
`protected int` | `y1` Vertical window position of first corner, in pixels from the top of the window.
`protected int` | `y2` Vertical window position of second corner, in pixels from the top of the window.

Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask`

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
`OMRect()` Default constructor, waiting to be filled.
`OMRect(double lt1, double ln1, double lt2, double ln2, int lType)` Create a lat/lon rectangle.
`OMRect(double lt1, double ln1, double lt2, double ln2, int lType, int nsegs)` Create a lat/lon rectangle.
`OMRect(double lt1, double ln1, int px1, int py1, int px2, int py2)` Construct an XY rectangle relative to a lat/lon point (RENDERTYPE_OFFSET).
`OMRect(int px1, int py1, int px2, int py2)` Construct an XY rectangle.

Method Summary
`boolean` | `generate(Projection proj)` Prepare the rectangle for rendering.
`int` | `getBottom()` Get the bottom of XY rectangle.
`double` | `getEastLon()` Get the longitude of the east edge in a LatLon rectangle.
`int` | `getLeft()` Get the left of XY rectangle.
`double` | `getNorthLat()` Get the latitude of the north edge in a LatLon rectangle.
`int` | `getNumSegs()` Get the number of segments of the lat/lon lines.
`int` | `getRight()` Get the right of XY rectangle.
`double` | `getSouthLat()` Get the latitude of the south edge in a LatLon rectangle.
`int` | `getTop()` Get the top of XY rectangle.
`double` | `getWestLon()` Get the longitude of the west edge in a LatLon rectangle.
`void` | `restore(OMGeometry source)` Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
`void` | `setLocation(double lt1, double ln1, double lt2, double ln2, int lType)` Set a lat/lon rectangle.
`void` | `setLocation(double lt1, double ln1, int px1, int py1, int px2, int py2)` Set an XY rectangle relative to a lat/lon point (RENDERTYPE_OFFSET).
`void` | `setLocation(int px1, int py1, int px2, int py2)` Set an XY rectangle.
`void` | `setNumSegs(int nsegs)` Set the number of segments of the lat/lon lines.

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`clone, deselect, distance, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, render, renderLabel, renderShape, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill, writeStroke, writeTextureMask`

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.OMGraphic
`clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
`clearAttributes, contains, distance, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, render, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible`

Field Detail

### x1

    protected int x1

  Horizontal window position of first corner, in pixels from left side of window.

### y1

    protected int y1

  Vertical window position of first corner, in pixels from the top of the window.

### lat1

    protected double lat1

  Latitude of first corner, decimal degrees.

### lon1

    protected double lon1

  Longitude of first corner, decimal degrees.

### x2

    protected int x2

  Horizontal window position of second corner, in pixels from left side of window.

### y2

    protected int y2

  Vertical window position of second corner, in pixels from the top of the window.

### lat2

    protected double lat2

  Latitude of second corner, decimal degrees.

### lon2

    protected double lon2

  Longitude of second corner, decimal degrees.

### nsegs

    protected int nsegs

  Number of segments to draw (used only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB lines).

Constructor Detail

### OMRect

    public OMRect()

  Default constructor, waiting to be filled.

### OMRect

    public OMRect(double lt1,
                  double ln1,
                  double lt2,
                  double ln2,
                  int lType)

  Create a lat/lon rectangle.

  Parameters:
    `lt1` - latitude of north edge, decimal degrees.
    `ln1` - longitude of west edge, decimal degrees.
    `lt2` - latitude of south edge, decimal degrees.
    `ln2` - longitude of east edge, decimal degrees.
    `lType` - line type - see OMGraphic.lineType.

### OMRect

    public OMRect(double lt1,
                  double ln1,
                  double lt2,
                  double ln2,
                  int lType,
                  int nsegs)

  Create a lat/lon rectangle.

  Parameters:
    `lt1` - latitude of north edge, decimal degrees.
    `ln1` - longitude of west edge, decimal degrees.
    `lt2` - latitude of south edge, decimal degrees.
    `ln2` - longitude of east edge, decimal degrees.
    `lType` - line type - see OMGraphic.lineType.
    `nsegs` - number of segment points (only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types, and if < 1, this value is generated internally)

### OMRect

    public OMRect(int px1,
                  int py1,
                  int px2,
                  int py2)

  Construct an XY rectangle. It doesn't matter which corners of the rectangle are used, as long as they are opposite from each other.

  Parameters:
    `px1` - x pixel position of the first corner relative to the window origin
    `py1` - y pixel position of the first corner relative to the window origin
    `px2` - x pixel position of the second corner relative to the window origin
    `py2` - y pixel position of the second corner relative to the window origin

### OMRect

    public OMRect(double lt1,
                  double ln1,
                  int px1,
                  int py1,
                  int px2,
                  int py2)

  Construct an XY rectangle relative to a lat/lon point (RENDERTYPE_OFFSET). It doesn't matter which corners of the rectangle are used, as long as they are opposite from each other.

  Parameters:
    `lt1` - latitude of the reference point, decimal degrees.
    `ln1` - longitude of the reference point, decimal degrees.
    `px1` - x pixel position of the first corner relative to the reference point
    `py1` - y pixel position of the first corner relative to the reference point
    `px2` - x pixel position of the second corner relative to the reference point
    `py2` - y pixel position of the second corner relative to the reference point

Method Detail

### setLocation

    public void setLocation(double lt1,
                            double ln1,
                            double lt2,
                            double ln2,
                            int lType)

  Set a lat/lon rectangle.

  Parameters:
    `lt1` - latitude of north edge, decimal degrees.
    `ln1` - longitude of west edge, decimal degrees.
    `lt2` - latitude of south edge, decimal degrees.
    `ln2` - longitude of east edge, decimal degrees.
    `lType` - line type - see OMGraphic.lineType.

### setLocation

    public void setLocation(int px1,
                            int py1,
                            int px2,
                            int py2)

  Set an XY rectangle. It doesn't matter which corners of the rectangle are used, as long as they are opposite from each other.

  Parameters:
    `px1` - x pixel position of the first corner relative to the window origin
    `py1` - y pixel position of the first corner relative to the window origin
    `px2` - x pixel position of the second corner relative to the window origin
    `py2` - y pixel position of the second corner relative to the window origin

### setLocation

    public void setLocation(double lt1,
                            double ln1,
                            int px1,
                            int py1,
                            int px2,
                            int py2)

  Set an XY rectangle relative to a lat/lon point (RENDERTYPE_OFFSET). It doesn't matter which corners of the rectangle are used, as long as they are opposite from each other.

  Parameters:
    `lt1` - latitude of the reference point, decimal degrees.
    `ln1` - longitude of the reference point, decimal degrees.
    `px1` - x pixel position of the first corner relative to the reference point
    `py1` - y pixel position of the first corner relative to the reference point
    `px2` - x pixel position of the second corner relative to the reference point
    `py2` - y pixel position of the second corner relative to the reference point

### getNorthLat

    public double getNorthLat()

  Get the latitude of the north edge in a LatLon rectangle. It also happens to be the latitude of the offset point.

  Returns:
    float latitude

### getWestLon

    public double getWestLon()

  Get the longitude of the west edge in a LatLon rectangle. It also happens to be the longitude of the offset point.

  Returns:
    float longitude

### getSouthLat

    public double getSouthLat()

  Get the latitude of the south edge in a LatLon rectangle.

  Returns:
    float latitude

### getEastLon

    public double getEastLon()

  Get the longitude of the east edge in a LatLon rectangle.

  Returns:
    float longitude

### getTop

    public int getTop()

  Get the top of XY rectangle.

  Returns:
    int

### getLeft

    public int getLeft()

  Get the left of XY rectangle.

  Returns:
    int

### getBottom

    public int getBottom()

  Get the bottom of XY rectangle.

  Returns:
    int

### getRight

    public int getRight()

  Get the right of XY rectangle.

  Returns:
    int

### setNumSegs

    public void setNumSegs(int nsegs)

  Set the number of segments of the lat/lon lines. (This is only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types, and if < 1, this value is generated internally).

  Parameters:
    `nsegs` - number of segment points

### getNumSegs

    public int getNumSegs()

  Get the number of segments of the lat/lon lines. (This is only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types).

  Returns:
    int number of segment points

### generate

    public boolean generate(Projection proj)

  Prepare the rectangle for rendering.

  Specified by:
    `generate` in interface `OMGeometry`
  Specified by:
    `generate` in class `OMGraphicAdapter`
  Parameters:
    `proj` - Projection
  Returns:
    true if generate was successful
  See Also:
    `OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)`

### restore

    public void restore(OMGeometry source)

  Description copied from class: `OMGraphicAdapter`
  Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.

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

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