AnyLogic AnyLogic
Expand
Font size

Class ShapeGISMap

All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, java.io.Serializable, java.lang.Cloneable

public class ShapeGISMap
extends AbstractShapeGISMap
GIS map projection manager and map renderer (persistent GIS Map shape which displays and map projection)
GIS map is a Shape and it can be placed on the model animation: it renders the associated map projection on the screen
This class provides several projection methods

General information:
Coordinates of any point are presented as:

  • the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
  • the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
The following order of coordinates is assumed: (latitude, longitude) Implementation is based on OpenMap GIS
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Nested Class Summary

Nested Classes 
static class  ShapeGISMap.Layer
Class which stores GIS map layer information
Modifier and Type Class Description

Field Summary

Fields 
static ITileURLProvider CLASSIC  
static ITileURLProvider GERMANSTYLE  
static ITileURLProvider HUMANITARIAN  
static AbstractGISRouteProvider STRAIGHT  
static ITileURLProvider TRANSPORT  
Modifier and Type Field Description

Fields inherited from class com.anylogic.engine.presentation.Shape3D

UNKNOWN_NAME

Constructor Summary

Constructors 
ShapeGISMap​(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double width, double height, java.lang.String packagePrefix, ShapeGISMap.Layer[] layers, double centerLatitude, double centerLongitude, double mapScale, java.awt.Color mapBorderColor, java.awt.Color mapBackgroundColor, boolean showTiles, TileURLProviderType tileURLProviderType, IGISRouteProvider routeProvider, int precisionInMeters, boolean showRouteNotFoundError)
Constructs a GIS Map shape with specific attributes.
ShapeGISMap​(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double width, double height, java.lang.String packagePrefix, ShapeGISMap.Layer[] layers, double centerLatitude, double centerLongitude, double mapScale, java.awt.Color mapBorderColor, java.awt.Color mapBackgroundColor, boolean showTiles, java.lang.String[] tileURLs, IGISRouteProvider routeProvider, int precisionInMeters, boolean showRouteNotFoundError)
Constructs a GIS Map shape with specific attributes.
Constructor Description

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
void add​(GISMultiRegion markupElement)
Adds GIS markup element to drawing set of elements.
void add​(GISMarkupElement markupElement)
Adds GIS markup element to drawing set of elements.
void addImageChangedListener​(ImageChangedListener listener)
Deprecated.
boolean contains​(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Point convertForward​(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Point convertForward​(double latitude, double longitude, Point out)
Deprecated.
this function is deprecated and will be removed in the next release
Point convertInverse​(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
Point convertInverse​(double x, double y, Point out)
Deprecated.
this function is deprecated and will be removed in the next release
double convertRotationAngleForward​(double latitude, double longitude, double angle)
Deprecated.
this function is deprecated and will be removed in the next release
double convertRotationAngleInverse​(double x, double y, double angle)
Deprecated.
this function is deprecated and will be removed in the next release
double convertXForward​(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
double convertXInverse​(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
double convertYForward​(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
double convertYInverse​(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
float[] createTrajectory​(double lonFrom, double latFrom, double lonTo, double latTo, int numberOfSegments)
Deprecated.
this function is deprecated and will be removed in the next release
void destroy()  
void dispose()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void draw​(java.awt.Graphics2D g, java.awt.geom.AffineTransform xform, boolean publicOnly)
Deprecated.
this function is deprecated and will be removed in the next release
SVGElement findSVGElement​(long svgId)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void fitBounds​(double bottomLat, double leftLon, double topLat, double rightLon)
Make map fits specified bounds.
double fromLengthUnits​(double length, LengthUnits units)
Convert value of length measured in given units to meters
double getCenterLatitude()
Deprecated.
this function is deprecated and will be removed in the next release
double getCenterLongitude()
Deprecated.
this function is deprecated and will be removed in the next release
double getDistance​(double latFrom, double lonFrom, double latTo, double lonTo)
Returns distance, in meters, between 2 given points
double getDistance​(GISPoint fromPoint, GISPoint toPoint)
Returns distance, in meters, between 2 given points
double getDistanceByRoute​(double latFrom, double lonFrom, double latTo, double lonTo)
Calculates length of route from one point to another.
double getDistanceByRoute​(GISPoint fromPoint, GISPoint toPoint)
Calculates length of route from one point to another.
double getHeight()
Returns the height of the shape.
ShapeGISMap.Layer[] getLayers()
Returns the array of layers used in this GIS Map
Returned array shouldn't be modified structurally: only items can be accessed for modification
double getMapScale()
Deprecated.
this function is deprecated and will be removed in the next release
double getMaxMapScale()
Returns the maximum available scale of the map projection
double getMinMapScale()
Returns the minimum available scale of the map projection
double getMPP()
Calculates amount of meters in one pixel of map presentation
Presentable getPresentable()
Returns the Presentable object (Agent or Experiment) where this shape belongs to, or null.
GISRoute getRoute​(double startLatitude, double startLongitude, double endLatitude, double endLongitude)
Creates an unidirectional route from one geographic point to another.
GISRoute getRoute​(double startLatitude, double startLongitude, double endLatitude, double endLongitude, boolean bidirectional)
Creates route from one geographic point to another.
GISRoute getRoute​(GISPoint start, GISPoint end)
Creates an unidirectional route from one geographic point to another.
GISRoute getRoute​(GISPoint start, GISPoint end, boolean bidirectional)
Creates route from one geographic point to another.
IGISRouteProvider getRouteProvider()
Retrieves default route provider for all agents in GIS space.
double getWidth()
Returns the width of the shape.
boolean isLayerVisible​(java.lang.String shapeFileName)
Tests if a shapefile layer is visible
boolean isMouseNavigationEnabled()
Returns true if panning and zooming with a mouse are allowed.
static com.bbn.openmap.proj.Projection makeProjection​(double centerLatitude, double centerLongitude, double projectionScale, int width, int height)
Create a Mercator projection.
void onMarkupChanged()  
void pan​(double toEast, double toNorth)
Moves the map projection center
Parameters are amounts of delta in the resulting offset
One horizontal delta is a half of longitude difference from map projection center to the west/east bound of projection
One vertical delta is a half of latitude difference from map projection center to the south/north bound of projection
void postSVGShapeSpecificAttributes​(java.util.List<java.lang.String> att, java.util.List<java.lang.String> val, boolean publicOnly)
Posts general properties specific to a particular shape class.
boolean projectionContains​(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
void remove​(GISMultiRegion markupElement)
Removes GIS markup element from drawing set of elements.
void remove​(GISMarkupElement markupElement)
Removes GIS markup element from drawing set of elements.
void removeImageChangedListener​(ImageChangedListener listener)
Deprecated.
void requestRedraw()
Deprecated.
this function is deprecated and will be removed in the next release
void resetSVGState()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void restoreOwner​(java.lang.Object owner)
Deprecated.
java.util.List<GISPoint> search​(java.lang.String query)  
java.util.List<GISNode> search​(java.lang.String query, boolean area, boolean visibleAreaOnly)  
GISPoint searchFirst​(java.lang.String query)
Search for a point on the Earth corresponding to the user's query.
GISMultiRegion searchFirstMultiRegion​(java.lang.String query)  
GISRegion searchFirstRegion​(java.lang.String query)  
java.util.List<GISMultiRegion> searchMultiRegion​(java.lang.String query)  
java.util.List<GISRegion> searchRegion​(java.lang.String query)  
void setCenterLatitude​(double centerLatitude)
Sets the latitude of the map projection center, measured in degrees (-90 ...
void setCenterLongitude​(double centerLongitude)
Sets the longitude of the map projection center, measured in degrees (-180 ...
void setHeight​(double height)
Sets the height of the shape.
void setLayerVisibility​(java.lang.String shapeFileName, boolean visible)
Shows or hides a shapefile layer.
void setMapScale​(double mapScale)
Sets the scale of map projection
void setMouseNavigationEnabled​(boolean mouseNavigationEnabled)
Manage ability to pan and zoom the map with a mouse.
void setProjectionCenter​(double centerLatitude, double centerLongitude)
Sets the center of the map projection
void setSearchBounds​(double bottomLatitude, double leftLongitude, double topLatitude, double rigthLongitude)
Sets bounds for search area.
void setWidth​(double width)
Sets the width of the shape.
double toLengthUnits​(double length, LengthUnits units)
Convert value of length measured in meters to given length units
boolean updateDynamicPropertiesStructural​(boolean publicOnly)  
SVGElement updateSVGProperties​(java.util.List<SVGCommand> output, ShapeDrawMode drawMode, boolean publicOnly, SVGElement owner, SVGElement elbehind)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client.
void zoomIn()
Increases scale of map projection (x 2)
void zoomOut()
Decreases scale of map projection (x 1/2)
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.AbstractShapeGISMap

clone, convertForward, convertInverse, formatMapScale, onClick

Methods inherited from class com.anylogic.engine.presentation.Shape3D

canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setRotation, setScale, setScale, setScaleZ, setZ

Methods inherited from class com.anylogic.engine.presentation.Shape

executeUserAction, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, randomPointInside, randomPointInside, removeSVGFromOwner, removeSVGImage, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Methods inherited from interface com.anylogic.engine.Locatable2D

getX, getY

Field Detail

CLASSIC

public static final ITileURLProvider CLASSIC

GERMANSTYLE

public static final ITileURLProvider GERMANSTYLE

TRANSPORT

public static final ITileURLProvider TRANSPORT

HUMANITARIAN

public static final ITileURLProvider HUMANITARIAN

STRAIGHT

public static final AbstractGISRouteProvider STRAIGHT

Constructor Detail

ShapeGISMap

public ShapeGISMap​(Presentable presentable,
                   ShapeDrawMode drawMode,
                   boolean ispublic,
                   double x,
                   double y,
                   double width,
                   double height,
                   java.lang.String packagePrefix,
                   ShapeGISMap.Layer[] layers,
                   double centerLatitude,
                   double centerLongitude,
                   double mapScale,
                   java.awt.Color mapBorderColor,
                   java.awt.Color mapBackgroundColor,
                   boolean showTiles,
                   TileURLProviderType tileURLProviderType,
                   IGISRouteProvider routeProvider,
                   int precisionInMeters,
                   boolean showRouteNotFoundError)
Constructs a GIS Map shape with specific attributes.
Parameters:
presentable - the presentable object owning this shape
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the shape upper left corner
y - the y coordinate of the shape upper left corner
width - the width of the shape
height - the height of the shape
packagePrefix - the package name of original agent where this image is defined, formatted using '/' characters; with '/' character at the beginning and at the end
layers - the array of ShapeGISMap.Layer objects to be used and drawn
centerLatitude - the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
centerLongitude - the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
mapScale - the scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"
mapBorderColor - the color of map's bounds
mapBackgroundColor - the color of map's background
showTiles - true draw tile layer
tileURLProviderType - an element of the TileURLProviderType enum provides URL for loading tile from server
routeProvider - the implementation of IGISRouteProvider interface provides route from one point to another and distance between two given points
precisionInMeters - precision measured in meters is used to simplify routes and regions
showRouteNotFoundError - affects when route is not found; true stop execution and show error; false join two points with straight line

ShapeGISMap

public ShapeGISMap​(Presentable presentable,
                   ShapeDrawMode drawMode,
                   boolean ispublic,
                   double x,
                   double y,
                   double width,
                   double height,
                   java.lang.String packagePrefix,
                   ShapeGISMap.Layer[] layers,
                   double centerLatitude,
                   double centerLongitude,
                   double mapScale,
                   java.awt.Color mapBorderColor,
                   java.awt.Color mapBackgroundColor,
                   boolean showTiles,
                   java.lang.String[] tileURLs,
                   IGISRouteProvider routeProvider,
                   int precisionInMeters,
                   boolean showRouteNotFoundError)
Constructs a GIS Map shape with specific attributes.
Parameters:
presentable - the presentable object owning this shape
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the shape upper left corner
y - the y coordinate of the shape upper left corner
width - the width of the shape
height - the height of the shape
packagePrefix - the package name of original agent where this image is defined, formatted using '/' characters; with '/' character at the beginning and at the end
layers - the array of ShapeGISMap.Layer objects to be used and drawn
centerLatitude - the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
centerLongitude - the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
mapScale - the scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"
mapBorderColor - the color of map's bounds
mapBackgroundColor - the color of map's background
showTiles - true draw tile layer
tileURLs - the array of urls to load tiles from a server. Must contain "[zoom]", "[x]", "[y]" to work properly. See for details.
routeProvider - the implementation of IGISRouteProvider interface provides route from one point to another and distance between two given points
precisionInMeters - precision measured in meters is used to simplify routes and regions
showRouteNotFoundError - affects when route is not found; true stop execution and show error; false join two points with straight line

Method Detail

setWidth

public void setWidth​(double width)
Sets the width of the shape.
Parameters:
width - the width of the shape

getWidth

public double getWidth()
Returns the width of the shape.
Returns:
the width of the shape

setHeight

public void setHeight​(double height)
Sets the height of the shape.
Parameters:
height - the height of the shape

getHeight

public double getHeight()
Returns the height of the shape.
Returns:
the height of the shape

updateDynamicPropertiesStructural

@AnyLogicInternalAPI
public boolean updateDynamicPropertiesStructural​(boolean publicOnly)
Overrides:
updateDynamicPropertiesStructural in class Shape
Returns:
true if:
1. update was done (usually for visible elements, respecting public flag etc.)
AND
2. further update of structural changes is applicable

contains

public boolean contains​(double px,
                        double py)
Description copied from class: Shape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

draw

@AnyLogicInternalAPI
@Deprecated
public void draw​(java.awt.Graphics2D g,
                 java.awt.geom.AffineTransform xform,
                 boolean publicOnly)
Deprecated.
this function is deprecated and will be removed in the next release

getMapScale

@Deprecated
public double getMapScale()
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Returns the map scale as it was last set programmatically or at the map creation. In the Cloud mode the user may change the scale manually, and that will not be known to the model. The scale translates to GIS zoom: scale 1/500000000 is zoom 0, and scale 1/2000 is zoom 18.
Specified by:
getMapScale in class AbstractShapeGISMap
Returns:
the current scale of the map

setMapScale

public void setMapScale​(double mapScale)
Description copied from class: AbstractShapeGISMap
Sets the scale of map projection
Specified by:
setMapScale in class AbstractShapeGISMap
Parameters:
mapScale - the scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"

getMinMapScale

public double getMinMapScale()
Description copied from class: AbstractShapeGISMap
Returns the minimum available scale of the map projection
Specified by:
getMinMapScale in class AbstractShapeGISMap
Returns:
the minimum available scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"

getMaxMapScale

public double getMaxMapScale()
Description copied from class: AbstractShapeGISMap
Returns the maximum available scale of the map projection
Specified by:
getMaxMapScale in class AbstractShapeGISMap
Returns:
the maximum available scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"

zoomIn

public void zoomIn()
Description copied from class: AbstractShapeGISMap
Increases scale of map projection (x 2)
Specified by:
zoomIn in class AbstractShapeGISMap

zoomOut

public void zoomOut()
Description copied from class: AbstractShapeGISMap
Decreases scale of map projection (x 1/2)
Specified by:
zoomOut in class AbstractShapeGISMap

pan

public void pan​(double toEast,
                double toNorth)
Description copied from class: AbstractShapeGISMap
Moves the map projection center
Parameters are amounts of delta in the resulting offset
One horizontal delta is a half of longitude difference from map projection center to the west/east bound of projection
One vertical delta is a half of latitude difference from map projection center to the south/north bound of projection
Specified by:
pan in class AbstractShapeGISMap
Parameters:
toEast - number of horizontal deltas to be added to the projection center, if positive, center is moved to the East, if negative - to the West
toNorth - number of vertical deltas to be added to the projection center, if positive, center is moved to the North, if negative - to the South

getCenterLatitude

@Deprecated
public double getCenterLatitude()
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Returns the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Specified by:
getCenterLatitude in class AbstractShapeGISMap
Returns:
the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)

getCenterLongitude

@Deprecated
public double getCenterLongitude()
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Returns the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Specified by:
getCenterLongitude in class AbstractShapeGISMap
Returns:
the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

setProjectionCenter

public void setProjectionCenter​(double centerLatitude,
                                double centerLongitude)
Description copied from class: AbstractShapeGISMap
Sets the center of the map projection
Specified by:
setProjectionCenter in class AbstractShapeGISMap
Parameters:
centerLatitude - new latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
centerLongitude - new longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

setCenterLatitude

public void setCenterLatitude​(double centerLatitude)
Description copied from class: AbstractShapeGISMap
Sets the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Specified by:
setCenterLatitude in class AbstractShapeGISMap
Parameters:
centerLatitude - new latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)

setCenterLongitude

public void setCenterLongitude​(double centerLongitude)
Description copied from class: AbstractShapeGISMap
Sets the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Specified by:
setCenterLongitude in class AbstractShapeGISMap
Parameters:
centerLongitude - new longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

convertXForward

@Deprecated
public double convertXForward​(double latitude,
                              double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates forward projection of the given point to screen and returns x-coordinate
Specified by:
convertXForward in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the x coordinate of screen-projection of the given point

convertYForward

@Deprecated
public double convertYForward​(double latitude,
                              double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates forward projection of the given point to screen and returns y-coordinate
Specified by:
convertYForward in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the y coordinate of screen-projection of the given point

convertForward

@Deprecated
public Point convertForward​(double latitude,
                            double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates forward projection of the given point to screen and returns (x, y) coordinates
Specified by:
convertForward in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the Point structure with (x, y) coordinates of screen-projection of the given point

convertForward

@Deprecated
public Point convertForward​(double latitude,
                            double longitude,
                            Point out)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates forward projection of the given point to screen and returns (x, y) coordinates
Specified by:
convertForward in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
out - the Point structure to write the result to, may be null
Returns:
the Point structure with (x, y) coordinates of screen-projection of the given point

convertRotationAngleForward

@Deprecated
public double convertRotationAngleForward​(double latitude,
                                          double longitude,
                                          double angle)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates forward projection of the given rotation angle (direction) at the given point, to screen and returns rotation angle in screen coordinates
Specified by:
convertRotationAngleForward in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
angle - the rotation angle measured in radians from East CCW (0 is East direction, PI/2 is North direction, etc.)
Returns:
the rotation angle measured in radians from model animation point (1, 0) CW around (0, 0) point (as Y-axis is directed downwards)

convertXInverse

@Deprecated
public double convertXInverse​(double x,
                              double y)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates inverse projection of the given point from screen and returns longitude
Specified by:
convertXInverse in class AbstractShapeGISMap
Parameters:
x - the x coordinate of screen-projection of the given point
y - the y coordinate of screen-projection of the given point
Returns:
the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

convertYInverse

@Deprecated
public double convertYInverse​(double x,
                              double y)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates inverse projection of the given point from screen and returns latitude
Specified by:
convertYInverse in class AbstractShapeGISMap
Parameters:
x - the x coordinate of screen-projection of the given point
y - the y coordinate of screen-projection of the given point
Returns:
the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)

convertInverse

@Deprecated
public Point convertInverse​(double x,
                            double y)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates inverse projection of the given point from screen and returns (latitude, longitude) coordinates
Specified by:
convertInverse in class AbstractShapeGISMap
Parameters:
x - the x coordinate of screen-projection of the given point
y - the y coordinate of screen-projection of the given point
Returns:
the Point structure with (latitude, longitude) of the point, where
latitude is measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
and longitude is measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

convertInverse

@Deprecated
public Point convertInverse​(double x,
                            double y,
                            Point out)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates inverse projection of the given point from screen and returns (latitude, longitude) coordinates
Specified by:
convertInverse in class AbstractShapeGISMap
Parameters:
x - the x coordinate of screen-projection of the given point
y - the y coordinate of screen-projection of the given point
out - the Point structure to write the result to, may be null
Returns:
the Point structure with (latitude, longitude) of the point, where
latitude is measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
and longitude is measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

convertRotationAngleInverse

@Deprecated
public double convertRotationAngleInverse​(double x,
                                          double y,
                                          double angle)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Creates inverse projection of the given rotation angle (direction) at the given point, from screen and returns rotation angle in map coordinates
Specified by:
convertRotationAngleInverse in class AbstractShapeGISMap
Parameters:
x - the x coordinate of screen-projection of the given point
y - the y coordinate of screen-projection of the given point
angle - the rotation angle measured in radians from model animation point (1, 0) CW around (0, 0) point (as Y-axis is directed downwards)
Returns:
the rotation angle measured in radians from East CCW (0 is East direction, PI/2 is North direction, etc.)

projectionContains

@Deprecated
public boolean projectionContains​(double latitude,
                                  double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Description copied from class: AbstractShapeGISMap
Returns true if the projection of the given point to screen is visible on this map
Specified by:
projectionContains in class AbstractShapeGISMap
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
true if the projection of the given point to screen is visible on this map

createTrajectory

@Deprecated
public float[] createTrajectory​(double lonFrom,
                                double latFrom,
                                double lonTo,
                                double latTo,
                                int numberOfSegments)
Deprecated.
this function is deprecated and will be removed in the next release

getDistance

public double getDistance​(double latFrom,
                          double lonFrom,
                          double latTo,
                          double lonTo)
Description copied from class: AbstractShapeGISMap
Returns distance, in meters, between 2 given points
Specified by:
getDistance in class AbstractShapeGISMap
Parameters:
latFrom - the latitude of the 1st point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
lonFrom - the longitude of the 1st point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latTo - the latitude of the 2nd point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
lonTo - the longitude of the 2nd point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the distance, in meters, between 2 given points

getDistance

public double getDistance​(GISPoint fromPoint,
                          GISPoint toPoint)
Description copied from class: AbstractShapeGISMap
Returns distance, in meters, between 2 given points
Specified by:
getDistance in class AbstractShapeGISMap
Parameters:
fromPoint - the 1st point on the Earth's surface
toPoint - the 2nd point on the Earth's surface
Returns:
the distance, in meters, between 2 given points

getDistanceByRoute

public double getDistanceByRoute​(double latFrom,
                                 double lonFrom,
                                 double latTo,
                                 double lonTo)
Description copied from class: AbstractShapeGISMap
Calculates length of route from one point to another. Uses route provider to create a route.
Specified by:
getDistanceByRoute in class AbstractShapeGISMap
Parameters:
latFrom - latitude of the start point
lonFrom - longitude of the start point
latTo - latitude of the end point
lonTo - longitude of the end point
Returns:
length of route in meters

getDistanceByRoute

public double getDistanceByRoute​(GISPoint fromPoint,
                                 GISPoint toPoint)
Description copied from class: AbstractShapeGISMap
Calculates length of route from one point to another. Uses route provider to create a route.
Specified by:
getDistanceByRoute in class AbstractShapeGISMap
Parameters:
fromPoint - the 1st point on the Earth's surface
toPoint - the 2nd point on the Earth's surface
Returns:
length of route in meters

getLayers

public ShapeGISMap.Layer[] getLayers()
Returns the array of layers used in this GIS Map
Returned array shouldn't be modified structurally: only items can be accessed for modification
Returns:
the array of layers used in this GIS Map

requestRedraw

@Deprecated
public void requestRedraw()
Deprecated.
this function is deprecated and will be removed in the next release

destroy

public void destroy()

makeProjection

@AnyLogicInternalAPI
public static com.bbn.openmap.proj.Projection makeProjection​(double centerLatitude,
                                                             double centerLongitude,
                                                             double projectionScale,
                                                             int width,
                                                             int height)
Create a Mercator projection.
Parameters:
centerLatitude - the latitude of projection's center
centerLongitude - the longitude of projection's center
projectionScale - the scale for projection within the range from 0 to 1
width - the width of new projection measured in pixels
height - the height of new projection measured in pixels
Returns:
projection, or null if the projection can't be created.

getPresentable

public Presentable getPresentable()
Description copied from class: Shape
Returns the Presentable object (Agent or Experiment) where this shape belongs to, or null.
Overrides:
getPresentable in class Shape
Returns:
the Presentable that owns this shape, or null

restoreOwner

@AnyLogicInternalCodegenAPI
@Deprecated
public void restoreOwner​(java.lang.Object owner)
Deprecated.
Description copied from class: Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
Specified by:
restoreOwner in interface com.anylogic.engine.internal.Child
Overrides:
restoreOwner in class Shape
Parameters:
owner - owner of this object, usually Agent, Experiment or ShapeGroup
public java.util.List<GISNode> search​(java.lang.String query,
                                      boolean area,
                                      boolean visibleAreaOnly)
public java.util.List<GISPoint> search​(java.lang.String query)

searchRegion

public java.util.List<GISRegion> searchRegion​(java.lang.String query)

searchMultiRegion

public java.util.List<GISMultiRegion> searchMultiRegion​(java.lang.String query)

searchFirst

public GISPoint searchFirst​(java.lang.String query)
Description copied from class: AbstractShapeGISMap
Search for a point on the Earth corresponding to the user's query.
Specified by:
searchFirst in class AbstractShapeGISMap
Parameters:
query - name of a geographic object or POI

searchFirstRegion

public GISRegion searchFirstRegion​(java.lang.String query)

searchFirstMultiRegion

public GISMultiRegion searchFirstMultiRegion​(java.lang.String query)

isLayerVisible

public boolean isLayerVisible​(java.lang.String shapeFileName)
Tests if a shapefile layer is visible
Parameters:
shapeFileName - the name of the shapefile
Returns:
true if the layer is visible, false if not or not found

setLayerVisibility

public void setLayerVisibility​(java.lang.String shapeFileName,
                               boolean visible)
Shows or hides a shapefile layer.
Parameters:
shapeFileName - the name of the shapefile
visible - true to show, false to hide

getRouteProvider

public IGISRouteProvider getRouteProvider()
Description copied from class: AbstractShapeGISMap
Retrieves default route provider for all agents in GIS space.
Specified by:
getRouteProvider in class AbstractShapeGISMap
Returns:
default route provider
See Also:
IGISRouteProvider

getRoute

public GISRoute getRoute​(GISPoint start,
                         GISPoint end,
                         boolean bidirectional)
Creates route from one geographic point to another.
Parameters:
start - point on the Earth's surface
end - point on the Earth's surface
bidirectional - true if edge of the network would be bidirectional
Returns:
route between two points

getRoute

public GISRoute getRoute​(double startLatitude,
                         double startLongitude,
                         double endLatitude,
                         double endLongitude,
                         boolean bidirectional)
Creates route from one geographic point to another.
Parameters:
startLatitude - latitude of the start point
startLongitude - longitude of the start point
endLatitude - latitude of the end point
endLongitude - latitude of the end point
bidirectional - true if edge of the network would be bidirectional
Returns:
route between two points

getRoute

public GISRoute getRoute​(GISPoint start,
                         GISPoint end)
Description copied from class: AbstractShapeGISMap
Creates an unidirectional route from one geographic point to another.
Specified by:
getRoute in class AbstractShapeGISMap
Parameters:
start - point on the Earth's surface
end - point on the Earth's surface
Returns:
route between two points

getRoute

public GISRoute getRoute​(double startLatitude,
                         double startLongitude,
                         double endLatitude,
                         double endLongitude)
Description copied from class: AbstractShapeGISMap
Creates an unidirectional route from one geographic point to another.
Specified by:
getRoute in class AbstractShapeGISMap
Parameters:
startLatitude - latitude of the start point
startLongitude - longitude of the start point
endLatitude - latitude of the end point
endLongitude - latitude of the end point
Returns:
route between two points

addImageChangedListener

@AnyLogicInternalAPI
@Deprecated
public void addImageChangedListener​(ImageChangedListener listener)
Deprecated.

removeImageChangedListener

@AnyLogicInternalAPI
@Deprecated
public void removeImageChangedListener​(ImageChangedListener listener)
Deprecated.

getMPP

public double getMPP()
Description copied from class: AbstractShapeGISMap
Calculates amount of meters in one pixel of map presentation
Specified by:
getMPP in class AbstractShapeGISMap

onMarkupChanged

@AnyLogicInternalAPI
public void onMarkupChanged()

add

public void add​(GISMarkupElement markupElement)
Adds GIS markup element to drawing set of elements.

remove

public void remove​(GISMarkupElement markupElement)
Removes GIS markup element from drawing set of elements.

add

public void add​(GISMultiRegion markupElement)
Adds GIS markup element to drawing set of elements.

remove

public void remove​(GISMultiRegion markupElement)
Removes GIS markup element from drawing set of elements.

toLengthUnits

public double toLengthUnits​(double length,
                            LengthUnits units)
Convert value of length measured in meters to given length units
Parameters:
length - value of length
units - length units
Returns:
length measured in specified units

fromLengthUnits

public double fromLengthUnits​(double length,
                              LengthUnits units)
Convert value of length measured in given units to meters
Parameters:
length - value of length
units - length units
Returns:
length measured in meters

setSearchBounds

public void setSearchBounds​(double bottomLatitude,
                            double leftLongitude,
                            double topLatitude,
                            double rigthLongitude)
Sets bounds for search area.
Parameters:
bottomLat - the latitude of searchable area's bottom bound, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
leftLon - the longitude of searchable area's left bound, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
topLat - the latitude of searchable area's top bound, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
rightLon - the longitude of searchable area's right bound, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

isMouseNavigationEnabled

public boolean isMouseNavigationEnabled()
Returns true if panning and zooming with a mouse are allowed.
Returns:
true if mouse panning and zooming are allowed false otherwise

setMouseNavigationEnabled

public void setMouseNavigationEnabled​(boolean mouseNavigationEnabled)
Manage ability to pan and zoom the map with a mouse.
Parameters:
mouseNavigationEnabled - true to allow mouse panning and zooming false to forbid

fitBounds

public void fitBounds​(double bottomLat,
                      double leftLon,
                      double topLat,
                      double rightLon)
Make map fits specified bounds.
Parameters:
bottomLat - the latitude of visible area's bottom bound, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
leftLon - the longitude of visible area's left bound, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
topLat - the latitude of visible area's top bound, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
rightLon - the longitude of visible area's right bound, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

updateSVGProperties

@AnyLogicInternalAPI
public SVGElement updateSVGProperties​(java.util.List<SVGCommand> output,
                                      ShapeDrawMode drawMode,
                                      boolean publicOnly,
                                      SVGElement owner,
                                      SVGElement elbehind)
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
Specified by:
updateSVGProperties in interface SVGElement
Overrides:
updateSVGProperties in class Shape
Parameters:
output - the list of commands to add to
drawMode - TODO
publicOnly - drawing context: if true, only shapes that are marked as public only are updated
owner - the SVG element that serves as a container for this element
elbehind - the SVG element behind this one, or null if none or if order is irrelevant
Returns:
the actual owner this element has been added to or null if element is not drawn (e.g. drawing of this element is not needed because of public only settings, permanently not needed or not supported - hence SVG id is not set). The actual owner may differ from the given owner when the svg element is added to a different place (e.g. GIS map).

resetSVGState

@AnyLogicInternalAPI
public void resetSVGState()
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Specified by:
resetSVGState in interface SVGElement
Overrides:
resetSVGState in class Shape

postSVGShapeSpecificAttributes

public void postSVGShapeSpecificAttributes​(java.util.List<java.lang.String> att,
                                           java.util.List<java.lang.String> val,
                                           boolean publicOnly)
Description copied from class: Shape
Posts general properties specific to a particular shape class. Is triggered by SVG_DIRTY_SHAPE flag. Made public for occasional posting of additional SVG properties from outside engine (e.g. from libraries)
Overrides:
postSVGShapeSpecificAttributes in class Shape
Parameters:
att - attribute names
val - attribute values
publicOnly - TODO

findSVGElement

@AnyLogicInternalAPI
public SVGElement findSVGElement​(long svgId)
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Specified by:
findSVGElement in interface SVGElement
Overrides:
findSVGElement in class Shape

dispose

@AnyLogicInternalAPI
public void dispose()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
How can we improve this article?