GIS Region

Use the GIS Region element to markup some closed area on the map. Each point of the region has the latitude and longitude coordinates, defined in degrees.

You can add 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

  1. 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.
  2. Alternatively, double-click the GIS Region element in the GIS section of  the Space Markup palette.
  3. 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.
  4. Click in the map to put the first point of the region. Do more clicks to add more points. 

  5. Finally put the final point with the double-click. 

  6. You can edit the region appearance after you finish drawing it.

Properties

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 autofilled 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. 

Editing region

You can edit region 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 the exact positions, defined in longitude and latitude.

 To move a point of a region

  1. Select the region on the map.
  2. Drag the region's point.

 To add new editing point to a region

  1. Select the region on the map.
  2. Double-click a segment of the region, where you want to add new editing point.

 To remove a point of a region

  1. Select the region on the map.
  2. Double-click the region's point you want to remove.

Functions

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 object.

void setTitle(String title)

Sets the title to the object.

Parameter:
title - title in quotation marks

double area()

Returns the area of this region (measured in m2)

Returns:
the area of this region

double area(AreaUnits units)

Returns the area of this region (measured in units)

boolean isVisible()

Returns the visibility of the markup element.

Returns:
visibility: true - visible, false - not

void setVisible(boolean v)

Sets the visibility of the markup element.

Parameters:
v - visibility: true - visible, false - not

void setOwner(ShapeGISMap map)

Sets the GIS map this point belongs to.

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 connection of this node with another node by index.

Parameters:
index - the index of required connection in range (0, this.getConnectionsCount() - 1)

int getConnectionsCount()

Returns the number of the node's connections to other nodes.

boolean contains(double lat, double lon)

Test if the shape contains the point with the given coordinates.

Parameters:
lat - the latitude coordinate of the point
lon - the longitude coordinate of the point

Returns:

true if the shape contains the point with the given coordinates

Point randomPointInside(Random rng, Point out)

Returns the randomly chosen point inside/along the given space markup element. This method utilises the given Random Number Generator.

Parameters:
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, in meters.

Parameters:
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.

Parameters:
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.

Parameter:
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.

Parameter:
lineColor - the new line color, null - do not draw the markup element line

LineStyle getLineStyle()

Returns the line style of the markup element: 
{LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED}


void setLineStyle(LineStyle lineStyle)

Sets the line style of the markup element:
{LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED}

Parameter:
lineStyle - the new style of the markup element

double getLineWidth()

Returns the line width of the markup element.

void setLineWidth()

Sets the line width of the markup element, 0 means thinnest possible.

Parameter:
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.

Parameter:
title - title in quotation marks

List<GISRegion> getRegions()

Returns the regions that this multiregion contains.

boolean add(GISRegion region)

Adds a given region to the multiregion object.

Parameter:
region - a region to be added

boolean addAll(Collection<GISRegion> regions)

Adds all regions to the multiregion object.

Parameter:
regions - a collection of regions

boolean remove(GISRegion region)

Removes a given region from the multiregion object.

Parameter:
region - a region to be removed

boolean removeAll(Collection<GISRegion> regions)

Removes all regions from the multiregion object.

Parameter:
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)

void setVisible(boolean visible)

Sets the visibility of the markup element.

Parameter:
v - visibility: true - visible, false - not

void setFillColor(Paint color)

Sets the fill color (or Texture) of the shape.

Parameter:
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.

Parameter:
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:

Parameter:
width - the width of the markup element line, in pixels

void setLineStyle(LineStyle lineStyle)

Sets the line style of the markup element:
{LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED}

Parameter:
lineStyle - the new style of the markup element

GISRegion randomRegionInside()

Returns a random region of this multiregion.