com.supermap.services.providers

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 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 WMSServiceException
        

        Constructs 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:
        findNearest in interface MapProvider
        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:
        getDefaultMapParameter in interface MapProvider
        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:
        getMapImage in interface MapProvider
        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
      • getMapParameter

        public MapParameter getMapParameter(java.lang.String mapName)
        

        Gets the map parameters of the specified map.

        Specified by:
        getMapParameter in interface MapProvider
        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:
        getNames in interface MapProvider
        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:
        getOverview in interface MapProvider
        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:
        getResource in interface MapProvider
        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:
        measureArea in interface MapProvider
        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:
        measureDistance in interface MapProvider
        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:
        queryByDistance in interface MapProvider
        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:
        queryByGeometry in interface MapProvider
        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:
        1. The parameter geometry is null.
        2. 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:
        queryByBounds in interface MapProvider
        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 in queryParameters.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:
        viewEntire in interface MapProvider
        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:
        queryBySQL in interface MapProvider
        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:
        setDefaultMapParameter in interface MapProvider
        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.
      • clearCache

        public void clearCache(java.lang.String mapName,
                      Rectangle2D bounds)
        

        Clears the cached tiles within the specified bounds.

        Specified by:
        clearCache in interface MapProvider
        Parameters:
        mapName - The map name.
        bounds - The specified map extent.
      • support

        public boolean support(java.lang.String mapName,
                      MapCapability capability)
        
        Description copied from interface: MapProvider
        Determines whether the map supports the specified function.
        Specified by:
        support in interface MapProvider
        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: MapProvider
        Gets the specified vector layer style in the specified map.
        Specified by:
        getVectorStyle in interface MapProvider
        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: MapProvider

        Gets the resource image of a specified map according to a resource image parameter.

        Specified by:
        getResource in interface MapProvider
        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: MapProvider
        Updates the map status permanently, which will do a persistence in the disk.
        Specified by:
        updateMap in interface MapProvider
        Parameters:
        mapParameter - The map status to update to.
        Returns:
        Whether the update is successful.