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
ConstructorsConstructorDescriptionCreates a newTLcdXYGeoBufferwith width 0.TLcdXYGeoBuffer(ILcdShape aShape, double aWidth) Creates a newTLcdXYGeoBufferwith the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cache.clone()Creates and returns a copy of this object.booleancontains2D(double x, double y) Checks whether thisILcdShapecontains the given point in the 2D space.booleancontains2D(ILcdPoint aPoint) Checks whether thisALcdShapecontains the given point in the 2D cartesian plane.booleanReturns whether the given object has the same class, coordinates, and width.Returns the base shape of the buffer.Returns theILcdBoundsby which the geometry of thisILcdBoundedobject is bounded.getCachedObject(Object aKey) Looks up and returns the cached Object corresponding to the given key.intReturns the end cap style of the buffer.Returns the focus point of thisILcdShape.intReturns 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 doublegetWidth()Returns the width of this buffer, expressed in meters and measured from the line segments of the base shape to the contour.inthashCode()The hash code of this shape is the hash code of its class, in order to be consistent with theALcdShape.equals(Object)method.voidinsertIntoCache(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.voidIndicates that the base shape has been changed, and that the buffer should be recalculated.voidmove2D(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.voidsetBaseShape(ILcdShape aShape) Sets the base shape of the buffer.voidsetEndCapStyle(int aEndCapStyle) Sets the end cap style of the buffer, which must be eitherILcdGeoBuffer.CAP_BUTTorILcdGeoBuffer.CAP_ROUND.voidsetJoinStyle(int aJoinStyle) Sets the join style of the buffer, which must beILcdGeoBuffer.JOIN_ROUND.voidsetWidth(double aWidth) Sets the width of the buffer, expressed in meters and measured from the axis to the border.toString()voidtranslate2D(double aX, double aY) Translates thisILcd2DEditableShapefrom its current position over the given translation vector in the 2D space.Methods inherited from class com.luciad.shape.shape2D.ALcd2DEditableShape
contains3D, move2DMethods inherited from class com.luciad.shape.ALcdShape
contains3D, fromDomainObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.luciad.shape.shape2D.ILcd2DEditableShape
move2DMethods inherited from interface com.luciad.shape.ILcdShape
contains3D, contains3D
-
Constructor Details
-
TLcdXYGeoBuffer
public TLcdXYGeoBuffer()Creates a newTLcdXYGeoBufferwith width 0. -
TLcdXYGeoBuffer
Creates a newTLcdXYGeoBufferwith the specified parameters.- Parameters:
aShape- the base shape of the buffer, which must be of the typeILcd2DEditableShapeand one of the following:ILcdPointILcdPolylineILcdPolygon
ILcdEditableComplexPolygonthat 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:ALcd2DEditableShapeTranslates this shape so that its focus point ends up at the specified position.- Specified by:
move2Din interfaceILcd2DEditableShape- Overrides:
move2Din 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:ILcd2DEditableShapeTranslates thisILcd2DEditableShapefrom its current position over the given translation vector in the 2D space. Only the first two dimensions of theILcdShapeare considered. The third dimension is left unchanged.- Specified by:
translate2Din 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:ILcdGeoBufferReturns 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:
getWidthin interfaceILcdGeoBuffer- Returns:
- the width of the buffer.
-
setWidth
public void setWidth(double aWidth) Description copied from interface:ILcd2DEditableGeoBufferSets the width of the buffer, expressed in meters and measured from the axis to the border.- Specified by:
setWidthin interfaceILcd2DEditableGeoBuffer- Parameters:
aWidth- the width of the buffer.
-
getBaseShape
Description copied from interface:ILcdGeoBufferReturns the base shape of the buffer.- Specified by:
getBaseShapein interfaceILcdGeoBuffer- Returns:
- the base shape of the buffer.
-
setBaseShape
Description copied from interface:ILcd2DEditableGeoBufferSets the base shape of the buffer.- Specified by:
setBaseShapein interfaceILcd2DEditableGeoBuffer- Parameters:
aShape- the base shape of the buffer.
-
invalidateShape
public void invalidateShape()Description copied from interface:ILcd2DEditableGeoBufferIndicates that the base shape has been changed, and that the buffer should be recalculated.- Specified by:
invalidateShapein interfaceILcd2DEditableGeoBuffer
-
getEndCapStyle
public int getEndCapStyle()Returns the end cap style of the buffer. The default isILcdGeoBuffer.CAP_ROUND.- Specified by:
getEndCapStylein interfaceILcdGeoBuffer- Returns:
- the end cap style of the buffer.
-
setEndCapStyle
public void setEndCapStyle(int aEndCapStyle) Description copied from interface:ILcd2DEditableGeoBufferSets the end cap style of the buffer, which must be eitherILcdGeoBuffer.CAP_BUTTorILcdGeoBuffer.CAP_ROUND.- Specified by:
setEndCapStylein interfaceILcd2DEditableGeoBuffer- Parameters:
aEndCapStyle- the end cap style of the buffer.
-
getJoinStyle
public int getJoinStyle()Description copied from interface:ILcdGeoBufferReturns 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:
getJoinStylein interfaceILcdGeoBuffer- Returns:
- the join style of the buffer.
-
setJoinStyle
public void setJoinStyle(int aJoinStyle) Description copied from interface:ILcd2DEditableGeoBufferSets the join style of the buffer, which must beILcdGeoBuffer.JOIN_ROUND.- Specified by:
setJoinStylein interfaceILcd2DEditableGeoBuffer- Parameters:
aJoinStyle- the join style of the buffer.
-
contains2D
Description copied from class:ALcdShapeChecks whether thisALcdShapecontains the given point in the 2D cartesian plane.- Specified by:
contains2Din interfaceILcdShape- Overrides:
contains2Din 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:ILcdShapeChecks whether thisILcdShapecontains the given point in the 2D space. Only the first two dimensions of theILcdShapeare considered.- Specified by:
contains2Din 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:ILcdShapeReturns the focus point of thisILcdShape.- Specified by:
getFocusPointin interfaceILcdShape- Returns:
- the focus point of this
ILcdShape.
-
getBounds
Description copied from interface:ILcdBoundedReturns theILcdBoundsby which the geometry of thisILcdBoundedobject 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
undefinedbounds. You can create undefined bounds using the default constructors ofTLcdLonLatBoundsorTLcdXYBounds.- Specified by:
getBoundsin interfaceILcdBounded- Returns:
- the
ILcdBoundsby which the geometry of thisILcdBoundedobject is bounded.
-
insertIntoCache
Description copied from interface:ILcdCacheInserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCachein 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:ILcdCacheLooks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObjectin 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:ILcdCacheLooks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObjectin 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:ILcdCacheClears the cache.- Specified by:
clearCachein 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:
clonein interfaceILcdCloneable- Overrides:
clonein classALcdShape- See Also:
-
equals
Returns whether the given object has the same class, coordinates, and width. -
hashCode
public int hashCode()Description copied from class:ALcdShapeThe 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
-