OMList (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 OMList<T extends OMGeometry>

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

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

Direct Known Subclasses:
  OMGeometryList, OMGraphicList

    public abstract class OMList<T extends OMGeometry>

extends OMGraphicAdapter
implements java.util.List<T>, OMGraphic

This class encapsulates a List of OMGraphics.

There are several things that this list does that make it better that any ol' List. You can make several common OMGraphic modification calls on the list, and the list handles the iteration and changing of all the graphics while taking into account a traverse order.

An additional benefit is that because the OMGraphicList extends OMGraphic it can contain other instances of OMGraphicList. This way you can manage groupings of graphics, (for instance, an OMGraphicList of OMGraphicLists which each have an OMRaster and OMText).

Many methods, such as generate() and findClosest() traverse the items in the GraphicsList recursively. The direction that the list is traversed is controlled by then traverseMode variable. The traverseMode mode lets you set whether the first or last object added to the list (FIRST_ADDED_ON_TOP or LAST_ADDED_ON_TOP) is drawn on top of the list and considered first for searches.

See Also:
  Serialized Form

Nested Class Summary
`protected static class` | `OMList.OMDist<T>` RetVal for closest object/distance calculations.

Field Summary
`protected boolean` | `allowDuplicates` Flag used to allow duplicates in the OMGraphicList.
`static int` | `FIRST_ADDED_ON_TOP` Used to set the order in which the list is traversed to draw or search the objects.
`protected java.util.List<T>` | `graphics` The List that actually contains the the OMGeometry/OMGraphic objects.
`static int` | `LAST_ADDED_ON_TOP` Used to set the order in which the list is traversed to draw or search the objects.
`static int` | `NONE` Used for searches, when OMDist doesn't have a graphic.
`protected boolean` | `processAllGeometries` Override flag for shouldProcess method.
`protected int` | `traverseMode` List traversal mode.
`protected boolean` | `vague` Flag to adjust behavior of OMGraphicList for certain queries.

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
`OMList()` Construct an OMGraphicList.
`OMList(int initialCapacity)`

Method Summary
`void` | `add(int index, T g)`
`boolean` | `add(T g)` Add an OMGraphic to the list.
`protected void` | `checkForDuplicate(T g)` Convenience function for methods that may add a OMGraphic.
`void` | `clear()`
`boolean` | `contains(java.lang.Object o)`
`boolean` | `contains(OMGraphic g)` Checks if an OMGraphic is on this list.
`boolean` | `containsAll(java.util.Collection<?> c)`
`abstract OMList<T>` | `create()`
`protected abstract OMList.OMDist<T>` | `createDist()`
`void` | `deselect()` If you call deselect() on an OMGraphicList, it calls deselect() all the graphics it contains, as well as the deselect method on it's super class.
`float` | `distance(double x, double y)` Finds the distance to the closest OMGraphic.
`void` | `doAction(T graphic, OMAction action)` Perform an action on the provided geometry.
`OMList<T>` | `findAll(int x, int y, float limit)` Find all of the OMGraphics on this list that are located within the pixel limit of the x, y pixel location.
`OMList<T>` | `findAll(int x, int y, float limit, boolean resetSelect, OMList<T> addTo)` Find all of the OMGraphics on this list that are located within the pixel limit of the x, y pixel location.
`protected boolean` | `findAllTest(int x, int y, float limit, boolean resetSelect, OMList<T> addTo, OMGeometry geometry, OMList.OMDist<T> omd)` Test to find out if an OMGraphic is located within the pixel limit of the x, y pixel location.
`T` | `findClosest(double x, double y, float limit)` Finds the object located the closest to the point, if the object distance away is within the limit.
`OMList.OMDist<T>` | `findClosest(double x, double y, float limit, boolean resetSelect)` Find the closest Object and its distance.
`T` | `findClosest(int x, int y)` Finds the object located the closest to the point, regardless of how far away it is.
`protected OMList.OMDist<T>` | `findClosestTest(OMList.OMDist<T> current, int index, OMGeometry graphic, double x, double y, float limit, boolean resetSelect)` Test the graphic distance away from the x, y point, and compare it to the current OMDist passed in.
`int` | `findIndexOfClosest(int x, int y)` Finds the object located the closest to the point, regardless of how far away it is.
`int` | `findIndexOfClosest(int x, int y, float limit)` Finds the object located the closest to the point, if the object distance away is within the limit.
`boolean` | `generate(Projection p)` Prepare the graphics for rendering.
`boolean` | `generate(Projection p, boolean forceProjectAll)` Prepare the graphics for rendering.
`boolean` | `getAllowDuplicates()` Get whether the list will allow duplicate entries added.
`T` | `getContains(int x, int y)` Finds the first OMGraphic (the one on top) that is under this pixel.
`java.util.List<T>` | `getCopy()`
`java.lang.String` | `getDescription()` OMGraphicList method for returning a simple description of the list.
`java.lang.String` | `getDescription(int level)` OMGraphic method, for returning a simple description if the contents of the list.
`boolean` | `getProcessAllGeometries()` Get the settings for the programmatic override for shouldProcess method to always process geometries.
`int` | `getTraverseMode()` Get the order in which the list is traversed to draw or search the objects.
`int` | `indexOf(java.lang.Object o)`
`boolean` | `isEmpty()`
`boolean` | `isVague()` Get whether the list returns the specific OMGraphic in response to a query, or itself.
`boolean` | `isVisible()` Get the visibility variable.
`java.util.Iterator<T>` | `iterator()`
`int` | `lastIndexOf(java.lang.Object o)`
`java.util.ListIterator<T>` | `listIterator()`
`java.util.ListIterator<T>` | `listIterator(int size)`
`void` | `moveIndexedOneToBack(int location)` Moves the graphic at the given index toward the back of the list by one spot, sliding the other graphic up on in the list in order.
`void` | `moveIndexedOneToBottom(int location)` Moves the graphic at the given index to the part of the list where it will be drawn under one of the other graphics, its neighbor on the list.
`void` | `moveIndexedOneToFront(int location)` Moves the graphic at the given index toward the front of the list by one spot, sliding the other graphic back on in the list in order.
`void` | `moveIndexedOneToTop(int location)` Moves the graphic at the given index to the part of the list where it will be drawn on top of one of the other graphics which is its neighbor on the list.
`void` | `moveIndexedToBottom(int location)` Moves the graphic at the given index to the part of the list where it will be drawn under all of the other graphics.
`void` | `moveIndexedToFirst(int location)` Moves the graphic at the given index to the front of the list, sliding the other graphics back on in the list in order.
`void` | `moveIndexedToLast(int location)` Moves the graphic at the given index to the end of the list, sliding the other graphics up on in the list in order.
`void` | `moveIndexedToTop(int location)` Moves the graphic at the given index to the part of the list where it will be drawn on top of the other graphics.
`protected OMGraphic` | `objectToOMGraphic(java.lang.Object obj)` Convenience method to cast an object to an OMGraphic if it is one.
`void` | `project(Projection p)` Projects any graphics needing projection.
`void` | `project(Projection p, boolean forceProjectAll)` Projects the OMGraphics on the list.
`T` | `remove(int index)`
`boolean` | `remove(java.lang.Object geometry)` Remove the graphic.
`boolean` | `removeAll(java.util.Collection<?> c)`
`void` | `render(java.awt.Graphics gr)` Renders all the objects in the list a graphics context.
`void` | `renderAllAsSelected(java.awt.Graphics gr)` Renders all the objects in the list a graphics context, in their 'selected' mode.
`void` | `restore(OMGeometry source)` You need to make sure that the Generic type of the source matches the generic type of this list.
`boolean` | `retainAll(java.util.Collection<?> c)`
`void` | `select()` Calls select() on all the items on the graphic list, as well as select() on the super class.
`T` | `selectClosest(int x, int y)` Finds the object located the closest to the coordinates, regardless of how far away it is.
`T` | `selectClosest(int x, int y, float limit)` Finds the object located the closest to the point, if the object distance away is within the limit, and sets the paint of that graphic to its select paint.
`protected OMList.OMDist<T>` | `selectClosestTest(OMList.OMDist<T> current, int index, OMGeometry graphic, int x, int y, float limit)` A variation on findClosestTest, manages select() and deselect().
`void` | `setAllowDuplicates(boolean set)` Set whether the list will allow duplicate entries added.
`void` | `setProcessAllGeometries(boolean set)` Set the programmatic override for shouldProcess method to always process geometries.
`void` | `setTraverseMode(int mode)` Set the order in which the list is traversed to draw or search the objects.
`void` | `setVague(boolean value)` Set whether the list returns the specific OMGraphic in response to a query, or itself.
`void` | `setVisible(boolean visible)` Set the visibility variable.
`protected boolean` | `shouldProcess(OMGeometry graphic)` This method is called internally for those methods where skipping invisible OMGeometries would save processing time and effort.
`int` | `size()`
`void` | `sort()` This sort method is a place-holder for OMGraphicList extensions to implement their own particular criteria for sorting an OMGraphicList.
`java.util.List<T>` | `subList(int fromIndex, int toIndex)`
`java.lang.Object[]` | `toArray()`
`
`<E> E[]`
` | `toArray(E[] a)`

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
`addAll, addAll, equals, get, hashCode, set`

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

### LAST_ADDED_ON_TOP

    public static final transient int LAST_ADDED_ON_TOP

  Used to set the order in which the list is traversed to draw or search the objects. This means that the last things on the list will be on top of the map because they are drawn last, on top of everything else. For searches, objects added last to the list will be considered first for a search match.

  See Also:
    Constant Field Values

### FIRST_ADDED_ON_TOP

    public static final transient int FIRST_ADDED_ON_TOP

  Used to set the order in which the list is traversed to draw or search the objects. This means that the first things on the list will appear on top because they are drawn last, on top of everything else. For searches, objects added first to the list will be considered first for a search match. This is the default mode for the list.

  See Also:
    Constant Field Values

### NONE

    public static final int NONE

  Used for searches, when OMDist doesn't have a graphic. The index of a null graphic is NONE. If you try to remove or insert a graphic at NONE, an exception will be thrown. If you try to get a graphic at NONE, you'll get null;

  See Also:
    Constant Field Values

### traverseMode

    protected int traverseMode

  List traversal mode. The default is FIRST_ADDED_ON_TOP.

### vague

    protected boolean vague

  Flag to adjust behavior of OMGraphicList for certain queries. If OMGraphicList should act as OMGraphic, the entire list will be treated as one object. Otherwise, the list will act as a pass-through container, and internal OMGraphics will be returned. This applies to distance(), selectClosest(), findClosest(), getOMGraphicThatContains(), etc. This flag becomes really helpful for embedded OMGraphicLists, not so much for top-level OMGraphicLists.

### allowDuplicates

    protected boolean allowDuplicates

  Flag used to allow duplicates in the OMGraphicList. True by default - this prevents the list from doing the extra work for checking for duplicates at addition time.

### graphics

    protected java.util.List<T extends OMGeometry> graphics

  The List that actually contains the the OMGeometry/OMGraphic objects.

### processAllGeometries

    protected boolean processAllGeometries

  Override flag for shouldProcess method. The setting will override the OMGraphicList from using the OMGraphic's visibility settings in determining which OMGraphics should be used in different distance, generate and render methods.

Constructor Detail

### OMList

    public OMList()

  Construct an OMGraphicList.

### OMList

    public OMList(int initialCapacity)

Method Detail

### getDescription

    public java.lang.String getDescription()

  OMGraphicList method for returning a simple description of the list. This is really a debugging method.

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

### getDescription

    public java.lang.String getDescription(int level)

  OMGraphic method, for returning a simple description if the contents of the list. This method handles the spacing of sub-member descriptions. This is really a debugging method.

  Returns:
    String that represents the structure of the OMGraphicList.

### setVague

    public void setVague(boolean value)

  Set whether the list returns the specific OMGraphic in response to a query, or itself.

### isVague

    public boolean isVague()

  Get whether the list returns the specific OMGraphic in response to a query, or itself.

### iterator

    public java.util.Iterator<T> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<T extends OMGeometry>`
  Specified by:
    `iterator` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `iterator` in interface `java.util.List<T extends OMGeometry>`

### listIterator

    public java.util.ListIterator<T> listIterator()

  Specified by:
    `listIterator` in interface `java.util.List<T extends OMGeometry>`

### listIterator

    public java.util.ListIterator<T> listIterator(int size)

  Specified by:
    `listIterator` in interface `java.util.List<T extends OMGeometry>`

### subList

    public java.util.List<T> subList(int fromIndex,
                                     int toIndex)

  Specified by:
    `subList` in interface `java.util.List<T extends OMGeometry>`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `size` in interface `java.util.List<T extends OMGeometry>`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `isEmpty` in interface `java.util.List<T extends OMGeometry>`

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `clear` in interface `java.util.List<T extends OMGeometry>`

### indexOf

    public int indexOf(java.lang.Object o)

  Specified by:
    `indexOf` in interface `java.util.List<T extends OMGeometry>`

### lastIndexOf

    public int lastIndexOf(java.lang.Object o)

  Specified by:
    `lastIndexOf` in interface `java.util.List<T extends OMGeometry>`

### removeAll

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

  Specified by:
    `removeAll` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `removeAll` in interface `java.util.List<T extends OMGeometry>`

### retainAll

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

  Specified by:
    `retainAll` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `retainAll` in interface `java.util.List<T extends OMGeometry>`

### contains

    public boolean contains(java.lang.Object o)

  Specified by:
    `contains` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `contains` in interface `java.util.List<T extends OMGeometry>`

### containsAll

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

  Specified by:
    `containsAll` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `containsAll` in interface `java.util.List<T extends OMGeometry>`

### add

    public boolean add(T g)

  Add an OMGraphic to the list.

  Specified by:
    `add` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `add` in interface `java.util.List<T extends OMGeometry>`

### add

    public void add(int index,
                    T g)

  Specified by:
    `add` in interface `java.util.List<T extends OMGeometry>`

### toArray

    public java.lang.Object[] toArray()

  Specified by:
    `toArray` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `toArray` in interface `java.util.List<T extends OMGeometry>`

### toArray

    public <E> E[] toArray(E[] a)

  Specified by:
    `toArray` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `toArray` in interface `java.util.List<T extends OMGeometry>`

### setTraverseMode

    public void setTraverseMode(int mode)

  Set the order in which the list is traversed to draw or search the objects. The possible modes for the list are FIRST_ADDED_ON_TOP or LAST_ADDED_ON_TOP.

  Parameters:
    `mode` - traversal mode

### getTraverseMode

    public int getTraverseMode()

  Get the order in which the list is traversed to draw or search the objects. The possible modes for the list are FIRST_ADDED_ON_TOP or LAST_ADDED_ON_TOP.

  Returns:
    int traversal mode

### remove

    public boolean remove(java.lang.Object geometry)

  Remove the graphic. If this list is not vague, it will also ask sub-OMGraphicLists to remove it if the geometry isn't found on this OMGraphicList.

  Specified by:
    `remove` in interface `java.util.Collection<T extends OMGeometry>`
  Specified by:
    `remove` in interface `java.util.List<T extends OMGeometry>`
  Parameters:
    `geometry` - the object to remove.
  Returns:
    true if geometry was on the list, false if otherwise.

### remove

    public T remove(int index)

  Specified by:
    `remove` in interface `java.util.List<T extends OMGeometry>`

### getCopy

    public final java.util.List<T> getCopy()

  Returns:
    an unmodifiable copy of this list.

### moveIndexedOneToTop

    public void moveIndexedOneToTop(int location)

  Moves the graphic at the given index to the part of the list where it will be drawn on top of one of the other graphics which is its neighbor on the list. This method does check to see what the traverseMode of the list is, and calls either moveIndexedToLast or moveIndexedToFirst, depending on what is appropriate.

  Parameters:
    `location` - the index location of the graphic to move.
  See Also:
    `moveIndexedOneToFront(int)`, `moveIndexedOneToBack(int)`

### moveIndexedToTop

    public void moveIndexedToTop(int location)

  Moves the graphic at the given index to the part of the list where it will be drawn on top of the other graphics. This method does check to see what the traverseMode of the list is, and calls either moveIndexedToLast or moveIndexedToFirst, depending on what is appropriate.

  Parameters:
    `location` - the index location of the graphic to move.

### moveIndexedOneToBottom

    public void moveIndexedOneToBottom(int location)

  Moves the graphic at the given index to the part of the list where it will be drawn under one of the other graphics, its neighbor on the list. This method does check to see what the traverseMode of the list is, and calls either moveIndexedOneToBack or moveIndexedOneToFront, depending on what is appropriate.

  Parameters:
    `location` - the index location of the graphic to move.
  See Also:
    `moveIndexedOneToFront(int)`, `moveIndexedOneToBack(int)`

### moveIndexedToBottom

    public void moveIndexedToBottom(int location)

  Moves the graphic at the given index to the part of the list where it will be drawn under all of the other graphics. This method does check to see what the traverseMode of the list is, and calls either moveIndexedToLast or moveIndexedToFirst, depending on what is appropriate.

  Parameters:
    `location` - the index location of the graphic to move.

### moveIndexedToFirst

    public void moveIndexedToFirst(int location)

  Moves the graphic at the given index to the front of the list, sliding the other graphics back on in the list in order. If the location is already at the beginning or beyond the end, nothing happens.

  Parameters:
    `location` - the index of the graphic to move.
  See Also:
    `moveIndexedToBottom(int)`, `moveIndexedToTop(int)`

### moveIndexedOneToFront

    public void moveIndexedOneToFront(int location)

  Moves the graphic at the given index toward the front of the list by one spot, sliding the other graphic back on in the list in order. If the location is already at the beginning or beyond the end, nothing happens.

  Parameters:
    `location` - the index of the graphic to move.

### moveIndexedToLast

    public void moveIndexedToLast(int location)

  Moves the graphic at the given index to the end of the list, sliding the other graphics up on in the list in order. If the location is already at the end or less than zero, nothing happens.

  Parameters:
    `location` - the index of the graphic to move.
  See Also:
    `moveIndexedToBottom(int)`, `moveIndexedToTop(int)`

### moveIndexedOneToBack

    public void moveIndexedOneToBack(int location)

  Moves the graphic at the given index toward the back of the list by one spot, sliding the other graphic up on in the list in order. If the location is already at the end or less than zero, nothing happens.

  Parameters:
    `location` - the index of the graphic to move.

### project

    public void project(Projection p)

  Projects any graphics needing projection. Use this method to project any new or changed OMGraphics before painting. to re-project the whole list, use `generate(Projection, boolean)` with `forceProjectAll` set to `true`. This is the same as calling `generate(p, false)`

  Parameters:
    `p` - a `Projection`
  See Also:
    `generate(Projection, boolean)`

### project

    public void project(Projection p,
                        boolean forceProjectAll)

  Projects the OMGraphics on the list. This is the same as calling `generate(p, forceProjectAll)`.

  Parameters:
    `p` - a `Projection`
    `forceProjectAll` - if true, all the graphics on the list are generated with the new projection. If false they are only generated if getNeedToRegenerate() returns true
  See Also:
    `generate(Projection, boolean)`

### generate

    public boolean generate(Projection p)

  Prepare the graphics for rendering. This is the same as calling `project(p, true)`.

  Specified by:
    `generate` in interface `OMGeometry`
  Specified by:
    `generate` in class `OMGraphicAdapter`
  Parameters:
    `p` - a `Projection`
  Returns:
    boolean true
  See Also:
    `generate(Projection, boolean)`

### generate

    public boolean generate(Projection p,
                            boolean forceProjectAll)

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

  Parameters:
    `p` - a `Projection`
    `forceProjectAll` - if true, all the graphics 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)`, `OMGraphic.regenerate(com.bbn.openmap.proj.Projection)`

### render

    public void render(java.awt.Graphics gr)

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

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

### renderAllAsSelected

    public void renderAllAsSelected(java.awt.Graphics gr)

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

  Parameters:
    `gr` - the AWT Graphics context

### shouldProcess

    protected boolean shouldProcess(OMGeometry graphic)

  This method is called internally for those methods where skipping invisible OMGeometries would save processing time and effort. If you don't want visibility to be considered when processing OMGeometries/OMGraphics, override this method and return true.

### setProcessAllGeometries

    public void setProcessAllGeometries(boolean set)

  Set the programmatic override for shouldProcess method to always process geometries.

### getProcessAllGeometries

    public boolean getProcessAllGeometries()

  Get the settings for the programmatic override for shouldProcess method to always process geometries.

### distance

    public float distance(double x,
                          double y)

  Finds the distance to the closest OMGraphic.

  Specified by:
    `distance` in interface `OMGeometry`
  Overrides:
    `distance` in class `OMGraphicAdapter`
  Parameters:
    `x` - x coordinate
    `y` - y coordinate
  Returns:
    float distance
  See Also:
    `findClosest(double, double, float)`

### createDist

    protected abstract OMList.OMDist<T> createDist()

### findClosest

    public OMList.OMDist<T> findClosest(double x,
                                        double y,
                                        float limit,
                                        boolean resetSelect)

  Find the closest Object and its distance. The search is always conducted from the topmost graphic to the bottom-most, depending on the traverseMode.

  Parameters:
    `x` - x coordinate
    `y` - y coordinate
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
    `resetSelect` - deselect any OMGraphic touched.
  Returns:
    OMDist

### findClosestTest

    protected OMList.OMDist<T> findClosestTest(OMList.OMDist<T> current,
                                               int index,
                                               OMGeometry graphic,
                                               double x,
                                               double y,
                                               float limit,
                                               boolean resetSelect)

  Test the graphic distance away from the x, y point, and compare it to the current OMDist passed in. If the graphic is the new closest, return the same OMDist object filled in with the new value. Otherwise, return null.

  Parameters:
    `current` - the OMDist that contains the current best result of a search.
    `index` - the index in the graphic list of the provided OMGraphic
    `graphic` - the OMGraphic to test
    `x` - the window horizontal pixel value.
    `y` - the window vertical pixel value.
    `resetSelect` - flag to call deselect on any OMGraphic contacted. Used here to pass on in case the OMGraphic provided is an OMGraphicList, and to use to decide if deselect should be called on the provided graphic.
  Returns:
    OMDist with an OMGraphic if the graphic passed in is the current closest. OMDist.graphic could be null, OMDist.d could be Infinity.

### findClosest

    public T findClosest(double x,
                         double y,
                         float limit)

  Finds the object located the closest to the point, if the object distance away is within the limit. The search is always conducted from the topmost graphic to the bottom-most, depending on the traverseMode. Any graphics where `isVisible()` returns false are not considered.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
  Returns:
    OMGraphic the closest on the list within the limit, or null if not found.

### findAll

    public OMList<T> findAll(int x,
                             int y,
                             float limit)

  Find all of the OMGraphics on this list that are located within the pixel limit of the x, y pixel location.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
  Returns:
    OMGraphicList containing all of the OMGraphics within the limit.

### findAll

    public OMList<T> findAll(int x,
                             int y,
                             float limit,
                             boolean resetSelect,
                             OMList<T> addTo)

  Find all of the OMGraphics on this list that are located within the pixel limit of the x, y pixel location.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
    `resetSelect` - call deselect on OMGraphics not within limit.
    `addTo` - OMGraphicList to add found OMGraphics to, if null a list will be created.
  Returns:
    OMGraphicList containing all of the OMGraphics within the limit, empty if none are found.

### create

    public abstract OMList<T> create()

### findAllTest

    protected boolean findAllTest(int x,
                                  int y,
                                  float limit,
                                  boolean resetSelect,
                                  OMList<T> addTo,
                                  OMGeometry geometry,
                                  OMList.OMDist<T> omd)

  Test to find out if an OMGraphic is located within the pixel limit of the x, y pixel location.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
    `resetSelect` - call deselect on OMGraphic not within limit.
    `addTo` - OMGraphicList to add found OMGeometries to, if null a list will be created.
    `geometry` - OMGraphic to test.
    `omd` - OMDist to use for test, provided to avoid recurring memory allocations for loops.
  Returns:
    true of this method should still be called again in a loop, false of this list is vague and we have a hit.

### findClosest

    public T findClosest(int x,
                         int y)

  Finds the object located the closest to the point, regardless of how far away it is. This method returns null if the list is not valid. The search starts at the first-added graphic.
  This is the same as calling `findClosest(x, y, Float.MAX_VALUE)`.

  Parameters:
    `x` - the horizontal pixel position of the window, from the left of the window.
    `y` - the vertical pixel position of the window, from the top of the window.
  Returns:
    the closest graphic to the xy window point.
  See Also:
    `findClosest(double, double, float)`

### findIndexOfClosest

    public int findIndexOfClosest(int x,
                                  int y,
                                  float limit)

  Finds the object located the closest to the point, if the object distance away is within the limit. The search is always conducted from the topmost graphic to the bottom-most, depending on the traverseMode. Any graphics where `isVisible()` returns false are not considered.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
  Returns:
    index of the closest on the list within the limit, or OMGraphicList.NONE if not found.

### findIndexOfClosest

    public int findIndexOfClosest(int x,
                                  int y)

  Finds the object located the closest to the point, regardless of how far away it is. This method returns null if the list is not valid. The search starts at the first-added graphic.
  This is the same as calling `findClosest(x, y, Float.MAX_VALUE)`.

  Parameters:
    `x` - the horizontal pixel position of the window, from the left of the window.
    `y` - the vertical pixel position of the window, from the top of the window.
  Returns:
    index of the closest graphic to the xy window point, or OMGraphicList.NONE if not found.
  See Also:
    `findIndexOfClosest(int, int, float)`

### selectClosest

    public T selectClosest(int x,
                           int y)

  Finds the object located the closest to the coordinates, regardless of how far away it is. Sets the select paint of that object, and resets the paint of all the other objects. The search starts at the first-added graphic.

  Parameters:
    `x` - the x coordinate on the component the graphics are displayed on.
    `y` - the y coordinate on the component the graphics are displayed on.
  Returns:
    the closest OMGraphic on the list, with selected having been called on that OMGraphics. This OMGraphic will be within the limit or null if none found. Will return this list if this list is set to be vague.

### selectClosest

    public T selectClosest(int x,
                           int y,
                           float limit)

  Finds the object located the closest to the point, if the object distance away is within the limit, and sets the paint of that graphic to its select paint. It sets the paints to all the other objects to the regular paint. The search starts at the first-added graphic. Any graphics where `isVisible()` returns false are not considered.

  Parameters:
    `x` - the horizontal pixel position of the window, from the left of the window.
    `y` - the vertical pixel position of the window, from the top of the window.
    `limit` - the max distance that a graphic has to be within to be returned, in pixels.
  Returns:
    the closest OMGraphic on the list, with selected having been called on that OMGraphics. This OMGraphic will be within the limit or null if none found. Will return this list if this list is set to be vague.

### selectClosestTest

    protected OMList.OMDist<T> selectClosestTest(OMList.OMDist<T> current,
                                                 int index,
                                                 OMGeometry graphic,
                                                 int x,
                                                 int y,
                                                 float limit)

  A variation on findClosestTest, manages select() and deselect().

  Parameters:
    `current` - the OMDist that contains the current best result of a search.
    `index` - the index in the graphic list of the provided OMGraphic
    `graphic` - the OMGraphic to test
    `x` - the window horizontal pixel value.
    `y` - the window vertical pixel value.
  Returns:
    OMDist if the graphic passed in is the current closest. OMGraphic will be set in OMDist and selected(). OMGraphic will be de-selected if not the closest, and the OMDist will be null. This method will return this list if it is set to be vague and one of its children meet the criteria.

### getContains

    public T getContains(int x,
                         int y)

  Finds the first OMGraphic (the one on top) that is under this pixel. If an OMGraphic is an OMGraphicList, its contents will be checked. If that check is successful and OMGraphicList is not vague, its OMGraphic will be returned - otherwise the list will be returned.

  Parameters:
    `x` - the horizontal pixel position of the window, from the left of the window.
    `y` - the vertical pixel position of the window, from the top of the window.
  Returns:
    the graphic that contains the pixel, NONE (null) if none are found.

### deselect

    public void deselect()

  If you call deselect() on an OMGraphicList, it calls deselect() all the graphics it contains, as well as the deselect method on it's super class.

  Specified by:
    `deselect` in interface `OMGeometry`
  Specified by:
    `deselect` in interface `OMGraphic`
  Overrides:
    `deselect` in class `OMGraphicAdapter`

### select

    public void select()

  Calls select() on all the items on the graphic list, as well as select() on the super class.

  Specified by:
    `select` in interface `OMGeometry`
  Specified by:
    `select` in interface `OMGraphic`
  Overrides:
    `select` in class `OMGraphicAdapter`

### doAction

    public void doAction(T graphic,
                         OMAction action)

  Perform an action on the provided geometry. If the geometry is not currently on the list, it is added (if the action doesn't say to delete it). If the geometry is null, the list checks for an action to take on the list (deselectAll).

### setVisible

    public void setVisible(boolean visible)

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

  Specified by:
    `setVisible` in interface `OMGeometry`
  Overrides:
    `setVisible` in class `BasicGeometry`
  Parameters:
    `visible` - boolean

### isVisible

    public boolean isVisible()

  Get the visibility variable. For the OMGraphicList, if any part of it is visible, then it is considered visible.

  Specified by:
    `isVisible` in interface `OMGeometry`
  Overrides:
    `isVisible` in class `BasicGeometry`
  Returns:
    boolean

### setAllowDuplicates

    public void setAllowDuplicates(boolean set)

  Set whether the list will allow duplicate entries added. If not, then the copy will be added, and the previous version removed.

### getAllowDuplicates

    public boolean getAllowDuplicates()

  Get whether the list will allow duplicate entries added. If not, then the copy will be added, and the previous version removed.

### checkForDuplicate

    protected void checkForDuplicate(T g)

  Convenience function for methods that may add a OMGraphic. Method checks to see if duplicates are allowed, and if they are not, it will remove the OMGraphic from the list. The calling method can be confident that it will be adding a unique OMGraphic. Internal methods that call this method should be synchronized on the graphics list.

### contains

    public boolean contains(OMGraphic g)

  Checks if an OMGraphic is on this list. Checks sublists, too.

### sort

    public void sort()

  This sort method is a place-holder for OMGraphicList extensions to implement their own particular criteria for sorting an OMGraphicList. Does nothing for a generic OMGraphicList.

### objectToOMGraphic

    protected OMGraphic objectToOMGraphic(java.lang.Object obj)

  Convenience method to cast an object to an OMGraphic if it is one. Returns null if it isn't.

### restore

    public void restore(OMGeometry source)

  You need to make sure that the Generic type of the source matches the generic type of this list. Will fail silently. Not sure if this is the right way to handle it, though.

  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