|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.Shape
com.xj.anylogic.engine.AbstractShapeGISMap
com.xj.anylogic.engine.presentation.ShapeGISMap
public class ShapeGISMap
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:
| Nested Class Summary | |
|---|---|
static class |
ShapeGISMap.Layer
Class which stores GIS map layer information |
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
ShapeGISMap(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
ShapeGISMap.Layer[] layers,
double centerLongitude,
double centerLatitude,
double mapScale,
java.awt.Color mapBorderColor,
java.awt.Color mapBackgroundColor)
Constructs a GIS Map shape with specific attributes. |
|
| Method Summary | |
|---|---|
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) |
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 |
double |
convertXForward(double longitude,
double latitude)
Creates forward projection of the given point to screen and returns x-coordinate |
double |
convertYForward(double longitude,
double latitude)
Creates forward projection of the given point to screen and returns y-coordinate |
float[] |
createTrajectory(double lonFrom,
double latFrom,
double lonTo,
double latTo)
Creates shortest path between two given points and returns it as polyline with N (=512) segments, as array of length 2(N+1) First number in array is always 0, next numbers are (lon, lat)-pairs of polyline nodes, including beginning and end This method is not designed to be called by user |
void |
destroy()
|
void |
draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
Draws the shape in a given context |
double |
getCenterLatitude()
Returns the latitude of the map projection center, measured in degrees (-90 ... |
double |
getCenterLongitude()
Returns the longitude of the map projection center, measured in degrees (-180 ... |
double |
getDistance(double lonFrom,
double latFrom,
double lonTo,
double latTo)
Returns distance, in meters, between 2 given points |
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()
Returns the scale of map projection |
double |
getMaxMapScale()
Returns the maximum available scale of the map projection |
double |
getMinMapScale()
Returns the minimum available scale of the map projection |
Presentable |
getPresentable()
Returns the Presentable object (ActiveObject or Experiment) where this shape belongs to, or null. |
double |
getWidth()
Returns the width of the shape. |
boolean |
onClickAt(double px,
double py,
boolean publicOnly)
Tests if the GIS map contains the point with the given coordinates and, if yes, executes the reaction on click at that point. |
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 |
boolean |
projectionContains(double longitude,
double latitude)
Returns true if the projection of the given point to
screen is visible on this map |
void |
requestRedraw()
Schedules projection recreation and map image rendering to the next animation update |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object The method is used in snapshot saving/loading |
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 |
setMapScale(double mapScale)
Sets the scale of map projection |
void |
setProjectionCenter(double centerLongitude,
double centerLatitude)
Sets the center of the map projection |
void |
setWidth(double width)
Sets the width of the shape. |
void |
zoomIn()
Increases scale of map projection ( x 2) |
void |
zoomOut()
Decreases scale of map projection ( x 1/2) |
| Methods inherited from class com.xj.anylogic.engine.AbstractShapeGISMap |
|---|
clone, formatMapScale, onClick |
| Methods inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, 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 |
|---|
public ShapeGISMap(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
ShapeGISMap.Layer[] layers,
double centerLongitude,
double centerLatitude,
double mapScale,
java.awt.Color mapBorderColor,
java.awt.Color mapBackgroundColor)
presentable - the presentable object owning this shapeispublic - if true, the shape is visible on container's presentationx - the x coordinate of the shape upper left cornery - the y coordinate of the shape upper left cornerwidth - the width of the shapeheight - the height of the shapepackagePrefix - the package name of original active object where this image is
defined, formatted using '/' characters; with '/' character at
the beginning and at the endlayers - the array of ShapeGISMap.Layer objects to be used and drawncenterLongitude - the longitude of the map projection center, measured in
degrees (-180 ... (West) ... 0 ... (East) ... +180)centerLatitude - the latitude of the map projection center, measured in degrees
(-90 ... (South) ... 0 ... (North) ... +90)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"| Method Detail |
|---|
public void setWidth(double width)
width - the width of the shapepublic double getWidth()
public void setHeight(double height)
height - the height of the shapepublic double getHeight()
public boolean onClickAt(double px,
double py,
boolean publicOnly)
onClickAt in class Shapepx - the x coordinate of the clickpy - the y coordinate of the clickpublicOnly - if true, not public shape returns false
public boolean contains(double px,
double py)
Shape
contains in class Shapepx - the x coordinate relative to this shape's containerpy - the y coordinate relative to this shape's container
public void draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
Shape
draw in class Shapepanel - the panel where the drawing is doneg - the graphics where the drawing takes placexform - the "original" transform that must be restored before drawingpublicOnly - if true, the shape is only drawn if it is publicpublic double getMapScale()
AbstractShapeGISMap
getMapScale in class AbstractShapeGISMappublic void setMapScale(double mapScale)
AbstractShapeGISMap
setMapScale in class AbstractShapeGISMapmapScale - the scale (ratio between meters on the screen and meters on
the Earth surface), e.g. 1/100000 means "1 km in 1 cm"public double getMinMapScale()
AbstractShapeGISMap
getMinMapScale in class AbstractShapeGISMappublic double getMaxMapScale()
AbstractShapeGISMap
getMaxMapScale in class AbstractShapeGISMappublic void zoomIn()
AbstractShapeGISMapx 2)
zoomIn in class AbstractShapeGISMappublic void zoomOut()
AbstractShapeGISMapx 1/2)
zoomOut in class AbstractShapeGISMap
public void pan(int toEast,
int toNorth)
AbstractShapeGISMap
pan in class AbstractShapeGISMaptoEast - number of horizontal deltas to be added to the projection
center, if positive, center is moved to the East, if negative -
to the WesttoNorth - number of vertical deltas to be added to the projection
center, if positive, center is moved to the North, if negative -
to the Southpublic double getCenterLatitude()
AbstractShapeGISMap
getCenterLatitude in class AbstractShapeGISMappublic double getCenterLongitude()
AbstractShapeGISMap
getCenterLongitude in class AbstractShapeGISMap
public void setProjectionCenter(double centerLongitude,
double centerLatitude)
AbstractShapeGISMap
setProjectionCenter in class AbstractShapeGISMapcenterLongitude - 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)public void setCenterLatitude(double centerLatitude)
AbstractShapeGISMap
setCenterLatitude in class AbstractShapeGISMapcenterLatitude - new latitude of the map projection center, measured in degrees
(-90 ... (South) ... 0 ... (North) ... +90)public void setCenterLongitude(double centerLongitude)
AbstractShapeGISMap
setCenterLongitude in class AbstractShapeGISMapcenterLongitude - new longitude of the map projection center, measured in
degrees (-180 ... (West) ... 0 ... (East) ... +180)
public double convertXForward(double longitude,
double latitude)
AbstractShapeGISMap
convertXForward in class AbstractShapeGISMaplongitude - 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)
public double convertYForward(double longitude,
double latitude)
AbstractShapeGISMap
convertYForward in class AbstractShapeGISMaplongitude - 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)
public double convertRotationAngleForward(double longitude,
double latitude,
double angle)
AbstractShapeGISMap
convertRotationAngleForward in class AbstractShapeGISMaplongitude - 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.)
public boolean projectionContains(double longitude,
double latitude)
AbstractShapeGISMaptrue if the projection of the given point to
screen is visible on this map
projectionContains in class AbstractShapeGISMaplongitude - 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)
true if the projection of the given point to
screen is visible on this map
public float[] createTrajectory(double lonFrom,
double latFrom,
double lonTo,
double latTo)
AbstractShapeGISMap
lonFrom - the longitude of the start point, measured in degrees (-180
... (West) ... 0 ... (East) ... +180)latFrom - the latitude of the start point, measured in degrees (-90 ...
(South) ... 0 ... (North) ... +90)lonTo - the longitude of the end point, measured in degrees (-180 ...
(West) ... 0 ... (East) ... +180)latTo - the latitude of the end point, measured in degrees (-90 ...
(South) ... 0 ... (North) ... +90)
public double getDistance(double lonFrom,
double latFrom,
double lonTo,
double latTo)
AbstractShapeGISMap
getDistance in class AbstractShapeGISMaplonFrom - 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)
public ShapeGISMap.Layer[] getLayers()
public void requestRedraw()
public void destroy()
public Presentable getPresentable()
Shape
getPresentable in class Shapepublic void restoreOwner(java.lang.Object owner)
Shape
restoreOwner in interface com.xj.anylogic.engine.internal.ChildrestoreOwner in class Shapeowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGroup
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||