AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, Serializable, Cloneable
Direct Known Subclasses:
ShapeGISMap

public abstract class AbstractShapeGISMap
extends Shape3D
GIS map projection manager and map renderer class
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) This is abstract class (additional GIS-services like layers access are available in the ShapeGISMap class)

Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

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

UNKNOWN_NAME

Constructor Summary

ConstructorDescription
AbstractShapeGISMap() 

Method Summary

Modifier and TypeMethodDescription
final AbstractShapeGISMapclone()
Cloning of GIS is not supported
(Other shapes except controls and charts allow cloning)
This method throws UnsupportedOperationException if called
abstract PointconvertForward(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
abstract PointconvertForward(double latitude, double longitude, Point out)
Deprecated.
this function is deprecated and will be removed in the next release
PointconvertForward(Point latLon)
Deprecated.
this function is deprecated and will be removed in the next release
abstract PointconvertInverse(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
abstract PointconvertInverse(double x, double y, Point out)
Deprecated.
this function is deprecated and will be removed in the next release
PointconvertInverse(Point xy)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertRotationAngleForward(double latitude, double longitude, double angle)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertRotationAngleInverse(double x, double y, double angle)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertXForward(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertXInverse(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertYForward(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
abstract doubleconvertYInverse(double x, double y)
Deprecated.
this function is deprecated and will be removed in the next release
StringformatMapScale()
Returns a string "1:k" (e.g.
abstract doublegetCenterLatitude()
Deprecated.
this function is deprecated and will be removed in the next release
abstract doublegetCenterLongitude()
Deprecated.
this function is deprecated and will be removed in the next release
abstract doublegetDistance(double latFrom, double lonFrom, double latTo, double lonTo)
Returns distance, in meters, between 2 given points
abstract doublegetDistance(GISPoint fromPoint, GISPoint toPoint)
Returns distance, in meters, between 2 given points
abstract doublegetDistanceByRoute(double latFrom, double lonFrom, double latTo, double lonTo)
Calculates length of route from one point to another.
abstract doublegetDistanceByRoute(GISPoint fromPoint, GISPoint toPoint)
Calculates length of route from one point to another.
abstract doublegetMapScale()
Deprecated.
this function is deprecated and will be removed in the next release
abstract doublegetMaxMapScale()
Returns the maximum available scale of the map projection
abstract doublegetMinMapScale()
Returns the minimum available scale of the map projection
abstract doublegetMPP()
Calculates amount of meters in one pixel of map presentation
abstract GISRoutegetRoute(double startLatitude, double startLongitude, double endLatitude, double endLongitude)
Creates an unidirectional route from one geographic point to another.
abstract GISRoutegetRoute(GISPoint start, GISPoint end)
Creates an unidirectional route from one geographic point to another.
abstract IGISRouteProvidergetRouteProvider()
Retrieves default route provider for all agents in GIS space.
booleanonClick(double latitude, double longitude)
Should be overridden to define the shape reaction on mouse click.
abstract voidpan(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
abstract booleanprojectionContains(double latitude, double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
abstract GISPointsearchFirst(String query)
Search for a point on the Earth corresponding to the user's query.
abstract voidsetCenterLatitude(double centerLatitude)
Sets the latitude of the map projection center, measured in degrees (-90 ...
abstract voidsetCenterLongitude(double centerLongitude)
Sets the longitude of the map projection center, measured in degrees (-180 ...
abstract voidsetMapScale(double mapScale)
Sets the scale of map projection
abstract voidsetProjectionCenter(double centerLatitude, double centerLongitude)
Sets the center of the map projection
abstract voidzoomIn()
Increases scale of map projection (x 2)
abstract voidzoomOut()
Decreases scale of map projection (x 1/2)

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

Constructor Details

AbstractShapeGISMap

public AbstractShapeGISMap()

Method Details

convertXForward

@Deprecated
public abstract double convertXForward(double latitude,
 double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given point to screen and returns x-coordinate
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 abstract double convertYForward(double latitude,
 double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given point to screen and returns y-coordinate
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 abstract Point convertForward(double latitude,
 double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given point to screen and returns (x, y) coordinates
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 abstract Point convertForward(double latitude,
 double longitude,
 Point out)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given point to screen and returns (x, y) coordinates
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

convertForward

@Deprecated
public Point convertForward(Point latLon)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given point to screen and returns (x, y) coordinates. The z of returned point isn't changed (it equals the given point).
Parameters:
latLon - the (latitude, longitude) of point, where
latitude is measured in degrees (-90 ... (South) ... 0 ... (North) ... +90) and longitude is measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
the Point structure with (x, y) coordinates of screen-projection of the given point

convertRotationAngleForward

@Deprecated
public abstract double convertRotationAngleForward(double latitude,
 double longitude,
 double angle)
Deprecated.
this function is deprecated and will be removed in the next release
Creates forward projection of the given rotation angle (direction) at the given point, to screen and returns rotation angle in screen coordinates
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 abstract double convertXInverse(double x,
 double y)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given point from screen and returns longitude
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 abstract double convertYInverse(double x,
 double y)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given point from screen and returns latitude
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 abstract Point convertInverse(double x,
 double y)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given point from screen and returns (latitude, longitude) coordinates
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 abstract Point convertInverse(double x,
 double y,
 Point out)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given point from screen and returns (latitude, longitude) coordinates
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)

convertInverse

@Deprecated
public Point convertInverse(Point xy)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given point from screen and returns (latitude, longitude) coordinates. The z of returned point isn't changed (it equals the given point).
Parameters:
xy - the (x, y) coordinates of screen-projection of the given point
Returns:
the new 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 abstract double convertRotationAngleInverse(double x,
 double y,
 double angle)
Deprecated.
this function is deprecated and will be removed in the next release
Creates inverse projection of the given rotation angle (direction) at the given point, from screen and returns rotation angle in map coordinates
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 abstract boolean projectionContains(double latitude,
 double longitude)
Deprecated.
this function is deprecated and will be removed in the next release
Returns true if the projection of the given point to screen is visible on this map
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

getDistance

public abstract double getDistance(double latFrom,
 double lonFrom,
 double latTo,
 double lonTo)
Returns distance, in meters, between 2 given points
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 abstract double getDistance(GISPoint fromPoint,
 GISPoint toPoint)
Returns distance, in meters, between 2 given points
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

onClick

@AnyLogicInternalCodegenAPI
public boolean onClick(double latitude,
 double longitude)
Should be overridden to define the shape reaction on mouse click. The click coordinates are geographical coordinates, obtained via inverse-projection of mouse click (which is definitely within the shape bounds) if this method is called. By default, does nothing and returns false.
Overrides:
onClick in class Shape
Parameters:
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90), where mouse click occurred
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), where mouse click occurred
Returns:
always return false here.

zoomOut

public abstract void zoomOut()
Decreases scale of map projection (x 1/2)

zoomIn

public abstract void zoomIn()
Increases scale of map projection (x 2)

setMapScale

public abstract void setMapScale(double mapScale)
Sets the scale of map projection
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"

getMaxMapScale

public abstract double getMaxMapScale()
Returns the maximum available scale of the map projection
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"

getMinMapScale

public abstract double getMinMapScale()
Returns the minimum available scale of the map projection
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"

getMapScale

@Deprecated
public abstract double getMapScale()
Deprecated.
this function is deprecated and will be removed in the next release
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.
Returns:
the current scale of the map

formatMapScale

public String formatMapScale()
Returns a string "1:k" (e.g. "1:100000") for map with scale 1/k
Returns:
the string representation of map scale

setProjectionCenter

public abstract void setProjectionCenter(double centerLatitude,
 double centerLongitude)
Sets the center of the map projection
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)

setCenterLongitude

public abstract void setCenterLongitude(double centerLongitude)
Sets the longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Parameters:
centerLongitude - new longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)

setCenterLatitude

public abstract void setCenterLatitude(double centerLatitude)
Sets the latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Parameters:
centerLatitude - new latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)

getCenterLongitude

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

getCenterLatitude

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

pan

public abstract 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
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

clone

public final AbstractShapeGISMap clone()
Cloning of GIS is not supported
(Other shapes except controls and charts allow cloning)
This method throws UnsupportedOperationException if called
Overrides:
clone in class Shape

getRouteProvider

public abstract IGISRouteProvider getRouteProvider()
Retrieves default route provider for all agents in GIS space.
Returns:
default route provider
See Also:
IGISRouteProvider

searchFirst

public abstract GISPoint searchFirst(String query)
Search for a point on the Earth corresponding to the user's query.
Parameters:
query - name of a geographic object or POI

getDistanceByRoute

public abstract double getDistanceByRoute(GISPoint fromPoint,
 GISPoint toPoint)
Calculates length of route from one point to another. Uses route provider to create a route.
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

getDistanceByRoute

public abstract double getDistanceByRoute(double latFrom,
 double lonFrom,
 double latTo,
 double lonTo)
Calculates length of route from one point to another. Uses route provider to create a route.
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

getRoute

public abstract GISRoute getRoute(GISPoint start,
 GISPoint end)
Creates an unidirectional route from one geographic point to another.
Parameters:
start - point on the Earth's surface
end - point on the Earth's surface
Returns:
route between two points

getRoute

public abstract GISRoute getRoute(double startLatitude,
 double startLongitude,
 double endLatitude,
 double endLongitude)
Creates an unidirectional 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
Returns:
route between two points

getMPP

@AnyLogicInternalAPI
public abstract double getMPP()
Calculates amount of meters in one pixel of map presentation