com.moximedia.ows.wms
Class WmsService

java.lang.Object
  extended bycom.moximedia.ows.wms.WmsService
All Implemented Interfaces:
java.lang.Cloneable, LayerType, java.io.Serializable, Service, ServiceType

public class WmsService
extends java.lang.Object
implements Service, ServiceType, LayerType, java.lang.Cloneable, java.io.Serializable

Implementation of a WMS service.

Author:
Doug Cates - www.moximedia.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.moximedia.ows.types.ServiceType
SERVICE_TYPE_ACETATE, SERVICE_TYPE_WFS, SERVICE_TYPE_WMS
 
Fields inherited from interface com.moximedia.ows.types.LayerType
LAYER_TYPE_ACETATE, LAYER_TYPE_WFS, LAYER_TYPE_WMS
 
Constructor Summary
WmsService()
          Creates a new WmsService object
 
Method Summary
 java.lang.String getAuthenticationId()
          Gets the authentication ID or keyword that specifies authentication parameters.
 java.lang.String getFeatureInfo(Map map, Layers lyrs, int x, int y, int maxResults)
          Creates the URL used for the WMS GetFeature request for this service for multiple layers.
 java.lang.String getFeatureInfo(Map map, WmsLayer lyr, int x, int y, int maxResults)
          Creates the URL used for the WMS GetFeature request for this service for a single layer.
 java.lang.String getForwardedImage(Map map, java.lang.String imageUrl)
          Makes a local copy of a remote image and returns a URL to it.
 java.lang.String getGetCapabilitiesUrl()
          Gets the capabilities URL if one is specified.
 java.lang.String getGetFeatureInfoExceptionFormat()
          Gets the GetFeatureInfo exception format.
 java.lang.String getGetFeatureInfoFormat()
          Gets the GetFeatureInfo request format.
 java.lang.String getGetFeatureInfoParsingFormat()
          Gets the name of the class used for parsing the GetFeatureInfo response for this service.
 java.lang.String getGetFeatureInfoRequest()
          Gets the last GetFeatureInfo request made to this service.
 java.lang.String getGetFeatureInfoResponse()
          Gets the last GetFeatureInfo response received from this service.
 java.lang.String getGetFeatureInfoUrl()
          Gets the base URL used for the WMS GetFeatureInfo requests.
 java.lang.String getGetMapExceptionFormat()
          Gets the exception format used in GetMap requests.
 java.lang.String getGetMapFormat()
          Gets the format used in GetMap requests, like image/png.
 java.lang.String getGetMapRequest()
          Gets the last GetMap request sent to this service.
 java.lang.String getGetMapUrl()
          Gets the base URL used for the WMS GetMap requests.
 boolean getIsPortalService()
          Returns an indicator of whether the service is one that has been added by the wms portal routine.
 boolean getIsUploadService()
          Returns an indicator of whether the service is one that has been added by the user using an upload routines.
 boolean getIsUserAddedService()
          Returns an indicator of whether the service is one that has been added by the user using an upload routine or the wms portal routines.
 Layers getLayers()
          Gets the layers in this service.
 java.lang.String getMap(Map map, boolean transparent)
          Creates the URL used for the WMS GetMap request for this service.
 java.lang.String getMap(Map map, Layers layers, boolean transparent)
          Creates the URL used for the WMS GetMap request for this service.
 java.lang.String getMap(Map map, Layers layers, int width, int height, Envelope extent, java.lang.String srs, boolean transparent)
          Creates the URL used for the WMS GetMap request for this service.
 java.lang.String getName()
          Get the name of this service.
 int getObjectId()
          Gets the IMF assigned object id for this service.
 java.awt.image.BufferedImage getProjectedImage(Map map, Layers layers, boolean transparent)
          Creates a projected image for the specified layers in this service.
 Projection getProjection()
          Gets the projection of this service.
 int getServiceType()
          Gets the service type of this service.
 java.lang.String getSld()
          Gets the URL of the service's styled layer descriptor SLD or null if there isn't one.
 java.lang.String getSrs()
          Gets the SRS code for this service.
 boolean getTransparent()
          Returns an indicator of whether the GetMap request asks for a transparent image.
 java.lang.String getVersion()
          Gets the version number used in WMS requests to this service.
 long getVersionNumber()
          Gets the version number as a comparable number.
 long getVersionNumber(java.lang.String versionString)
          Gets the comparable numeric version number associated with a string.
 boolean hasAuthentication()
          Returns an indicator of whether the service uses authentication.
 boolean hasSemiTransparentLayers()
          Returns an indicator of whether the service contains any semi-transparent layers.
 boolean isForwarded()
          Returns an indicator of whether images received from the service are copied and forwarded.
 boolean isQueryable()
          Returns an indicator as to whether the service is queryable, as indicated by the presence of a valid GET-FEATURE-INFO element.
 void query(Map map, Layer lyr, int x, int y)
          Perform a GetFeatureInfo query on one layer in this service.
 void setAuthentication(java.lang.String userpass)
          Sets the username and password.
 void setBackgroundColor(Color color)
          Sets the background color
 void setExtraFeatureInfoRequestParameter(java.lang.String paramName, java.lang.String paramValue)
          Sets an extra vendor specific parameter to add to GetFeatureInfo requests from this WMS service.
 void setExtraMapRequestParameter(java.lang.String paramName, java.lang.String paramValue)
          Sets an extra vendor specific parameter to add to GetMap requests from this WMS service.
 void setForwarded(boolean forwarded)
          Sets the service to be forwarded.
 void setGetFeatureInfoExceptionFormat(java.lang.String format)
          Sets the GetFeatureInfo exception format.
 void setGetFeatureInfoFormat(java.lang.String format)
          Sets the GetFeatureInfo request format.
 void setGetFeatureInfoParsingFormat(java.lang.String format)
          Sets the name of the class used for parsing the GetFeatureInfo response for this service.
 void setGetFeatureInfoUrl(java.lang.String href)
          Sets the base URL used for the WMS GetFeatureInfo requests.
 void setGetMapExceptionFormat(java.lang.String format)
          Sets the exception format used in GetMap requests.
 void setGetMapFormat(java.lang.String format)
          Sets the format used in GetMap requests, like image/png.
 void setGetMapUrl(java.lang.String href)
          Sets the base URL used for the WMS GetMap requests.
 void setIsPortalService(boolean isPortal)
          Sets an indicator of whether the service is one that has been added by the wms portal routines.
 void setIsUploadService(boolean isUpload)
          Sets an indicator of whether the service is one that has been added by the user using an upload routines.
 void setName(java.lang.String name)
          Sets the name of this service.
 void setProjection(Projection prj)
          Sets the service's projection and SRS.
 void setSld(java.lang.String href)
          Sets the service's styled layer descriptor SLD.
 void setSrs(java.lang.String srs)
          Sets the service's srs string.
 void setTransparent(boolean flag)
          Sets whether the GetMap request asks for a transparent image.
 void setVersion(java.lang.String version)
          Sets the version number used in WMS requests to this service.
 void setXmlAttribute(Map map, java.lang.String element, java.lang.String name, java.lang.String value)
          Sets one of the attributes of this object using a string value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WmsService

public WmsService()
Creates a new WmsService object

Method Detail

getIsPortalService

public boolean getIsPortalService()
Returns an indicator of whether the service is one that has been added by the wms portal routine.

Returns:
True if the service has been added, otherwise false.

setIsPortalService

public void setIsPortalService(boolean isPortal)
Sets an indicator of whether the service is one that has been added by the wms portal routines.

Parameters:
isPortal - if the service has been added, otherwise false.

getIsUploadService

public boolean getIsUploadService()
Returns an indicator of whether the service is one that has been added by the user using an upload routines.

Returns:
True if the service has been added, otherwise false.

setIsUploadService

public void setIsUploadService(boolean isUpload)
Sets an indicator of whether the service is one that has been added by the user using an upload routines.

Parameters:
isUpload - if the service has been added, otherwise false.

getIsUserAddedService

public boolean getIsUserAddedService()
Returns an indicator of whether the service is one that has been added by the user using an upload routine or the wms portal routines.

Returns:
True if the service has been added, otherwise false.

hasAuthentication

public boolean hasAuthentication()
Returns an indicator of whether the service uses authentication.

Returns:
True if authentication is used, otherwise false.

getAuthenticationId

public java.lang.String getAuthenticationId()
Gets the authentication ID or keyword that specifies authentication parameters.

Returns:
The authentication id, or null if there isn't one.

setAuthentication

public void setAuthentication(java.lang.String userpass)
Sets the username and password.

Parameters:
userpass - The credentials separated by a colon, user:pass

setBackgroundColor

public void setBackgroundColor(Color color)
Sets the background color


getGetCapabilitiesUrl

public java.lang.String getGetCapabilitiesUrl()
Gets the capabilities URL if one is specified.

Returns:
The URL, or null if there isn't one set.

isForwarded

public boolean isForwarded()
Returns an indicator of whether images received from the service are copied and forwarded. A service is forwarded if explicitly set or if authentication is used.

Specified by:
isForwarded in interface Service
Returns:
True if the service is forwarded, otherwise false.

setForwarded

public void setForwarded(boolean forwarded)
Sets the service to be forwarded. Note that this setting will have no effect if the service needs authentication.

Parameters:
forwarded - True if it should be forwarded, otherwise false.

getGetFeatureInfoExceptionFormat

public java.lang.String getGetFeatureInfoExceptionFormat()
Gets the GetFeatureInfo exception format.

Returns:
The exception format.

setGetFeatureInfoExceptionFormat

public void setGetFeatureInfoExceptionFormat(java.lang.String format)
Sets the GetFeatureInfo exception format.

Parameters:
format - The exception format.

getGetFeatureInfoFormat

public java.lang.String getGetFeatureInfoFormat()
Gets the GetFeatureInfo request format.

Returns:
The GetFeatureInfo request format.

setGetFeatureInfoFormat

public void setGetFeatureInfoFormat(java.lang.String format)
Sets the GetFeatureInfo request format.

Parameters:
format - The GetFeatureInfo request format.

getGetFeatureInfoParsingFormat

public java.lang.String getGetFeatureInfoParsingFormat()
Gets the name of the class used for parsing the GetFeatureInfo response for this service.

Returns:
The name of the parser handler.

setGetFeatureInfoParsingFormat

public void setGetFeatureInfoParsingFormat(java.lang.String format)
Sets the name of the class used for parsing the GetFeatureInfo response for this service.


getGetFeatureInfoRequest

public java.lang.String getGetFeatureInfoRequest()
Gets the last GetFeatureInfo request made to this service.

Returns:
The last GetFeatureInfo request.

getGetFeatureInfoResponse

public java.lang.String getGetFeatureInfoResponse()
Gets the last GetFeatureInfo response received from this service.

Returns:
The last GetFeatureInfo response.

getGetFeatureInfoUrl

public java.lang.String getGetFeatureInfoUrl()
Gets the base URL used for the WMS GetFeatureInfo requests.

Returns:
The base URL.

setGetFeatureInfoUrl

public void setGetFeatureInfoUrl(java.lang.String href)
Sets the base URL used for the WMS GetFeatureInfo requests.

Parameters:
href - The base URL.

getGetMapExceptionFormat

public java.lang.String getGetMapExceptionFormat()
Gets the exception format used in GetMap requests.

Returns:
The exception format.

setGetMapExceptionFormat

public void setGetMapExceptionFormat(java.lang.String format)
Sets the exception format used in GetMap requests.

Parameters:
format - The exception format.

getGetMapRequest

public java.lang.String getGetMapRequest()
Gets the last GetMap request sent to this service.

Returns:
The last GetMap request.

getGetMapFormat

public java.lang.String getGetMapFormat()
Gets the format used in GetMap requests, like image/png.

Returns:
The request format.

setGetMapFormat

public void setGetMapFormat(java.lang.String format)
Sets the format used in GetMap requests, like image/png.

Parameters:
format - The request format.

getGetMapUrl

public java.lang.String getGetMapUrl()
Gets the base URL used for the WMS GetMap requests.

Returns:
The base URL.

setGetMapUrl

public void setGetMapUrl(java.lang.String href)
Sets the base URL used for the WMS GetMap requests.

Parameters:
href - The base URL.

getLayers

public Layers getLayers()
Gets the layers in this service.

Returns:
The layers.

getName

public java.lang.String getName()
Get the name of this service. The name is used to find this service in the map's service array.

Specified by:
getName in interface Service
Returns:
The name of this service.

setName

public void setName(java.lang.String name)
Sets the name of this service. The name is used to find this service in the map's service array.

Parameters:
name - The name of this service.

getObjectId

public int getObjectId()
Gets the IMF assigned object id for this service.

Specified by:
getObjectId in interface Service
Returns:
The object id.

getProjection

public Projection getProjection()
Gets the projection of this service.

Returns:
The projection.

setProjection

public void setProjection(Projection prj)
Sets the service's projection and SRS.

Parameters:
prj - The projection.

getServiceType

public int getServiceType()
Gets the service type of this service.

Specified by:
getServiceType in interface Service
Returns:
Always returns com.moximedia.ows.types.ServiceType.SERVICE_TYPE_WMS

setSld

public void setSld(java.lang.String href)
Sets the service's styled layer descriptor SLD.

Parameters:
href - The URL to the SLD. Set the SLD to null if you don't want to use an SLD.

getSld

public java.lang.String getSld()
Gets the URL of the service's styled layer descriptor SLD or null if there isn't one.

Returns:
The URL to the SLD or null.

getSrs

public java.lang.String getSrs()
Gets the SRS code for this service.

Returns:
The SRS code.

setSrs

public void setSrs(java.lang.String srs)
Sets the service's srs string. Does not set the projection.

Parameters:
srs - The SRS string.

getTransparent

public boolean getTransparent()
Returns an indicator of whether the GetMap request asks for a transparent image.

Returns:
True if the transparent request is true, otherwise false.

setTransparent

public void setTransparent(boolean flag)
Sets whether the GetMap request asks for a transparent image.

Parameters:
flag - True if transparency is requested, otherwise false.

getVersion

public java.lang.String getVersion()
Gets the version number used in WMS requests to this service.

Returns:
The version number, like 1.1.1

setVersion

public void setVersion(java.lang.String version)
Sets the version number used in WMS requests to this service.

Parameters:
version - The version number, like 1.1.1

getVersionNumber

public long getVersionNumber()
Gets the version number as a comparable number. For internal use only to determine what specification to use.

Returns:
The version number.

getVersionNumber

public long getVersionNumber(java.lang.String versionString)
Gets the comparable numeric version number associated with a string.

Parameters:
versionString - The version string.
Returns:
The version number.

query

public void query(Map map,
                  Layer lyr,
                  int x,
                  int y)
Perform a GetFeatureInfo query on one layer in this service.

Parameters:
map - The map containing the service and layer.
lyr - The layer.
x - The x coordinate value in pixels.
y - The y coordinate value in pixels.

isQueryable

public boolean isQueryable()
Returns an indicator as to whether the service is queryable, as indicated by the presence of a valid GET-FEATURE-INFO element.

Returns:
True if the service appears to be queryable, otherwise false.

setXmlAttribute

public void setXmlAttribute(Map map,
                            java.lang.String element,
                            java.lang.String name,
                            java.lang.String value)
Sets one of the attributes of this object using a string value. This method should only be called from the SAX event handler.

Parameters:
map - The map that contains this service.
element - The XML element tag containing this attribute.
name - The XML attribute name.
value - The XML attribute value.

getMap

public java.lang.String getMap(Map map,
                               boolean transparent)
Creates the URL used for the WMS GetMap request for this service.

Parameters:
map - The map containing the service
transparent - True if tranparent otherwise false.
Returns:
The GetMap URL.

getMap

public java.lang.String getMap(Map map,
                               Layers layers,
                               boolean transparent)
Creates the URL used for the WMS GetMap request for this service.

Specified by:
getMap in interface Service
Parameters:
map - The map containing the service
layers - The layers to draw.
transparent - True if tranparent otherwise false.
Returns:
The GetMap URL.

getMap

public java.lang.String getMap(Map map,
                               Layers layers,
                               int width,
                               int height,
                               Envelope extent,
                               java.lang.String srs,
                               boolean transparent)
Creates the URL used for the WMS GetMap request for this service.

Parameters:
map - The map containing the service
layers - The layers to draw.
width - The map width in pixels.
height - The map height in pixels.
extent - The map extent.
srs - The spatial reference system code.
transparent - True if tranparent otherwise false.
Returns:
The GetMap URL.

getFeatureInfo

public java.lang.String getFeatureInfo(Map map,
                                       WmsLayer lyr,
                                       int x,
                                       int y,
                                       int maxResults)
Creates the URL used for the WMS GetFeature request for this service for a single layer.

Parameters:
map - The map containing the service
lyr - The layer to query.
x - The query point x coordinate in pixels.
y - The query point y coordinate in pixels.
maxResults - The maximum number of results to return.
Returns:
The GetFeatureInfo URL.

getFeatureInfo

public java.lang.String getFeatureInfo(Map map,
                                       Layers lyrs,
                                       int x,
                                       int y,
                                       int maxResults)
Creates the URL used for the WMS GetFeature request for this service for multiple layers.

Parameters:
map - The map containing the service
x - The query point x coordinate in pixels.
y - The query point y coordinate in pixels.
maxResults - The maximum number of results to return.
Returns:
The GetFeatureInfo URL.

getForwardedImage

public java.lang.String getForwardedImage(Map map,
                                          java.lang.String imageUrl)
Makes a local copy of a remote image and returns a URL to it.

Parameters:
map - The map used for this service.
imageUrl - The image returned from the GetMap request.
Returns:
The URL to the local copy.

getProjectedImage

public java.awt.image.BufferedImage getProjectedImage(Map map,
                                                      Layers layers,
                                                      boolean transparent)
Creates a projected image for the specified layers in this service.

Parameters:
map - The map used for this service.
layers - The layers to draw.
transparent - True if the map should be transparent, otherwise false.
Returns:
The projected image.

hasSemiTransparentLayers

public boolean hasSemiTransparentLayers()
Returns an indicator of whether the service contains any semi-transparent layers.

Returns:
True if any semi-transparent layers exist, otherwise false.

setExtraFeatureInfoRequestParameter

public void setExtraFeatureInfoRequestParameter(java.lang.String paramName,
                                                java.lang.String paramValue)
Sets an extra vendor specific parameter to add to GetFeatureInfo requests from this WMS service. If the parameter value is set to null, the parameter is removed (not added to the request).

Parameters:
paramName - The parameter name.
paramValue - The parameter value.

setExtraMapRequestParameter

public void setExtraMapRequestParameter(java.lang.String paramName,
                                        java.lang.String paramValue)
Sets an extra vendor specific parameter to add to GetMap requests from this WMS service. If the parameter value is set to null, the parameter is removed (not added to the request).

Parameters:
paramName - The parameter name.
paramValue - The parameter value.


Internet Mapping Framework for OpenGIS Java Object Model API (v1.3.007)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.