com.supermap.services.components.spi

Class TiledMapProviderBase

  • java.lang.Object
    • com.supermap.services.components.spi.TiledMapProviderBase
    • Field Detail

      • REGEX

        protected static final java.lang.String REGEX
        
      • REPLACEMENT

        protected static final java.lang.String REPLACEMENT
        
      • QUESTION_MARK

        protected static final java.lang.String QUESTION_MARK
        
      • LINK_MARK

        protected static final java.lang.String LINK_MARK
        
      • CACHE_DIR

        protected static final java.lang.String CACHE_DIR
        
      • message

        protected static ResourceManager message
        
      • logger

        protected static final LocLogger logger
        
      • lock

        protected final java.util.concurrent.locks.ReentrantLock lock
        
      • tilePixWidth

        protected int tilePixWidth
        

        Tile width, the unit is in pixel, the default is 256 pixels.

      • tilePixHeight

        public int tilePixHeight
        

        Tile height, the unit is in pixel, the default is 256 pixels.

        .
    • Constructor Detail

      • TiledMapProviderBase

        public TiledMapProviderBase()
        
        The default constructor.
      • TiledMapProviderBase

        public TiledMapProviderBase(MapProviderSetting setting)
        
        Constructor with parameters.
        Parameters:
        setting -
    • Method Detail

      • getNames

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

        Initializing the default map status, a mapping object will be returned, of which the key is map name, valude is map parameter object.

        Specified by:
        getNames in interface MapProvider
        Returns:
        Map status mapping. The key is the map name, and the value is the map parameter object.
      • getMapParameter

        public MapParameter getMapParameter(java.lang.String mapName)
        
        Description copied from interface: MapProvider

        Gets the status of a map (the map parameters) after outputting map images last time.

        Specified by:
        getMapParameter in interface MapProvider
        Parameters:
        mapName - The specified map name.
        Returns:
        Map parameters.
      • getDefaultMapParameter

        public MapParameter getDefaultMapParameter(java.lang.String mapName)
        
        Description copied from interface: MapProvider

        Gets the default map parameters of the specified map.

        Retrieval of the initial default map parameter depends on the type of the service accessed. For example, if the GIS functions provided by SuperMap Objects Java are accessed, the initial default map parameter is obtained from a workspace file; if the GIS functions of a WMS service are accessed, the default map parameter is determined in the WMS service.

        Specified by:
        getDefaultMapParameter in interface MapProvider
        Parameters:
        mapName - The map name.
        Returns:
        The map parameter object.
      • clearCache

        public void clearCache(java.lang.String mapName,
                      Rectangle2D bounds)
        
        Description copied from interface: MapProvider

        Clears the cache corresponding to a specified area.

        Specified by:
        clearCache in interface MapProvider
      • getMapImage

        public MapImage getMapImage(MapParameter mapParameter,
                           ImageOutputOption outputOption)
        
        Description copied from interface: MapProvider

        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)
        
        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.
        Returns:
        The resource image address.
      • 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.
      • measureDistance

        public MeasureResult measureDistance(java.lang.String mapName,
                                    Point2D[] points,
                                    MeasureParameter measureParam)
        
        Description copied from interface: MapProvider

        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:
        Measurement result object.
      • measureArea

        public MeasureResult measureArea(java.lang.String mapName,
                                Point2D[] points,
                                MeasureParameter measureParam)
        
        Description copied from interface: MapProvider

        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:
        Measurement result object.
      • queryByDistance

        public QueryResult queryByDistance(java.lang.String mapName,
                                  Geometry geometry,
                                  double distance,
                                  QueryParameterSet queryParameterSet)
        
        Description copied from interface: MapProvider

        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 querying distance.
        queryParameterSet - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParameterSet.queryParams[i] .
        Returns:
        Query result object.
      • queryByGeometry

        public QueryResult queryByGeometry(java.lang.String mapName,
                                  Geometry geometry,
                                  SpatialQueryMode spatialQueryMode,
                                  QueryParameterSet queryParameterSet)
        
        Description copied from interface: MapProvider

        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 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.
        queryParameterSet - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParameterSet.queryParams[i] .
        Returns:
        Query result object.
      • queryByBounds

        public QueryResult queryByBounds(java.lang.String mapName,
                                Rectangle2D bounds,
                                QueryParameterSet queryParameterSet)
        
        Description copied from interface: MapProvider

        Queries the geometries in the specified range on the map.

        Specified by:
        queryByBounds in interface MapProvider
        Parameters:
        mapName - The map name.
        bounds - The specified query bounds.
        Returns:
        Query result object.
      • queryBySQL

        public QueryResult queryBySQL(java.lang.String mapName,
                             QueryParameterSet queryParameterSet)
        
        Description copied from interface: MapProvider

        Performs SQL query on specified map.

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

        public QueryResult findNearest(java.lang.String mapName,
                              Geometry geometry,
                              double maxDistance,
                              QueryParameterSet queryParameterSet)
        
        Description copied from interface: MapProvider

        Queries the nearest geometric object on a specified map whose distance to a specified geometry is within a certain value. When limit the number of returned geometric objects (specified by QueryParameterSet.expectCount), the query result is the expectCount features nearest to the center in the records. There is no orders of expectCount.

        Specified by:
        findNearest in interface MapProvider
        Parameters:
        mapName - The map name.
        geometry - The geometric object.
        maxDistance - The maximum distance, of which the unit is identical with that of the map specified with mapName parameter.
        queryParameterSet - Query parameters can query multiple layers of a map. The query parameters in a single layer can be set in queryParameterSet.queryParams[i] .
        Returns:
        Query result object.
      • viewEntire

        public MapImage viewEntire(java.lang.String layerName,
                          MapParameter mapParameter,
                          ImageOutputOption outputOption)
        
        Description copied from interface: MapProvider

        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)
        

        Gets the overview map image according to map parameters and image output settings.

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

        public MapProviderSetting getMapProviderSetting()
        

        Gets the configuration of map service provider.

        Returns:
        The configuration of map service provider.
      • setMapProviderSetting

        public void setMapProviderSetting(MapProviderSetting mapProviderSetting)
        

        Sets the configuration of map service provider.

        Parameters:
        mapProviderSetting - The configuration of map service provider.
      • dispose

        public void dispose()
        

        Release the resource object.

        Specified by:
        dispose in interface Disposable
      • checkSetting

        protected void checkSetting(MapProviderSetting setting)
        
        Checks the configuration of map service provider.
        Parameters:
        setting -
      • outputImage

        protected byte[] outputImage(MapParameter param,
                         ImageOutputOption outputOption,
                         double currentResolution)
        

        Output image in real time. It is stored in the specified path according to the map parameter.

        Parameters:
        param - Map status
        outputOption - Image parameter
        currentResolution - Resolution
      • outputImage

        protected byte[] outputImage(MapParameter param,
                         ImageOutputOption outputOption,
                         double currentResolution,
                         Point2D tileOrigin,
                         int tileImageWidth,
                         int tileImageHeight,
                         double[] resolutions)
        
        Outputting map according to the map parameter.
        Parameters:
        param - Map parameters.
        outputOption - Image output parameters.
        currentResolution - The current resolution.
        tileOrigin - The origin of current tile matrix.
        tileImageWidth - The width of current tile matrix.
        tileImageHeight - The height of current tile matrix.
        resolutions -
        Returns:
      • getProximalResolution

        protected double getProximalResolution(double[] paramResolutions,
                                   double currentResolution)
        
        Search the resolution that is larger than or equal to the current,and the nearest resolution. If the matching resolution is too different from the actual resolution (default is 5 times), returns -1.
      • getProximalResolution

        protected double getProximalResolution(double[] paramResolutions,
                                   double currentResolution,
                                   int maxTolerance)
        

        Search the resolution that is larger than or equal to the current,and the nearest resolution.

        When the matching resolution is too different from the actual resolution (over maxTolerance), returns -1; when maxTolerance == 0, it means no tolerance

      • outputImageToFile

        protected void outputImageToFile(java.lang.String targetFileName,
                             java.awt.image.BufferedImage targetImage,
                             ImageOutputOption outputOption)
        

        Merges the tiles and the region of given range to a image. Input to the specified file.

        Parameters:
        targetFileName - The specified file name
        targetImage - Result image
        outputOption - Output parameters.
      • outputImageToFile

        protected void outputImageToFile(java.lang.String targetFileName,
                             byte[] imageData,
                             ImageOutputOption outputOption)
        
      • isResolutionEquals

        protected boolean isResolutionEquals(double resolution1,
                                 double resolution2)
        

        Determines if two resolutions are within the tolerance (1.0E-6)

        Parameters:
        resolution1 - double
        resolution2 - double
        Returns:
        Is it equal
      • getDefaultMapParameters

        protected java.util.Map<java.lang.String,MapParameter> getDefaultMapParameters()
        
        Returns the default map parameters.
        Returns:
        The default map parameters.
      • setDefaultMapParameters

        protected void setDefaultMapParameters(java.util.Map<java.lang.String,MapParameter> defaultMapParameters)
        

        Sets the default map status.

        Parameters:
        defaultMapParameters - Map status mapping. The key is the map name, and the value is the map parameter object.
      • init

        protected void init(MapProviderSetting setting)
        

        Initialization function. This function does not carry on null judgment on parameter, but it may judge the correction of the contents.

        Parameters:
        setting - The configuration object of service provider.
      • getResolutoinByScale

        protected double getResolutoinByScale(double resolution,
                                  MapParameter defaultMapParameter)
        
      • 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.
      • getSupportResolutions

        public abstract double[] getSupportResolutions(java.lang.String mapName)
        

        Returns the resolution of the current service support. If all resolutions are supported, empty is returned.

        Parameters:
        mapName - The map name.
        Returns:
        The resolution array.
      • initSupportedMapNames

        protected abstract java.util.List<java.lang.String> initSupportedMapNames()
        
        Initializes the supported map list.
        Returns:
        The map name list.
      • initDefaultMapParameter

        protected abstract java.util.Map<java.lang.String,MapParameter> initDefaultMapParameter()
        

        Initializing the default map status, a mapping object will be returned, of which the key is map name, valude is map parameter object.

        Returns:
        Map status mapping. The key is the map name, and the value is the map parameter object.
      • getSupportImageFormat

        public abstract OutputFormat[] getSupportImageFormat(java.lang.String mapName)
        

        Return the supported image formats.

        Parameters:
        mapName - The map name.
        Returns:
        Supported image format array
      • getOrigin

        protected abstract Point2D getOrigin(java.lang.String mapName)
        

        Get the geographical coordinate of left upper corner of the map.

        Parameters:
        mapName - The map name.
        Returns:
        The geographical coordinate of left upper corner of the map.
      • cacheEnabled

        protected abstract boolean cacheEnabled()
        
      • 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.
      • 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.