AnyLogic
Expand
Font size
All Implemented Interfaces:
IPathData, Serializable, Iterable<T>
Direct Known Subclasses:
AbstractNetworkCurve, Curve

@AnyLogicInternalAPI
public abstract class AbstractCurve<T extends AbstractMarkupSegment>
extends Object
implements IPathData, Iterable<T>
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
AbstractCurve() 

Method Summary

Modifier and TypeMethodDescription
voidaddSegment(T segment)
Adss a segment to this curve when creating the curve from code.
PointgetEndPoint(Point out)
Returns the location of the end point
doublegetOffset3D(double offset2D)
Returns offset on the curve, which correlates to provided offset2D on XY projection
final PositiongetPositionAt2DOffset(double offset, Position out)
Returns the point (+rotations) located on the markup element at the XY projection with the given offset distance calculated from start point.
final PositiongetPositionAtOffset(double offset, Position out)
Returns the point (+rotations) located on the markup element with the given offset distance calculated from start point.
TgetSegment(int index)
Returns the segment by its index
intgetSegmentCount()
Returns the number of segments
PointgetStartPoint(Point out)
Returns the location of the start point
final booleanisInitialized()
Returns was this markup initialized of not
Iterator<T>iterator()
Creates and returns read-only iterator over segments
final doublelength()
Returns the length of the markup element, calculated in 3D space.
Stream<T>segmentsStream()
Creates and returns stream over segments
StringtoString() 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Methods inherited from interface java.lang.Iterable

forEach, spliterator

Constructor Details

AbstractCurve

public AbstractCurve()

Method Details

isInitialized

public final boolean isInitialized()
Returns was this markup initialized of not

addSegment

public void addSegment(T segment)
Adss a segment to this curve when creating the curve from code. The curve should be uninitialized, while the segment should be initialized.
Parameters:
segment - a segment to be added

getSegmentCount

public int getSegmentCount()
Returns the number of segments
Returns:
the number of segments

getSegment

public T getSegment(int index)
Returns the segment by its index
Parameters:
index - the segment index, [0 .. getSegmentCount() - 1]
Returns:
the segment

iterator

public Iterator<T> iterator()
Creates and returns read-only iterator over segments
Specified by:
iterator in interface Iterable<T extends AbstractMarkupSegment>

segmentsStream

public Stream<T> segmentsStream()
Creates and returns stream over segments

getStartPoint

public Point getStartPoint(Point out)
Returns the location of the start point
Parameters:
out - output object to write to, may be null
Returns:
the Point object with coordinates of the first point

getEndPoint

public Point getEndPoint(Point out)
Returns the location of the end point
Parameters:
out - output object to write to, may be null
Returns:
the Point object with coordinates of the last point

length

public final double length()
Returns the length of the markup element, calculated in 3D space.
Returns:
the length of the markup element (measured in pixels), a positive number

getPositionAtOffset

public final Position getPositionAtOffset(double offset,
 Position out)
Returns the point (+rotations) located on the markup element with the given offset distance calculated from start point.
Parameters:
offset - offset, non-negative value, should be less or equal to the full length.
out - output object to write to, may be null
Returns:
the Position object with coordinates of the point with the given offset and orientation along markup element line at this point

getPositionAt2DOffset

public final Position getPositionAt2DOffset(double offset,
 Position out)
Returns the point (+rotations) located on the markup element at the XY projection with the given offset distance calculated from start point.
Parameters:
offset - offset, non-negative value, should be less or equal to the length of the projection to XY.
out - output object to write to, may be null
Returns:
the Position object with coordinates of the point with the given offset and orientation along markup element line at this point

getOffset3D

public double getOffset3D(double offset2D)
Returns offset on the curve, which correlates to provided offset2D on XY projection
Parameters:
offset2D - offset on the XY projection of the curve
Returns:
offset on the curve, which correlates to offset on XY projection

toString

public String toString()
Overrides:
toString in class Object