- java.lang.Object
- com.anylogic.engine.markup.AbstractMarkupSegment
- com.anylogic.engine.markup.MarkupSegment
- All Implemented Interfaces:
IMarkupSegment
,Serializable
- Direct Known Subclasses:
MarkupSegmentArc
,MarkupSegmentLine
public abstract class MarkupSegment extends AbstractMarkupSegment
Basic implementation of
IMarkupSegment
for continuous space.- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Method | Description |
---|---|---|
abstract List<Shape> | convertToShapes() | |
BoundingRectangle | getBoundingRectangle() | |
abstract double | getDistanceSq |
For horizontal segments, calculates and returns the square of distance to the
point (in the XY-projection).
|
abstract double | getDistanceSq |
Calculates and returns the square of distance to the given (x, y, z) point.
|
double | getDistanceSq |
Calculates and returns the square of distance to the given point.
|
final Point | getEnd |
Returns the location of the end point of the segment
|
final double | getEndX() |
Returns the x coordinate of the end point of the segment
|
final double | getEndY() |
Returns the y coordinate of the start point of the segment
|
final double | getEndZ() |
Returns the z coordinate of the start point of the segment
|
abstract double | getNearestPoint |
Calculates (using the
output object) the point in this space markup element
nearest to the given (x, y, z) point. |
abstract double | getNearestPoint |
For horizontal segments, calculates (using the
output object) the point in
this space markup element nearest to the given (x, y) point. |
double | getNearestPoint |
For horizontal segments, calculates (using the
output object) the point in
this space markup element nearest to the given (x, y) point. |
double | getOffsetFrom2D |
Converts offset from the beginning of this segment given in XY-projection,
to true offset, which may be used in various methods which require offset
|
final Position | getPositionAtOffset |
Returns the point located on the segment with the given
offset distance calculated from
start point. |
final Point | getStart |
Returns the location of the start point of the segment
|
final double | getStartX() |
Returns the x coordinate of the start point of the segment
|
final double | getStartY() |
Returns the y coordinate of the start point of the segment
|
final double | getStartZ() |
Returns the z coordinate of the start point of the segment
|
final double | length() |
Returns the length of the path segment
|
final double | length2D() |
Returns the length of the path segment in XY-projection
|
final void | setEnd |
Sets the end point of the path segment.
This function may be called only for segments created using constructor without arguments. Please call AbstractMarkupSegment.initialize() after segment setup is finished. |
final void | setEnd |
Sets the end point of the path segment.
This function may be called only for segments created using constructor without arguments. Please call AbstractMarkupSegment.initialize() after segment setup is finished. |
final void | setStart |
Sets the start point of the path segment.
This function may be called only for segments created using constructor without arguments. Please call AbstractMarkupSegment.initialize() after segment setup is finished. |
final void | setStart |
Sets the start point of the path segment.
This function may be called only for segments created using constructor without arguments. Please call AbstractMarkupSegment.initialize() after segment setup is finished. |
final void | setStartNextTo |
Sets the start point of the path segment to the coordinates of the end
point of the given
previousSegment .This function may be called only for segments created using constructor without arguments. Please call AbstractMarkupSegment.initialize() after segment setup is finished. |
public final void setStart(double x, double y, double z)
Sets the start point of the path segment.
This function may be called only for segments created using constructor without arguments.
Please call
This function may be called only for segments created using constructor without arguments.
Please call
AbstractMarkupSegment.initialize()
after segment setup is finished.- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinate
public final void setStart(Point p)
Sets the start point of the path segment.
This function may be called only for segments created using constructor without arguments.
Please call
This function may be called only for segments created using constructor without arguments.
Please call
AbstractMarkupSegment.initialize()
after segment setup is finished.- Specified by:
setStart
in interfaceIMarkupSegment
- Parameters:
p
- the point
public final void setStartNextTo(IMarkupSegment previousSegment)
Sets the start point of the path segment to the coordinates of the end
point of the given
This function may be called only for segments created using constructor without arguments.
Please call
previousSegment
.This function may be called only for segments created using constructor without arguments.
Please call
AbstractMarkupSegment.initialize()
after segment setup is finished.- Specified by:
setStartNextTo
in interfaceIMarkupSegment
- Parameters:
previousSegment
- the segment to get end-point, e.g. the previous segment in the path
public final Point getStart(Point out)
Returns the location of the start point of the segment
- Specified by:
getStart
in interfaceIMarkupSegment
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the segment start
public final void setEnd(double x, double y, double z)
Sets the end point of the path segment.
This function may be called only for segments created using constructor without arguments.
Please call
This function may be called only for segments created using constructor without arguments.
Please call
AbstractMarkupSegment.initialize()
after segment setup is finished.- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinate
public final void setEnd(Point p)
Sets the end point of the path segment.
This function may be called only for segments created using constructor without arguments.
Please call
This function may be called only for segments created using constructor without arguments.
Please call
AbstractMarkupSegment.initialize()
after segment setup is finished.- Specified by:
setEnd
in interfaceIMarkupSegment
- Parameters:
p
- the point
public final Point getEnd(Point out)
Returns the location of the end point of the segment
- Specified by:
getEnd
in interfaceIMarkupSegment
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the segment end
public final double getStartX()
Returns the x coordinate of the start point of the segment
- Returns:
- the x coordinate of the start point of the segment
public final double getStartY()
Returns the y coordinate of the start point of the segment
- Returns:
- the y coordinate of the start point of the segment
public final double getStartZ()
Returns the z coordinate of the start point of the segment
- Returns:
- the z coordinate of the start point of the segment
public final double getEndX()
Returns the x coordinate of the end point of the segment
- Returns:
- the x coordinate of the end point of the segment
public final double getEndY()
Returns the y coordinate of the start point of the segment
- Returns:
- the y coordinate of the start point of the segment
public final double getEndZ()
Returns the z coordinate of the start point of the segment
- Returns:
- the z coordinate of the start point of the segment
public final Position getPositionAtOffset(double offset, Position out)
Returns the point located on the segment with the given
offset
distance calculated from
start point.- Parameters:
offset
- offset, non-negative value, should be less or equal to the segment length.out
- output object to write to, may benull
- Returns:
public abstract double getDistanceSq(double x, double y)
For horizontal segments, calculates and returns the square of distance to the
point (in the XY-projection).
All the calculations are performed in the horizontal projection (z-coordinates aren't used,
as if all of the z coordinates were zero).
- Parameters:
x
- x coordinate of the pointy
- y coordinate of the point- Returns:
- the square of distance to the given point in the horizontal (XY) projection
public abstract double getNearestPoint(double x, double y, double z, Point out)
Calculates (using the
output
object) the point in this space markup element
nearest to the given (x, y, z) point. Returns the square of distance to the point.- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointz
- z coordinate of the pointoutput
- the output point to write result to.- Returns:
- the square of distance to the nearest point
public abstract double getNearestPoint(double x, double y, Point out)
For horizontal segments, calculates (using the
output
object) the point in
this space markup element nearest to the given (x, y) point.
Returns the square of distance to the point (in the XY-projection).
All the calculations are performed in the horizontal projection (z-coordinates aren't used,
as if all of the z coordinates were zero).- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointout
- the output point to write result to. Note thatoutput.z
is left unchanged.- Returns:
- the square of distance to the nearest point in the horizontal (XY) projection
public double getNearestPoint(Point givenPoint, Point out)
Description copied from interface:
IMarkupSegment
For horizontal segments, calculates (using the
output
object) the point in
this space markup element nearest to the given (x, y) point.
Returns the square of distance to the point (in the XY-projection).
All the calculations are performed in the horizontal projection (z-coordinates aren't used,
as if all of the z coordinates were zero).- Specified by:
getNearestPoint
in interfaceIMarkupSegment
out
- the output point to write result to. Note thatoutput.z
is left unchanged.- Returns:
- the square of distance to the nearest point in the horizontal (XY) projection
public abstract double getDistanceSq(double x, double y, double z)
Calculates and returns the square of distance to the given (x, y, z) point.
- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointz
- z coordinate of the point- Returns:
- the square of distance to the given point
public double getDistanceSq(Point givenPoint)
Description copied from interface:
IMarkupSegment
Calculates and returns the square of distance to the given point.
- Specified by:
getDistanceSq
in interfaceIMarkupSegment
- Returns:
- the square of distance to the given point
public final double length()
Description copied from class:
AbstractMarkupSegment
Returns the length of the path segment
- Specified by:
length
in interfaceIMarkupSegment
- Overrides:
length
in classAbstractMarkupSegment
- Returns:
- the length of the path segment, a positive number
public final double length2D()
Returns the length of the path segment in XY-projection
- Returns:
- the length of the path segment in XY-projection, a positive number
@AnyLogicInternalAPI public double getOffsetFrom2D(double offset2D)
Converts offset from the beginning of this segment given in XY-projection,
to true offset, which may be used in various methods which require offset
- Parameters:
offset2D
- offset in XY-projection- Returns:
- offset
public abstract List<Shape> convertToShapes()
- Returns:
- the list of primitives that comprise the markup segment
@AnyLogicInternalAPI BoundingRectangle getBoundingRectangle()