public class TLcdAssociationBasedAirspace extends ALcdShapeList implements ILcdEditableAssociationBasedAirspace
This implementation performs a discretization in geodetic coordinates of the airspaces contained in the associations and geometrically combines them using the corresponding association types. This calculation is performed in 2D; the height values of the associated airspaces will be ignored.
Before an association-based airspace can be discretized, it must comply to a few rules:
ILcdAssociationBasedAirspace
for adding airspace associations
must be fulfilled.ILcdGenericAirspace
must be of the type ILcdAirspace
or ILcdAssociationBasedAirspace
; if it has the former type, it should be a valid
convex or concave polygon; if it has the latter type, it should be discretizable.isAirspaceAssociationDiscretizable
()
can be used to check whether discretization is possible.Modifier and Type | Field and Description |
---|---|
TLcdDataProperty |
ASSOCIATIONS_PROPERTY
The AirspaceAssociations property of the airspace.
|
Constructor and Description |
---|
TLcdAssociationBasedAirspace()
Deprecated.
|
TLcdAssociationBasedAirspace(TLcdDataType aDataType)
Creates a new instance for the given type.
|
Modifier and Type | Method and Description |
---|---|
void |
addAirspaceAssociation(ILcdAirspaceAssociation aAirspaceAssociation)
Adds an
ILcdAirspaceAssociation object to the ILcdAssociationBasedAirspace object. |
protected void |
calculateFocusPoint()
Computes the focus point as the center of the bounding box.
|
Object |
clone()
Creates and returns a copy of this object.
|
boolean |
contains2D(double aX,
double aY)
Checks whether this
ILcdShape contains the given point in
the 2D space. |
boolean |
contains2D(ILcdPoint aPoint)
Checks whether this
ALcdShape contains the given point in the
2D cartesian plane. |
boolean |
contains3D(double aX,
double aY,
double aZ)
Checks whether this
ILcdShape contains the given point in
the 3D space. |
boolean |
contains3D(ILcdPoint aPoint)
Checks whether this
ALcdShape contains the given point in the
3D space. |
boolean |
equals(Object aObject)
Returns true if this object is the same as the specified object.
|
ILcdAirspaceAssociation |
getAirspaceAssociation(int aSequenceNumber)
Returns the
ILcdAirspaceAssociation object with the given index. |
int |
getAirspaceAssociationCount()
Returns the number of
ILcdAirspaceAssociation objects that are used in the
ILcdAssociationBasedAirspace object. |
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
TLcdDataType |
getDataType()
Returns the type of this data object.
|
ILcdShape |
getShape(int i)
Returns the
ILcdShape at the given index. |
int |
getShapeCount()
Returns the number of
ILcdShape objects in the list. |
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 |
invalidate()
Discards the geometry cached with this airspace and recalculates it.
|
boolean |
isAirspaceAssociationDiscretizable()
Checks whether this association-based airspace can be discretized.
|
void |
removeAirspaceAssociation(ILcdAirspaceAssociation aAirspaceAssociation)
Removes an
ILcdAirspaceAssociation object from the ILcdAssociationBasedAirspace object. |
void |
removeAirspaceAssociationAt(int aIndex)
Removes the
ILcdAirspaceAssociation object on the specified index from the
ILcdAssociationBasedAirspace . |
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.
|
clearCache, getCachedObject, getFocusPoint, insertIntoCache, invalidateBounds, invalidateObject, removeCachedObject, setFocusPoint, toString
fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
getFocusPoint
public final TLcdDataProperty ASSOCIATIONS_PROPERTY
ILcdAirspaceAssociation
.@Deprecated public TLcdAssociationBasedAirspace()
TLcdAssociationBasedAirspace(TLcdDataType)
TLcdAssociationBasedAirspace
instance.public TLcdAssociationBasedAirspace(TLcdDataType aDataType)
aDataType
- the data type of the returned instanceIllegalArgumentException
- if TLcdAISDataTypes.AssociationBasedAirspace
is not
assignable from the given data typeTLcdAISDataTypes.AssociationBasedAirspace
public TLcdDataType getDataType()
ILcdDataObject
null
.getDataType
in interface ILcdDataObject
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 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(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 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 int getAirspaceAssociationCount()
ILcdAssociationBasedAirspace
ILcdAirspaceAssociation
objects that are used in the
ILcdAssociationBasedAirspace
object.getAirspaceAssociationCount
in interface ILcdAssociationBasedAirspace
ILcdAirspaceAssociation
objects that are used in the
ILcdAssociationBasedAirspace
object.public void addAirspaceAssociation(ILcdAirspaceAssociation aAirspaceAssociation)
ILcdEditableAssociationBasedAirspace
ILcdAirspaceAssociation
object to the ILcdAssociationBasedAirspace
object.
Note that there is no explicit check for null
associations,
which leave the airspace in an invalid state.addAirspaceAssociation
in interface ILcdEditableAssociationBasedAirspace
aAirspaceAssociation
- An ILcdAirspaceAssociation
object for the ILcdAssociationBasedAirspace
objectpublic ILcdAirspaceAssociation getAirspaceAssociation(int aSequenceNumber)
ILcdAssociationBasedAirspace
ILcdAirspaceAssociation
object with the given index.
The index represents the index in a list which contains all ILcdAirspaceAssociation
objects
of the ILcdAssociationBasedAirspace
object, ordered by their sequence number.getAirspaceAssociation
in interface ILcdAssociationBasedAirspace
aSequenceNumber
- The index of the airspace association to retrieve.ILcdAirspaceAssociation
object with the given index.public void removeAirspaceAssociation(ILcdAirspaceAssociation aAirspaceAssociation)
ILcdEditableAssociationBasedAirspace
ILcdAirspaceAssociation
object from the ILcdAssociationBasedAirspace
object.
If this airspace does not contain the association or if null
is supplied,
it is unchanged. If the association is found and removed, subsequent associations are shifted to the left.removeAirspaceAssociation
in interface ILcdEditableAssociationBasedAirspace
aAirspaceAssociation
- the <ILcdAirspaceAssociation
object to be removed.public void removeAirspaceAssociationAt(int aIndex)
ILcdEditableAssociationBasedAirspace
ILcdAirspaceAssociation
object on the specified index from the
ILcdAssociationBasedAirspace
. Subsequent associations are shifted to the left
after the removal.removeAirspaceAssociationAt
in interface ILcdEditableAssociationBasedAirspace
aIndex
- the index in the ILcdEditableAssociationBasedAirspace
where the
ILcdAirspaceAssociation
object must be removed.public int getShapeCount()
ILcdShapeList
ILcdShape
objects in the list.getShapeCount
in interface ILcdShapeList
ILcdShape
objects in the list.public ILcdShape getShape(int i) throws IndexOutOfBoundsException
ILcdShapeList
ILcdShape
at the given index.getShape
in interface ILcdShapeList
i
- a valid index in the list of ILcdShape
objects.ILcdShape
at the given index.IndexOutOfBoundsException
- when the index is not valid.public ILcdBounds getBounds()
ILcdBounded
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
.
getBounds
in interface ILcdBounded
getBounds
in class ALcdShapeList
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.protected void calculateFocusPoint()
ALcdShapeList
calculateFocusPoint
in class ALcdShapeList
public boolean contains2D(double aX, double aY)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
contains2D
in class ALcdShapeList
aX
- the x coordinate of the point.aY
- the y coordinate of the point.public boolean contains3D(double aX, double aY, double aZ)
ILcdShape
ILcdShape
contains the given point in
the 3D space.contains3D
in interface ILcdShape
contains3D
in class ALcdShapeList
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public boolean contains2D(ILcdPoint aPoint)
ALcdShape
ALcdShape
contains the given point in the
2D cartesian plane.contains2D
in interface ILcdShape
contains2D
in class ALcdShape
aPoint
- the point to test.ILcdShape.contains2D(double, double)
public boolean contains3D(ILcdPoint aPoint)
ALcdShape
ALcdShape
contains the given point in the
3D space.contains3D
in interface ILcdShape
contains3D
in class ALcdShape
aPoint
- the point to test.ILcdShape.contains3D(double, double, double)
public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdShapeList
Object.clone()
public boolean equals(Object aObject)
equals
in class ALcdShapeList
aObject
- the reference object with which to compare.public int hashCode()
ALcdShape
ALcdShape.equals(Object)
method.
Extensions should refine this implementation, based on their properties.hashCode
in class ALcdShapeList
public boolean isAirspaceAssociationDiscretizable()
getShapeCount
will return 0.getBounds
will return the combined bounds
of the individual airspaces contained in the associations of this airspace (if there are any).public void invalidate()
public 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.