Package com.luciad.shape.shape2D
Class TLcdXYGeoBuffer
java.lang.Object
com.luciad.shape.ALcdShape
com.luciad.shape.shape2D.ALcd2DEditableShape
com.luciad.shape.shape2D.TLcdXYGeoBuffer
- All Implemented Interfaces:
ILcdBounded
,ILcdGeoBuffer
,ILcdShape
,ILcd2DEditableGeoBuffer
,ILcd2DEditableShape
,ILcdCache
,ILcdCloneable
,Serializable
,Cloneable
public class TLcdXYGeoBuffer
extends ALcd2DEditableShape
implements ILcd2DEditableGeoBuffer, ILcdCache
This class represents a buffer around a shape with a given
width, in the cartesian space. To calculate the contour, the utility method
TLcdCartesian.computeBufferContour2D
can be used.
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.
- See Also:
-
Field Summary
Fields inherited from interface com.luciad.shape.ILcdGeoBuffer
CAP_BUTT, CAP_ROUND, JOIN_ROUND
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdXYGeoBuffer
with width 0.TLcdXYGeoBuffer
(ILcdShape aShape, double aWidth) Creates a newTLcdXYGeoBuffer
with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the cache.clone()
Creates and returns a copy of this object.boolean
contains2D
(double x, double y) Checks whether thisILcdShape
contains the given point in the 2D space.boolean
contains2D
(ILcdPoint aPoint) Checks whether thisALcdShape
contains the given point in the 2D cartesian plane.boolean
Returns whether the given object has the same class, coordinates, and width.Returns the base shape of the buffer.Returns theILcdBounds
by which the geometry of thisILcdBounded
object is bounded.getCachedObject
(Object aKey) Looks up and returns the cached Object corresponding to the given key.int
Returns the end cap style of the buffer.Returns the focus point of thisILcdShape
.int
Returns the join style for the contour of this buffer, which defines the representation of the contour at the joins between two line segments of the base shape.final double
getWidth()
Returns the width of this buffer, expressed in meters and measured from the line segments of the base shape to the contour.int
hashCode()
The hash code of this shape is the hash code of its class, in order to be consistent with theALcdShape.equals(Object)
method.void
insertIntoCache
(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.void
Indicates that the base shape has been changed, and that the buffer should be recalculated.void
move2D
(double aX, double aY) Translates this shape so that its focus point ends up at the specified position.removeCachedObject
(Object aKey) Looks up and removes the cached Object corresponding to the given key.void
setBaseShape
(ILcdShape aShape) Sets the base shape of the buffer.void
setEndCapStyle
(int aEndCapStyle) Sets the end cap style of the buffer, which must be eitherILcdGeoBuffer.CAP_BUTT
orILcdGeoBuffer.CAP_ROUND
.void
setJoinStyle
(int aJoinStyle) Sets the join style of the buffer, which must beILcdGeoBuffer.JOIN_ROUND
.void
setWidth
(double aWidth) Sets the width of the buffer, expressed in meters and measured from the axis to the border.toString()
void
translate2D
(double aX, double aY) Translates thisILcd2DEditableShape
from its current position over the given translation vector in the 2D space.Methods inherited from class com.luciad.shape.shape2D.ALcd2DEditableShape
contains3D, move2D
Methods inherited from class com.luciad.shape.ALcdShape
contains3D, fromDomainObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.shape.shape2D.ILcd2DEditableShape
move2D
Methods inherited from interface com.luciad.shape.ILcdShape
contains3D, contains3D
-
Constructor Details
-
TLcdXYGeoBuffer
public TLcdXYGeoBuffer()Creates a newTLcdXYGeoBuffer
with width 0. -
TLcdXYGeoBuffer
Creates a newTLcdXYGeoBuffer
with the specified parameters.- Parameters:
aShape
- the base shape of the buffer, which must be of the typeILcd2DEditableShape
and one of the following:ILcdPoint
ILcdPolyline
ILcdPolygon
ILcdEditableComplexPolygon
that contains only editable polygons.aWidth
- the width in meters of the corridor, expressed in meters and measured from the axis to the border.- Throws:
IllegalArgumentException
- if the supplied base shape is not one of the supported shapes, or if the width is negative.
-
-
Method Details
-
move2D
public void move2D(double aX, double aY) Description copied from class:ALcd2DEditableShape
Translates this shape so that its focus point ends up at the specified position.- Specified by:
move2D
in interfaceILcd2DEditableShape
- Overrides:
move2D
in classALcd2DEditableShape
- Parameters:
aX
- the x coordinate of the point.aY
- the y coordinate of the point.
-
translate2D
public void translate2D(double aX, double aY) Description copied from interface:ILcd2DEditableShape
Translates thisILcd2DEditableShape
from its current position over the given translation vector in the 2D space. Only the first two dimensions of theILcdShape
are considered. The third dimension is left unchanged.- Specified by:
translate2D
in interfaceILcd2DEditableShape
- Parameters:
aX
- the x coordinate of the translation vector.aY
- the y coordinate of the translation vector.
-
getWidth
public final double getWidth()Description copied from interface:ILcdGeoBuffer
Returns the width of this buffer, expressed in meters and measured from the line segments of the base shape to the contour. The width is positive (width >= 0).- Specified by:
getWidth
in interfaceILcdGeoBuffer
- Returns:
- the width of the buffer.
-
setWidth
public void setWidth(double aWidth) Description copied from interface:ILcd2DEditableGeoBuffer
Sets the width of the buffer, expressed in meters and measured from the axis to the border.- Specified by:
setWidth
in interfaceILcd2DEditableGeoBuffer
- Parameters:
aWidth
- the width of the buffer.
-
getBaseShape
Description copied from interface:ILcdGeoBuffer
Returns the base shape of the buffer.- Specified by:
getBaseShape
in interfaceILcdGeoBuffer
- Returns:
- the base shape of the buffer.
-
setBaseShape
Description copied from interface:ILcd2DEditableGeoBuffer
Sets the base shape of the buffer.- Specified by:
setBaseShape
in interfaceILcd2DEditableGeoBuffer
- Parameters:
aShape
- the base shape of the buffer.
-
invalidateShape
public void invalidateShape()Description copied from interface:ILcd2DEditableGeoBuffer
Indicates that the base shape has been changed, and that the buffer should be recalculated.- Specified by:
invalidateShape
in interfaceILcd2DEditableGeoBuffer
-
getEndCapStyle
public int getEndCapStyle()Returns the end cap style of the buffer. The default isILcdGeoBuffer.CAP_ROUND
.- Specified by:
getEndCapStyle
in interfaceILcdGeoBuffer
- Returns:
- the end cap style of the buffer.
-
setEndCapStyle
public void setEndCapStyle(int aEndCapStyle) Description copied from interface:ILcd2DEditableGeoBuffer
Sets the end cap style of the buffer, which must be eitherILcdGeoBuffer.CAP_BUTT
orILcdGeoBuffer.CAP_ROUND
.- Specified by:
setEndCapStyle
in interfaceILcd2DEditableGeoBuffer
- Parameters:
aEndCapStyle
- the end cap style of the buffer.
-
getJoinStyle
public int getJoinStyle()Description copied from interface:ILcdGeoBuffer
Returns the join style for the contour of this buffer, which defines the representation of the contour at the joins between two line segments of the base shape. This is alwaysILcdGeoBuffer.JOIN_ROUND
.- Specified by:
getJoinStyle
in interfaceILcdGeoBuffer
- Returns:
- the join style of the buffer.
-
setJoinStyle
public void setJoinStyle(int aJoinStyle) Description copied from interface:ILcd2DEditableGeoBuffer
Sets the join style of the buffer, which must beILcdGeoBuffer.JOIN_ROUND
.- Specified by:
setJoinStyle
in interfaceILcd2DEditableGeoBuffer
- Parameters:
aJoinStyle
- the join style of the buffer.
-
contains2D
Description copied from class:ALcdShape
Checks whether thisALcdShape
contains the given point in the 2D cartesian plane.- Specified by:
contains2D
in interfaceILcdShape
- Overrides:
contains2D
in classALcdShape
- Parameters:
aPoint
- the point to test.- Returns:
- the boolean result of the containment test.
- See Also:
-
contains2D
public boolean contains2D(double x, double y) Description copied from interface:ILcdShape
Checks whether thisILcdShape
contains the given point in the 2D space. Only the first two dimensions of theILcdShape
are considered.- Specified by:
contains2D
in interfaceILcdShape
- Parameters:
x
- the x coordinate of the point.y
- the y coordinate of the point.- Returns:
- the boolean result of the containment test.
-
getFocusPoint
Description copied from interface:ILcdShape
Returns the focus point of thisILcdShape
.- Specified by:
getFocusPoint
in interfaceILcdShape
- Returns:
- the focus point of this
ILcdShape
.
-
getBounds
Description copied from interface:ILcdBounded
Returns theILcdBounds
by which the geometry of thisILcdBounded
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 ofTLcdLonLatBounds
orTLcdXYBounds
.- Specified by:
getBounds
in interfaceILcdBounded
- Returns:
- the
ILcdBounds
by which the geometry of thisILcdBounded
object is bounded.
-
insertIntoCache
Description copied from interface:ILcdCache
Inserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCache
in interfaceILcdCache
- Parameters:
aKey
- the key Object that will be used to identify the Object. The key must therefore be a unique identifier, typically the caller itself:insertIntoCache(this, ...)
.aObject
- the Object to be cached.
-
getCachedObject
Description copied from interface:ILcdCache
Looks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there is no Object corresponding to the given key.
-
removeCachedObject
Description copied from interface:ILcdCache
Looks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there was no Object corresponding to the given key.
-
clearCache
public void clearCache()Description copied from interface:ILcdCache
Clears the cache.- Specified by:
clearCache
in interfaceILcdCache
-
clone
Creates and returns a copy of this object. The axis of the buffer is cloned. The calculation of the contour is not copied or cloned at all, but recalculated when needed.- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classALcdShape
- See Also:
-
equals
Returns whether the given object has the same class, coordinates, and width. -
hashCode
public int hashCode()Description copied from class:ALcdShape
The hash code of this shape is the hash code of its class, in order to be consistent with theALcdShape.equals(Object)
method. Extensions should refine this implementation, based on their properties. -
toString
-