com.xj.anylogic.engine
Class AbstractShapeGISMap

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Shape
      extended by com.xj.anylogic.engine.AbstractShapeGISMap
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, Locatable2D, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ShapeGISMap

public abstract class AbstractShapeGISMap
extends Shape

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 following order of coordinates is assumed: (longitude, latitude), uniformly with (x, y)
This is abstract class (additional GIS-services like layers access are available in the ShapeGISMap class)

This object is only available in the AnyLogic Professional

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xj.anylogic.engine.presentation.Shape
UNKNOWN_NAME
 
Constructor Summary
AbstractShapeGISMap()
           
 
Method Summary
 AbstractShapeGISMap clone()
          Cloning of GIS is not supported
(Other shapes except controls and charts allow cloning)
This method throws UnsupportedOperationException if called
abstract  double convertRotationAngleForward(double longitude, double latitude, double angle)
          Creates forward projection of the given rotation angle (direction) at the given point, to screen and returns rotation angle in screen coordinates
abstract  double convertXForward(double longitude, double latitude)
          Creates forward projection of the given point to screen and returns x-coordinate
abstract  double convertYForward(double longitude, double latitude)
          Creates forward projection of the given point to screen and returns y-coordinate
 java.lang.String formatMapScale()
          Returns a string "1:k" (e.g. "1:100000") for map with scale 1/k
abstract  double getCenterLatitude()
          Returns the latitude of the map projection center, measured in degrees (-90 ...
abstract  double getCenterLongitude()
          Returns the longitude of the map projection center, measured in degrees (-180 ...
abstract  double getDistance(double lonFrom, double latFrom, double lonTo, double latTo)
          Returns distance, in meters, between 2 given points
abstract  double getMapScale()
          Returns the scale of map projection
abstract  double getMaxMapScale()
          Returns the maximum available scale of the map projection
abstract  double getMinMapScale()
          Returns the minimum available scale of the map projection
 boolean onClick(double longitude, double latitude)
          Should be overridden to define the shape reaction on mouse click.
abstract  void pan(int toEast, int 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  boolean projectionContains(double longitude, double latitude)
          Returns true if the projection of the given point to screen is visible on this map
abstract  void setCenterLatitude(double centerLatitude)
          Sets the latitude of the map projection center, measured in degrees (-90 ...
abstract  void setCenterLongitude(double centerLongitude)
          Sets the longitude of the map projection center, measured in degrees (-180 ...
abstract  void setMapScale(double mapScale)
          Sets the scale of map projection
 void setProjectionCenter(double centerLongitude, double centerLatitude)
          Sets the center of the map projection
abstract  void zoomIn()
          Increases scale of map projection (x 2)
abstract  void zoomOut()
          Decreases scale of map projection (x 1/2)
 
Methods inherited from class com.xj.anylogic.engine.presentation.Shape
canHandleClick, contains, draw, getGroup, getName, getPresentable, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClickAt, restoreOwner, setPos, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractShapeGISMap

public AbstractShapeGISMap()
Method Detail

convertXForward

public abstract double convertXForward(double longitude,
                                       double latitude)
Creates forward projection of the given point to screen and returns x-coordinate

Parameters:
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Returns:
the x coordinate of screen-projection of the given point

convertYForward

public abstract double convertYForward(double longitude,
                                       double latitude)
Creates forward projection of the given point to screen and returns y-coordinate

Parameters:
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Returns:
the y coordinate of screen-projection of the given point

convertRotationAngleForward

public abstract double convertRotationAngleForward(double longitude,
                                                   double latitude,
                                                   double angle)
Creates forward projection of the given rotation angle (direction) at the given point, to screen and returns rotation angle in screen coordinates

Parameters:
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
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)

projectionContains

public abstract boolean projectionContains(double longitude,
                                           double latitude)
Returns true if the projection of the given point to screen is visible on this map

Parameters:
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Returns:
true if the projection of the given point to screen is visible on this map

getDistance

public abstract double getDistance(double lonFrom,
                                   double latFrom,
                                   double lonTo,
                                   double latTo)
Returns distance, in meters, between 2 given points

Parameters:
lonFrom - the longitude of the 1st point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latFrom - the latitude of the 1st point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
lonTo - the longitude of the 2nd point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latTo - the latitude of the 2nd point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
Returns:
the distance, in meters, between 2 given points

onClick

public boolean onClick(double longitude,
                       double latitude)
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:
longitude - the longitude of point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), where mouse click occurred
latitude - the latitude of point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90), where mouse click occurred
Returns:
true if further click processing is not needed, false otherwise

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

public abstract double getMapScale()
Returns the scale of map projection

Returns:
the scale (ratio between meters on the screen and meters on the Earth surface), e.g. 1/100000 means "1 km in 1 cm"

formatMapScale

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

Parameters:
centerLongitude - new longitude of the map projection center, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
centerLatitude - new latitude of the map projection center, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)

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

public abstract double getCenterLongitude()
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

public abstract double getCenterLatitude()
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(int toEast,
                         int 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


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.