With the help of the GIS route, you can draw custom routes on the map to define a road, a railroad, a river, or any other kind of line on the map.
You can add GIS Route element only onto the GIS map. Add the GIS map shape to your model before you use GIS markup elements.
To add a route from one point to another
- Pan and zoom the GIS map to display the area where you need the route to start.
- Right-click the map and select Route from here from the context menu.
- Pan the map to the location where the route should end, then right-click the map and select Route to here.
- Two special marks will appear in these locations on the map, and GIS map will start searching for the route:
- You will see the GIS Route element appear on the map:
- If you are in some location on the map where the route ends, you are safe to use the Route from here. The route will be built in the same manner as in the example above.
- Its appearance and type depend on the settings defined in the Routing properties section. If you use a routing server or a routing graph to create routes, an existing route between these two points will be provided for you.
- To create a route that starts or ends in a GIS point, right-click the point and select one of the options from its context menu. This will help you to create a network automatically.
- After the route is created, you can edit it as any other manually drawn GIS route.
To draw a route manually
- Double-click the GIS Route element in the GIS section of the Space Markup palette.
- The icon of the element should turn into . It means that the drawing mode is activated and now you can draw a route in the GIS map point by point.
- Click in the map at the position of the first point of the route.
- Subsequently click at other points where you want to place other salient points.
- Double-click to place the end point and finish drawing.
- After you finish drawing, you can edit the route.
- General
-
Name - The name of the route. The name is used to identify and access the route from code.
Ignore - If selected, the route is excluded from the model.
Visible - Here you specify route is visible on the animation at the model runtime, or not. Using the control, choose yes or no if you want to specify the visibility just once. Otherwise, if you expect visibility to change dynamically or to depend on some other conditions, you may specify here the expression defining the route’s visibility. This expression will be dynamically re-evaluated at the model runtime. It should return boolean value. The route is visible when the specified expression evaluates to true, and not visible otherwise.
Lock the position - If this option is selected, the shape’s position on the map is fixed. The shape cannot be moved, but you can select it to change other properties.
Bidirectional - If this option is selected, the route is bidirectional. Deselect it, if you want the route to have one specific direction.
- Appearance
-
Line color - The line color. Click the control and choose a color using the Colors dialog box. Choose No Color, if you do not want the line to be drawn.
Line width - Choose line width from the drop-down list, or enter the value in pixels in the field to the right. You can specify the dynamic expression, it should return int value.
Line style - The line style of the route. Choose from the drop-down list, whether you want solid, dashed, or dotted line to be drawn.
You can edit a route appearance by editing its points. When you then edit the GIS map itself, for instance, if you pan the map or zoom it in or out, the route’s points will remain in their positions defined by longitude and latitude.
To move a point of a route
- Select the route on the map.
- Drag the route’s point.
To add a new point to a route
- Select the route on the map.
- Double-click a segment of the route, where you want to add a new point.
To remove a point of a route
- Select the route on the map.
- Double-click the route’s point you want to remove.
You can dynamically modify the GIS route’s properties at model runtime using the following API.
- General
-
Function Description double length() Returns the length of the GIS route (in meters), used e.g. for desired speed calculation. double length(LengthUnits units) Returns the length of the GIS route (in specified units), used e.g. for desired speed calculation. boolean isBidirectional() Returns the 'bidirectional' property value.
For routes created in the graphical editor, the property value is true by default.
For routes created programmatically, the value of the property depends on the value specified initially. Check the description of the method you’ve used for more details. Returns true for routes which allow movements in both directions, false for routes that allow movements from source to target only.void setBidirectional(boolean bidirectional) Sets the 'bidirectional' property value.
For routes created in the graphical editor, the property value is true by default.
For routes created programmatically, the value of the property depends on the value specified initially. Check the description of the method you’ve used for more details. bidirectional — true for routes that allow movements in both directions, false for routes that allow movements from source to target only.void setOwner(ShapeGISMap map) Sets the GIS map this route belongs to. void setVisible(boolean v) Sets the visibility of the markup element.
v — visibility: true — visible, false — not.boolean isVisible() Returns true if the element is currently visible; returns false otherwise. INetwork getNetwork() Returns the network this markup element belongs to or null if this element is not a part of a network. boolean contains(double lat, double lon) Checks if the shape contains the point with the given coordinates. Returns true if the shape contains the point with the given coordinates.
lat — the latitude coordinate of the point.
lon — the longitude coordinate of the point.boolean contains(double lat, double lon, double distance) Checks if the shape contains the point with the given coordinates using the given tolerance. Returns true if the shape contains the point with the given coordinates.
lat — the latitude coordinate of the point.
lon — the longitude coordinate of the point.
distance — the distance tolerance to determine whether the given point lies within the markup element line proximity.boolean containsSq(double lat, double lon, double squareDistance) Checks if the shape contains the point with the given coordinates using the given tolerance. Returns true if the shape contains the point with the given coordinates.
lat — the latitude coordinate of the point.
lon — the longitude coordinate of the point.
squareDistance — the square of distance tolerance to determine whether the given point lies within the markup element line proximity.Point randomPointInside(Random rng, Point out) Returns a randomly chosen point inside/along the given space markup element. This method utilizes the given Random Number Generator.
rng — the random number generator.
out — output object to write to, may be null. - Distance
-
Function Description double getNearestPoint(double lat, double lon, Point out) Calculates (using the out object) the point in this space markup element nearest to the point with the given latitude and longitude. Returns the square of distance to the point.
lat — the latitude of the point.
lon — the longitude of the point.
out — the output point to write result to.double getNearestPoint(Point givenPoint, Point out) Calculates (using the out object) the point in this space markup element nearest to the given point. Returns the square of distance to the point.
givenPoint — the point distance to which you need to calculate.
out — the output point to write result to.Position getPositionAtOffset(double offset, Position out) Returns the position located on the markup element with the given offset distance calculated from start point.
offset — offset, non-negative value, should be less or equal to the full length.
out — output object to write to, may be null.Position getPositionAtOffset(double offset, LengthUnits units, Position out) Returns the position located on the markup element with the given offset distance calculated from start point.
offset — offset, non-negative value, should be less or equal to the full length.
units — the length units.
out — output object to write to, may be null. - Start and end points
-
Function Description GISNode getSource() Returns the location of the route’s source node. GISNode getTarget() Returns the location of the route’s target node. Point getStartPoint() Returns the Point object with the coordinates of the starting point. Point getStartPoint(Point out) Returns the Point object with the coordinates of the starting point.
out — output object to write to, may be null.Point getEndPoint() Returns the Point object with coordinates of the end point. Point getEndPoint(Point out) Returns the Point object with coordinates of the end point.
out — output object to write to, may be null.GISNode getOtherNode(GISNode n) If the given node is the source of this route, returns the route’s target node. Otherwise, returns the source node. This function does not check whether the provided GIS node is the source or the target.
n — the node (one of the route endings).Position getStartPosition(Position position) Returns the Position object with the coordinates of the route’s starting position. Position getEndPosition(Position position) Returns the Position object with coordinates of the route’s ending position. - Route’s segments
-
Function Description int getSegmentCount() Returns the number of segments. GISMarkupSegment getSegment(int index) Returns the segment by its index.
index — the segment index, [0 .. IPath.getSegmentCount() - 1] - Appearance
-
Function Description Color getLineColor() Returns the line color of the markup element, or null if markup element has no line color or has textured line (in this case getLineTexture() should be used instead). void setLineColor(Paint lineColor) Sets the line color (or Texture) of the markup element.
lineColor — the new line color, null — do not draw the markup element line.LineStyle getLineStyle Returns the line style of the markup element.
Valid values:
LINE_STYLE_SOLID, LINE_STYLE_DOTTED, or LINE_STYLE_DASHEDvoid setLineStyle(LineStyle lineStyle) Sets the line style of the markup element.
Valid values:
LINE_STYLE_SOLID, LINE_STYLE_DOTTED, or LINE_STYLE_DASHED
lineStyle — the new style of the markup element.double getLineWidth() Returns the line width of the markup element. void setLineWidth(double width) Sets the line width of the markup element:
width — the width of the markup element line, in pixels.Texture getLineTexture() Returns the line texture of the markup element, if the markup element has line texture. - Removal
-
Function Description void remove() Removes the GIS route from the presentation. If the GIS route is not a part of presentation, the function does nothing. Removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
-
How can we improve this article?
-