com.esri.wms.client
Class Map

java.lang.Object
  extended by com.esri.wms.client.Map
All Implemented Interfaces:
Serializable

public class Map
extends Object
implements Serializable

Connects to an OGC WMS server and represents the WMS map to be displayed.

 ServerConnection server = new ServerConnection("http://server/");
 Map map = new Map(server);
 
 MapURL mapUrl = map.getMapURL(server.getMapFormats().get(0));
 
 String url = mapUrl.getURL();
 System.out.println(url);
 

See Also:
Serialized Form

Constructor Summary
Map(Layer layer, ServerConnection wmsServer)
          Instantiates an object of Map from the given layer and server.
Map(ServerConnection wmsServer)
          Instantiates a object of Map from the given server connection.
 
Method Summary
 void applyLayerFilter(List<String> layers)
          Only the layers in the given list will be enabled.
 List<Layer> getAllLayers()
          Returns all map sub-layers in a list.
 Color getBackgroundColor()
          Gets the background color of the Map.
 SpatialReference getDefaultSpatialReference()
          Gets the default spatial reference for the map rendering.
 Envelope getExtent()
          Gets the extend of current map.
 Envelope getFullExtent()
          Gets the full extent of the Map.
 int getHeight()
          Gets the height of the map.
 Layer getLayer()
          Gets the layer of the Map.
 List<String> getLayerFilter()
          Returns the layers filter which associated with the map.
 String getLayerStyleString()
          Creates the value of the STYLES parameter which is a comma-separated list of one or more valid style names.
 InputStream getMapAsStream(String mime)
          Creates a GetMap request URL based on current map and server settings.
 String getMapLayerString()
          Creates the value of the LAYERS parameter which is a comma-separated list of one or more valid layer names.
 MapURL getMapURL(String mime)
          Creates a GetMap request URL based on current map and server settings.
 List<Layer> getQueryableLayers()
          Creates the value of the QUERY_LAYERS parameter which is a comma-separated list of one or more valid layer names.
 List<SpatialReference> getSpatialReferences()
          Gets the supported spatial references of the Map.
 int getWidth()
          Gets the width of the Map.
 ServerConnection getWmsServer()
          Gets the server to which the map connect.
 Boolean isTransparent()
          Returns true if the map has a transparent background.
 FeatureInfo query(Point point, List<Layer> queryLayers, int count, String format)
          Gets feature information on the given point.
 void setBackgroundColor(Color backgroundColor)
          Sets the background color of the Map.
 void setDefaultSpatialReference(SpatialReference defaultSpatialReference)
          Sets the default spatial reference for the map rendering.
 void setExtent(Envelope extent)
          Sets the extend of the map.
 void setHeight(int height)
          Sets the height of the map.
 void setTransparent(Boolean transparent)
          Sets to true if the map has a transparent background.
 void setWidth(int width)
          Sets the width of the Map.
 Point toMapPoint(Point point)
          Transforms a point from the screen spatial reference system to the map reference system.
 Point toScreenPoint(Point point)
          Transforms a point from the map spatial reference system to the screen reference system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Map

public Map(Layer layer,
           ServerConnection wmsServer)
Instantiates an object of Map from the given layer and server. If the layer has a bounding box, the new map will use the spatial reference of the bounding box as the defaultSpatialReference, otherwise it will take the defaultMapRef on the wmsServer.

Parameters:
layer - the layer to add to the map.
wmsServer - the server connection object.

Map

public Map(ServerConnection wmsServer)
Instantiates a object of Map from the given server connection.

Method Detail

getBackgroundColor

public Color getBackgroundColor()
Gets the background color of the Map.

Returns:
Returns the backgroundColor.

setBackgroundColor

public void setBackgroundColor(Color backgroundColor)
Sets the background color of the Map.

Parameters:
backgroundColor - The backgroundColor to set.

getFullExtent

public Envelope getFullExtent()
Gets the full extent of the Map.

Returns:
Returns the full extent.

getHeight

public int getHeight()
Gets the height of the map.

Returns:
Returns the height.

setHeight

public void setHeight(int height)
Sets the height of the map.

Parameters:
height - The height to set.

getLayer

public Layer getLayer()
Gets the layer of the Map.

Returns:
Returns the layer.

isTransparent

public Boolean isTransparent()
Returns true if the map has a transparent background.

Returns:
Returns true if the map has transparent background.

setTransparent

public void setTransparent(Boolean transparent)
Sets to true if the map has a transparent background.

Parameters:
transparent - Sets to true if the map has a transparent background.

getSpatialReferences

public List<SpatialReference> getSpatialReferences()
Gets the supported spatial references of the Map.

Returns:
Returns the validSpatialReferences.

getWidth

public int getWidth()
Gets the width of the Map.

Returns:
Returns the width.

setWidth

public void setWidth(int width)
Sets the width of the Map.

Parameters:
width - The width to set.

getWmsServer

public ServerConnection getWmsServer()
Gets the server to which the map connect.

Returns:
Returns the wmsServer.

getAllLayers

public List<Layer> getAllLayers()
Returns all map sub-layers in a list.


getMapURL

public MapURL getMapURL(String mime)
Creates a GetMap request URL based on current map and server settings.
 MapURL mapUrl = map.getMapURL(server.getMapFormats().get(0));
 
 String url = mapUrl.getURL();
 System.out.println(url);
 

Parameters:
mime - the format of the return map.

getMapAsStream

public InputStream getMapAsStream(String mime)
                           throws IOException
Creates a GetMap request URL based on current map and server settings. Returns a map image as stream

Parameters:
mime - the format of the return map.
Returns:
Returns the map InputStream.
Throws:
IOException

query

public FeatureInfo query(Point point,
                         List<Layer> queryLayers,
                         int count,
                         String format)
                  throws ServiceException,
                         IOException
Gets feature information on the given point. GetFeatureInfo is an optional operation. It is only supported for those queryable Layers. A client shall not issue a GetFeatureInfo request for other layers.

Parameters:
point - a screen point
queryLayers - the layers to query.
count - Number of features about which to return information (default=1).
format - Return format of feature information (MIME type).
Throws:
ServiceException
IOException

toScreenPoint

public Point toScreenPoint(Point point)
Transforms a point from the map spatial reference system to the screen reference system.

Parameters:
point - the point in map spatial reference system.

toMapPoint

public Point toMapPoint(Point point)
Transforms a point from the screen spatial reference system to the map reference system.

Parameters:
point - the point in screen spatial reference system.

getExtent

public Envelope getExtent()
Gets the extend of current map. The spatial reference of the extent will be used for the map rendering.


setExtent

public void setExtent(Envelope extent)
Sets the extend of the map. The spatial reference of the extent will be used for the map rendering.


getDefaultSpatialReference

public SpatialReference getDefaultSpatialReference()
Gets the default spatial reference for the map rendering.


setDefaultSpatialReference

public void setDefaultSpatialReference(SpatialReference defaultSpatialReference)
Sets the default spatial reference for the map rendering.

Parameters:
defaultSpatialReference -

getMapLayerString

public String getMapLayerString()
Creates the value of the LAYERS parameter which is a comma-separated list of one or more valid layer names.


getLayerStyleString

public String getLayerStyleString()
Creates the value of the STYLES parameter which is a comma-separated list of one or more valid style names.


getQueryableLayers

public List<Layer> getQueryableLayers()
Creates the value of the QUERY_LAYERS parameter which is a comma-separated list of one or more valid layer names.


applyLayerFilter

public void applyLayerFilter(List<String> layers)
Only the layers in the given list will be enabled. If the layer in the list is a group layer, all its children will be enabled.

Parameters:
layers - the layer name list to enable.

getLayerFilter

public List<String> getLayerFilter()
Returns the layers filter which associated with the map.

Returns:
the enabled layer name list.