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

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphicAdapter
              com.bbn.openmap.omGraphics.OMList<OMGraphic>
                  com.bbn.openmap.omGraphics.OMGraphicList
                      com.bbn.openmap.omGraphics.OMGraphicHash

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

    public class OMGraphicHash

extends OMGraphicList

This is an OMGraphicsList sub-class with a Map interface. Access is backed by a HashMap. Insertion and removal of OMGraphics is through the Map interface.

The add(OMGraphic), addOMGraphic(OMGraphic), remove(OMGraphic), and removeOMGraphicAt(int) method are disabled and will throw a RuntimeException if called.

This class is suited for use as the top OMGraphicList in an OMHandlerLayer that has a large number of OMGraphic objects and needs to access those objects using a unique key.

Author:
  David J. Ward
See Also:
  `OMGraphicList`, Serialized Form

Nested Class Summary

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

Field Summary

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
`OMGraphicHash()` Creates a new instance of OMGraphicHash
`OMGraphicHash(int initialCapacity)` Construct an OMGraphicList with an initial capacity.

Method Summary
`boolean` | `add(OMGraphic g)` Add an OMGraphic to the list.
`void` | `clear()` Remove all elements from the graphic list.
`java.lang.Object` | `clone()` Generic return of SinkGraphic for subclasses that don't implement clone properly.
`boolean` | `containsKey(java.lang.Object obj)` Returns `true` if this map contains a mapping for the specified key.
`boolean` | `containsValue(OMGraphic obj)` Returns `true` if this map maps one or more keys to the specified value.
`java.util.Set<java.util.Map.Entry<java.lang.Object,OMGraphic>>` | `entrySet()` Returns a set view of the mappings contained in this map.
`OMGraphic` | `get(java.lang.Object obj)` Returns the value to which this map maps the specified key.
`java.util.Set<java.lang.Object>` | `keySet()` Returns a set view of the keys contained in this map.
`java.lang.Object` | `put(java.lang.Object key, OMGraphic graphic)` Associates the specified value with the specified key in this map (optional operation).
`void` | `putAll(java.util.Map<java.lang.Object,OMGraphic> map)` Copies all of the mappings from the specified map to this map (optional operation).
`OMGraphic` | `remove(int location)` Remove the graphic at the location number.
`boolean` | `remove(java.lang.Object key)` Removes the mapping for this key from this map if it is present (optional operation).
`boolean` | `remove(OMGraphic graphic)` Remove the graphic.
`void` | `restore(OMGeometry source)` You need to make sure that the Generic type of the source matches the generic type of this list.
`java.util.Collection<OMGraphic>` | `values()` Returns a collection view of the values contained in this map.

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicList
`add, addAll, addAll, create, createDist, get, getOMGraphicAt, getTargets, iteratorCopy, listIteratorCopy, listIteratorCopy, objectToOMGraphic, readGraphics, readGraphics, set, setFillPaint, setGridGenerator, setLinePaint, setMatted, setMattingPaint, setOMGraphicAt, setSelectPaint, setStroke, setTargets, setTextureMask, sort, writeGraphics, writeGraphics`

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, generate, getAllowDuplicates, getContains, getCopy, getDescription, getDescription, getProcessAllGeometries, getTraverseMode, indexOf, isEmpty, isVague, isVisible, iterator, lastIndexOf, listIterator, listIterator, moveIndexedOneToBack, moveIndexedOneToBottom, moveIndexedOneToFront, moveIndexedOneToTop, moveIndexedToBottom, moveIndexedToFirst, moveIndexedToLast, moveIndexedToTop, project, project, removeAll, render, renderAllAsSelected, retainAll, select, selectClosest, selectClosest, selectClosestTest, setAllowDuplicates, setProcessAllGeometries, setTraverseMode, setVague, setVisible, shouldProcess, size, subList, toArray, toArray`

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
`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, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setRenderType, setSelectColor, setSelected, setShowEditablePalette, 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
`getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setRenderType, setSelected, setShowEditablePalette, 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`

Constructor Detail

### OMGraphicHash

    public OMGraphicHash()

  Creates a new instance of OMGraphicHash

### OMGraphicHash

    public OMGraphicHash(int initialCapacity)

  Construct an OMGraphicList with an initial capacity.

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

Method Detail

### get

    public OMGraphic get(java.lang.Object obj)

  Returns the value to which this map maps the specified key. Returns `null` if the map contains no mapping for this key. A return value of `null` does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to `null`. The `containsKey` operation may be used to distinguish these two cases.

  More formally, if this map contains a mapping from a key `k` to a value `v` such that `(key==null ? k==null : key.equals(k))`, then this method returns `v`; otherwise it returns `null`. (There can be at most one such mapping.)

  Parameters:
    `obj` - key whose associated value is to be returned.
  Returns:
    the value to which this map maps the specified key, or `null` if the map contains no mapping for this key.
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional).
    `java.lang.NullPointerException` - if the key is `null` and this map does not permit `null` keys (optional).
  See Also:
    `containsKey(Object)`

### containsKey

    public boolean containsKey(java.lang.Object obj)

  Returns `true` if this map contains a mapping for the specified key. More formally, returns `true` if and only if this map contains a mapping for a key `k` such that `(key==null ? k==null : key.equals(k))`. (There can be at most one such mapping.)

  Parameters:
    `obj` - key whose presence in this map is to be tested.
  Returns:
    `true` if this map contains a mapping for the specified key.
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional).
    `java.lang.NullPointerException` - if the key is `null` and this map does not permit `null` keys (optional).

### containsValue

    public boolean containsValue(OMGraphic obj)

  Returns `true` if this map maps one or more keys to the specified value. More formally, returns `true` if and only if this map contains at least one mapping to a value `v` such that `(value==null ? v==null : value.equals(v))`. This operation will probably require time linear in the map size for most implementations of the `Map` interface.

  Parameters:
    `obj` - value whose presence in this map is to be tested.
  Returns:
    `true` if this map maps one or more keys to the specified value.
  Throws:
    `java.lang.ClassCastException` - if the value is of an inappropriate type for this map (optional).
    `java.lang.NullPointerException` - if the value is `null` and this map does not permit `null` values (optional).

### entrySet

    public java.util.Set<java.util.Map.Entry<java.lang.Object,OMGraphic>> entrySet()

  Returns a set view of the mappings contained in this map. Each element in the returned set is a `Map.Entry`. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation, or through the `setValue` operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Set.remove`, `removeAll`, `retainAll` and `clear` operations. It does not support the `add` or `addAll` operations.

  Returns:
    a set view of the mappings contained in this map.

### keySet

    public java.util.Set<java.lang.Object> keySet()

  Returns a set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Set.remove`, `removeAll` `retainAll`, and `clear` operations. It does not support the add or `addAll` operations.

  Returns:
    a set view of the keys contained in this map.

### put

    public java.lang.Object put(java.lang.Object key,
                                OMGraphic graphic)

  Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for this key, the old value is replaced by the specified value. (A map `m` is said to contain a mapping for a key `k` if and only if `m.containsKey(k)` would return `true` .))

  Parameters:
    `key` - key with which the specified value is to be associated.
    `graphic` - value to be associated with the specified key.
  Returns:
    previous value associated with specified key, or `null` if there was no mapping for key. A `null` return can also indicate that the map previously associated `null` with the specified key, if the implementation supports `null` values.
  Throws:
    `java.lang.UnsupportedOperationException` - if the `put` operation is not supported by this map.
    `java.lang.ClassCastException` - if the class of the specified key or value prevents it from being stored in this map.
    `java.lang.IllegalArgumentException` - if some aspect of this key or value prevents it from being stored in this map.
    `java.lang.NullPointerException` - if this map does not permit `null` keys or values, and the specified key or value is `null`.

### putAll

    public void putAll(java.util.Map<java.lang.Object,OMGraphic> map)

  Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of calling `put(k, v)` on this map once for each mapping from key `k` to value `v` in the specified map. The behavior of this operation is unspecified if the specified map is modified while the operation is in progress.

  Parameters:
    `map` - Mappings to be stored in this map.
  Throws:
    `java.lang.UnsupportedOperationException` - if the `putAll` method is not supported by this map.
    `java.lang.ClassCastException` - if the class of a key or value in the specified map prevents it from being stored in this map.
    `java.lang.IllegalArgumentException` - some aspect of a key or value in the specified map prevents it from being stored in this map.
    `java.lang.NullPointerException` - if the specified map is `null`, or if this map does not permit `null` keys or values, and the specified map contains `null` keys or values.

### remove

    public boolean remove(java.lang.Object key)

  Removes the mapping for this key from this map if it is present (optional operation). More formally, if this map contains a mapping from key `k` to value `v` such that `(key==null ? k==null : key.equals(k))`, that mapping is removed. (The map can contain at most one such mapping.)

  Returns the value to which the map previously associated the key, or `null` if the map contained no mapping for this key. (A `null` return can also indicate that the map previously associated `null` with the specified key if the implementation supports `null` values.) The map will not contain a mapping for the specified key once the call returns.

  Specified by:
    `remove` in interface `java.util.Collection<OMGraphic>`
  Specified by:
    `remove` in interface `java.util.List<OMGraphic>`
  Overrides:
    `remove` in class `OMList<OMGraphic>`
  Parameters:
    `key` - key whose mapping is to be removed from the map.
  Returns:
    previous value associated with specified key, or `null` if there was no mapping for key.
  Throws:
    `java.lang.ClassCastException` - if the key is of an inappropriate type for this map (optional).
    `java.lang.NullPointerException` - if the key is `null` and this map does not permit `null` keys (optional).
    `java.lang.UnsupportedOperationException` - if the `remove` method is not supported by this map.

### values

    public java.util.Collection<OMGraphic> values()

  Returns a collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own `remove` operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the `Iterator.remove`, `Collection.remove`, `removeAll`, `retainAll` and `clear` operations. It does not support the add or `addAll` operations.

  Returns:
    a collection view of the values contained in this map.

### clone

    public java.lang.Object clone()

  Description copied from class: `OMGraphicAdapter`
  Generic return of SinkGraphic for subclasses that don't implement clone properly.

  Specified by:
    `clone` in interface `OMGraphic`
  Overrides:
    `clone` in class `OMGraphicList`
  Returns:
    a duplicate list full of shallow copies of each of the OMGraphics contained on the list.

### add

    public boolean add(OMGraphic g)

  Add an OMGraphic to the list.

  For OMGraphicHash this method will throw an `IllegalArgumentException` because adding a graphic must be done through `put(key,value)`.

  Specified by:
    `add` in interface `java.util.Collection<OMGraphic>`
  Specified by:
    `add` in interface `java.util.List<OMGraphic>`
  Overrides:
    `add` in class `OMGraphicList`

### remove

    public OMGraphic remove(int location)

  Remove the graphic at the location number.

  For OMGraphicHash this method will throw an `IllegalArgumentException` because removing a graphic must be done through `remove(key)`.

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

### remove

    public boolean remove(OMGraphic graphic)

  Remove the graphic.

  For OMGraphicHash this method will throw an `IllegalArgumentException` because removing a graphic must be done through `remove(key)`.

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

### clear

    public void clear()

  Remove all elements from the graphic list.

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

### restore

    public void restore(OMGeometry source)

  Description copied from class: `OMList`
  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 `OMList<OMGraphic>`

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