com.supermap.services.providers

Class AggregationMapProvider

  • java.lang.Object
    • com.supermap.services.providers.AggregationMapProvider
  • All Implemented Interfaces:
    Disposable, MapProvider, ProviderContextAware


    public class AggregationMapProvider
    extends java.lang.Object
    implements MapProvider, Disposable, ProviderContextAware
    

    The map service provider with aggregation capabilities.

    The GIS service provider with aggregation capabilities is a special kind of GIS service provider, which is also known as the service aggregator in SuperMap iServer. The map service provider with aggregation capabilities can be called the map service aggregator, which is an aggregator with aggregation capabilities.

    Unlike other service providers (such as WMSMapProvider, WMS service providers), the service aggregator does not access the remote or local services directly or encapsulate GIS functionalities directly, however, it implements GIS functionalities by calling different types of GIS service providers. These GIS service providers encapsulate and integrate a variety of services of different types and sources

    For example, AggregationMapProvider can implement the aggregation of map functionalities provided by the local SuperMap Objects and by the remote WFS service by calling the UGCMapProvider (the UGC map service providers) and the WMSMapProvider (the WFS service providers). As shown in the following image:

    Map aggregation capabilities supported by AggregationMapProvider currently include:

    • The overlay of map images.
    • The overlay of map parameters.
    • The overlay of query results.

    AggregationMapProvider currently doesn't support following functions:

    • Modifies the default parameter of the map.
    • Outputs the overview.
    • Constructor Detail

      • AggregationMapProvider

        public AggregationMapProvider()
        

        The default constructor.

      • AggregationMapProvider

        public AggregationMapProvider(AggregationMapProviderSetting mapProviderSetting)
        

        Constructs a new AggregationMapProvider instance according to settings of the aggregation map service provider.

        Parameters:
        mapProviderSetting - The aggregation map service provider setting, can not be null.
    • Method Detail

      • getNames

        public java.util.List<java.lang.String> getNames()
        

        Gets the map name list corresponding to the current map service provider.

        Specified by:
        getNames in interface MapProvider
        Returns:
        The list of map names.
      • getMapParameter

        public MapParameter getMapParameter(java.lang.String mapName)
        

        Gets map parameters of a specified map, and the name of that is the map name after aggregation.

        When aggregating several maps, you can get map parameters after aggregation by this method , where the layer list (MapParameter.layers) stores all layers of several maps in aggregation.

        Specified by:
        getMapParameter in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        Returns:
        Map parameters after aggregation.
      • 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.
      • getMapImage

        public MapImage getMapImage(MapParameter mapParameter,
                           ImageOutputOption outputOption)
        

        Gets map images according to map parameters and image output settings.

        Specified by:
        getMapImage in interface MapProvider
        Parameters:
        mapParameter - Map parameters.
        outputOption - Image output settings.
        Returns:
        The map image object.
      • getResource

        public java.lang.String getResource(java.lang.String mapName,
                                   ResourceParameter resourceParameter)
        

        Gets the resource image of the map after aggregation according to a resource image parameter.

        Specified by:
        getResource in interface MapProvider
        Parameters:
        mapName - The map name.
        resourceParameter - The resource image parameter.
        Returns:
        The resource image address.
      • measureDistance

        public MeasureResult measureDistance(java.lang.String mapName,
                                    Point2D[] points,
                                    MeasureParameter measureParam)
        

        Measures distances on the map after aggregation based on 2D geographic coordinates and a measuring parameter.

        Specified by:
        measureDistance in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        points - The array of 2D geographic coordinates.
        measureParam - The measuring parameter.
        Returns:
        The distance measurement result.
      • measureArea

        public MeasureResult measureArea(java.lang.String mapName,
                                Point2D[] points,
                                MeasureParameter measureParam)
        

        Measures areas on the map after aggregation based on 2D geographic coordinates and a measuring parameter.

        Specified by:
        measureArea in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        points - The array of 2D geographic coordinates.
        measureParam - The measuring parameter.
        Returns:
        The area measurement result.
      • queryByDistance

        public QueryResult queryByDistance(java.lang.String mapName,
                                  Geometry geometry,
                                  double distance,
                                  QueryParameterSet queryParam)
        

        Queries all the geometric objects on the map after aggregation 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.

        This method will return all the geometries that satisfy the filter condition.

        Specified by:
        queryByDistance in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        geometry - The geometric object, which has spatial information and shape information, but no attribute information.
        distance - The querying distance.
        queryParam - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParam.queryParams[i].
        Returns:
        Query result object.
      • queryByGeometry

        public QueryResult queryByGeometry(java.lang.String mapName,
                                  Geometry geometry,
                                  SpatialQueryMode spatialQueryMode,
                                  QueryParameterSet queryParam)
        

        Queries geometric objects that satisfy a certain spatial relationship with a specified geometric object and meet query conditions on the map after aggregation.

        This method will return all the geometries that satisfy the filter condition.

        Specified by:
        queryByGeometry in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        geometry - The geometric object, which has spatial information and shape information, but no attribute information.
        spatialQueryMode - The spatial query mode, which defines several spatial relationships between geometries, and it allows users to construct filter conditions to perform querying. For example, searching spatial objects which are contained in specified region object, or which have a disjoint or adjacent relationship with the specified region object.
        queryParam - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParam.queryParams[i].
        Returns:
        Query result object.
      • queryByBounds

        public QueryResult queryByBounds(java.lang.String mapName,
                                Rectangle2D bounds,
                                QueryParameterSet queryParameterSet)
        

        Queries the geometries within a specified range on the map after aggregation.

        Specified by:
        queryByBounds in interface MapProvider
        Parameters:
        mapName -
        bounds -
        queryParameterSet -
        Returns:
      • queryBySQL

        public QueryResult queryBySQL(java.lang.String mapName,
                             QueryParameterSet queryParam)
        

        Performs SQL query on the map after aggregation.

        This method will return all the geometries that satisfy the filter condition.

        Specified by:
        queryBySQL in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        queryParam - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParam.queryParams[i].
        Returns:
        Query result object.
      • setDefaultMapParameter

        public MapParameter setDefaultMapParameter(MapParameter mapParameter)
        

        Currently does not support this method.

        Sets the default map parameters.

        Specified by:
        setDefaultMapParameter in interface MapProvider
        Parameters:
        mapParameter - Map parameters.
        Returns:
        Map parameters.
      • getDefaultMapParameter

        public MapParameter getDefaultMapParameter(java.lang.String mapName)
        

        Gets the default map parameters of a specified map, and the name of that is the map name after aggregation.

        When aggregating several maps, you can get map parameters after aggregation by this method , where the map name (MapParameter.name) is the aggregation name, and the layer list (MapParameter.layers) stores all layers of several maps in aggregation.

        Specified by:
        getDefaultMapParameter in interface MapProvider
        Parameters:
        mapName - The map name after aggregation.
        Returns:
        The default map parameters after aggregation.
      • 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.
      • getOverview

        public Overview getOverview(MapParameter mapParameter,
                           ImageOutputOption outputOption)
        

        Currently does not support this method.

        Gets the overview after maps are overlaid together.

        Specified by:
        getOverview in interface MapProvider
        Parameters:
        mapParameter - Map parameters.
        outputOption - Image output settings.
        Returns:
        Eagle-eye object.
      • findNearest

        public QueryResult findNearest(java.lang.String mapName,
                              Geometry geometry,
                              double maxDistance,
                              QueryParameterSet queryParameters)
        

        Queries the nearest geometric object whose distance to a specified geometry is within a certain value.

        This method will return all the geometries that satisfy the filter condition.

        Specified by:
        findNearest in interface MapProvider
        Parameters:
        mapName - The specified map name.
        geometry - The specified Geometric object.
        maxDistance - The maximum distance.
        queryParameters - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParam.queryParams[i].
        Returns:
        Query result object.
      • dispose

        public void dispose()
        

        Releases the resources used by the current service provider.

        Specified by:
        dispose in interface Disposable
      • setProviderContext

        public void setProviderContext(ProviderContext context)
        

        Sets the context of the aggregation service provider.

        Specified by:
        setProviderContext in interface ProviderContextAware
        Parameters:
        context - The context of the aggregation service provider.
      • merge

        protected MapParameter merge(java.util.List<MapParameter> mapParameters)
        

        Merges map parameters of multiple maps.

        SuperMap iServer chooses the map parameter of the last map in the map list as the merged map parameter, and then adds layers of all maps to the layer list (MapParameter.layers) of the merged map parameters.

        Parameters:
        mapParameters - The map parameter list.
        Returns:
        The merged map parameter. If the parameter mapParameters is null or the length is 0, null will be returned.
      • mergeByUrl

        protected void mergeByUrl(java.util.List<java.lang.String> urls,
                      java.lang.String outputPath)
        

        Performs the overlay operation on multiple map images and outputs new images.

        The default format of the new image is PNG.

        Parameters:
        urls - The image URL list.
        outputPath - The path of the new image after overlay.
      • merge

        protected Rectangle2D merge(Rectangle2D bounds,
                        Rectangle2D bounds2)
        

        Merges map extent 1 and map extent 2.

        The returned map contains map extent 1 and map extent 2.

        Parameters:
        bounds - The specified map extent 1.
        bounds2 - The specified map extent 2.
        Returns:
        The map extent after merging.
      • getExpectedResult

        protected QueryResult getExpectedResult(java.util.List<QueryResult> queryResultList,
                                    int start,
                                    int expectedCount)
        

        Gets the expected query result according to multiple query results.

        Parameters:
        queryResultList - The query result list, indicating the list of the query result of each map.
        start - The start record index (QueryParameterSet.startRecord).
        expectedCount - The expected count of the returned records (QueryParameterSet.expectCount).
        Returns:
        Query result object.
      • getRecordset

        protected Recordset getRecordset(Recordset recordset,
                             int start,
                             int count)
        

        Copies a new recordset with a specified recordset. The new recordset starts from the specified position (parameter start) in the original recordset and ends at he position calculated by paramter count.

        Parameters:
        recordset - The specified recordset.
        start - The start location of the feature array.
        count - The number of feature array elements to be copied.
        Returns:
        New recordset.
      • 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.