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

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphicAdapter
              com.bbn.openmap.omGraphics.OMList<OMGeometry>
                  com.bbn.openmap.omGraphics.OMGeometryList

All Implemented Interfaces:
  OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<OMGeometry>, java.util.Collection<OMGeometry>, java.util.List<OMGeometry>

Direct Known Subclasses:
  OMAreaList

    public class OMGeometryList

extends OMList<OMGeometry>
implements java.io.Serializable

This class encapsulates a List of OMGeometries. It's an OMGraphic, so it contains information on how to draw them. It's also a subclass to the OMGraphicList, and relies on many OMGraphicList methods.

The OMGeometryList assumes that all OMGeometries on it should be rendered the same - same fill color, same edge color and stroke, and will create one java.awt.Shape object from all the projected OMGeometries for more efficient rendering. If your individual OMGeometries have independent rendering characteristics, use the OMGraphicList and OMGraphics.

Because the OMGeometryList creates a single java.awt.Shape object for all of its contents, it needs to be generated() if an OMGeometry is added or removed from the list. If you don't regenerate the OMGeometryList, the list will iterate through its contents and render each piece separately.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList
`OMList.OMDist<T>`

Field Summary
`protected boolean` | `connectParts` Flag to mark that the parts should be connected, making this OMGeometryList a combination OMGraphic that sums disparate parts.

Fields inherited from class com.bbn.openmap.omGraphics.OMList
`allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague`

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
`OMGeometryList()` Construct an OMGeometryList.
`OMGeometryList(java.util.Collection<OMGeometry> c)`
`OMGeometryList(int initialCapacity)` Construct an OMGeometryList with an initial capacity.

Method Summary
`void` | `add(int index, OMGeometry element)`
`boolean` | `add(OMGeometry g)` Add an OMGeometry to the GraphicList.
`boolean` | `addAll(java.util.Collection<? extends OMGeometry> c)`
`boolean` | `addAll(int index, java.util.Collection<? extends OMGeometry> c)`
`boolean` | `addOMGraphic(OMGraphic omg)` For backward compatibility.
`void` | `clear()`
`OMList<OMGeometry>` | `create()`
`protected OMList.OMDist<OMGeometry>` | `createDist()`
`boolean` | `generate(Projection p, boolean forceProjectAll)` Prepare the geometries for rendering.
`OMGeometry` | `get(int index)`
`boolean` | `getConnectParts()` Get whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false).
`java.util.Iterator<OMGeometry>` | `iteratorCopy()` Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.
`java.util.ListIterator<OMGeometry>` | `listIteratorCopy()` Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.
`java.util.ListIterator<OMGeometry>` | `listIteratorCopy(int size)` Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.
`void` | `readGraphics(java.io.ObjectInputStream objstream)` Read a cache of OMGeometries, given a ObjectInputStream.
`OMGeometry` | `remove(int location)` Remove the geometry at the location number.
`boolean` | `remove(OMGeometry geometry)` Remove the geometry from the list.
`boolean` | `removeAll(java.util.Collection<?> c)`
`void` | `render(java.awt.Graphics gr)` Renders all the objects in the list a geometries context.
`void` | `renderAllAsSelected(java.awt.Graphics gr)` Renders all the objects in the list a geometry's context, in their 'selected' mode.
`protected void` | `renderGeometry(OMGeometry geometry, java.awt.Graphics gr)`
`boolean` | `retainAll(java.util.Collection<?> c)`
`OMGeometry` | `set(int index, OMGeometry geometry)` Set the geometry at the specified location.
`void` | `setConnectParts(boolean value)` Set whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false).
`protected java.awt.geom.GeneralPath` | `updateShape(java.awt.geom.GeneralPath currentShape, OMGeometry geometry, Projection p, boolean forceProject)` Given an OMGeometry, check its visibility and if visible, generate it if required and add the result to the provided current shape.
`protected void` | `updateShape(OMGeometry geometry, Projection p, boolean forceProject)` Deprecated. use the new paradigm from the other updateShape

Methods inherited from class com.bbn.openmap.omGraphics.OMList
`checkForDuplicate, contains, contains, containsAll, deselect, distance, doAction, findAll, findAll, findAllTest, findClosest, findClosest, findClosest, findClosestTest, findIndexOfClosest, findIndexOfClosest, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, objectToOMGraphic, project, project, remove, restore, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, sort, subList, toArray, toArray`

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`clone, 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, renderLabel, renderShape, 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, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.List
`equals, hashCode`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic
`clone, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, 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, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape`

Field Detail

### connectParts

    protected boolean connectParts

  Flag to mark that the parts should be connected, making this OMGeometryList a combination OMGraphic that sums disparate parts. False by default.

Constructor Detail

### OMGeometryList

    public OMGeometryList()

  Construct an OMGeometryList.

### OMGeometryList

    public OMGeometryList(int initialCapacity)

  Construct an OMGeometryList with an initial capacity.

  Parameters:
    `initialCapacity` - the initial capacity of the list

### OMGeometryList

    public OMGeometryList(java.util.Collection<OMGeometry> c)

Method Detail

### add

    public boolean add(OMGeometry g)

  Add an OMGeometry to the GraphicList. The OMGeometry must not be null.

  Specified by:
    `add` in interface `java.util.Collection<OMGeometry>`
  Specified by:
    `add` in interface `java.util.List<OMGeometry>`
  Overrides:
    `add` in class `OMList<OMGeometry>`
  Parameters:
    `g` - the non-null OMGeometry to add
  Throws:
    `java.lang.IllegalArgumentException` - if OMGeometry is null

### addOMGraphic

    public boolean addOMGraphic(OMGraphic omg)

  For backward compatibility.

  Parameters:
    `omg` -
  Returns:
    true if add was successful

### remove

    public boolean remove(OMGeometry geometry)

  Remove the geometry from the list.

  Parameters:
    `geometry` - the geometry to remove.
  Returns:
    true if geometry was on the list, false if otherwise.

### set

    public OMGeometry set(int index,
                          OMGeometry geometry)

  Set the geometry at the specified location. The OMGeometry must not be null.

  Specified by:
    `set` in interface `java.util.List<OMGeometry>`
  Parameters:
    `geometry` - OMGeometry
    `index` - index location of the OMGeometry placement.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if index is out-of-bounds

### remove

    public OMGeometry remove(int location)

  Remove the geometry at the location number.

  Specified by:
    `remove` in interface `java.util.List<OMGeometry>`
  Overrides:
    `remove` in class `OMList<OMGeometry>`
  Parameters:
    `location` - the location of the OMGeometry to remove

### render

    public void render(java.awt.Graphics gr)

  Renders all the objects in the list a geometries context. This is the same as `paint()` for AWT components. The geometries are rendered in the order of traverseMode. Any geometries where `isVisible()` returns false are not rendered.

  Specified by:
    `render` in interface `OMGeometry`
  Overrides:
    `render` in class `OMList<OMGeometry>`
  Parameters:
    `gr` - the AWT Graphics context

### renderGeometry

    protected void renderGeometry(OMGeometry geometry,
                                  java.awt.Graphics gr)

### renderAllAsSelected

    public void renderAllAsSelected(java.awt.Graphics gr)

  Renders all the objects in the list a geometry's context, in their 'selected' mode. This is the same as `paint()` for AWT components. The geometries are rendered in the order of traverseMode. Any geometries where `isVisible()` returns false are not rendered. All of the geometries on the list are returned to their deselected state.

  Overrides:
    `renderAllAsSelected` in class `OMList<OMGeometry>`
  Parameters:
    `gr` - the AWT Graphics context

### generate

    public boolean generate(Projection p,
                            boolean forceProjectAll)

  Prepare the geometries for rendering. This must be done before calling `render()`! This recursively calls generate() on the OMGeometries on the list.

  Overrides:
    `generate` in class `OMList<OMGeometry>`
  Parameters:
    `p` - a `Projection`
    `forceProjectAll` - if true, all the geometries on the list are generated with the new projection. If false they are only generated if getNeedToRegenerate() returns true
  Returns:
    true if generation was successful for all objects on list.
  See Also:
    `OMGeometry.generate(com.bbn.openmap.proj.Projection)`, `OMGeometry.regenerate(com.bbn.openmap.proj.Projection)`

### updateShape

    protected void updateShape(OMGeometry geometry,
                               Projection p,
                               boolean forceProject)

  Deprecated. use the new paradigm from the other updateShape

  Given a OMGeometry, it calls generate/regenerate on it, and then adds the GeneralPath shape within it to the OMGeometryList shape object. Calls setShape() with the new current shape, which is a synchronized method.

  Parameters:
    `geometry` - the geometry to append
    `p` - the current projection
    `forceProject` - flag to force re-generation

### updateShape

    protected java.awt.geom.GeneralPath updateShape(java.awt.geom.GeneralPath currentShape,
                                                    OMGeometry geometry,
                                                    Projection p,
                                                    boolean forceProject)

  Given an OMGeometry, check its visibility and if visible, generate it if required and add the result to the provided current shape. Does not call setShape().

  Parameters:
    `currentShape` - the current shape
    `geometry` - the geometry to test
    `p` - the current projection
    `forceProject` - flag to force regeneration
  Returns:
    the newly combined shape.

### readGraphics

    public void readGraphics(java.io.ObjectInputStream objstream)
                      throws java.io.IOException

  Read a cache of OMGeometries, given a ObjectInputStream.

  Parameters:
    `objstream` - ObjectInputStream of geometry list.
  Throws:
    `java.io.IOException`

### setConnectParts

    public void setConnectParts(boolean value)

  Set whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false).

### getConnectParts

    public boolean getConnectParts()

  Get whether the OMGeometries on the list should be connected to make a one-part shape object (if true), or a multi-part shape object (if false).

### iteratorCopy

    public java.util.Iterator<OMGeometry> iteratorCopy()

  Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.

### listIteratorCopy

    public java.util.ListIterator<OMGeometry> listIteratorCopy()

  Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.

### listIteratorCopy

    public java.util.ListIterator<OMGeometry> listIteratorCopy(int size)

  Returns a iterator of a shallow copy of the current list, to avoid concurrent modification exceptions if the list is being generated or rendered while the list is being reviewed for other reasons.

### create

    public OMList<OMGeometry> create()

  Specified by:
    `create` in class `OMList<OMGeometry>`

### createDist

    protected OMList.OMDist<OMGeometry> createDist()

  Specified by:
    `createDist` in class `OMList<OMGeometry>`

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Collection<OMGeometry>`
  Specified by:
    `clear` in interface `java.util.List<OMGeometry>`
  Overrides:
    `clear` in class `OMList<OMGeometry>`

### add

    public void add(int index,
                    OMGeometry element)

  Specified by:
    `add` in interface `java.util.List<OMGeometry>`
  Overrides:
    `add` in class `OMList<OMGeometry>`

### addAll

    public boolean addAll(java.util.Collection<? extends OMGeometry> c)

  Specified by:
    `addAll` in interface `java.util.Collection<OMGeometry>`
  Specified by:
    `addAll` in interface `java.util.List<OMGeometry>`

### addAll

    public boolean addAll(int index,
                          java.util.Collection<? extends OMGeometry> c)

  Specified by:
    `addAll` in interface `java.util.List<OMGeometry>`

### removeAll

    public boolean removeAll(java.util.Collection<?> c)

  Specified by:
    `removeAll` in interface `java.util.Collection<OMGeometry>`
  Specified by:
    `removeAll` in interface `java.util.List<OMGeometry>`
  Overrides:
    `removeAll` in class `OMList<OMGeometry>`

### retainAll

    public boolean retainAll(java.util.Collection<?> c)

  Specified by:
    `retainAll` in interface `java.util.Collection<OMGeometry>`
  Specified by:
    `retainAll` in interface `java.util.List<OMGeometry>`
  Overrides:
    `retainAll` in class `OMList<OMGeometry>`

### get

    public OMGeometry get(int index)

  Specified by:
    `get` in interface `java.util.List<OMGeometry>`

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