Package com.anylogic.engine.markup
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.markup.GISMarkupElement
- Methods inherited from class com.anylogic.engine.markup.AbstractMarkup
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Methods inherited from interface com.anylogic.engine.markup.AnimationStaticLocationProvider
- Methods inherited from interface com.anylogic.engine.markup.INetworkMarkupElement
- Methods inherited from interface com.anylogic.engine.markup.IPath
- Methods inherited from interface java.lang.Iterable
- Constructor Details
- Method Details
- getNearestPoint
- getNearestPoint
- contains
- containsSq
- contains
- isBidirectional
- setSource
- getSource
- setTarget
- getTarget
- setBidirectional
- getStartPoint
- getStartPoint
- getEndPoint
- getEndPoint
- getSegmentCount
- getOtherNode
- length
- length
- getSegment
- iterator
- getPositionAtOffset
- getPositionAtOffset
- getStartPosition
- getEndPosition
- createOMGraphicObject
- getPosition
- getPosition
- randomPointInside
- addSegment
- java.lang.Object
- com.anylogic.engine.markup.AbstractMarkup
- com.anylogic.engine.markup.GISMarkupElement
- com.anylogic.engine.markup.GISRoute
- All Implemented Interfaces:
AggregatableAnimationElement
,AnimationMovingLocationProvider
,AnimationStaticLocationProvider
,INetworkMarkupElement
,IPath<GISNode>
,SVGElement
,Serializable
,Iterable<GISMarkupSegment>
public class GISRoute extends GISMarkupElement implements IPath<GISNode>, Iterable<GISMarkupSegment>
Implementation of
IPath
for network in GIS space.- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
GISRoute |
Creates GIS route based on the array of segments.
|
GISRoute |
Creates GIS route based on the array of segments with specific drawing
attributes.
|
GISRoute |
Creates GIS route based on the array of segments with specific drawing
attributes.
|
GISRoute |
Creates unidirectional GIS route based on curve.
|
GISRoute |
Creates GIS route based on curve.
|
GISRoute |
Creates GIS route for network.
|
GISRoute |
Creates unidirectional GIS route based on the array of segments.
|
Modifier and Type | Method | Description |
---|---|---|
void | addSegment |
Adds segment to this markup element
|
boolean | contains |
Check this element contains a point with given coordinates.
|
boolean | contains |
Test if GIS Route contains the point with the given coordinates, using
the given tolerance
|
boolean | containsSq |
Test if GIS Route contains the point with the given coordinates, using
the given tolerance
|
com.bbn.openmap.omGraphics.OMGraphic | createOMGraphicObject() |
Deprecated.
|
Point | getEndPoint() |
Returns the location of the end point
|
Point | getEndPoint |
Returns the location of the end point
|
Position | getEndPosition |
Returns the end position
|
double | getNearestPoint |
Calculates (using the
out object) the point in GIS Route element
nearest to the given point. |
double | getNearestPoint |
Calculates (using the
output object) the point in this space markup element
nearest to the given point. |
GISNode | getOtherNode |
If the given node is source of this path, returns path's target,
otherwise returns source.
|
Position | getPosition |
Returns position with offset corresponding to the given
value ,
assuming that 0 is start and maxValue is end |
Position | getPosition |
Returns the item position with the given index.
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1). |
Position | getPositionAtOffset |
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
Position | getPositionAtOffset |
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
GISMarkupSegment | getSegment |
Returns the segment by its index
|
int | getSegmentCount() |
Returns the number of segments
|
GISNode | getSource() |
Returns source node of this path.
|
Point | getStartPoint() |
Returns the location of the start point
|
Point | getStartPoint |
Returns the location of the start point
|
Position | getStartPosition |
Returns the start position
|
GISNode | getTarget() |
Returns target node of this path.
|
boolean | isBidirectional() |
Returns the 'bidirectional' property (
true by default). |
Iterator<GISMarkupSegment> | iterator() |
Creates and returns read-only iterator over segments
|
final double | length() |
Returns the length of markup element, used e.g.
|
final double | length |
Returns the length of markup element, used e.g.
|
final Point | randomPointInside |
Returns the randomly chosen point inside/along the given space markup element.
|
void | setBidirectional |
Sets the 'bidirectional' property (
true by default). |
void | setSource |
Sets source node of this path.
|
void | setTarget |
Sets source node of this path.
|
discardOwner, error, getFromOMGraphic, getLineColor, getLineStyle, getLineTexture, getLineWidth, getNetwork, getOmGraphic, getSpace, initialize, onAggregatorVisibilityChanged, remove, setLineColor, setLineStyle, setLineWidth, setOwner, setVisible
executeUserAction, findSVGElement, getDrawMode, getName, getSVGId, initializeInternal, isPublic, isVisible, onAggregatorInitialized, removeSVGFromOwner, resetSVGState, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public GISRoute(ShapeGISMap map, Curve<? extends GISMarkupSegment> curve, boolean bidirectional)
Creates GIS route based on curve.
- Parameters:
map
- GIS map for drawing this markup elementcurve
- the curve consisting of GIS segments.bidirectional
-true
if edge of the network would be bidirectional
public GISRoute(ShapeGISMap map, Curve<? extends GISMarkupSegment> curve)
Creates unidirectional GIS route based on curve.
- Parameters:
map
- GIS map for drawing this markup elementcurve
- the curve consisting of GIS segments.
public GISRoute(ShapeGISMap map, Curve<? extends GISMarkupSegment> curve, GISPoint source, GISPoint target, boolean bidirectional)
Creates GIS route for network.
- Parameters:
map
- GIS map for drawing this markup elementcurve
- the curve consisting of GIS segments.source
- the source node in networktarget
- the target node in networkbidirectional
-true
if edge of the network would be bidirectional
public GISRoute(ShapeGISMap owner, boolean bidirectional, GISMarkupSegment... segments)
Creates GIS route based on the array of segments. Notice that the order of segments is valuable.
- Parameters:
owner
- GIS map for drawing this markup elementbidirectional
-true
if edge of the network would be bidirectionalsegments
- the array of segments
public GISRoute(ShapeGISMap owner, GISMarkupSegment... segments)
Creates unidirectional GIS route based on the array of segments. Notice that the order of segments is valuable.
- Parameters:
owner
- GIS map for drawing this markup elementsegments
- the array of segments
@AnyLogicInternalCodegenAPI public GISRoute(ShapeGISMap owner, boolean isPermanent, Paint lineColor, double lineWidth, LineStyle lineStyle, boolean bidirectional, GISNode source, GISNode target, GISMarkupSegmentDescriptor... segmentDescriptors)
Creates GIS route based on the array of segments with specific drawing
attributes. Notice that the order of segments is valuable.
- Parameters:
owner
-isPermanent
-lineColor
- the color of routelineWidth
- the width of route in pixelslineStyle
- the style of drawingbidirectional
-true
if edge of the network would be bidirectionalsource
- the source node in networktarget
- the target node in networksegmentDescriptors
- the array of segments
public GISRoute(ShapeGISMap owner, boolean isPermanent, Paint lineColor, double lineWidth, LineStyle lineStyle, boolean bidirectional, GISNode source, GISNode target, GISMarkupSegment... segments)
Creates GIS route based on the array of segments with specific drawing
attributes. Notice that the order of segments is valuable.
- Parameters:
owner
-isPermanent
-lineColor
- the color of routelineWidth
- the width of route in pixelslineStyle
- the style of drawingbidirectional
-true
if edge of the network would be bidirectionalsource
- the source node in networktarget
- the target node in networksegments
- the array of segments
public double getNearestPoint(double lat, double lon, Point out)
Calculates (using the
out
object) the point in GIS Route element
nearest to the given point. Returns the square of distance to the point.- Parameters:
lat
- the latitude of the point
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)lon
- the y coordinate of the point
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)out
- the output point to write result to.- Returns:
- the square of distance to the nearest point
public double getNearestPoint(Point givenPoint, Point out)
Description copied from interface:
INetworkMarkupElement
Calculates (using the
output
object) the point in this space markup element
nearest to the given point. Returns the square of distance to the point.- Specified by:
getNearestPoint
in interfaceINetworkMarkupElement
- Parameters:
givenPoint
- given pointout
- the output point to write result to.- Returns:
- the square of distance to the nearest point
public boolean contains(double lat, double lon)
Description copied from interface:
INetworkMarkupElement
Check this element contains a point with given coordinates.
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90),
y
coordinate is the longitude of the current location,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180),- Specified by:
contains
in interfaceINetworkMarkupElement
- Parameters:
lat
- the x 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:
public boolean containsSq(double lat, double lon, double squareDistance)
Test if GIS Route contains the point with the given coordinates, using
the given tolerance
- Parameters:
lat
- the latitude of the point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)lon
- the y coordinate of the point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)squareDistance
- the square of distance tolerance to determine whether the given point lies on the markup element line or not- Returns:
true
if the shape contains the point with the given coordinates
public boolean contains(double lat, double lon, double distance)
Test if GIS Route contains the point with the given coordinates, using
the given tolerance
- Parameters:
lat
- the latitude of the point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)lon
- the y coordinate of the point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)distance
- the distance tolerance to determine whether the given point lies on the markup element line or not- Returns:
true
if the shape contains the point with the given coordinates
public boolean isBidirectional()
Description copied from interface:
IPath
Returns the 'bidirectional' property (
true
by default).- Specified by:
isBidirectional
in interfaceIPath<GISNode>
- Returns:
true
for paths which allow movements in both directions,false
for paths which allow movements from source to target only
public void setSource(GISNode node)
Description copied from interface:
IPath
Sets source node of this path. This method should be called before
initialize()
method.public GISNode getSource()
Description copied from interface:
IPath
Returns source node of this path.
public void setTarget(GISNode node)
Description copied from interface:
IPath
Sets source node of this path. This method should be called before
initialize()
method.public GISNode getTarget()
Description copied from interface:
IPath
Returns target node of this path.
public void setBidirectional(boolean bidirectional)
Description copied from interface:
IPath
Sets the 'bidirectional' property (
true
by default).- Specified by:
setBidirectional
in interfaceIPath<GISNode>
- Parameters:
bidirectional
-true
for paths which allow movements in both directions,false
for paths which allow movements from source to target only- See Also:
-
IPath.isBidirectional()
public Point getStartPoint()
Description copied from interface:
IPath
Returns the location of the start point
- Specified by:
getStartPoint
in interfaceIPath<GISNode>
- Returns:
- the Point object with coordinates of the first point
public Point getStartPoint(Point out)
Description copied from interface:
IPath
Returns the location of the start point
- Specified by:
getStartPoint
in interfaceIPath<GISNode>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the first point
public Point getEndPoint()
Description copied from interface:
IPath
Returns the location of the end point
- Specified by:
getEndPoint
in interfaceIPath<GISNode>
- Returns:
- the Point object with coordinates of the last point
public Point getEndPoint(Point out)
Description copied from interface:
IPath
Returns the location of the end point
- Specified by:
getEndPoint
in interfaceIPath<GISNode>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the last point
public int getSegmentCount()
Description copied from interface:
IPath
Returns the number of segments
- Specified by:
getSegmentCount
in interfaceIPath<GISNode>
- Returns:
- the number of segments
public GISNode getOtherNode(GISNode n)
Description copied from interface:
IPath
If the given node is source of this path, returns path's target,
otherwise returns source. Note that this function doesn't check
that the given is either source or target: this is the responsibility
of user calling this function. The ordinal use case is calling this
method for some path connected to some node.
- Specified by:
getOtherNode
in interfaceIPath<GISNode>
- Parameters:
n
- the node (one of the path endings)- Returns:
- the node of the other end of this path
public final double length()
Returns the length of markup element, used e.g. for desired speed calculation
- Specified by:
length
in interfaceAnimationMovingLocationProvider
- Returns:
- the length of markup element (measured in meters)
public final double length(LengthUnits units)
Description copied from interface:
AnimationMovingLocationProvider
Returns the length of markup element, used e.g. for desired speed calculation
- Specified by:
length
in interfaceAnimationMovingLocationProvider
- Returns:
- the length of markup element
public GISMarkupSegment getSegment(int index)
Description copied from interface:
IPath
Returns the segment by its index
- Specified by:
getSegment
in interfaceIPath<GISNode>
- Parameters:
index
- the segment index, [0 ..IPath.getSegmentCount()
- 1]- Returns:
- the segment
public Iterator<GISMarkupSegment> iterator()
Creates and returns read-only iterator over segments
public Position getPositionAtOffset(double offset, Position out)
Description copied from interface:
IPath
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point.- Specified by:
getPositionAtOffset
in interfaceIPath<GISNode>
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.out
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the point with the given offset and orientation along markup element line at this point
public Position getPositionAtOffset(double offset, LengthUnits units, Position out)
Description copied from interface:
IPath
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point.- Specified by:
getPositionAtOffset
in interfaceIPath<GISNode>
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.units
- the length unitsout
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the point with the given offset and orientation along markup element line at this point
public Position getStartPosition(Position position)
Description copied from interface:
IPath
Returns the start position
- Specified by:
getStartPosition
in interfaceIPath<GISNode>
- Parameters:
position
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the first position
public Position getEndPosition(Position position)
Description copied from interface:
IPath
Returns the end position
- Specified by:
getEndPosition
in interfaceIPath<GISNode>
- Parameters:
position
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the last position
@AnyLogicInternalAPI @Deprecated public com.bbn.openmap.omGraphics.OMGraphic createOMGraphicObject()
Deprecated.
- Specified by:
createOMGraphicObject
in classGISMarkupElement
public Position getPosition(double value, double maxValue, Position out)
Description copied from interface:
AnimationMovingLocationProvider
Returns position with offset corresponding to the given
value
,
assuming that 0
is start and maxValue
is end- Specified by:
getPosition
in interfaceAnimationMovingLocationProvider
- Returns:
- position by offset
public Position getPosition(int index, int totalNumber, Position out)
Description copied from interface:
AnimationStaticLocationProvider
Returns the item position with the given index.
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1).
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1).
- Specified by:
getPosition
in interfaceAnimationStaticLocationProvider
- Parameters:
index
- the index of some item positions, should be not negative and less thantotalNumber
totalNumber
- the total number of item positions, should be positiveout
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the requested item position
public final Point randomPointInside(Random rng, Point out)
Description copied from interface:
INetworkMarkupElement
Returns the randomly chosen point inside/along the given space markup element.
This method utilises the given Random Number Generator.
- Specified by:
randomPointInside
in interfaceINetworkMarkupElement
- Parameters:
rng
- the random number generator.out
- output object to write to, may benull
- Returns:
- the randomly chosen point
public void addSegment(GISMarkupSegment segment)
Adds segment to this markup element
- Parameters:
segment
- the segment, should be initialized if was created using no-argument constructor