public class TLcdFeaturedShapeList extends TLcdShapeList implementsILcdFeatured, ILcdDataObject
ILcdShapeList
that is
also ILcdDataObject
and ILcdFeatured
.
This class is typically used in situations that require both ILcdDataObject
and ILcdFeatured
. In case only ILcdDataObject
is required,
TLcdDataObjectShapeList
should be used.
A TLcdFeaturedShapeList
has a display name, which can be set freely.
If the display name has not been set explicitly, it is retrieved
from the list of features through a default display name index. The
value of this index can be set; its default value is 0.
This class is thread-safe for concurrent read-only access of its contents. For read-write access, external locking must be used. Such locking is typically done at the model level.
Constructor and Description |
---|
TLcdFeaturedShapeList()
Constructs a
TLcdFeaturedShapeList that doesn't have any ILcdShape objects,
features, or display name. |
TLcdFeaturedShapeList(ILcdShape[] aShapeArray,
ILcdBounds aBounds)
Constructs a
TLcdFeaturedShapeList with the given array of shapes. |
TLcdFeaturedShapeList(String aDisplayName)
Constructs a
TLcdFeaturedShapeList that doesn't have any ILcdShape objects or
features, with the given display name. |
TLcdFeaturedShapeList(String aDisplayName,
ILcdFeatured aFeaturesObject)
Constructs a
TLcdFeaturedShapeList that doesn't have any ILcdShape objects,
with the given features and display name. |
TLcdFeaturedShapeList(TLcdFeaturedShapeList aFeaturedShapeList)
Constructs a
TLcdFeaturedShapeList that is a clone of the given
TLcdFeaturedShapeList . |
Modifier and Type | Method and Description |
---|---|
boolean |
canSetFeature(int aIndex)
Checks whether the specified feature is editable.
|
Object |
clone()
Creates and returns a copy of this object.
|
boolean |
equals(Object aObject)
Returns whether the given object has the same class, the same coordinates,
the same features, and the same display name.
|
TLcdDataType |
getDataType()
Returns the type of this data object.
|
int |
getDefaultDisplayNameIndex()
Returns the current index of the feature to use as display name,
if the display name has not been specified explicitly.
|
String |
getDisplayName()
Returns the name for this object to be used for display.
|
Object |
getFeature(int aIndex)
Returns the feature
Object at the given index. |
int |
getFeatureCount()
Returns the number of features.
|
ILcdFeatured |
getFeatures()
Returns the features of this object.
|
Object |
getValue(String aPropertyName)
Convenience method that returns the value of the property with the given name.
|
Object |
getValue(TLcdDataProperty aProperty)
Returns the value of the given property.
|
int |
hashCode()
The hash code of this shape is the hash code of its class, in order to
be consistent with the
ALcdShape.equals(Object) method. |
boolean |
hasValue(String aPropertyName)
Indicates whether this data object has a value for the given property.
|
boolean |
hasValue(TLcdDataProperty aProperty)
Indicates whether this data object has a value for the given property.
|
void |
setDefaultDisplayNameIndex(int aDefaultDisplayNameIndex)
Sets the index of the feature to use as display name, if the display name has
not been specified explicitly.
|
void |
setFeature(int aIndex,
Object aFeature)
Sets the feature
Object at the given index. |
void |
setFeatures(ILcdFeatured aFeatured)
Sets the features to this object.
|
void |
setValue(String aPropertyName,
Object aValue)
Convenience method that sets the value of the property with the given name.
|
void |
setValue(TLcdDataProperty aProperty,
Object aValue)
Sets the value of the given property for this data object.
|
String |
toString()
Returns the display name.
|
addShape, addShape, addShapes, clearShapes, getShape, getShapeCount, removeShape, removeShape, removeShapes, setShape, setShape, setShapes, shapeChanged, shapeChanged, shapesChanged
calculateFocusPoint, clearCache, contains2D, contains3D, getBounds, getCachedObject, getFocusPoint, insertIntoCache, invalidateBounds, invalidateObject, removeCachedObject, setFocusPoint
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
contains2D, contains2D, contains3D, contains3D, getFocusPoint
getBounds
public TLcdFeaturedShapeList()
TLcdFeaturedShapeList
that doesn't have any ILcdShape
objects,
features, or display name.public TLcdFeaturedShapeList(String aDisplayName)
TLcdFeaturedShapeList
that doesn't have any ILcdShape
objects or
features, with the given display name.aDisplayName
- a display name.public TLcdFeaturedShapeList(String aDisplayName, ILcdFeatured aFeaturesObject)
TLcdFeaturedShapeList
that doesn't have any ILcdShape
objects,
with the given features and display name.aDisplayName
- a display name.aFeaturesObject
- a set of featurespublic TLcdFeaturedShapeList(ILcdShape[] aShapeArray, ILcdBounds aBounds)
TLcdFeaturedShapeList
with the given array of shapes.aShapeArray
- the shape array for this shape list.aBounds
- the total bounds of this shape list, if known at construction time, or null
if unknown.public TLcdFeaturedShapeList(TLcdFeaturedShapeList aFeaturedShapeList)
TLcdFeaturedShapeList
that is a clone of the given
TLcdFeaturedShapeList
.aFeaturedShapeList
- the TLcdFeaturedShapeList
to clone.public final int getFeatureCount()
ILcdFeatured
getFeatureCount
in interface ILcdFeatured
public final Object getFeature(int aIndex) throws IndexOutOfBoundsException
ILcdFeatured
Object
at the given index.getFeature
in interface ILcdFeatured
aIndex
- a valid feature index.Object
at the given index.IndexOutOfBoundsException
- when an index is chosen greater than the result of getFeatureCount.ILcdFeatured.setFeature(int, java.lang.Object)
public void setFeature(int aIndex, Object aFeature)
ILcdFeatured
Object
at the given index.setFeature
in interface ILcdFeatured
aIndex
- a valid feature index.aFeature
- the new feature Object
.ILcdFeatured.getFeature(int)
,
ILcdFeatured.canSetFeature(int)
public boolean canSetFeature(int aIndex)
ILcdFeatured
canSetFeature
in interface ILcdFeatured
aIndex
- a valid feature index.public void setFeatures(ILcdFeatured aFeatured)
aFeatured
- the features to set to this object.getFeatures()
public ILcdFeatured getFeatures()
setFeatures(com.luciad.util.ILcdFeatured)
public String getDisplayName()
setDefaultDisplayNameIndex(int)
public void setDefaultDisplayNameIndex(int aDefaultDisplayNameIndex)
aDefaultDisplayNameIndex
- a valid index in the list of features.getDefaultDisplayNameIndex()
public int getDefaultDisplayNameIndex()
setDefaultDisplayNameIndex(int)
public Object clone()
clone
in interface ILcdCloneable
clone
in class TLcdShapeList
Object.clone()
public boolean equals(Object aObject)
equals
in class ALcdShapeList
public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.hashCode
in class ALcdShapeList
public String toString()
toString
in class ALcdShapeList
public Object getValue(TLcdDataProperty aProperty)
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.
getValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be returnedpublic TLcdDataType getDataType()
ILcdDataObject
null
.getDataType
in interface ILcdDataObject
public void setValue(TLcdDataProperty aProperty, Object aValue)
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 thedata 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
.setValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be setaValue
- the value to setTLcdDataType.getProperty(String)
public Object getValue(String aPropertyName)
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). SeeILcdDataObject.getValue(TLcdDataProperty)
for more information.getValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be returnedTLcdDataType.getProperty(String)
public void setValue(String aPropertyName, Object aValue)
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). SeeILcdDataObject.setValue(TLcdDataProperty, Object)
for more information.setValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be setaValue
- the value to setpublic boolean hasValue(TLcdDataProperty aProperty)
ILcdDataObject
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 IllegalArgumentExceptionaProperty
is null
: not allowed, you will get NullPointerExceptionhasValue
in interface ILcdDataObject
aProperty
- the property for which to return whether a value is present or not.true
if this data object has a value for the given property, false
otherwise.public boolean hasValue(String aPropertyName)
ILcdDataObject
ILcdDataObject.hasValue(TLcdDataProperty)
for more information.hasValue
in interface ILcdDataObject
aPropertyName
- the name of the property for which to return whether a value is present
or not.true
if this data object has a value for the property with the given name,
false
otherwise.