Class TLcdFeaturedSingleShapeList

java.lang.Object
com.luciad.util.TLcdFeatureArray
com.luciad.format.database.TLcdFeaturedSingleShapeList
All Implemented Interfaces:
ILcdDataObject, ILcdBounded, ILcdEditableShapeList, ILcdShape, ILcdShapeList, ILcdCloneable, ILcdFeatured, Serializable, Cloneable

public class TLcdFeaturedSingleShapeList extends TLcdFeatureArray implements ILcdFeatured, ILcdEditableShapeList, ILcdDataObject
This class provides an implementation of ILcdDataobject and ILcdShapeList that contains a single shape. This class implements ILcdEditableShapeList. It however only allows at most one shape to be part of the shape list. In case more then one shape would be added, an IllegalArgumentException is thrown. It also implements ILcdFeatured. Features are directly mapped one-on-one on data properties.

An optional index can specify the feature that determines the identity of the object (through equals and hashCode). This index is typically derived from the data type using the TLcdPrimaryKeyAnnotation. Because of this, this class is mostly useful when used to represent objects that are lazily retrieved from a database.

See Also:
  • Constructor Details

  • Method Details

    • getPrimaryFeatureIndex

      public int getPrimaryFeatureIndex()
      Returns the index of the primary feature, which identifies the object. A value of -1 indicates that there is no such feature.
    • getPrimaryFeature

      public Object getPrimaryFeature()
      Returns the primary feature, or null if there is no such feature.
    • getShapeCount

      public int getShapeCount()
      Description copied from interface: ILcdShapeList
      Returns the number of ILcdShape objects in the list.
      Specified by:
      getShapeCount in interface ILcdShapeList
      Returns:
      the number of ILcdShape objects in the list.
    • getShape

      public ILcdShape getShape(int aIndex) throws IndexOutOfBoundsException
      Description copied from interface: ILcdShapeList
      Returns the ILcdShape at the given index.
      Specified by:
      getShape in interface ILcdShapeList
      Parameters:
      aIndex - a valid index in the list of ILcdShape objects.
      Returns:
      the ILcdShape at the given index.
      Throws:
      IndexOutOfBoundsException - when the index is not valid.
    • contains2D

      public boolean contains2D(ILcdPoint aPoint)
      Description copied from interface: ILcdShape
      Checks whether this ILcdShape contains the given ILcdPoint in the 2D space. Only the first two dimensions of the ILcdShape and the ILcdPoint are considered.
      Specified by:
      contains2D in interface ILcdShape
      Parameters:
      aPoint - the ILcdPoint to test.
      Returns:
      the boolean result of the containment test.
      See Also:
    • contains2D

      public boolean contains2D(double aX, double aY)
      Description copied from interface: ILcdShape
      Checks whether this ILcdShape contains the given point in the 2D space. Only the first two dimensions of the ILcdShape are considered.
      Specified by:
      contains2D in interface ILcdShape
      Parameters:
      aX - the x coordinate of the point.
      aY - the y coordinate of the point.
      Returns:
      the boolean result of the containment test.
    • contains3D

      public boolean contains3D(ILcdPoint aPoint)
      Description copied from interface: ILcdShape
      Checks whether this ILcdShape contains the given ILcdPoint in the 3D space.
      Specified by:
      contains3D in interface ILcdShape
      Parameters:
      aPoint - the ILcdPoint to test.
      Returns:
      the boolean result of the containment test.
      See Also:
    • contains3D

      public boolean contains3D(double aX, double aY, double aZ)
      Description copied from interface: ILcdShape
      Checks whether this ILcdShape contains the given point in the 3D space.
      Specified by:
      contains3D in interface ILcdShape
      Parameters:
      aX - the x coordinate of the point.
      aY - the y coordinate of the point.
      aZ - the z coordinate of the point.
      Returns:
      the boolean result of the containment test.
    • getFocusPoint

      public ILcdPoint getFocusPoint()
      Description copied from interface: ILcdShape
      Returns the focus point of this ILcdShape.
      Specified by:
      getFocusPoint in interface ILcdShape
      Returns:
      the focus point of this ILcdShape.
    • getBounds

      public ILcdBounds getBounds()
      Description copied from interface: ILcdBounded
      Returns the ILcdBounds by which the geometry of this ILcdBounded object is bounded.

      If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points) the return value is unspecified. It is highly recommended to return an undefined bounds. You can create undefined bounds using the default constructors of TLcdLonLatBounds or TLcdXYBounds.

      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      the ILcdBounds by which the geometry of this ILcdBounded object is bounded.
    • equals

      public boolean equals(Object aObject)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • getDataType

      public TLcdDataType getDataType()
      Description copied from interface: ILcdDataObject
      Returns the type of this data object. This can never be null.
      Specified by:
      getDataType in interface ILcdDataObject
      Returns:
      the type of this data object
    • getValue

      public Object getValue(TLcdDataProperty aProperty)
      Description copied from interface: ILcdDataObject

      Returns the value of the given property.

      If the property is a collection, the returned value will never be null. If the property has not been set, an empty collection of the appropriate type will be returned (Set, List or Map).

      The property must not be null, and must be declared in the data object's type or in one of its super types. Otherwise an IllegalArgumentException is thrown.

      Specified by:
      getValue in interface ILcdDataObject
      Parameters:
      aProperty - the property for which the value is to be returned
      Returns:
      the value of the given property for this data object
    • getValue

      public Object getValue(String aPropertyName)
      Description copied from interface: ILcdDataObject

      Convenience method that returns the value of the property with the given name.

      If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy).

      See ILcdDataObject.getValue(TLcdDataProperty) for more information.

      Specified by:
      getValue in interface ILcdDataObject
      Parameters:
      aPropertyName - the name of the property of which the value is to be returned
      Returns:
      the value of the property with the given name
      See Also:
    • setValue

      public void setValue(TLcdDataProperty aProperty, Object aValue)
      Description copied from interface: ILcdDataObject

      Sets the value of the given property for this data object. The implementation is allowed to throw an exception if the given value can't be set.

      The given property must be declared in the data object's type or in one of its super types. In other words, getDataType().getProperties().contains( aProperty ) should always be true. Otherwise, the implementation should throw an IllegalArgumentException.

      Specified by:
      setValue in interface ILcdDataObject
      Parameters:
      aProperty - the property for which the value is to be set
      aValue - the value to set
      See Also:
    • setValue

      public void setValue(String aPropertyName, Object aValue)
      Description copied from interface: ILcdDataObject

      Convenience method that sets the value of the property with the given name.

      If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy).

      See ILcdDataObject.setValue(TLcdDataProperty, Object) for more information.

      Specified by:
      setValue in interface ILcdDataObject
      Parameters:
      aPropertyName - the name of the property of which the value is to be set
      aValue - the value to set
    • hasValue

      public boolean hasValue(TLcdDataProperty aProperty)
      Description copied from interface: ILcdDataObject
      Indicates whether this data object has a value for the given property.

      • aProperty is from the right data type, and this instance has a value for it: returns true
      • aProperty is from the right data type, and this instance has no value for it: returns false
      • aProperty is not from the right data type: not allowed, you will get IllegalArgumentException
      • aProperty is null: not allowed, you will get NullPointerException

      A multivalued property is considered to have a value if it has at least one value.

      Specified by:
      hasValue in interface ILcdDataObject
      Parameters:
      aProperty - the property for which to return whether a value is present or not.
      Returns:
      true if this data object has a value for the given property, false otherwise.
    • hasValue

      public boolean hasValue(String aPropertyName)
      Description copied from interface: ILcdDataObject
      Indicates whether this data object has a value for the given property.
      See ILcdDataObject.hasValue(TLcdDataProperty) for more information.
      Specified by:
      hasValue in interface ILcdDataObject
      Parameters:
      aPropertyName - the name of the property for which to return whether a value is present or not.
      Returns:
      true if this data object has a value for the property with the given name, false otherwise.
    • addShape

      public void addShape(int aIndex, ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Inserts the specified shape at the specified position in this ILcdShapeList.
      Specified by:
      addShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index at which the shape is to be inserted.
      aShape - the shape to be inserted.
    • addShape

      public void addShape(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Appends the specified shape to the end of this ILcdShapeList.
      Specified by:
      addShape in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape to be appended to this ILcdShapeList.
    • addShapes

      public void addShapes(ILcdShape[] aShape)
      Description copied from interface: ILcdEditableShapeList
      Appends the specified array of shapes to the end of this ILcdShapeList.
      Specified by:
      addShapes in interface ILcdEditableShapeList
      Parameters:
      aShape - the array of shapes to be appended to this ILcdShapeList.
    • clearShapes

      public void clearShapes()
      Description copied from interface: ILcdEditableShapeList
      Removes all of the shapes from this ILcdShapeList.
      Specified by:
      clearShapes in interface ILcdEditableShapeList
    • removeShape

      public ILcdShape removeShape(int aIndex)
      Description copied from interface: ILcdEditableShapeList
      Removes the shape at the specified position in this ILcdShapeList. Shifts any subsequent shapes to the left. Returns the shape that was removed from this ILcdShapeList.
      Specified by:
      removeShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index of the shape to removed.
      Returns:
      the shape previously at the specified position.
    • removeShape

      public boolean removeShape(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Removes the first occurrence of the specified shape in this ILcdShapeList. If this ILcdShapeList does not contain the shape, it is unchanged.
      Specified by:
      removeShape in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape to be removed, if present.
      Returns:
      true if this ILcdShapeList contained the specified element.
    • removeShapes

      public void removeShapes(ILcdShape[] aShape)
      Description copied from interface: ILcdEditableShapeList
      Removes all shapes from this ILcdShapeList that are contained in the specified array of shapes.
      Specified by:
      removeShapes in interface ILcdEditableShapeList
      Parameters:
      aShape - the array of shapes to be removed from this ILcdShapeList.
    • setShape

      public ILcdShape setShape(int aIndex, ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Replaces the shape at the specified position in this ILcdShapeList with the specified shape.
      Specified by:
      setShape in interface ILcdEditableShapeList
      Parameters:
      aIndex - index of shape to replace.
      aShape - the shape to be stored at the specified position.
      Returns:
      the shape previously at the specified position.
    • setShapes

      public void setShapes(ILcdShape[] aShapes)
      Description copied from interface: ILcdEditableShapeList
      Replace the list of shapes contained in this ILcdShapeList with the specified array of shapes.
      Specified by:
      setShapes in interface ILcdEditableShapeList
      Parameters:
      aShapes - the array of shapes to be stored in this ILcdShapeList.
    • shapeChanged

      public void shapeChanged(int aIndex)
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that the shape at the specified position has changed.
      Specified by:
      shapeChanged in interface ILcdEditableShapeList
      Parameters:
      aIndex - the index of the shape that has changed.
    • shapeChanged

      public void shapeChanged(ILcdShape aShape)
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that the specified shape has changed.
      Specified by:
      shapeChanged in interface ILcdEditableShapeList
      Parameters:
      aShape - the shape that has changed.
    • shapesChanged

      public void shapesChanged()
      Description copied from interface: ILcdEditableShapeList
      Notifies this ILcdShapeList that some (possibly all) of its shapes have changed.
      Specified by:
      shapesChanged in interface ILcdEditableShapeList