Class WMSMapProvider
- java.lang.Object
-
- com.supermap.services.providers.WMSMapProvider
-
- All Implemented Interfaces:
- DynamicProjectionable, MapProvider, ProviderContextAware
public class WMSMapProvider extends java.lang.Object implements MapProvider, ProviderContextAware, DynamicProjectionable
WMS service provider.
WMSMapProvider is the type of service provider for accessing WMS service-related functions. Different versions of WMS services have different instantiated WMSMapProvider objects.
WMSMapProvider obtains functions provided by the WMS service through calling methods getCapabilities, getMap, and getFeatureInfo of WMSClient (e.g.,
WMSClient).
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringURL_CHARSETThe url charset.
-
Constructor Summary
Constructors Constructor and Description WMSMapProvider()The default constructor.WMSMapProvider(java.lang.String url, java.lang.String version, java.lang.String userName, java.lang.String password)${services_components_spi_ogc_WMSMapProvider_contructor_WMSMapProvider_Title}WMSMapProvider(java.lang.String url, java.lang.String version, java.lang.String userName, java.lang.String password, boolean cacheEnabled, java.lang.String outputPath, java.lang.String outputSite)Constructs a WMSMapProvider object according to the URL, version, user name, password and cache related settings of the WMS services.
-
Method Summary
Methods Modifier and Type Method and Description voidclearCache(java.lang.String mapName, Rectangle2D bounds)Clears the cached tiles within the specified bounds.QueryResultfindNearest(java.lang.String mapName, Geometry geometry, double maxDistance, QueryParameterSet queryParameterSet)WMS standard does not support this method.MapParametergetDefaultMapParameter(java.lang.String mapName)${services_components_spi_ogc_WMSMapProvider_method_getDefaultMapParameter_Title}java.util.List<PrjCoordSys>getDynamicPrjCoordsyses(java.lang.String mapName)Map supported dynamic projection lists.MapImagegetMapImage(MapParameter pMapParameter, ImageOutputOption outputOption)${services_components_spi_ogc_WMSMapProvider_method_getMapImage_Title}MapParametergetMapParameter(java.lang.String mapName)Gets the map parameters of the specified map.java.util.List<java.lang.String>getNames()Gets all the map names corresponding to the current service provider.OverviewgetOverview(MapParameter mapParameter, ImageOutputOption outputOption)WMSMapProvider currently does not support this method.java.lang.StringgetResource(java.lang.String mapName, ResourceParameter resourceParameter)WMS standard does not support this method.byte[]getResource(java.lang.String mapName, ResourceParameter resourceParameter, Point2D[] points)Gets the resource image of a specified map according to a resource image parameter.VectorStylegetVectorStyle(java.lang.String mapName, java.lang.String[] layerNames, VectorStyleType type)Gets the specified vector layer style in the specified map.MeasureResultmeasureArea(java.lang.String mapName, Point2D[] points, MeasureParameter measureParam)WMS standard does not support this method.MeasureResultmeasureDistance(java.lang.String mapName, Point2D[] points, MeasureParameter measureParam)WMS standard does not support this method.QueryResultqueryByBounds(java.lang.String mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet)Queries the geometries within a specified range on the map.QueryResultqueryByDistance(java.lang.String mapName, Geometry geometry, double distance, QueryParameterSet queryParameterSet)WMS standard does not support this method.QueryResultqueryByGeometry(java.lang.String mapName, Geometry geometry, SpatialQueryMode spatialQueryMode, QueryParameterSet queryParameterSet)Queries geometric objects that satisfy a certain spatial relationship with a specified geometric object and meet query conditions on a specified map.QueryResultqueryBySQL(java.lang.String mapName, QueryParameterSet queryParameterSet)WMS standard does not support this method.MapParametersetDefaultMapParameter(MapParameter mapParameter)WMS standard does not support this method.voidsetProviderContext(ProviderContext context)Sets the service provider context.booleansupport(java.lang.String mapName, MapCapability capability)Determines whether the map supports the specified function.protected Rectangle2DunitConvert(Rectangle2D bounds, Unit oldUnit, Unit newUnit)booleanupdateMap(MapParameter mapParameter)Updates the map status permanently, which will do a persistence in the disk.MapImageviewEntire(java.lang.String layerName, MapParameter mapParameter, ImageOutputOption outputOption)Displays a map in the Full Extent mode according to map layer name, map parameters and image output settings.
-
-
-
Field Detail
-
URL_CHARSET
public static final java.lang.String URL_CHARSET
The url charset. Default is GBK.
-
-
Constructor Detail
-
WMSMapProvider
public WMSMapProvider()
The default constructor.
-
WMSMapProvider
public WMSMapProvider(java.lang.String url, java.lang.String version, java.lang.String userName, java.lang.String password) throws WMSServiceException${services_components_spi_ogc_WMSMapProvider_contructor_WMSMapProvider_Title}
${services_components_spi_ogc_WMSMapProvider_contructor_WMSMapProvider_Description}
- Parameters:
url- ${services_components_spi_ogc_WMSMapProvider_contructor_param_url}version- ${services_components_spi_ogc_WMSMapProvider_contructor_param_version}userName- ${services_components_spi_ogc_WMSMapProvider_contructor_param_userName}password- ${services_components_spi_ogc_WMSMapProvider_contructor_param_password}- Throws:
java.lang.IllegalArgumentException- ${services_components_spi_ogc_WMSMapProvider_contructor_throws_IllegalArgumentException}WMSServiceException
-
WMSMapProvider
public WMSMapProvider(java.lang.String url, java.lang.String version, java.lang.String userName, java.lang.String password, boolean cacheEnabled, java.lang.String outputPath, java.lang.String outputSite) throws WMSServiceExceptionConstructs a WMSMapProvider object according to the URL, version, user name, password and cache related settings of the WMS services.
- Parameters:
url- The URL of the WMS service, can't be null.version- The WMS service version number, e.g., "1.1.1".userName- The user name for accessing the WMS service.password- The password for accessing the WMS service.cacheEnabled- Whether to enable the cache.outputPath- Map images output path.outputSite- The site for publishing map images.- Throws:
WMSServiceException- The illegal argument exception.
This exception is thrown when the url parameter is null or its length is zero.
-
-
Method Detail
-
findNearest
public QueryResult findNearest(java.lang.String mapName, Geometry geometry, double maxDistance, QueryParameterSet queryParameterSet)
WMS standard does not support this method.
Queries the nearest geometric object on a specified map whose distance to a specified geometry is within a certain value.
- Specified by:
findNearestin interfaceMapProvider- Parameters:
mapName- The map name.geometry- The geometric object.maxDistance- The maximum distance.queryParameterSet- Query parameter set.- Returns:
- No return value because this method is not supported currently.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
getDefaultMapParameter
public MapParameter getDefaultMapParameter(java.lang.String mapName)
${services_components_spi_ogc_WMSMapProvider_method_getDefaultMapParameter_Title}
${services_components_spi_ogc_WMSMapProvider_method_getDefaultMapParameter_Description}
- Specified by:
getDefaultMapParameterin interfaceMapProvider- Parameters:
mapName- The map name.- Returns:
- ${services_components_spi_ogc_WMSMapProvider_method_getDefaultMapParameter_return}
-
getMapImage
public MapImage getMapImage(MapParameter pMapParameter, ImageOutputOption outputOption) throws WMSServiceException
${services_components_spi_ogc_WMSMapProvider_method_getMapImage_Title}
${services_components_spi_ogc_WMSMapProvider_method_getMapImage_Description}
- Specified by:
getMapImagein interfaceMapProvider- Parameters:
mapParameter- ${services_components_spi_ogc_WMSMapProvider_method_getMapImage_param_mapParameter}outputOption- ${services_components_spi_ogc_WMSMapProvider_method_getMapImage_param_outputOption}- Returns:
- ${services_components_spi_ogc_WMSMapProvider_method_getMapImage_return}
- Throws:
java.lang.IllegalArgumentException- ${services_components_spi_ogc_WMSMapProvider_method_getMapImage_throws_IllegalArgumentException}WMSServiceException
-
unitConvert
protected Rectangle2D unitConvert(Rectangle2D bounds, Unit oldUnit, Unit newUnit)
-
getMapParameter
public MapParameter getMapParameter(java.lang.String mapName)
Gets the map parameters of the specified map.
- Specified by:
getMapParameterin interfaceMapProvider- Parameters:
mapName- The map name.- Returns:
- Map parameters.
-
getNames
public java.util.List<java.lang.String> getNames()
Gets all the map names corresponding to the current service provider.
- Specified by:
getNamesin interfaceMapProvider- Returns:
- ${services_components_spi_ogc_WMSMapProvider_method_getName_return}
-
getOverview
public Overview getOverview(MapParameter mapParameter, ImageOutputOption outputOption)
WMSMapProvider currently does not support this method.
Gets eagle-eye map according to map parameters and image output settings.
- Specified by:
getOverviewin interfaceMapProvider- Parameters:
mapParameter- Map parameters.outputOption- Image output settings.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
getResource
public java.lang.String getResource(java.lang.String mapName, ResourceParameter resourceParameter)WMS standard does not support this method.
Gets the resource image of a specified map according to a resource image parameter.
- Specified by:
getResourcein interfaceMapProvider- Parameters:
mapName- The map name.resourceParameter- The resource image parameter.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
measureArea
public MeasureResult measureArea(java.lang.String mapName, Point2D[] points, MeasureParameter measureParam)
WMS standard does not support this method.
Measures areas on a specified map based on 2D geographic coordinates and a measuring parameter.
- Specified by:
measureAreain interfaceMapProvider- Parameters:
mapName- The map name.points- The array of 2D geographic coordinates.measureParam- The measuring parameter.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
measureDistance
public MeasureResult measureDistance(java.lang.String mapName, Point2D[] points, MeasureParameter measureParam)
WMS standard does not support this method.
Measures distances on a specified map based on 2D geographic coordinates and a measuring parameter.
- Specified by:
measureDistancein interfaceMapProvider- Parameters:
mapName- The map name.points- The array of 2D geographic coordinates.measureParam- The measuring parameter.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
queryByDistance
public QueryResult queryByDistance(java.lang.String mapName, Geometry geometry, double distance, QueryParameterSet queryParameterSet)
WMS standard does not support this method.
Queries all the geometric objects on a specified map whose distances to a specified geometry are within a certain value.
Which means to query all the geometries within a circle whose center is the specified geometry.
- Specified by:
queryByDistancein interfaceMapProvider- Parameters:
mapName- The map name.geometry- The geometric object.distance- The unit of the distance extent is identical to that of dataset coordinates corresponding to the current map.queryParameterSet- Query parameter set.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
queryByGeometry
public QueryResult queryByGeometry(java.lang.String mapName, Geometry geometry, SpatialQueryMode spatialQueryMode, QueryParameterSet queryParameterSet)
Queries geometric objects that satisfy a certain spatial relationship with a specified geometric object and meet query conditions on a specified map.
- Specified by:
queryByGeometryin interfaceMapProvider- Parameters:
mapName- The map name.geometry- The geometric object, which has spatial information and shape information, but no attribute information.spatialQueryMode- The query mode between the spatial geometry objects.queryParameterSet- Query parameter set.- Returns:
- Query result object.
- Throws:
java.lang.IllegalArgumentException- the illegal argument exception, thrown when one of the following errors occur:
- The parameter geometry is null.
- The parameter queryParameterSet is null.
-
queryByBounds
public QueryResult queryByBounds(java.lang.String mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet)
Queries the geometries within a specified range on the map.
- Specified by:
queryByBoundsin interfaceMapProvider- Parameters:
mapName- The map name.bounds- The specified extent of Bounds.queryParameters- Query parameters can query multiple layers of a map. The query parameters in a single layer can be set inqueryParameters.queryParams[i].- Returns:
- Query result object.
-
viewEntire
public MapImage viewEntire(java.lang.String layerName, MapParameter mapParameter, ImageOutputOption outputOption)
Displays a map in the Full Extent mode according to map layer name, map parameters and image output settings.
The full geographic map extent to display is the minimum circumscribed rectangle of the specified layer.
- Specified by:
viewEntirein interfaceMapProvider- Parameters:
layerName- Layer name, used to determine the full map extent.mapParameter- Map parameters.outputOption- Image output settings.- Returns:
- The Map object.
- Throws:
java.lang.IllegalArgumentException- ${services_components_spi_ogc_WMSMapProvider_method_viewEntire_throws_IllegalArgumentException}
-
queryBySQL
public QueryResult queryBySQL(java.lang.String mapName, QueryParameterSet queryParameterSet)
WMS standard does not support this method.
Performs SQL query on specified map.
- Specified by:
queryBySQLin interfaceMapProvider- Parameters:
mapName- The map name.queryParameterSet- Query parameter set.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
setDefaultMapParameter
public MapParameter setDefaultMapParameter(MapParameter mapParameter)
WMS standard does not support this method.
Sets the default map parameters.
- Specified by:
setDefaultMapParameterin interfaceMapProvider- Parameters:
mapParameter- Map parameters.- Returns:
- No value is returned because WMSMapProvider object do not support this method.
- Throws:
java.lang.UnsupportedOperationException- An exception will be thrown, because the WMSMapProvider object doesn't support the method.
-
setProviderContext
public void setProviderContext(ProviderContext context)
Sets the service provider context.- Specified by:
setProviderContextin interfaceProviderContextAware- Parameters:
context- The service provider context.
-
clearCache
public void clearCache(java.lang.String mapName, Rectangle2D bounds)Clears the cached tiles within the specified bounds.
- Specified by:
clearCachein interfaceMapProvider- Parameters:
mapName- The map name.bounds- The specified map extent.
-
getDynamicPrjCoordsyses
public java.util.List<PrjCoordSys> getDynamicPrjCoordsyses(java.lang.String mapName)
Description copied from interface:DynamicProjectionableMap supported dynamic projection lists.- Specified by:
getDynamicPrjCoordsysesin interfaceDynamicProjectionable- Returns:
-
support
public boolean support(java.lang.String mapName, MapCapability capability)Description copied from interface:MapProviderDetermines whether the map supports the specified function.- Specified by:
supportin interfaceMapProvider- Parameters:
mapName- The map name.capability- Function type.- Returns:
- true means to support; otherwise, false.
-
getVectorStyle
public VectorStyle getVectorStyle(java.lang.String mapName, java.lang.String[] layerNames, VectorStyleType type)
Description copied from interface:MapProviderGets the specified vector layer style in the specified map.- Specified by:
getVectorStylein interfaceMapProvider- Parameters:
mapName- The map name.layerNames- The layer name.type- The vector style type.- Returns:
- Vector layer style.
-
getResource
public byte[] getResource(java.lang.String mapName, ResourceParameter resourceParameter, Point2D[] points)Description copied from interface:MapProviderGets the resource image of a specified map according to a resource image parameter.
- Specified by:
getResourcein interfaceMapProvider- Parameters:
mapName- The map name.resourceParameter- The resource image parameter.points- The points used to draw resource images.- Returns:
- Binary stream of the image.
-
updateMap
public boolean updateMap(MapParameter mapParameter)
Description copied from interface:MapProviderUpdates the map status permanently, which will do a persistence in the disk.- Specified by:
updateMapin interfaceMapProvider- Parameters:
mapParameter- The map status to update to.- Returns:
- Whether the update is successful.
-
-