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 sourcesFor example,
AggregationMapProvidercan implement the aggregation of map functionalities provided by the local SuperMap Objects and by the remote WFS service by calling theUGCMapProvider(the UGC map service providers) and theWMSMapProvider(the WFS service providers). As shown in the following image:
Map aggregation capabilities supported by
AggregationMapProvidercurrently include:- The overlay of map images.
- The overlay of map parameters.
- The overlay of query results.
AggregationMapProvidercurrently doesn't support following functions:- Modifies the default parameter of the map.
- Outputs the overview.
-
-
Constructor Summary
Constructors Constructor and Description AggregationMapProvider()The default constructor.AggregationMapProvider(AggregationMapProviderSetting mapProviderSetting)Constructs a new AggregationMapProvider instance according to settings of the aggregation map service provider.
-
Method Summary
Methods Modifier and Type Method and Description voidclearCache(java.lang.String mapName, Rectangle2D bounds)Clears the cached tiles within the specified bounds.voiddispose()Releases the resources used by the current service provider.QueryResultfindNearest(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.MapParametergetDefaultMapParameter(java.lang.String mapName)Gets the default map parameters of a specified map, and the name of that is the map name after aggregation.protected QueryResultgetExpectedResult(java.util.List<QueryResult> queryResultList, int start, int expectedCount)Gets the expected query result according to multiple query results.MapImagegetMapImage(MapParameter mapParameter, ImageOutputOption outputOption)Gets map images according to map parameters and image output settings.MapParametergetMapParameter(java.lang.String mapName)Gets map parameters of a specified map, and the name of that is the map name after aggregation.java.util.List<java.lang.String>getNames()Gets the map name list corresponding to the current map service provider.OverviewgetOverview(MapParameter mapParameter, ImageOutputOption outputOption)Currently does not support this method.protected QueryParameterSetgetQueryParameters(QueryParameterSet referQueryParam, int index)Gets the valid query parameters.protected RecordsetgetRecordset(Recordset recordset, int start, int count)Copies a new recordset with a specified recordset.java.lang.StringgetResource(java.lang.String mapName, ResourceParameter resourceParameter)Gets the resource image of the map after aggregation according to a resource image parameter.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)Measures areas on the map after aggregation based on 2D geographic coordinates and a measuring parameter.MeasureResultmeasureDistance(java.lang.String mapName, Point2D[] points, MeasureParameter measureParam)Measures distances on the map after aggregation based on 2D geographic coordinates and a measuring parameter.protected MapParametermerge(java.util.List<MapParameter> mapParameters)Merges map parameters of multiple maps.protected Rectangle2Dmerge(Rectangle2D bounds, Rectangle2D bounds2)Merges map extent 1 and map extent 2.protected voidmergeByUrl(java.util.List<java.lang.String> urls, java.lang.String outputPath)Performs the overlay operation on multiple map images and outputs new images.QueryResultqueryByBounds(java.lang.String mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet)Queries the geometries within a specified range on the map after aggregation.QueryResultqueryByDistance(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.QueryResultqueryByGeometry(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.QueryResultqueryBySQL(java.lang.String mapName, QueryParameterSet queryParam)Performs SQL query on the map after aggregation.MapParametersetDefaultMapParameter(MapParameter mapParameter)Currently does not support this method.voidsetProviderContext(ProviderContext context)Sets the context of the aggregation service provider.booleansupport(java.lang.String mapName, MapCapability capability)Determines whether the map supports the specified function.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.
-
-
-
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:
getNamesin interfaceMapProvider- 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:
getMapParameterin interfaceMapProvider- 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:
clearCachein interfaceMapProvider- 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:
getMapImagein interfaceMapProvider- 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:
getResourcein interfaceMapProvider- 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:
measureDistancein interfaceMapProvider- 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:
measureAreain interfaceMapProvider- 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:
queryByDistancein interfaceMapProvider- 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 inqueryParam.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:
queryByGeometryin interfaceMapProvider- 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 inqueryParam.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:
queryByBoundsin interfaceMapProvider- 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:
queryBySQLin interfaceMapProvider- 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 inqueryParam.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:
setDefaultMapParameterin interfaceMapProvider- 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:
getDefaultMapParameterin interfaceMapProvider- 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:
viewEntirein interfaceMapProvider- 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:
getOverviewin interfaceMapProvider- 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:
findNearestin interfaceMapProvider- 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 inqueryParam.queryParams[i].- Returns:
- Query result object.
-
dispose
public void dispose()
Releases the resources used by the current service provider.
- Specified by:
disposein interfaceDisposable
-
setProviderContext
public void setProviderContext(ProviderContext context)
Sets the context of the aggregation service provider.
- Specified by:
setProviderContextin interfaceProviderContextAware- 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.
-
getQueryParameters
protected QueryParameterSet getQueryParameters(QueryParameterSet referQueryParam, int index)
Gets the valid query parameters.
Valid means the dataset (
referQueryParam.queryParams[i].name) of the query parameters exists in the sublayer (Layer.subLayers) of the layers (MapParameter.layers) of the current map parameter.- Parameters:
referQueryParam- Query parameters can query multiple layers of a map. The query parameters in a single layer can be set inqueryParam.queryParams[i].index- The element index in the map parameter list.- Returns:
- Query parameter set.
-
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: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.
-
-