Use the GIS Region element to markup some closed area on the map.
You can add the GIS Region element only into the GIS map. Add GIS map shape first to your model before you use GIS markup elements.
To add a region
- The simplest way to create a GIS region is to use the search menu. You can convert any search result you find, a region or a country, into a GIS region or GIS multiregion, and it will save you an enormous amount of time you would spend if you decided to draw it manually. The converted region will have the name and title information filled in for you. Moreover, using search allows you to create GIS multiregions.
- Alternatively, double-click the GIS Region 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 region on the map point by point.
- Click in the map to put the first point of the region. Do more clicks to add more points.
- Finally put the final point with the double-click.
- You can edit the region appearance after you finish drawing it.
- General
-
Name — The name of the region. The name is used to identify and access the region from code.
Ignore — If selected, the region is excluded from the model.
Visible — If selected, the region is visible at runtime.
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.
Title — Here you can type the title for this region. The title that you can define in this field is accessible in the run-time via API. When you convert a search result to create a GIS region, its title will be automatically filled with the full name of that region.
- Appearance
-
Fill color — Shape’s fill color. Choose No Fill, if you do not want shape to be filled.
Line color — Outline color. Choose No Color, if you do not want outline to be drawn.
Line width — Outline width.
Line style — Outline style. Choose from the drop-down list, whether you want solid, dashed, or dotted outline to be drawn.
You can edit the region’s 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 region’s points will remain in their positions defined in longitude and latitude.
To move a point of a region
- Select the region on the map.
- Drag the region’s point.
To add a new point to a region
- Select the region on the map.
- Double-click a segment of the region, where you want to add a new point.
To remove a point of a region
- Select the region on the map.
- Double-click the regions point you want to remove.
You can dynamically modify GIS region’s properties at model runtime using the following API.
- General
-
Function Description String getTitle() Returns the title of the element. void setTitle(String title) Sets the title to the element.
title — the title of the region.double area() Returns the area of this region (measured in m2). double area(AreaUnits units) Returns the area of this region (measured in the specified units).
units — a constant defining the area units.boolean isVisible() Returns true if the element is visible; returns false otherwise. void setVisible(boolean v) Sets the visibility of the markup element.
v — visibility: true — visible, false — not.INetwork getNetwork() Returns the network this markup element belongs to or null if this element isn’t a part of a network. GISRoute getConnection(int index) Returns the connection of this node with another node by index.
index — the index of required connection in range (0, this.getConnectionsCount - 1).int getConnectionsCount() Returns the number of the node’s connections with other nodes. boolean contains(double lat, double lon) Returns true if the shape contains the point with the given coordinates; returns false otherwise.
lat — the latitude coordinate of the point.
lon — the longitude coordinate of the point.Point randomPointInside(Random rng, Point out) Returns the randomly chosen point inside/along the given space markup element. This method uses 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 the point in this space markup element nearest to the given point. Returns the square of distance (in meters) to the nearest point.
lat — latitude measured in degrees: (-90 ... (South) ... 0 ... (North) ... 90).
lon — longitude measured in degrees: (-180 ... (West) ... 0 ... (East) ... 180).
out — the output point to write result to.double getNearestPoint(Point givenPoint, Point out) Calculates (using the output object) the point in this space markup element nearest to the given point. Returns the square of distance (in meters) to the nearest point.
givenPoint — given point.
out — the output point to write result to. - Appearance
-
Function Description Color getFillColor() Returns the fill color of the shape, or null if shape has no fill color or has textured fill (in this case getFillTexture() should be used instead). void setFillColor(Paint color) Sets the fill color (or Texture) of the shape.
fillColor — the new fill color, null — do not fill the shape.Color getLineColor() Returns the outline color of the markup element, or null if markup element has no line color or has textured outline (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
LINE_STYLE_DASHEDvoid setLineStyle(LineStyle lineStyle) Sets the line style of the markup element.
lineStyle — the new style of the markup element.
Valid values:
LINE_STYLE_SOLID
LINE_STYLE_DOTTED
LINE_STYLE_DASHEDdouble getLineWidth() Returns the line width of the markup element. void setLineWidth() Sets the line width of the markup element, 0 means thinnest possible.
width — the new line width of the markup element.Texture getFillTexture() Returns the fill texture of the shape, if the shape has fill texture. Texture getLineTexture() Returns the line texture of the markup element, if the markup element has line texture. - Multiregion functions
-
Function Description String getTitle() Returns the title of the multiregion. void setTitle(String title) Sets the title to the multiregion.
title — title in quotation marks.List getRegions() Returns the list of regions that this multiregion contains. boolean add(GISRegion region) Adds a given region to the multiregion object.
region — a region to be added.boolean addAll(Collection regions) Adds all regions to the multiregion object.
regions — a collection of regions.boolean remove(GISRegion region) Removes a given region from the multiregion object.
region — a region to be removed.boolean removeAll(Collection regions) Removes all regions from the multiregion object.
regions — a collection of regions.double area() Returns the total area (measured in m2). double area(AreaUnits units) Returns the area of this multiregion (measured in the specified units).
units — a constant defining the area units.void setVisible(boolean visible) Sets the visibility of the markup element.
v — visibility: true — visible, false — not.void setFillColor(Paint color) Sets the fill color (or Texture) of the shape.
fillColor — the new fill color.
null — do not fill the shape.void setLineColor(Paint color) Sets the line color (or Texture) of the markup element.
lineColor — the new line color, null — do not draw the markup element line.void setLineWidth(double width) Sets the line width of the markup element:
width — the width of the markup element line, in pixels.void setLineStyle(LineStyle lineStyle) Sets the line style of the markup element.
lineStyle — the new style of the markup element.
Valid values:
LINE_STYLE_SOLID
LINE_STYLE_DOTTED
LINE_STYLE_DASHEDGISRegion randomRegionInside() Returns a random region of this multiregion. - Removal
-
Function Description void remove() Removes the GIS region from the presentation. If the GIS region 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?
-