|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface is used to manage a geography map and paint it.
GeographyMap manages coordinate system, coordinate transformation, and coordinate correction. Every map object is set the default CRS(Coordinate Reference System), WGS84, which helps to transform a set of geography ordinates to a set of screen ordinates. In the future you can set custom CRS to a map object. GeographyMap can project an area of the map (named window of the map) to a specified rectangle area of the display device (view port).After you have correctly define the window and view port, you can success in getting correct coordinate transformation and displaying a map.
GeographyMap handles the event occurring on the map. When some import property of the map is changed, some MapEvent will occur and be dispatched to all the registered listeners. GeographyMap object can manage these listeners( added, removed, and so on) and dispatches these kinds of events to the listeners. For example, if the window of a map is changed, a MapEvent with the MAP_WINDOW_CHANGED type will occurs on the map. The map will dispatch this event to the registered listener which is interested in the map events.
Geography layers are the contents of a map. A GeographyMap object manages these layers. With a map object, you can
add, remove, delete a layer, change the style of a specified layer, query the features of a layer, and even handle
the event occurring on layers. If you are interested in some kind of MapLayerChangedEvent
,
you should register a MapLayerListener
to the map. When some MapLayerChangedEvent occurs,
the map will dispatch the event to the listener.
Field Summary | |
static int |
IMAGELAYER_INDEX
|
static int |
LAYERMOVE_TYPE_DOWN
Constant for moving a layer. |
static int |
LAYERMOVE_TYPE_TOBOTTOM
Constant for moving a layer. |
static int |
LAYERMOVE_TYPE_TOTOP
Constant for moving a layer. |
static int |
LAYERMOVE_TYPE_UP
Constant for moving a layer. |
static int |
MAPMODE_AREA_DWITHIN_SELECT
Constant which defines how to operate the map. |
static int |
MAPMODE_AREA_WITHIN_SELECT
Constant which defines how to operate the map. |
static int |
MAPMODE_DEFAULT
Constant which defines how to operate the map. |
static int |
MAPMODE_DISTANCE
Constant which defines how to operate the map. |
static int |
MAPMODE_PAN
Constant which defines how to operate the map. |
static int |
MAPMODE_SELECT
Constant which defines how to operate the map. |
static int |
MAPMODE_ZOOMIN
Constant which defines how to operate the map. |
static int |
MAPMODE_ZOOMIN_BYSCALE
|
static int |
MAPMODE_ZOOMOUT
Constant which defines how to operate the map. |
static int |
MAPMODE_ZOOMRESET
Constant which defines how to operate the map. |
Method Summary | |
void |
addBackAndForwardTask()
Adds a task to the redo/undo queue of the map object. |
void |
addLayer(java.lang.String layerName,
int executorType)
Adds a geographical layer to the map by specifying corresponding executor type. |
void |
addLayer(java.lang.String layerName,
int executorType,
GridBbox bbox,
java.lang.String style,
java.lang.String srs,
java.lang.String serverPath)
Adds a layer to the map. |
void |
addLayer(java.lang.String layerName,
int executorType,
java.lang.String serverPath)
Adds a layer to the map. |
void |
addMapLayerListeren(MapLayerListener listener)
Adds the specified MapLayerListener to the listener list. |
void |
addMapListener(MapListener listener)
Adds the specified MapChangedListener to the listener list. |
void |
addPanActionFilter(PanActionFilter filter)
Adds a PanActionFilter instance to the map. |
boolean |
canGoBack()
Determines whether the map object can go back right now. |
boolean |
canGoForward()
Determines whether the map object can go forward right now. |
boolean |
canPan()
Determines if the map can be panned. |
void |
clearSelection()
Clears all features from the selected features collection. |
void |
drawMap(java.awt.image.BufferedImage bufferImage)
|
void |
drawMap(java.awt.Graphics2D g)
Draws the context in the window of the map to something with the specified Graphics2D object |
java.lang.Object[] |
getAllLayerNames()
Gets the names of all the layers stored in the map. |
twaver.GeoCoordinate |
getCenterPoint()
Gets the center point of the map, and the point is described by a GeoCoordinate instance. |
double |
getDistance(java.util.ArrayList pointList)
Measures the summation of the distances between the points stored in the specified ArrayList. |
double |
getDistance(double fromLongitude,
double fromLatitude,
double toLongitude,
double toLatitude)
Measures the distance between the two points specified by the given coordinates. |
java.awt.Color |
getGroundingColor()
Gets the grounding color of the map |
GeographyLayer |
getLayer(int index)
Gets a GeographyLayer object in the map with the specified index. |
GeographyLayer |
getLayer(java.lang.String layerName)
Gets a GeographyLayer object by the specified layer name. |
int |
getLayerCount()
Gets the count of the layers stored in the map. |
int |
getLayerIndex(java.lang.String layerName)
Gets a layer's index by the specified layer name. |
GridBbox |
getLimitedArea()
Gets the area of the map can display |
double[] |
getLL(double x,
double y)
Gets the geographical coordinate of a specified screen point which is described by x-y axes. |
java.awt.geom.Rectangle2D |
getMapArea()
Gets the whole map's bounds. |
int |
getMapMode()
Gets the operation mode of the map. |
java.lang.String |
getOverviewTitle()
Gets the title of the overview window |
int |
getProjectionType()
Gets the projection type of the map; |
int |
getQueryLayerIndex()
Gets the index of the query layer. |
GeographyFeature[] |
getSelectedFeatures()
Gets all selected GeographyFeatures |
java.awt.geom.Rectangle2D |
getSelectedFeaturesArea()
Gets the area which is covered by the selected features. |
java.awt.Color |
getSelectedFilledColor()
Gets the color used to fill the selected features. |
java.awt.Color |
getSelectedStrokeColor()
Gets the color used to paint the selected features' bounds. |
java.awt.Rectangle |
getViewport()
Gets the projection range. |
java.awt.geom.Rectangle2D |
getViewportBounds()
|
java.awt.geom.Rectangle2D |
getWindow()
Gets the window of the map. |
double |
getWindowMaxx()
Gets the max longitude of the map's window. |
double |
getWindowMaxy()
Gets the max latitude of the map's window. |
double |
getWindowMinx()
Gets the minimal longitude of the map's window. |
double |
getWindowMiny()
Gets the minimal latitude of the map's window. |
double[] |
getXY(double longitude,
double latitude)
Gets the screen coordinate of the point which is described by geographical coordinate. |
int |
getZoom()
Gets current zoom of the map object. |
int |
getZoomLowLimit()
Gets the lower limit of the map's zoom. |
int |
getZoomUpLimit()
Gets the upper limit of the map's zoom. |
void |
goBack()
Goes back to the last state of the map object which is stored in the map's redo/undo queue. |
void |
goForward()
Goes forward to the next state of the map object which is stored in the map's redo/undo queue. |
boolean |
isEnableMouseWheelZoom()
Determines whether the map can be zoomed in or zoomed out when the mouse wheel is scrolled |
boolean |
isSupportingBackAndForward()
Determines whether the map object supports redo/undo tasks. |
boolean |
isVisible(int index)
Determines whether the layer specified by the index is visible. |
boolean |
isVisible(java.lang.String layerName)
Determines whether the specified layer in the map is visible. |
void |
moveLayer(java.lang.String layerName,
int layerMovedType)
Moves the specified geography layer upward or downward. |
void |
removeAllLayers()
Removes all layers stored in the map. |
void |
removeLayer(int index)
Removes a layer specified by the index. |
void |
removeLayer(java.lang.String layerName)
Removes a layer specified by the layer name. |
void |
removeLayers(java.lang.String[] layerNames)
Removes the layers specified by their names. |
void |
removeMapLayerListener(MapLayerListener listener)
Removes the specified MapLayerListener from the listener list. |
void |
removeMapListener(MapListener listener)
Removes the specified MapChangedListener from the listener list. |
void |
reset()
Resets the window of the map. |
void |
selectFeatures(double x,
double y)
Selects the feature on the query layer by the specified point described by X and Y coordinates. |
void |
selectFeatures(java.awt.geom.Rectangle2D area)
Selects features which are overlapped by the specified rectangle. |
void |
selectFeatures(java.lang.String attributeName,
int operator,
java.lang.Object value)
Selects the features on the query layer by the specified attribute value. |
void |
setBackAndForwardLimit(int limit)
Specifies the capability of the map object's redo/undo queue. |
void |
setCenterPoint(double longitude,
double latitude)
Sets the center point of the map. |
void |
setCenterPoint(twaver.GeoCoordinate center)
Specifies the center point of the map. |
void |
setEnableMouseWheelZoom(boolean enable)
Defines if the map can be zoomed in or zoomed out when the mouse wheel is scrolled |
void |
setGroundingColor(java.awt.Color color)
Sets the grounding color of the map. |
void |
setLimitedArea(GridBbox limitedArea)
Defines the area of the map can display |
void |
setMapMode(int value)
Sets the operation mode of the map. |
void |
setOverviewTitle(java.lang.String title)
Sets the title of the overview window |
void |
setProjectionType(int type)
Sets the projection type of the map; |
void |
setQueryLayer(int index)
Defines which layer is the query layer by the specified index. |
void |
setQueryLayer(java.lang.String layerName)
Defines which layer is the query layer by the specified layerName. |
void |
setSupportingBackAndForward(boolean supportingUndo)
Specifies the if the map can support redo/undo tasks. |
void |
setViewport(java.awt.Rectangle viewportRect)
Sets the projection range. |
void |
setWindow(double minLongitude,
double minLatitude,
double maxLongitude,
double maxLatitude)
Defines the window on the map with the specified area in latitude and longitude coordinates. |
boolean |
setZoom(int zoom)
Sets the zoom of the map object. |
void |
setZoomLevels(int[] levels)
|
void |
setZoomLowLimit(int lowlimit)
Sets the lower limit of the map's zoom. |
void |
setZoomUpLimit(int uplimit)
Sets the upper limit of the map's zoom. |
Field Detail |
public static final int IMAGELAYER_INDEX
public static final int LAYERMOVE_TYPE_DOWN
moveLayer(java.lang.String, int)
,
Constant Field Valuespublic static final int LAYERMOVE_TYPE_TOBOTTOM
moveLayer(java.lang.String, int)
,
Constant Field Valuespublic static final int LAYERMOVE_TYPE_TOTOP
moveLayer(java.lang.String, int)
,
Constant Field Valuespublic static final int LAYERMOVE_TYPE_UP
moveLayer(java.lang.String, int)
,
Constant Field Valuespublic static final int MAPMODE_AREA_DWITHIN_SELECT
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_AREA_WITHIN_SELECT
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_DEFAULT
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_DISTANCE
public static final int MAPMODE_PAN
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_SELECT
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_ZOOMIN
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_ZOOMIN_BYSCALE
public static final int MAPMODE_ZOOMOUT
getMapMode()
,
setMapMode(int)
,
Constant Field Valuespublic static final int MAPMODE_ZOOMRESET
getMapMode()
,
setMapMode(int)
,
Constant Field ValuesMethod Detail |
public void addBackAndForwardTask()
public void addLayer(java.lang.String layerName, int executorType)
layerName
- the name of the layer which is being added into a map object.executorType
- the type of the executor which provides data for the specified layer.TWaverGisConst.EXECUTOR_TYPE_GEOSERVER
,
TWaverGisConst.EXECUTOR_TYPE_GEOSERVER_CACHE
public void addLayer(java.lang.String layerName, int executorType, GridBbox bbox, java.lang.String style, java.lang.String srs, java.lang.String serverPath)
layerName
- the name of the layerexecutorType
- the executor type used to load geographical data from serverbbox
- the layer's bounding box.style
- the style used to render the layer by the serversrs
- the SRS used to display the layer.serverPath
- the URL of the map server.public void addLayer(java.lang.String layerName, int executorType, java.lang.String serverPath)
layerName
- the name of the layerexecutorType
- the executor type used to load geographical data from serverserverPath
- the URL of the map server.public void addMapLayerListeren(MapLayerListener listener)
listener
- the specified MapLayerListenerpublic void addMapListener(MapListener listener)
listener
- the specified MapChangedListenerpublic void addPanActionFilter(PanActionFilter filter)
PanActionFilter
instance to the map.
filter
- a PanActionFilter
instancepublic boolean canGoBack()
public boolean canGoForward()
public boolean canPan()
public void clearSelection()
public void drawMap(java.awt.image.BufferedImage bufferImage)
public void drawMap(java.awt.Graphics2D g)
g
- the specified Graphics2D objectpublic java.lang.Object[] getAllLayerNames()
public twaver.GeoCoordinate getCenterPoint()
GeoCoordinate
instance.
public double getDistance(java.util.ArrayList pointList)
pointList
- the specified ArrayList object, which stores the points.
public double getDistance(double fromLongitude, double fromLatitude, double toLongitude, double toLatitude)
fromLongitude
- the from point's longitude coordinate.fromLatitude
- the from point's latitude coordinate.toLongitude
- the to point's longitude coordinate.toLatitude
- the to point's latitude coordinate.
public java.awt.Color getGroundingColor()
public GeographyLayer getLayer(int index)
index
- the specified index
public GeographyLayer getLayer(java.lang.String layerName)
layerName
- the specified layer name
public int getLayerCount()
public int getLayerIndex(java.lang.String layerName)
layerName
- the specified layer name
public GridBbox getLimitedArea()
public double[] getLL(double x, double y)
x
- the x value of the specified screen pointy
- the y value of the specified screen point
GisToolkits.convertScreenToLatLong(GeographyMap, double, double)
public java.awt.geom.Rectangle2D getMapArea()
public int getMapMode()
MAPMODE_DEFAULT
,
MAPMODE_ZOOMIN
,
MAPMODE_ZOOMOUT
,
MAPMODE_ZOOMOUT
,
MAPMODE_PAN
,
MAPMODE_SELECT
,
MAPMODE_DISTANCE
,
MAPMODE_AREA_WITHIN_SELECT
,
MAPMODE_AREA_DWITHIN_SELECT
public java.lang.String getOverviewTitle()
public int getProjectionType()
TWaverGisConst.PROJECTIONTYPE_MERCATOR
,
TWaverGisConst.PROJECTIONTYPE_4326
public int getQueryLayerIndex()
public GeographyFeature[] getSelectedFeatures()
public java.awt.geom.Rectangle2D getSelectedFeaturesArea()
public java.awt.Color getSelectedFilledColor()
public java.awt.Color getSelectedStrokeColor()
public java.awt.Rectangle getViewport()
public java.awt.geom.Rectangle2D getViewportBounds()
public java.awt.geom.Rectangle2D getWindow()
public double getWindowMaxx()
public double getWindowMaxy()
public double getWindowMinx()
public double getWindowMiny()
public double[] getXY(double longitude, double latitude)
longitude
- the longitude of the specified point.latitude
- the latitude of the specified point.
GisToolkits.convertLatLongToScreen(GeographyMap, double, double)
public int getZoom()
public int getZoomLowLimit()
public int getZoomUpLimit()
public void goBack() throws javax.swing.undo.CannotUndoException
javax.swing.undo.CannotUndoException
public void goForward() throws javax.swing.undo.CannotUndoException
javax.swing.undo.CannotUndoException
public boolean isEnableMouseWheelZoom()
true
if the map can be zoomed by scrolling mouse wheel; false
otherwise.public boolean isSupportingBackAndForward()
public boolean isVisible(int index)
index
- the specified index
public boolean isVisible(java.lang.String layerName)
layerName
- the name of the specified layer.
public void moveLayer(java.lang.String layerName, int layerMovedType)
layerName
- the name of the layer which will be movedlayerMovedType
- the type which specifies how to move the specified layer. You must specify one of the following
choices:LAYERMOVE_TYPE_UP
,
LAYERMOVE_TYPE_DOWN
,
LAYERMOVE_TYPE_TOTOP
,
LAYERMOVE_TYPE_TOBOTTOM
public void removeAllLayers()
public void removeLayer(int index)
index
- the specified index.public void removeLayer(java.lang.String layerName)
layerName
- the name of the layerpublic void removeLayers(java.lang.String[] layerNames)
layerNames
- the specified names , stored in an array.public void removeMapLayerListener(MapLayerListener listener)
listener
- the specified MapLayerListenerpublic void removeMapListener(MapListener listener)
listener
- the specified MapChangedListenerpublic void reset()
public void selectFeatures(double x, double y)
x
- the X coordinate on the screeny
- the Y coordinate on the screenpublic void selectFeatures(java.awt.geom.Rectangle2D area)
area
- the screen area, in which you want to select featurespublic void selectFeatures(java.lang.String attributeName, int operator, java.lang.Object value)
attributeName
- the name of the attribute which is used to be compared.operator
- the type of comparison operation. You can pick the following choices:value
- used as the reference value For example: selectFeatures("NAME",TWaverGisConst.OPERATOR_EQUAL,"New
York"); will pick out all the features which have the "
NAME" attribute and the attribute value is "New York".TWaverGisConst.COMPARISON_OPERATOR_LESSOREQUAL
,
TWaverGisConst.COMPARISON_OPERATOR_LESS
,
TWaverGisConst.COMPARISON_OPERATOR_GREATER
,
TWaverGisConst.COMPARISON_OPERATOR_GREATEROREQUAL
,
TWaverGisConst.COMPARISON_OPERATOR_EQUAL
public void setBackAndForwardLimit(int limit)
public void setCenterPoint(double longitude, double latitude)
longitude
- the longitude of the center point of the map.latitude
- the latitude of the center point of the map.public void setCenterPoint(twaver.GeoCoordinate center)
GeoCoordinate
class.
center
- the center point .public void setEnableMouseWheelZoom(boolean enable)
enable
- public void setGroundingColor(java.awt.Color color)
color
- the grounding color.public void setLimitedArea(GridBbox limitedArea)
limitedArea
- the specified area.
For example:
To make the map only display an area which bottom left corner's geography coordinate is (0,0)
and which top right corner's geography coordinate is (180,90), you can invoke the method like the following:
map.setLimitedArea(new GridBbox(0,0,180,90);public void setMapMode(int value)
value
- defines the operation mode. You must specify one of the following choices:MAPMODE_DEFAULT
,
MAPMODE_ZOOMIN
,
MAPMODE_ZOOMOUT
,
MAPMODE_ZOOMOUT
,
MAPMODE_PAN
,
MAPMODE_SELECT
,
MAPMODE_DISTANCE
,
MAPMODE_AREA_WITHIN_SELECT
,
MAPMODE_AREA_DWITHIN_SELECT
public void setOverviewTitle(java.lang.String title)
title
- the specified title of the overview window.public void setProjectionType(int type)
type
- the specified projection type of the mapTWaverGisConst.PROJECTIONTYPE_MERCATOR
,
TWaverGisConst.PROJECTIONTYPE_4326
,
getProjectionType()
public void setQueryLayer(int index)
index
- the specified index.public void setQueryLayer(java.lang.String layerName)
layerName
- the specified layer name.public void setSupportingBackAndForward(boolean supportingUndo)
supportingUndo
- public void setViewport(java.awt.Rectangle viewportRect)
viewportRect
- the projection rangepublic void setWindow(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)
minLongitude
- the minimal longitudeminLatitude
- the minimal latitudemaxLongitude
- the max longitudemaxLatitude
- the max latitudepublic boolean setZoom(int zoom)
zoom
- the specified zoom.public void setZoomLevels(int[] levels)
public void setZoomLowLimit(int lowlimit)
lowlimit
- the specified lower limit of the map's zoom.public void setZoomUpLimit(int uplimit)
uplimit
- the specified upper limit of the map's zoom.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |