AnyLogic AnyLogic
Expand
Font size
All Implemented Interfaces:
IMarkupSegment, java.io.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

Constructors 
GISMarkupSegmentLine()  
GISMarkupSegmentLine​(double slat, double slon, double elat, double elon)  
GISMarkupSegmentLine​(double slat, double slon, double elat, double elon, double realLength)  
GISMarkupSegmentLine​(GISMarkupSegment s, double realLength)  
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
void addTo​(java.awt.geom.Path2D path)
Adds this segment to the given path assuming that path is currently positioned on the start point of this segment
double getDistanceSq​(double lat, double lon)
Calculates and returns the square of distance to the given latitude and longitude
double getDistanceSq​(Point givenPoint)
Calculates and returns the square of distance to the given point.
Point getEnd​(Point out)
Gets end point of markup segment.
Position getEnd​(Position out)
Returns the location of the end position of the segment
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.
double getNearestPoint​(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.
double getNearestPointOnRay2D​(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).
double getOffsetOfPoint​(double lat, double lon)
Calculates distance by segment to the given point.
Point getStart​(Point out)
Gets start point of markup segment.
Position getStart​(Position out)
Returns the location of the start position of the segment
void initialize()  
void setStart​(Point startPoint)
Sets start point of this segment.
Modifier and Type Method Description

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 Detail

GISMarkupSegmentLine

public GISMarkupSegmentLine()

GISMarkupSegmentLine

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

GISMarkupSegmentLine

public GISMarkupSegmentLine​(GISMarkupSegment s,
                            double realLength)

GISMarkupSegmentLine

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

Method Detail

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​(java.awt.geom.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
How can we improve this article?