public abstract class ALcdShape extends Object implements ILcdShape
This abstract class provides a basis for implementing the ILcdShape
interface.
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.
Warning: when using extensions of this class directly as domain objects (=model elements),
make sure to override the equals(Object)
and hashCode()
methods so that two different domain objects
with the same geometry are not considered equal.
See the equals() and hashCode() requirements for domain objects article for more information.
Constructor and Description |
---|
ALcdShape() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates and returns a copy of this object, by delegating to
Object.clone() . |
boolean |
contains2D(ILcdPoint aPoint)
Checks whether this
ALcdShape contains the given point in the
2D cartesian plane. |
boolean |
contains3D(ILcdPoint aPoint)
Checks whether this
ALcdShape contains the given point in the
3D space. |
boolean |
equals(Object aObject)
An object is considered equal to this shape if it has the same class.
|
static ILcdShape |
fromDomainObject(Object aObject)
Returns a shape for the given object.
|
int |
hashCode()
The hash code of this shape is the hash code of its class, in order to
be consistent with the
equals(Object) method. |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
contains2D, contains3D, getFocusPoint
getBounds
public static ILcdShape fromDomainObject(Object aObject)
Returns a shape for the given object. The given object is usually a domain object, i.e. an object retrieved from the model. It returns a shape in the following cases:
Object
is an ILcdShape
.Object
is an ILcdDataObject
whose type contains a TLcdHasGeometryAnnotation
with an ILcdShape
property.In other cases, this method returns null
.
One should never check if an Object
is a shape using instanceof
, but use this method
instead and perform a null
-check on the result.
aObject
- an object, usually the domain object in a model.null
.public boolean contains2D(ILcdPoint aPoint)
ALcdShape
contains the given point in the
2D cartesian plane.contains2D
in interface ILcdShape
aPoint
- the point to test.ILcdShape.contains2D(double, double)
public boolean contains3D(ILcdPoint aPoint)
ALcdShape
contains the given point in the
3D space.contains3D
in interface ILcdShape
aPoint
- the point to test.ILcdShape.contains3D(double, double, double)
public Object clone()
Object.clone()
. Extensions should delegate to this implementation
with super.clone()
, in order to create an object instance of
the right type, with all fields copied. They then should explicitly
clone any non-primitive fields for which a deeper clone is required.clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public boolean equals(Object aObject)
public int hashCode()
equals(Object)
method.
Extensions should refine this implementation, based on their properties.