AnyLogic
Expand
Font size
All Implemented Interfaces:
IMarkupSegment, Serializable

public class GISMarkupSegmentLine
extends GISMarkupSegment
Straight markup segment for GIS space.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
GISMarkupSegmentLine() 
GISMarkupSegmentLine(double slat, double slon, double elat, double elon) 
GISMarkupSegmentLine(double slat, double slon, double elat, double elon, boolean isGeodesic) 
GISMarkupSegmentLine(double slat, double slon, double elat, double elon, double realLength) 
GISMarkupSegmentLine(double slat, double slon, double elat, double elon, double realLength, boolean isGeodesic) 
GISMarkupSegmentLine(GISMarkupSegment s, double realLength) 
GISMarkupSegmentLine(GISMarkupSegment s, double realLength, boolean isGeodesic) 

Method Summary

Modifier and TypeMethodDescription
voidaddTo(Path2D path)
Adds this segment to the given path assuming that path is currently positioned on the start point of this segment
doublegetDistanceSq(double lat, double lon)
Calculates and returns the square of distance to the given latitude and longitude
doublegetDistanceSq(Point givenPoint)
Calculates and returns the square of distance to the given point.
PointgetEnd(Point out)
Gets end point of markup segment.
PositiongetEnd(Position out)
Returns the location of the end position of the segment
doublegetNearestPoint(double lat, double lon, Point out)
Calculates (using the out object) the point in this space markup element nearest to the given (lat, lon) point.
doublegetNearestPoint(Point givenPoint, Point out)
For horizontal segments, calculates (using the output object) the point in this space markup element nearest to the given (x, y) point.
doublegetNearestPointOnRay2D(double lat1, double lon1, double lat2, double lon2, Point out)
Calculates (and sets in the 'out' object) the point where this segment intersects the given ray with the minimum distance from ray beginning (if there are several intersection points like in arc segments).
doublegetOffsetOfPoint(double lat, double lon)
Calculates distance by segment to the given point.
PointgetStart(Point out)
Gets start point of markup segment.
PositiongetStart(Position out)
Returns the location of the start position of the segment
voidinitialize() 
voidsetStart(Point startPoint)
Sets start point of this segment.

Methods inherited from class com.anylogic.engine.markup.GISMarkupSegment

length, setEnd, setEnd, setStart, setStartNextTo

Methods inherited from class java.lang.Object

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

Constructor Details

GISMarkupSegmentLine

public GISMarkupSegmentLine()

GISMarkupSegmentLine

public GISMarkupSegmentLine(double slat,
 double slon,
 double elat,
 double elon)

GISMarkupSegmentLine

public GISMarkupSegmentLine(double slat,
 double slon,
 double elat,
 double elon,
 boolean isGeodesic)

GISMarkupSegmentLine

public GISMarkupSegmentLine(GISMarkupSegment s,
 double realLength)

GISMarkupSegmentLine

public GISMarkupSegmentLine(GISMarkupSegment s,
 double realLength,
 boolean isGeodesic)

GISMarkupSegmentLine

public GISMarkupSegmentLine(double slat,
 double slon,
 double elat,
 double elon,
 double realLength)

GISMarkupSegmentLine

public GISMarkupSegmentLine(double slat,
 double slon,
 double elat,
 double elon,
 double realLength,
 boolean isGeodesic)

Method Details

initialize

public void initialize()

getNearestPoint

public double getNearestPoint(double lat,
 double lon,
 Point out)
Calculates (using the out object) the point in this space markup element nearest to the given (lat, lon) point. Returns the square of distance to the given point.
Parameters:
lat - the latitude of given point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
lon - the longitude of given point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
out - the output point to write result to. Note that output.z is left unchanged.
Returns:
the square of distance to the nearest point

getNearestPoint

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).
out - the output point to write result to. Note that output.z is left unchanged.
Returns:
the square of distance to the nearest point in the horizontal (XY) projection

getOffsetOfPoint

public double getOffsetOfPoint(double lat,
 double lon)
Description copied from interface: IMarkupSegment
Calculates distance by segment to the given point. Point is specified by a pair of coordinates. The given point should by on this segment.
Parameters:
lat - the x coordinate of the given point.
In case of GIS environment this is the latitude of the given point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
lon - the y coordinate of the given point
In case of GIS environment this is the longitude of the given point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the distance by segment to the given point

getStart

public Point getStart(Point out)
Description copied from interface: IMarkupSegment
Gets start point of markup segment.
Parameters:
out - the point to store the result of method's execution
Returns:
the start point of this segment

getEnd

public Point getEnd(Point out)
Description copied from interface: IMarkupSegment
Gets end point of markup segment.
Parameters:
out - the point to store the result of method's execution
Returns:
the start point of this segment

getNearestPointOnRay2D

public double getNearestPointOnRay2D(double lat1,
 double lon1,
 double lat2,
 double lon2,
 Point out)
Description copied from interface: IMarkupSegment
Calculates (and sets in the 'out' object) the point where this segment intersects the given ray with the minimum distance from ray beginning (if there are several intersection points like in arc segments). Returns the square of that distance.
Returns +infinity if there is no intersections.
Parameters:
lat1 - the X coordinate of the start point of the ray
lon1 - the Y coordinate of the start point of the ray
lat2 - the X coordinate of some point on the ray
lon2 - the Y coordinate of some point on the ray
out - the Point object to write result to
Returns:
the square of the distance from ray beginning to the nearest intersection point or +infinity if there is no intersections

addTo

public void addTo(Path2D path)
Description copied from interface: IMarkupSegment
Adds this segment to the given path assuming that path is currently positioned on the start point of this segment
Parameters:
path - the path to add this segment to

setStart

public void setStart(Point startPoint)
Description copied from interface: IMarkupSegment
Sets start point of this segment.
Specified by:
setStart in interface IMarkupSegment
Overrides:
setStart in class GISMarkupSegment
Parameters:
startPoint - the point to set as start point of this segment

getDistanceSq

public double getDistanceSq(double lat,
 double lon)
Calculates and returns the square of distance to the given latitude and longitude
Parameters:
lat - latitude
lon - longitude
Returns:
squared distance

getDistanceSq

public double getDistanceSq(Point givenPoint)
Description copied from interface: IMarkupSegment
Calculates and returns the square of distance to the given point.
Returns:
the square of distance to the given point

getStart

public Position getStart(Position out)
Description copied from class: AbstractMarkupSegment
Returns the location of the start position of the segment
Specified by:
getStart in class AbstractMarkupSegment
Parameters:
out - output object to write to, may be null
Returns:
the Position object with coordinates of the segment start

getEnd

public Position getEnd(Position out)
Description copied from class: AbstractMarkupSegment
Returns the location of the end position of the segment
Specified by:
getEnd in class AbstractMarkupSegment
Parameters:
out - output object to write to, may be null
Returns:
the Position object with coordinates of the segment end