twaver.gis
Interface GeographyMap


public interface GeographyMap

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 non-fuzzily 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 FILRER_DWITHIN
          Constant defining the relationship between two geometries( A geometry and B geometry).
static int FILTER_WITHIN
          Constant defining the relationship between two geometries( A geometry and B geometry).
static int GEOGRAPHYMAP_TYPE_SHPFILE
          Constant for defining a geographical map object's type.It specifies shape files will be used as the data source of the map object.
static int GEOGRAPHYMAP_TYPE_TILE
          Constant for defining a geographical map object's type.It specifies some GIS servers will be used as the data source of the map object.
static int GROUNDING_STYLE_DEFAULT
          Constant which defines the style of painting the grounding of the map.
static int GROUNDING_STYLE_GRADIENT_HORIZONTAL
          Constant which defines the style of painting the grounding of the map.
static int GROUNDING_STYLE_GRADIENT_ROUND
          Constant which defines the style of painting the grounding of the map.
static int GROUNDING_STYLE_GRADIENT_VERTICAL
          Constant which defines the style of painting the grounding of the map.
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.
static int UNIT_CENTIMETER
           
static int UNIT_FEET
           
static int UNIT_KILOMETER
           
static int UNIT_METER
           
static int UNIT_MILE
           
 
Method Summary
 void addBackAndForwardTask()
          Adds a task to the redo/undo queue of the map object.
 void addGridLayer()
          Adds the grid layer to the map with the default settings.
 void addGridLayer(int gridCount, java.awt.Color gridColor)
          Adds the grid layer and specifies the grid density and color used to paint the grid.
 void addLayer(java.lang.String mapPath)
          Adds a geographical layer to the map from the specified path, and @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE will be used as the default executor type.
 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, java.lang.String serverPath)
           
 void addLayer(java.lang.String path, java.lang.String property)
          Adds a geographical layer and specifies which non-geometric property value will be displayed in the map.
 void addLayer(java.net.URL mapPath)
          Adds a geographical layer to the map from the specified path, and @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE will be used as the default executor type.
 void addLayer(java.net.URL mapPath, java.lang.String property)
          Adds a geographical layer and specifies which non-geometric property value will be displayed in 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.
 void addScaleBar()
          Adds scale bar to the map with the default settings.
 void addScaleBar(java.awt.Color scaleBarColor, java.awt.Font scaleBarFont)
          Adds the scale bar to the map with specified color and font.
 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
 void drawMap(java.awt.Graphics2D g, java.awt.Rectangle viewport)
          Deprecated.  
 void drawMap(java.awt.Graphics2D g, java.awt.Rectangle viewport, int tileWidth, int tileHeight, int tileRow, int tileCol, java.awt.geom.Rectangle2D window)
          Paints the specified area of the map on the specified view port.
 void drawMap(java.awt.Graphics2D g2d, java.awt.Rectangle viewport, java.awt.geom.Rectangle2D window)
          Deprecated.  
 void drawOverview(java.awt.Graphics2D g, java.awt.Rectangle viewport, java.awt.geom.Rectangle2D window)
          Draws the overview of the map.
 void drawSelected(java.awt.Graphics2D g)
          Draws the selected context of the map with the specified Graphics2D object
 java.lang.Object[] getAllLayerNames()
          Gets the names of all the layers stored in the map.
 GeoCoordinate getCenterPoint()
          Gets the center point of the map, and the point is described by a GeoCoordinate instance.
 int getCroundingStyle()
          Gets the style uesed to paint the grounding of the map.
 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.image.BufferedImage getFullImage(java.awt.Dimension viewportSize)
          Gets a image on which the context of the whole map is drawn referring to the specified projection range.
 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.
 java.net.URL getLayerPath(java.lang.String layerName)
          Gets the URL of a layer according to the specified layer name.
 java.util.Vector getLayerPaths()
          Gets all URLs of all the layers.
 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 bound.
 double getMapLatitude(double y)
          Converts Y coordinate of the screen to latitude referring to map's projection.
 double getMapLongitude(double x)
          Converts X coordinate of the screen to longitude referring to the map's geographic information.
 int getMapMode()
          Gets the operation mode of the map.
 int getMapType()
          Gets the type of the map object.
 java.awt.Dimension getOverviewDimesion()
          Gets the predefined dimension of the overview panel.
 int getQueryLayerIndex()
          Gets the index of the query layer.
 java.awt.image.BufferedImage getRasterData()
          Gets the raster data of the map.
 int getScale()
          Gets the denominator of the map's scale.
 GeographyFeature[] getSelectedFeatures()
          Gets all selected GeographyFeatures
 java.awt.geom.Rectangle2D getSelectedFeaturesArea()
          Gets the area which is covered by the selected features.
 java.util.Map getSelectedFeaturesAttributes()
          Gets the attributes of all 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.
 int getThresholdLevel()
          Gets the threshold level of the map according to the current scale denominator of the map.
 int getThresholdLevel(int scale)
          Gets the threshold level according to the specified scale denominator
 int getThresholdsNum()
          Gets the number of the defined thresholds.
 java.awt.Rectangle getViewport()
          Gets the projection range.
 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 getX(double longitude)
          Converts longitude to X coordinate of the screen referring to map's projection.
 double[] getXY(double longitude, double latitude)
          Gets the screen coordinate of the point which is described by geographical coordinate.
 double getY(double latitude)
          Converts latitude to Y coordinate of the screen referring to map's projection.
 int getZoom()
          Gets current zoom of the map object.
 int getZoomLoLimit()
          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 isGridLayerVisible()
          Determines whether the grid layer is visible.
 boolean isScaleBarVisible()
          Determines whether the scale bar is visible on the map.
 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 registerThresholds(int level, int mapScaleThreshold)
          Registers the thresholds to synchronize the element's size with the scale of the geographical map.
 void removeAllLayers()
          Removes all layers stored in the map.
 void removeGridLayer()
          Removes the grid layer from 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 removeScaleBar()
          Removes the scale bar from the map.
 void reset()
          Resets the window of the map.
 java.awt.geom.Rectangle2D reviseWholeMap(java.awt.Rectangle viewport)
          Revises the window which can cover the whole map referring to the specified projection area.
 void reviseWindow()
          Revises current window.
 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, int filterType)
          Selects features according to the relationships between their geometries and a 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 setAnchors(java.util.Vector anchors)
          Sets the anchors of the raster data.
 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(GeoCoordinate center)
          Specifies the center point of the map.
 void setGroundingColor(java.awt.Color color)
          Sets the grounding color of the map.
 void setGroundingStyle(int style)
          Defines the style used to painting the grounding of the map.
 void setLayerComplexStyle(java.lang.String layerName, java.awt.Color strokeColor, java.awt.Color fillColor, double width, double alpha, boolean needText, java.awt.Font font, java.awt.Color fontColor, boolean withHalo, java.awt.Color haloColor, java.lang.String property)
          Sets the style of the specified layer by the layer name.
 void setLayerComplexStyle(java.lang.String layerName, java.awt.Color strokeColor, java.awt.Color fillColor, double width, double alpha, boolean needText, java.awt.Font font, java.awt.Color fontColor, java.lang.String property)
          Sets the style of the specified layer by the layer name.
 void setMapMode(int value)
          Sets the operation mode of the map.
 void setOverviewDimension(java.awt.Dimension overview)
          Defines the dimension of the overview panel.
 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 setSelectedFeaturesStyle(java.awt.Color strokeColor, java.awt.Color fillColor)
          Specifies the style of all the selected features.
 void setSelectedFeaturesStyle(java.awt.Color strokeColor, java.awt.Color fillColor, double width, double alpha)
          Sets the geometric style used to paint the selected features.
 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.
 void setWindowByScreen(java.awt.geom.Rectangle2D rect)
          Defines the window on the map with the specified Rectangle2D in screen coordinates.
 void setZoom(int zoom)
          Sets the zoom of the map object.
 void setZoomLoLimit(int lolimit)
          Sets the lower limit of the map's zoom.
 void setZoomUpLimint(int uplimit)
          Sets the upper limit of the map's zoom.
 void stopRendering()
          Stops rendering the map.
 

Field Detail

GEOGRAPHYMAP_TYPE_SHPFILE

public static final int GEOGRAPHYMAP_TYPE_SHPFILE
Constant for defining a geographical map object's type.It specifies shape files will be used as the data source of the map object.

See Also:
Constant Field Values

GEOGRAPHYMAP_TYPE_TILE

public static final int GEOGRAPHYMAP_TYPE_TILE
Constant for defining a geographical map object's type.It specifies some GIS servers will be used as the data source of the map object.

See Also:
Constant Field Values

IMAGELAYER_INDEX

public static final int IMAGELAYER_INDEX
See Also:
Constant Field Values

LAYERMOVE_TYPE_UP

public static final int LAYERMOVE_TYPE_UP
Constant for moving a layer. It specifies a geography layer will be moved upward .

See Also:
moveLayer(java.lang.String, int), Constant Field Values

LAYERMOVE_TYPE_DOWN

public static final int LAYERMOVE_TYPE_DOWN
Constant for moving a layer. It specifies a geography layer will be moved downward .

See Also:
moveLayer(java.lang.String, int), Constant Field Values

LAYERMOVE_TYPE_TOTOP

public static final int LAYERMOVE_TYPE_TOTOP
Constant for moving a layer. It specifies a geography layer will be moved to the top of the map .

See Also:
moveLayer(java.lang.String, int), Constant Field Values

LAYERMOVE_TYPE_TOBOTTOM

public static final int LAYERMOVE_TYPE_TOBOTTOM
Constant for moving a layer. It specifies a geography layer will be moved to the bottom of the map .

See Also:
moveLayer(java.lang.String, int), Constant Field Values

MAPMODE_DEFAULT

public static final int MAPMODE_DEFAULT
Constant which defines how to operate the map. It specifies no operation on map.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_ZOOMIN

public static final int MAPMODE_ZOOMIN
Constant which defines how to operate the map. It specifies the operation to zoom in.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_ZOOMOUT

public static final int MAPMODE_ZOOMOUT
Constant which defines how to operate the map. It specifies the operation to zoom out.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_ZOOMRESET

public static final int MAPMODE_ZOOMRESET
Constant which defines how to operate the map. It specifies reset operation .

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_PAN

public static final int MAPMODE_PAN
Constant which defines how to operate the map. It specifies pan operation.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_SELECT

public static final int MAPMODE_SELECT
Constant which defines how to operate the map. It specifies selection operation to the specified coordinates.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_DISTANCE

public static final int MAPMODE_DISTANCE
Constant which defines how to operate the map. It specifies the operation to measure the distance.

See Also:
Constant Field Values

MAPMODE_AREA_WITHIN_SELECT

public static final int MAPMODE_AREA_WITHIN_SELECT
Constant which defines how to operate the map. It specifies the operation to select the features which is in the specified area.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_AREA_DWITHIN_SELECT

public static final int MAPMODE_AREA_DWITHIN_SELECT
Constant which defines how to operate the map. It specifies the operation to select the features which is cross the specified area.

See Also:
getMapMode(), setMapMode(int), Constant Field Values

MAPMODE_ZOOMIN_BYSCALE

public static final int MAPMODE_ZOOMIN_BYSCALE
See Also:
Constant Field Values

FILTER_WITHIN

public static final int FILTER_WITHIN
Constant defining the relationship between two geometries( A geometry and B geometry). This constant defines the relationship that B contains A.

See Also:
selectFeatures(Rectangle2D, int), Constant Field Values

FILRER_DWITHIN

public static final int FILRER_DWITHIN
Constant defining the relationship between two geometries( A geometry and B geometry). This constant defines the relationship that A intersects B.

See Also:
selectFeatures(Rectangle2D, int), Constant Field Values

GROUNDING_STYLE_DEFAULT

public static final int GROUNDING_STYLE_DEFAULT
Constant which defines the style of painting the grounding of the map. It defines that there is no special style is set, and the grounding will be used to fill the view port area without any special effect.

See Also:
setGroundingStyle(int), Constant Field Values

GROUNDING_STYLE_GRADIENT_HORIZONTAL

public static final int GROUNDING_STYLE_GRADIENT_HORIZONTAL
Constant which defines the style of painting the grounding of the map. It defines that when the grounding is used to fill the view port area, there will be horizontal gradient effect.

See Also:
setGroundingStyle(int), Constant Field Values

GROUNDING_STYLE_GRADIENT_VERTICAL

public static final int GROUNDING_STYLE_GRADIENT_VERTICAL
Constant which defines the style of painting the grounding of the map. It defines that when the grounding is used to fill the view port area, there will be vertical gradient effect.

See Also:
setGroundingStyle(int), Constant Field Values

GROUNDING_STYLE_GRADIENT_ROUND

public static final int GROUNDING_STYLE_GRADIENT_ROUND
Constant which defines the style of painting the grounding of the map. It defines that when the grounding is used to fill the view port area, there will be round gradient effect.

See Also:
setGroundingStyle(int), Constant Field Values

UNIT_METER

public static final int UNIT_METER
See Also:
Constant Field Values

UNIT_CENTIMETER

public static final int UNIT_CENTIMETER
See Also:
Constant Field Values

UNIT_KILOMETER

public static final int UNIT_KILOMETER
See Also:
Constant Field Values

UNIT_FEET

public static final int UNIT_FEET
See Also:
Constant Field Values

UNIT_MILE

public static final int UNIT_MILE
See Also:
Constant Field Values
Method Detail

setGroundingColor

public void setGroundingColor(java.awt.Color color)
Sets the grounding color of the map.

Parameters:
color - the grounding color.

getGroundingColor

public java.awt.Color getGroundingColor()
Gets the grounding color of the map

Returns:
the grounding color.

setGroundingStyle

public void setGroundingStyle(int style)
Defines the style used to painting the grounding of the map.

Parameters:
style - the specified style.

You have the following choices:

See Also:
GROUNDING_STYLE_DEFAULT, GROUNDING_STYLE_GRADIENT_HORIZONTAL, GROUNDING_STYLE_GRADIENT_VERTICAL, GROUNDING_STYLE_GRADIENT_ROUND

getCroundingStyle

public int getCroundingStyle()
Gets the style uesed to paint the grounding of the map.

Returns:
the style used to paint the grounding of the map.

getMapMode

public int getMapMode()
Gets the operation mode of the map.

Returns:
the operation mode. The value will be one of the following choices:
See Also:
MAPMODE_DEFAULT, MAPMODE_ZOOMIN, MAPMODE_ZOOMOUT, MAPMODE_ZOOMOUT, MAPMODE_PAN, MAPMODE_SELECT, MAPMODE_DISTANCE, MAPMODE_AREA_WITHIN_SELECT, MAPMODE_AREA_DWITHIN_SELECT

setMapMode

public void setMapMode(int value)
Sets the operation mode of the map.

Parameters:
value - defines the operation mode. You must specify one of the following choices:
See Also:
MAPMODE_DEFAULT, MAPMODE_ZOOMIN, MAPMODE_ZOOMOUT, MAPMODE_ZOOMOUT, MAPMODE_PAN, MAPMODE_SELECT, MAPMODE_DISTANCE, MAPMODE_AREA_WITHIN_SELECT, MAPMODE_AREA_DWITHIN_SELECT

addMapListener

public void addMapListener(MapListener listener)
Adds the specified MapChangedListener to the listener list.

Parameters:
listener - the specified MapChangedListener

removeMapListener

public void removeMapListener(MapListener listener)
Removes the specified MapChangedListener from the listener list.

Parameters:
listener - the specified MapChangedListener

addMapLayerListeren

public void addMapLayerListeren(MapLayerListener listener)
Adds the specified MapLayerListener to the listener list.

Parameters:
listener - the specified MapLayerListener

removeMapLayerListener

public void removeMapLayerListener(MapLayerListener listener)
Removes the specified MapLayerListener from the listener list.

Parameters:
listener - the specified MapLayerListener

isVisible

public boolean isVisible(java.lang.String layerName)
Determines whether the specified layer in the map is visible.

Parameters:
layerName - the name of the specified layer.
Returns:
true if the layer is visible, false otherwise

reset

public void reset()
Resets the window of the map. Projects the whole map to the specified rectangle area.


getMapLongitude

public double getMapLongitude(double x)
Converts X coordinate of the screen to longitude referring to the map's geographic information.

Parameters:
x - the specified X coordinate on the screen
Returns:
the correct longitude.
See Also:
GisToolkits.convertScreenToLatLong(GeographyMap, double, double)

getMapLatitude

public double getMapLatitude(double y)
Converts Y coordinate of the screen to latitude referring to map's projection.

Parameters:
y - the specified Y coordinate on the screen
Returns:
the correct latitude
See Also:
GisToolkits.convertScreenToLatLong(GeographyMap, double, double)

getX

public double getX(double longitude)
Converts longitude to X coordinate of the screen referring to map's projection.

Parameters:
longitude - the specified longitude
Returns:
the correct X coordinate
See Also:
GisToolkits.convertLatLongToScreen(GeographyMap, GeoCoordinate)

getY

public double getY(double latitude)
Converts latitude to Y coordinate of the screen referring to map's projection.

Parameters:
latitude - the specified latitude
Returns:
the correct Y coordinate
See Also:
GisToolkits.convertLatLongToScreen(GeographyMap, GeoCoordinate)

moveLayer

public void moveLayer(java.lang.String layerName,
                      int layerMovedType)
Moves the specified geography layer upward or downward.

Parameters:
layerName - the name of the layer which will be moved
layerMovedType - the type which specifies how to move the specified layer. You must specify one of the following choices:
See Also:
LAYERMOVE_TYPE_UP, LAYERMOVE_TYPE_DOWN, LAYERMOVE_TYPE_TOTOP, LAYERMOVE_TYPE_TOBOTTOM

getMapArea

public java.awt.geom.Rectangle2D getMapArea()
Gets the whole map's bound.

Returns:
the map's bound. You can get the min coordinates by invoking getMinX() and getMinY(). You can get the max coordinates by invoking getMaxX() and getMaxY(). The coordinates is latitude and longitude coordinates. For example: Rectangle2D area = map.getMapArea(); System.out.println("the min coordinate is "+area.getMinX()+","+area.getMinY()); the result will be like: the min coordinate is 110.3234,22.4343

addLayer

public void addLayer(java.lang.String layerName,
                     int executorType)
Adds a geographical layer to the map by specifying corresponding executor type.

Parameters:
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.
See Also:
Executor.EXECUTOR_TYPE_SHAPEFILE, Executor.EXECUTOR_TYPE_GEOSERVER_WMS, Executor.EXECUTOR_TYPE_GEOSERVER_CACHE

addLayer

public void addLayer(java.lang.String layerName,
                     int executorType,
                     java.lang.String serverPath)

addLayer

public void addLayer(java.lang.String mapPath)
              throws java.io.IOException
Adds a geographical layer to the map from the specified path, and @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE will be used as the default executor type.

Parameters:
mapPath - the specified path.
Throws:
java.lang.Exception
java.io.IOException

addLayer

public void addLayer(java.net.URL mapPath)
              throws java.io.IOException
Adds a geographical layer to the map from the specified path, and @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE will be used as the default executor type.

Parameters:
mapPath - the specified path
Throws:
java.io.IOException

reviseWholeMap

public java.awt.geom.Rectangle2D reviseWholeMap(java.awt.Rectangle viewport)
Revises the window which can cover the whole map referring to the specified projection area.

Parameters:
viewport - the specified projection area
Returns:
the revised window

addLayer

public void addLayer(java.lang.String path,
                     java.lang.String property)
              throws java.io.IOException
Adds a geographical layer and specifies which non-geometric property value will be displayed in the map. At the same time, @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE is used as the default executor type.

Parameters:
path - the specified path of the layer.
property - the specified non-geometric property name
Throws:
java.io.IOException

addLayer

public void addLayer(java.net.URL mapPath,
                     java.lang.String property)
              throws java.io.IOException
Adds a geographical layer and specifies which non-geometric property value will be displayed in the map. At the same time, @see twaver.gis.tiles.Executor#EXECUTOR_TYPE_SHAPEFILE is used as the default executor type.

Parameters:
mapPath - the specified path of the layer
property - the specified non-geometric property name
Throws:
java.io.IOException

getLayer

public GeographyLayer getLayer(int index)
Gets a GeographyLayer object in the map with the specified index.

Parameters:
index - the specified index
Returns:
the relative GeographyLayer object.Null means there is no layer object at the specified location.

getLayerIndex

public int getLayerIndex(java.lang.String layerName)
Gets a layer's index by the specified layer name.

Parameters:
layerName - the specified layer name
Returns:
the correct index of the layer

getLayer

public GeographyLayer getLayer(java.lang.String layerName)
Gets a GeographyLayer object by the specified layer name.

Parameters:
layerName - the specified layer name
Returns:
a GeographyLayer object if there is a layer which has the specified name, null otherwise

getLayerCount

public int getLayerCount()
Gets the count of the layers stored in the map.

Returns:
the count of the layers.

getAllLayerNames

public java.lang.Object[] getAllLayerNames()
Gets the names of all the layers stored in the map.

Returns:
a String array storing the names.

setQueryLayer

public void setQueryLayer(int index)
Defines which layer is the query layer by the specified index.

Parameters:
index - the specified index.

setQueryLayer

public void setQueryLayer(java.lang.String layerName)
Defines which layer is the query layer by the specified layerName.

Parameters:
layerName - the specified layer name.

isVisible

public boolean isVisible(int index)
Determines whether the layer specified by the index is visible.

Parameters:
index - the specified index
Returns:
true if the layer is visible, false otherwise

setWindow

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

Parameters:
minLongitude - the minimal longitude
minLatitude - the minimal latitude
maxLongitude - the max longitude
maxLatitude - the max latitude

setWindowByScreen

public void setWindowByScreen(java.awt.geom.Rectangle2D rect)
Defines the window on the map with the specified Rectangle2D in screen coordinates.

Parameters:
rect - the specified Rectangle2D

getWindow

public java.awt.geom.Rectangle2D getWindow()
Gets the window of the map.

Returns:
a Rectangle2D object storing the window information if a window is set, null otherwise

getWindowMinx

public double getWindowMinx()
Gets the minimal longitude of the map's window.

Returns:
the minimal longitude of the window

getWindowMiny

public double getWindowMiny()
Gets the minimal latitude of the map's window.

Returns:
the minimal latitude

getWindowMaxx

public double getWindowMaxx()
Gets the max longitude of the map's window.

Returns:
the max longitude of the window

getWindowMaxy

public double getWindowMaxy()
Gets the max latitude of the map's window.

Returns:
the max latitude

setViewport

public void setViewport(java.awt.Rectangle viewportRect)
Sets the projection range.

Parameters:
viewportRect - the projection range

getViewport

public java.awt.Rectangle getViewport()
Gets the projection range.

Returns:
the view port described by screen coordinates.

drawMap

public void drawMap(java.awt.Graphics2D g)
Draws the context in the window of the map to something with the specified Graphics2D object

Parameters:
g - the specified Graphics2D object

drawMap

public void drawMap(java.awt.image.BufferedImage bufferImage)

drawMap

public void drawMap(java.awt.Graphics2D g,
                    java.awt.Rectangle viewport)
Deprecated.  

Paints the window area of map on the view port area.

Parameters:
g - the specified Graphics2D object to paint the map
viewport - the target view port

drawMap

public void drawMap(java.awt.Graphics2D g2d,
                    java.awt.Rectangle viewport,
                    java.awt.geom.Rectangle2D window)
Deprecated.  

Parameters:
g2d -
viewport -
window -

getFullImage

public java.awt.image.BufferedImage getFullImage(java.awt.Dimension viewportSize)
Gets a image on which the context of the whole map is drawn referring to the specified projection range.

Parameters:
viewportSize - the specified projection range
Returns:
a BufferedIamge object.

setOverviewDimension

public void setOverviewDimension(java.awt.Dimension overview)
Defines the dimension of the overview panel.

If you want to display the whole map on an overview panel, you should set the dimension with this method.

Parameters:
overview - the dimension of the overview panel.

getOverviewDimesion

public java.awt.Dimension getOverviewDimesion()
Gets the predefined dimension of the overview panel.

Returns:
a Dimension object.

getSelectedFeatures

public GeographyFeature[] getSelectedFeatures()
Gets all selected GeographyFeatures

Returns:
an array filled with selected features .

getSelectedFeaturesArea

public java.awt.geom.Rectangle2D getSelectedFeaturesArea()
Gets the area which is covered by the selected features.

Returns:
the area which is covered by the selected features. The area is described by geographical coordinates.

selectFeatures

public void selectFeatures(java.lang.String attributeName,
                           int operator,
                           java.lang.Object value)
Selects the features on the query layer by the specified attribute value.

Parameters:
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".
See Also:
TWaverGisConst.OPERATOR_LESSOREQUAL, TWaverGisConst.OPERATOR_LESS, TWaverGisConst.OPERATOR_GREATER, TWaverGisConst.OPERATOR_GREATEROREQUAL, TWaverGisConst.OPERATOR_EQUAL

selectFeatures

public void selectFeatures(double x,
                           double y)
Selects the feature on the query layer by the specified point described by X and Y coordinates.

Parameters:
x - the X coordinate on the screen
y - the Y coordinate on the screen

selectFeatures

public void selectFeatures(java.awt.geom.Rectangle2D area,
                           int filterType)
Selects features according to the relationships between their geometries and a specified rectangle.

Parameters:
area - the screen area, in which you want to select features
filterType - the specified filter type. You have the following choices:
See Also:
FILTER_WITHIN, FILRER_DWITHIN

setLayerComplexStyle

public void setLayerComplexStyle(java.lang.String layerName,
                                 java.awt.Color strokeColor,
                                 java.awt.Color fillColor,
                                 double width,
                                 double alpha,
                                 boolean needText,
                                 java.awt.Font font,
                                 java.awt.Color fontColor,
                                 java.lang.String property)
Sets the style of the specified layer by the layer name. The style is described by stroke color, fill color, width, alpha, the flag defining if the label is shown ,label's font, label's font color, and the name of the non-geometric property which should be displayed by label in the map. At the same time, the label will be displayed without any halo.

Parameters:
layerName - the specified layer name.
strokeColor - the color of the stroke used to paint.
fillColor - the color used to fill the layer.
width - the width of the stroke.
alpha - the alpha used to paint the layer.
needText - the flag defining if the label will be displayed.
font - the label's font if needText is true.
fontColor - the color of the label font if needText is true.
property - the name of the property which should be displayed by label.

setLayerComplexStyle

public void setLayerComplexStyle(java.lang.String layerName,
                                 java.awt.Color strokeColor,
                                 java.awt.Color fillColor,
                                 double width,
                                 double alpha,
                                 boolean needText,
                                 java.awt.Font font,
                                 java.awt.Color fontColor,
                                 boolean withHalo,
                                 java.awt.Color haloColor,
                                 java.lang.String property)
Sets the style of the specified layer by the layer name. The style is described by stroke color, fill color, width, alpha, the flag defining if the label is shown ,label's font, label's font color, the color of label's halo, and the name of the non-geometric property which should be displayed by label in the map.

Parameters:
layerName - the specified layer name.
strokeColor - the color of the stroke used to paint.
fillColor - the color used to fill the layer.
width - the width of the stroke.
alpha - the alpha used to paint the layer.
needText - the flag defining if the label will be displayed.
font - the label's font if needText is true.
fontColor - the color of the label font if needText is true.
withHalo - defines whether the label has a halo.
haloColor - specifies the color of label's halo.
property - the name of the property which should be displayed by label.

getQueryLayerIndex

public int getQueryLayerIndex()
Gets the index of the query layer.

Returns:
the index of the query layer.

getSelectedFeaturesAttributes

public java.util.Map getSelectedFeaturesAttributes()
Gets the attributes of all selected features.

Returns:
a Map object storing the attributes of all selected features.

setSelectedFeaturesStyle

public void setSelectedFeaturesStyle(java.awt.Color strokeColor,
                                     java.awt.Color fillColor)
Specifies the style of all the selected features.

Parameters:
strokeColor - the color used to draw the selected features
fillColor - the color used to fill the selected features

setSelectedFeaturesStyle

public void setSelectedFeaturesStyle(java.awt.Color strokeColor,
                                     java.awt.Color fillColor,
                                     double width,
                                     double alpha)
Sets the geometric style used to paint the selected features.

Parameters:
strokeColor - the color of the stroke used to paint the selected features.
fillColor - the color used to fill the selected features.
width - the width of the stroke.
alpha - the alpha used to fill the selected features.

getDistance

public double getDistance(double fromLongitude,
                          double fromLatitude,
                          double toLongitude,
                          double toLatitude)
Measures the distance between the two points specified by the given coordinates.

Parameters:
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.
Returns:
the distance between the two points. The default unit is meter. The unit is relative to the CRS.

getDistance

public double getDistance(java.util.ArrayList pointList)
Measures the summation of the distances between the points stored in the specified ArrayList. All the points should be described by latitude and longitude coordinates.

Parameters:
pointList - the specified ArrayList object, which stores the points.
Returns:
the summation of the distances

getScale

public int getScale()
Gets the denominator of the map's scale.

Returns:
the denominator of the scale. For example: If the scale of the map is 1:500000, the result of getScale() will be 500000.

drawSelected

public void drawSelected(java.awt.Graphics2D g)
Draws the selected context of the map with the specified Graphics2D object

Parameters:
g - the specified Graphics2D object.

removeLayer

public void removeLayer(java.lang.String layerName)
Removes a layer specified by the layer name.

Parameters:
layerName - the name of the layer

removeLayer

public void removeLayer(int index)
Removes a layer specified by the index.

Parameters:
index - the specified index.

removeAllLayers

public void removeAllLayers()
Removes all layers stored in the map.


removeLayers

public void removeLayers(java.lang.String[] layerNames)
Removes the layers specified by their names.

Parameters:
layerNames - the specified names , stored in an array.

reviseWindow

public void reviseWindow()
Revises current window.


clearSelection

public void clearSelection()
Clears all features from the selected features collection.


stopRendering

public void stopRendering()
Stops rendering the map.

If you use multithread mechanism to draw a map, in order to synchronize the threads and , you should invoke this method before draw a map.


getSelectedFilledColor

public java.awt.Color getSelectedFilledColor()
Gets the color used to fill the selected features.

Returns:
the color used to fill the selected features

getSelectedStrokeColor

public java.awt.Color getSelectedStrokeColor()
Gets the color used to paint the selected features' bounds.

Returns:
the color used to paint the selected features' bounds

addScaleBar

public void addScaleBar()
Adds scale bar to the map with the default settings.


addScaleBar

public void addScaleBar(java.awt.Color scaleBarColor,
                        java.awt.Font scaleBarFont)
Adds the scale bar to the map with specified color and font.

Parameters:
scaleBarColor - the color used to fill the scale bar
scaleBarFont - the font for the description of the scale bar

removeScaleBar

public void removeScaleBar()
Removes the scale bar from the map.


addGridLayer

public void addGridLayer()
Adds the grid layer to the map with the default settings.


addGridLayer

public void addGridLayer(int gridCount,
                         java.awt.Color gridColor)
Adds the grid layer and specifies the grid density and color used to paint the grid.

Parameters:
gridCount - the grid density to cover the screen.
gridColor - the color used to paint the grid.Default color is white.

removeGridLayer

public void removeGridLayer()
Removes the grid layer from the map.


isScaleBarVisible

public boolean isScaleBarVisible()
Determines whether the scale bar is visible on the map.

Returns:
true if it is visible, false otherwise.

isGridLayerVisible

public boolean isGridLayerVisible()
Determines whether the grid layer is visible.

Returns:
true if it is visible, false otherwise.

getLayerPath

public java.net.URL getLayerPath(java.lang.String layerName)
Gets the URL of a layer according to the specified layer name.

Parameters:
layerName - the layer name
Returns:
the URL of the specified layer

getLayerPaths

public java.util.Vector getLayerPaths()
Gets all URLs of all the layers.

Returns:
all URLs of all the layers

getRasterData

public java.awt.image.BufferedImage getRasterData()
Gets the raster data of the map.

Returns:
the raster data stored in the map.

setAnchors

public void setAnchors(java.util.Vector anchors)
Sets the anchors of the raster data.

Parameters:
anchors - the list of all anchors on the raster data.

drawOverview

public void drawOverview(java.awt.Graphics2D g,
                         java.awt.Rectangle viewport,
                         java.awt.geom.Rectangle2D window)
Draws the overview of the map.

Parameters:
g - the Graphics object used to display the map
viewport - a Rectangle object which is described by screen coordinates in pixels, is used to specify the view port of the map.
window - the window on the map. The Rectangle2D object is described by geographical coordinates in degrees.

drawMap

public void drawMap(java.awt.Graphics2D g,
                    java.awt.Rectangle viewport,
                    int tileWidth,
                    int tileHeight,
                    int tileRow,
                    int tileCol,
                    java.awt.geom.Rectangle2D window)
Paints the specified area of the map on the specified view port.

Parameters:
g - the original Graphics object.
viewport - view port of the target. Defined by a Rectangle object in x and y decimal
tileWidth -
tileHeight -
tileRow -
tileCol -
window -

registerThresholds

public void registerThresholds(int level,
                               int mapScaleThreshold)
Registers the thresholds to synchronize the element's size with the scale of the geographical map.

Parameters:
level - the level of elements' size. If it is set as zero, all the elements should keep their original size. If the level is larger,the elements' size will be smaller.
mapScaleThreshold - the scale of the geographical map. Defines the scale threshold which if the scale reaches, the elements' sizes should be changed at the same time.

getThresholdsNum

public int getThresholdsNum()
Gets the number of the defined thresholds.

Returns:
the number of the defined thresholds.

getThresholdLevel

public int getThresholdLevel()
Gets the threshold level of the map according to the current scale denominator of the map.


getThresholdLevel

public int getThresholdLevel(int scale)
Gets the threshold level according to the specified scale denominator

Parameters:
scale - the specified scale denominator
Returns:
the threshold level corresponding to the specified scale denominator

setBackAndForwardLimit

public void setBackAndForwardLimit(int limit)
Specifies the capability of the map object's redo/undo queue.


setSupportingBackAndForward

public void setSupportingBackAndForward(boolean supportingUndo)
Specifies the if the map can support redo/undo tasks.

Parameters:
supportingUndo -

isSupportingBackAndForward

public boolean isSupportingBackAndForward()
Determines whether the map object supports redo/undo tasks.

Returns:
true if the map object can redo/undo, false otherwise

canGoBack

public boolean canGoBack()
Determines whether the map object can go back right now.

Returns:
true if the map object can go back, false otherwise

canGoForward

public boolean canGoForward()
Determines whether the map object can go forward right now.

Returns:
true if the map object can go forward, false otherwise

goBack

public void goBack()
            throws javax.swing.undo.CannotUndoException
Goes back to the last state of the map object which is stored in the map's redo/undo queue.

Throws:
javax.swing.undo.CannotUndoException

goForward

public void goForward()
               throws javax.swing.undo.CannotUndoException
Goes forward to the next state of the map object which is stored in the map's redo/undo queue.

Throws:
javax.swing.undo.CannotUndoException

addBackAndForwardTask

public void addBackAndForwardTask()
Adds a task to the redo/undo queue of the map object. The task contains the current states of the map, e.g current window, current view port, current center coordinate, etc.


setZoom

public void setZoom(int zoom)
Sets the zoom of the map object. Only when the type of the map is GEOGRAPHYMAP_TYPE_TILE, this method works correctly.

Parameters:
zoom - the specified zoom.

getZoom

public int getZoom()
Gets current zoom of the map object. Only when the type of the map is GEOGRAPHYMAP_TYPE_TILE, this method returns correct value.

Returns:
current zoom of the map.

getMapType

public int getMapType()
Gets the type of the map object.

Returns:
the type of the map
See Also:
GEOGRAPHYMAP_TYPE_SHPFILE, GEOGRAPHYMAP_TYPE_TILE

setCenterPoint

public void setCenterPoint(GeoCoordinate center)
Specifies the center point of the map. This method will pan the specified center coordinate to the center of the screen. Like setZoom(int),getZoom() and etc, only when the map's type is GEOGRAPHYMAP_TYPE_TILE, this method works correctly. The center point should be described by geographical coordinate wrapped by GeoCoordinate class.

Parameters:
center - the center point .

getCenterPoint

public GeoCoordinate getCenterPoint()
Gets the center point of the map, and the point is described by a GeoCoordinate instance.

Returns:
the geographical coordinate of the center point of the map object.

setCenterPoint

public void setCenterPoint(double longitude,
                           double latitude)
Sets the center point of the map. Only when the map's type is GEOGRAPHYMAP_TYPE_TILE, this method works correctly.

Parameters:
longitude - the longitude of the center point of the map.
latitude - the latitude of the center point of the map.

getLL

public double[] getLL(double x,
                      double y)
Gets the geographical coordinate of a specified screen point which is described by x-y axes. Only when the map's type is GEOGRAPHYMAP_TYPE_TILE, this method works correctly.

Parameters:
x - the x value of the specified screen point
y - the y value of the specified screen point
Returns:
the geographical coordinate of the specified screen point.
See Also:
GisToolkits.convertScreenToLatLong(GeographyMap, double, double)

getXY

public double[] getXY(double longitude,
                      double latitude)
Gets the screen coordinate of the point which is described by geographical coordinate. Only when the map's type is GEOGRAPHYMAP_TYPE_TILE, this method works correctly.

Parameters:
longitude - the longitude of the specified point.
latitude - the latitude of the specified point.
Returns:
null, if TWaver can not covert the point correctly; an array containing 2 double values otherwise. The first value represents x value, and the second value represents y value.
See Also:
GisToolkits.convertLatLongToScreen(GeographyMap, double, double)

addPanActionFilter

public void addPanActionFilter(PanActionFilter filter)
Adds a PanActionFilter instance to the map.

Parameters:
filter - a PanActionFilter instance

canPan

public boolean canPan()
Determines if the map can be panned.

Returns:
true, if the map can be panned, false otherwise.

setZoomUpLimint

public void setZoomUpLimint(int uplimit)
Sets the upper limit of the map's zoom.

Parameters:
uplimit - the specified upper limit of the map's zoom.

setZoomLoLimit

public void setZoomLoLimit(int lolimit)
Sets the lower limit of the map's zoom.

Parameters:
lolimit - the specified lower limit of the map's zoom.

getZoomUpLimit

public int getZoomUpLimit()
Gets the upper limit of the map's zoom.

Returns:
the upper limit of the map's zoom.

getZoomLoLimit

public int getZoomLoLimit()
Gets the lower limit of the map's zoom.

Returns:
the lower limit of the map's zoom.