类 MapImpl
- java.lang.Object
-
- com.supermap.services.components.impl.MapImpl
-
- 所有已实现的接口:
- ComponentContextAware, Map, Disposable, Tileable, Tiling, VectorTileCapabilities
public class MapImpl extends java.lang.Object implements Map, Tileable, Disposable, ComponentContextAware, Tiling
地图服务组件接口的实现类。
地图服务组件是一类 GIS 服务组件,封装了与地图相关的 GIS 功能,该类实现了该接口。
地图服务组件所使用的服务提供者类型必须是地图服务提供者(
MapProvider)。使用 SuperMap 数据构建地图服务组件的示例代码如下:
public MapImpl getMapComponent() { // 初始化SuperMap 地图服务提供者设置。 UGCMapProviderSetting ugcPSetting = new UGCMapProviderSetting(); // SuperMap 工作空间路径。 ugcPSetting.setWorkspacePath("C:\\SuperMap\\World\\World.sxwu"); // 地图服务提供者的地图图片的输出路径。 ugcPSetting.setOutputPath(".\\output1"); // 地图服务提供者的地图图片发布站点。 ugcPSetting.setOutputSite("http://localhost"); ugcPSetting.setName("default"); // 地图服务提供者集合,用于初始化地图服务组件上下文。 List<MapProviderSetting> ugcPSettings = new ArrayList<MapProviderSetting>(); ugcPSettings.add(ugcPSetting); // 地图服务组件的配置信息,用于初始化地图服务组件上下文。 MapConfig config = new MapConfig(); // 地图服务组件的地图图片的输出路径。 config.setOutputPath(".\\output"); // 地图服务组件的地图图片发布站点。 config.setOutputSite("http://localhost/output"); // 初始化地图服务组件上下文。 MapContext mapContext = new MapContext(); mapContext.setMapProviderSettings(ugcPSettings); mapContext.setConfig(config); // 创建地图服务组件。 MapImpl mapc = new MapImpl(mapContext); return mapc; }- 另请参阅:
Component
-
-
字段概要
字段 限定符和类型 字段和说明 static doubleDEFAULT_DPIprotected static java.lang.StringPROVIDER_FACTORY提供者(Provider)工厂对象关键字。
-
构造器概要
构造器 构造器和说明 MapImpl()默认构造函数。MapImpl(MapContext mapContext)构造一个带指定的地图服务组件上下文信息的 MapImpl 对象。
-
方法概要
方法 限定符和类型 方法和说明 intaddSymbol(java.lang.String mapName, SymbolInfo symbolInfo, ResourceType resourceType)voidclearAllCache()清除服务的所有缓存。voidclearCache(Rectangle2D bounds)清除指定地图范围内的缓存。voidclearCache(Rectangle2D bounds, MapParameter mapParameter, ImageOutputOption outputOption)根据指定地图范围、地图参数和图片输出设置清除对应范围的缓存。voiddispose()释放该地图服务组件所占用的资源。voiddispose(boolean disposeProvidersInContext)QueryResultfindNearest(Geometry geometry, double maxDistance, QueryParameterSet queryParameterSet, java.lang.String mapName)在指定地图上,查找距离指定几何对象一定容限内的几何对象。java.util.List<ChartFeatureInfoSpec>getChartFeatureInfoSpecs(java.lang.String mapName)海图功能用,获取海图所有物标类型。MapParametergetDefaultMapParameter(java.lang.String mapName)获取默认地图参数。MapParametergetDefaultMapParameterNoCache(MapProvider mapProvider, java.lang.String mapName)java.util.List<PrjCoordSys>getDynamicPrjCoordsyses(java.lang.String mapName)java.util.List<FieldInfo>getFieldsByLayerName(java.lang.String mapName, LayerFieldsQueryParameter layerFieldsQueryParameter)通过图层查询参数获取图层的fields信息MapImagegetMapImage(MapParameter mapParameter, ImageOutputOption outputOption)根据地图参数、图片输出设置获取地图图片。java.util.List<java.lang.String>getMapNames()获取地图名称列表。MapParametergetMapParameter(java.lang.String mapName)获取指定地图的参数。byte[]getMVTFonts(java.lang.String mapName, java.lang.String fontstack, java.lang.String range)获取指定地图sdf格式的字体数据。java.lang.StringgetMVTSpriteJson(java.lang.String mapName, java.lang.String spriteName)获取指定地图指定Sprite的json字符串。byte[]getMVTSpriteResource(java.lang.String mapName, java.lang.String spriteName)获取指定地图指定Sprite的资源。byte[]getMVTTile(VectorTileParameter vectorTileParameter)获取MVT地图切片。OverviewgetOverview(MapParameter mapParameter, ImageOutputOption outputOption)根据地图参数以及图片输出设置获取鹰眼。Rectangle2DgetProjectionExtent(java.lang.String mapName)获取当前投影下的范围protected MapProvidergetProvider(java.lang.String name)获取指定地图对应的地图服务提供者(MapProvider)。protected MapProvidergetQueryProvider(java.lang.String name)获取查询功能需要的地图服务提供者。java.lang.StringgetResource(ResourceParameter resourceParameter)根据资源图片参数获取资源图片。byte[]getResource(ResourceParameter resourceParameter, Point2D[] points)根据资源图片参数获取资源图片。byte[]getResource(java.lang.String mapName, java.lang.String symbolId, OutputFormat format)根据资源图片参数获取资源图片。SymbolInfogetSymbol(java.lang.String mapName, int symbolId, ResourceType resourceType)获取symbol信息。TileDatagetTile(TileParameter tileParameter)获取一个瓦片,可以是栅格瓦片或矢量瓦片。MapImagegetTileImage(MapParameter mapParameter, ImageOutputOption outputOption)根据地图参数、图片输出设置获取地图图片。TileMatrixSetgetTileMatrixSet(java.lang.String tileMatrixSetId)获取某个瓦片矩阵集java.util.List<TileMatrixSet>getTileMatrixSets()获取瓦片矩阵集列表TilesetInfogetTileset(TileType tileType, java.lang.String tileMatrixSetId)获取 1~n 个数据(数据集)的瓦片集。TilesetInfogetTileset(TileType tileType, java.lang.String dataName, java.lang.String tileMatrixSetId)获取某个数据(数据集或地图)的某个瓦片集。TilesetInfo[]getTilesetInfos(java.lang.String mapName)返回指定地图对应的所有切片集java.util.List<TilesetInfo>getTilesets(TileType tileType)获取 1~n 个数据(数据集)支持的瓦片集列表。java.util.List<TilesetInfo>getTilesets(TileType tileType, java.lang.String dataName)获取某个数据(数据集或地图)支持的瓦片集列表。MapImagegetTrackingLayerImage(MapParameter mapParameter, ImageOutputOption outputOption)根据地图参数、图片输出设置获取 TrackingLayer 的图片。UTFGridResultgetUTFGrid(UTFGridParameter gridParameter)根据地理范围从指定图层中提取UTFGrid对象。VectorStylegetVectorStyle(java.lang.String mapName, java.lang.String[] layerNames, VectorStyleType type)获取指定地图中,指定矢量图层的样式。VectorStylegetVectorStyle(VectorStyleParameter vectorStyleParameter)获取指定地图中,指定矢量图层的样式。VectorTileDatagetVectorTile(VectorTileParameter vectorTileParameter)获取矢量地图切片。protected booleanisExpired(long createTime, TileType type)java.lang.String[]listMVTSprites(java.lang.String mapName)列出指定地图所有的Sprites名字。MeasureResultmeasureArea(java.lang.String mapName, Point2D[] points, MeasureParameter measureParameter)根据地图名称、二维地理坐标点、量算参数进行面积量算。MeasureResultmeasureDistance(java.lang.String mapName, Point2D[] points, MeasureParameter measureParameter)根据地图名称、二维地理坐标点、量算参数进行距离量算。MapImagepan(double offsetX, double offsetY, MapParameter mapParameter, ImageOutputOption outputOption)地图平移。QueryResultqueryByBounds(java.lang.String mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet)在指定的地图上,查询指定范围内的几何对象。QueryResultqueryByDistance(java.lang.String mapName, Geometry geometry, double distance, QueryParameterSet queryParameterSet)在指定的地图上,查询距离指定几何对象一定范围内的所有几何对象。QueryResultqueryByGeometry(java.lang.String mapName, Geometry geometry, SpatialQueryMode spatialQueryMode, QueryParameterSet queryParameterSet)在指定的地图上,查询与指定的几何对象符合某种空间关系和查询条件的几何对象。QueryResultqueryByKeywords(java.lang.String mapName, KeywordsQueryParameterSet queryParameterSet)根据关键字查询地图上的要素。QueryResultqueryBySQL(java.lang.String mapName, QueryParameterSet queryParameterSet)在指定的地图上,执行 SQL 查询。QueryResultqueryChart(java.lang.String mapName, java.lang.String[] chartLayerNames, ChartQueryParameterSet chartQueryParams)海图功能用,物标属性查询。QueryResultqueryChart(java.lang.String mapName, java.lang.String[] chartLayerNames, ChartQueryParameterSet chartQueryParams, Rectangle2D bounds)海图功能用,物标boudns查询ChartFeatureQueryResultqueryChartFeatureByBounds(java.lang.String mapName, Rectangle2D bounds)voidsetComponentContext(ComponentContext context)设置地图服务组件上下文。protected voidsetComponentContext(ComponentContext context, ImageTileCache<TileSourceInfo> tileCache, UTFGridTileCache<TileSourceInfo> utfGridTileCache, VectorTileCache<TileSourceInfo> vectorTileCache)MapParametersetDefaultMapParameter(MapParameter mapParameter)设置默认地图参数。booleansupport(java.lang.String mapName, MapCapability capability)判断地图是否支持相应功能。booleanupdateMap(MapParameter mapParameter)永久更新地图状态,会更新到磁盘中进行持久化。voidupdateVectorStyle(java.lang.String mapName, java.lang.String layerName, VectorStyleType type, java.lang.String style)更新指定地图中,指定矢量图层的样式。voiduseCachedDefaultMapParams(boolean use)MapImageviewByBounds(Rectangle2D bounds, MapParameter mapParameter, ImageOutputOption outputOption)根据地理坐标范围显示地图。MapImageviewByScale(Point2D center, double scale, MapParameter mapParameter, ImageOutputOption outputOption)根据指定的中心点和比例尺等参数显示地图。MapImageviewEntire(MapParameter mapParameter, ImageOutputOption outputOption)根据地图参数以及图片输出设置进行全幅显示。MapImageviewEntire(java.lang.String layerName, MapParameter mapParameter, ImageOutputOption outputOption)根据地图图层名、地图参数以及图片输出设置进行全幅显示。MapImagezoom(Point2D center, double ratio, MapParameter mapParameter, ImageOutputOption outputOption)根据指定的中心点、缩放比例、地图参数和图片输出设置进行地图缩放。
-
-
-
字段详细资料
-
PROVIDER_FACTORY
protected static final java.lang.String PROVIDER_FACTORY
提供者(Provider)工厂对象关键字。 默认为“MapProviderFactory”。
-
DEFAULT_DPI
public static final double DEFAULT_DPI
-
-
构造器详细资料
-
MapImpl
public MapImpl(MapContext mapContext)
构造一个带指定的地图服务组件上下文信息的 MapImpl 对象。
- 参数:
mapContext- 地图服务组件的上下文信息。该参数不能为空。
-
MapImpl
public MapImpl()
默认构造函数。
-
-
方法详细资料
-
useCachedDefaultMapParams
public void useCachedDefaultMapParams(boolean use)
-
clearCache
public void clearCache(Rectangle2D bounds) throws MapException
清除指定地图范围内的缓存。
- 指定者:
clearCache在接口中Map- 参数:
bounds- 指定的地图范围。- 抛出:
MapException- 地图服务组件异常信息。
-
clearCache
public void clearCache(Rectangle2D bounds, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据指定地图范围、地图参数和图片输出设置清除对应范围的缓存。
- 指定者:
clearCache在接口中Map- 参数:
bounds- 指定的地图范围。mapParameter- 地图参数。outputOption- 图片输出设置。- 抛出:
MapException- 地图服务组件异常信息。
-
clearAllCache
public void clearAllCache() throws MapException清除服务的所有缓存。
- 指定者:
clearAllCache在接口中Map- 抛出:
MapException- 地图服务组件异常信息。
-
getMapNames
public java.util.List<java.lang.String> getMapNames()
获取地图名称列表。
- 指定者:
getMapNames在接口中Map- 指定者:
getMapNames在接口中Tileable- 指定者:
getMapNames在接口中Tiling- 返回:
- 地图名称列表。
-
getMapParameter
public MapParameter getMapParameter(java.lang.String mapName) throws MapException
获取指定地图的参数。
- 指定者:
getMapParameter在接口中Map- 参数:
mapName- 地图名称。- 返回:
- 地图参数。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。
-
getMapImage
public MapImage getMapImage(MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图参数、图片输出设置获取地图图片。
- 指定者:
getMapImage在接口中Map- 参数:
mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。
-
getTileImage
public MapImage getTileImage(MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图参数、图片输出设置获取地图图片。
- 指定者:
getTileImage在接口中Map- 参数:
mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。
-
getTile
public TileData getTile(TileParameter tileParameter)
从接口复制的说明:Tiling获取一个瓦片,可以是栅格瓦片或矢量瓦片。
-
getTileMatrixSets
public java.util.List<TileMatrixSet> getTileMatrixSets()
从接口复制的说明:Tiling获取瓦片矩阵集列表- 指定者:
getTileMatrixSets在接口中Tiling- 返回:
-
getTileMatrixSet
public TileMatrixSet getTileMatrixSet(java.lang.String tileMatrixSetId)
从接口复制的说明:Tiling获取某个瓦片矩阵集- 指定者:
getTileMatrixSet在接口中Tiling- 返回:
-
getTilesets
public java.util.List<TilesetInfo> getTilesets(TileType tileType, java.lang.String dataName)
从接口复制的说明:Tiling获取某个数据(数据集或地图)支持的瓦片集列表。- 指定者:
getTilesets在接口中Tiling- 返回:
-
getTileset
public TilesetInfo getTileset(TileType tileType, java.lang.String dataName, java.lang.String tileMatrixSetId)
从接口复制的说明:Tiling获取某个数据(数据集或地图)的某个瓦片集。- 指定者:
getTileset在接口中Tiling- 返回:
-
getTilesets
public java.util.List<TilesetInfo> getTilesets(TileType tileType)
从接口复制的说明:Tiling获取 1~n 个数据(数据集)支持的瓦片集列表。 跨多个collection出图,支持的瓦片集列表,比如多个数据集可以出矢量瓦片- 指定者:
getTilesets在接口中Tiling- 返回:
-
getTileset
public TilesetInfo getTileset(TileType tileType, java.lang.String tileMatrixSetId)
从接口复制的说明:Tiling获取 1~n 个数据(数据集)的瓦片集。 跨多个collection出图,支持的某瓦片集详情- 指定者:
getTileset在接口中Tiling- 返回:
-
getResource
public byte[] getResource(java.lang.String mapName, java.lang.String symbolId, OutputFormat format) throws MapException从接口复制的说明:Map根据资源图片参数获取资源图片。- 指定者:
getResource在接口中MapsymbolId- 符号idformat- 符号的格式- 返回:
- 图片对应的二进制流。
- 抛出:
MapException- 地图服务组件异常信息。
-
getResource
public java.lang.String getResource(ResourceParameter resourceParameter) throws MapException
根据资源图片参数获取资源图片。
- 指定者:
getResource在接口中Map- 参数:
resourceParameter- 资源图片参数。- 返回:
- 资源图片地址。
- 抛出:
MapException- 地图服务组件异常信息。当前地图名列表大小小于0时,抛出该异常。java.lang.IllegalArgumentException- 当参数 resourceParameter 为空时,抛出该异常。
-
getResource
public byte[] getResource(ResourceParameter resourceParameter, Point2D[] points) throws MapException
从接口复制的说明:Map根据资源图片参数获取资源图片。- 指定者:
getResource在接口中Map- 参数:
resourceParameter- 资源图片参数,如生成的图片的高度、宽度、类型,资源的类型、风格等。points- 绘制资源图片时用的点- 返回:
- 图片对应的二进制流。
- 抛出:
MapException- 地图服务组件异常信息。
-
measureDistance
public MeasureResult measureDistance(java.lang.String mapName, Point2D[] points, MeasureParameter measureParameter) throws MapException
根据地图名称、二维地理坐标点、量算参数进行距离量算。
- 指定者:
measureDistance在接口中Map- 参数:
mapName- 地图名称。points- 二维地理坐标点数组。measureParameter- 量算参数。- 返回:
- 量算结果对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 measureParameter 为空。
- 参数 points 为空。
- 参数 measureParameter 为空。
-
measureArea
public MeasureResult measureArea(java.lang.String mapName, Point2D[] points, MeasureParameter measureParameter) throws MapException
根据地图名称、二维地理坐标点、量算参数进行面积量算。
- 指定者:
measureArea在接口中Map- 参数:
mapName- 地图名称。points- 二维地理坐标点数组。measureParameter- 量算参数。- 返回:
- 量算结果对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 measureParameter 为空。
- 参数 points 为空。
- 参数 measureParameter 为空。
-
queryByDistance
public QueryResult queryByDistance(java.lang.String mapName, Geometry geometry, double distance, QueryParameterSet queryParameterSet) throws MapException
在指定的地图上,查询距离指定几何对象一定范围内的所有几何对象。 当限制了返回几何对象个数(由
QueryParameterSet.expectCount指定)时,查询结果为查询总记录中随机抽取的 expectCount 个对象。到指定几何对象的一定距离范围,实际是以指定几何对象为中心的一个圆,在这个圆内以及与圆相交的几何对象都能够被查询出来。
本查询的示例如下,其中地图服务组件初始化请参见地图组件初始化示例。
public QueryResult queryByDistanceSample() throws MapException { // 初始化地图服务组件,参见地图服务组件的初始化。 MapImpl mapc = getMapComponent(); // 属性查询参数集合。 QueryParameterSet queryParameters = new QueryParameterSet(); QueryParameter[] queryLayerParams = new QueryParameter[1]; queryLayerParams[0] = new QueryParameter(); queryLayerParams[0].name = "Countries@World"; // 属性过滤条件,这里设为空。 queryLayerParams[0].attributeFilter = ""; // 返回的属性字段名称(不区分大小写)。 queryLayerParams[0].fields = new String[] { "Country", "Capital" }; queryParameters.queryParams = queryLayerParams; // 设置查询结果只包含属性信息。 queryParameters.queryOption = QueryOption.ATTRIBUTE; // 创建缓冲区查询的参照几何对象,这里为一个三角形的面状对象。 Point2D p1 = new Point2D(101.0, 26.0); Point2D p2 = new Point2D(97.0, 21.0); Point2D p3 = new Point2D(103.0, 16.0); Point2D[] point2ds = { p1, p2, p3 }; Geometry geometry = Geometry.fromPoint2Ds(point2ds, GeometryType.REGION); // 查询在“世界地图”地图的“Countries@World”图层中,距离指定几何对象为0.5范围内所有的要素。 QueryResult queryResult = mapc.queryByDistance("世界地图", geometry, 0.5, queryParameters); mapc.dispose(); return queryResult; }- 指定者:
queryByDistance在接口中Map- 参数:
mapName- 地图名称。geometry- 几何对象。distance- 查询的距离范围,单位同当前地图对应的数据集坐标单位(coordUnit)。queryParameterSet- 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在queryParameterSet.queryParams[i]中进行设置。- 返回:
- 查询结果对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 geometry 为空。
- 参数 distance 小于等于零。
- 参数 queryParameterSet 为空。
- 参数
queryParameterSet.queryParams为空,或该数组长度等于0。
-
queryByGeometry
public QueryResult queryByGeometry(java.lang.String mapName, Geometry geometry, SpatialQueryMode spatialQueryMode, QueryParameterSet queryParameterSet) throws MapException
在指定的地图上,查询与指定的几何对象符合某种空间关系和查询条件的几何对象。
- 指定者:
queryByGeometry在接口中Map- 参数:
mapName- 地图名称。geometry- 几何对象。spatialQueryMode- 空间几何对象间的查询模式。空间几何对象间的查询模式定义了一些几何对象之间的空间位置关系,根据这些空间关系来构建过滤条件执行查询。例如:查询可被包含在面对象中的空间对象,与面有相离或者相邻关系的空间对象等。queryParameterSet- 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在queryParameterSet.queryParams[i]中进行设置。- 返回:
- 返回查询结果对象。
- 抛出:
MapException- 地图服务组件异常信息。
当出现以下情况时会抛出该异常:
- 参数
queryParameters.queryParams数组长度等于0。 - 名称为 mapName 的地图不存在。
- 参数
java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 geometry 为空。
- 参数 spatialQueryMode 为空。
- 参数 queryParameterSet 为空。
- 参数
queryParameterSet.queryParams为空。
- 参数 geometry 为空。
-
queryBySQL
public QueryResult queryBySQL(java.lang.String mapName, QueryParameterSet queryParameterSet) throws MapException
在指定的地图上,执行 SQL 查询。
- 指定者:
queryBySQL在接口中Map- 参数:
mapName- 地图名称。queryParameterSet- 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在queryParameterSet.queryParams[i]中进行设置。- 返回:
- 查询结果对象。
- 抛出:
MapException- 地图服务组件异常信息。名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 queryParameterSet 为空。
- 参数
queryParameterSet.queryParams为空,或该数组长度等于0。 - 名称为 mapName 的地图不存在。
- 参数 queryParameterSet 为空。
-
queryByBounds
public QueryResult queryByBounds(java.lang.String mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet) throws MapException
在指定的地图上,查询指定范围内的几何对象。
- 指定者:
queryByBounds在接口中Map- 参数:
mapName- 地图名称。bounds- 指定的查询范围。queryParameterSet- 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在queryParameters.queryParams[i]中进行设置。- 返回:
- 查询结果对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 bounds 为空。
- 参数 queryParameterSet 为空。
- 参数
queryParameterSet.queryParams为空,或该数组长度等于0。
-
setDefaultMapParameter
public MapParameter setDefaultMapParameter(MapParameter mapParameter) throws MapException
设置默认地图参数。
- 指定者:
setDefaultMapParameter在接口中Map- 参数:
mapParameter- 地图参数。- 返回:
- 地图参数对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.mapName的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当参数 mapParameter 为空时,会抛出该异常。
-
getDefaultMapParameter
public MapParameter getDefaultMapParameter(java.lang.String mapName) throws MapException
获取默认地图参数。
初始的默认地图参数是由所访问的服务类型决定的,比如,访问 SuperMap Objects Java 提供的 GIS 能力,那么初始默认地图参数从工作空间文件中获取到;访问 WMS 服务提供的 GIS 能力,默认地图参数由 WMS 服务决定。
- 指定者:
getDefaultMapParameter在接口中Map- 参数:
mapName- 地图名称。- 返回:
- 地图参数对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为 mapName 的地图不存在时,抛出该异常。
-
pan
public MapImage pan(double offsetX, double offsetY, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
地图平移。
- 指定者:
pan在接口中Map- 参数:
offsetX- 在横坐标方向的地理坐标偏移量。offsetY- 在纵坐标方向的地理坐标偏移量。mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。
-
viewByBounds
public MapImage viewByBounds(Rectangle2D bounds, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地理坐标范围显示地图。
- 指定者:
viewByBounds在接口中Map- 参数:
bounds- 地理坐标范围。mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 bounds 为空。
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
-
viewByScale
public MapImage viewByScale(Point2D center, double scale, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据指定的中心点和比例尺等参数显示地图。
示例如下,其中地图服务组件初始化请参见地图组件初始化示例。
public MapImage viewByScaleSample() throws MapException { // 初始化地图服务组件,参见地图服务组件的初始化。 MapImpl mapc = getMapComponent(); // 中心点坐标。 Point2D center = new Point2D(101.0, 26.0); // 出图的比例尺。 double scale = 0.00000003; // 地图参数,这里使用“世界地图”默认的地图参数。 MapParameter mapParameter = mapc.getDefaultMapParameter("世界地图"); // 图片输出设置,这里设置图片输出格式是PNG。 ImageOutputOption outputOption = new ImageOutputOption(); outputOption.format = OutputFormat.PNG; MapImage mapImage = mapc.viewByScale(center, scale, mapParameter, outputOption); // 释放地图组件占用的资源 mapc.dispose(); return mapImage; }- 指定者:
viewByScale在接口中Map- 参数:
center- 中心点。scale- 比例尺。mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 center 为空。
- 参数 scale 小于等于零。
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
-
zoom
public MapImage zoom(Point2D center, double ratio, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据指定的中心点、缩放比例、地图参数和图片输出设置进行地图缩放。
- 指定者:
zoom在接口中Map- 参数:
center- 中心点。ratio- 缩放比例。mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 center 为空。
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
- 参数 ratio 等于0。
-
viewEntire
public MapImage viewEntire(MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图参数以及图片输出设置进行全幅显示。
- 指定者:
viewEntire在接口中Map- 参数:
mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.mapName的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
-
getTrackingLayerImage
public MapImage getTrackingLayerImage(MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图参数、图片输出设置获取 TrackingLayer 的图片。
- 指定者:
getTrackingLayerImage在接口中Map- 参数:
mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
- 没有高亮几何对象。
-
findNearest
public QueryResult findNearest(Geometry geometry, double maxDistance, QueryParameterSet queryParameterSet, java.lang.String mapName) throws MapException
在指定地图上,查找距离指定几何对象一定容限内的几何对象。 当限制了返回几何对象个数(由
QueryParameterSet.expectCount指定)时,查询结果为查询总记录中距离指定中心最近的expectCount个地物,这expectCount个地物按无序排列。- 指定者:
findNearest在接口中Map- 参数:
geometry- 几何对象。maxDistance- 容限范围,单位同当前地图对应的数据集坐标单位(coordUnit)。queryParameterSet- 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在queryParameterSet.queryParams[i]中进行设置。mapName- 地图名称。- 返回:
- 查询结果对象。
- 抛出:
MapException- 地图服务组件异常信息。名称为 mapName 的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 geometry 为空。
- 参数 maxDistance 小于等于零。
- 参数 queryParameterSet 为空。
- 参数 mapName 为空。
- 参数
queryParameterSet.queryParams为空,或数组长度为0。
- 参数 geometry 为空。
-
viewEntire
public MapImage viewEntire(java.lang.String layerName, MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图图层名、地图参数以及图片输出设置进行全幅显示。
参数中指定的图层名称是指以该图层内容的最小外接矩形作为全幅显示的地理范围。
- 指定者:
viewEntire在接口中Map- 参数:
layerName- 地图图层名,即以该图层的最小外接矩形作为全幅显示的地理范围。mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
-
getOverview
public Overview getOverview(MapParameter mapParameter, ImageOutputOption outputOption) throws MapException
根据地图参数以及图片输出设置获取鹰眼。
- 指定者:
getOverview在接口中Map- 参数:
mapParameter- 地图参数。outputOption- 图片输出设置。- 返回:
- 地图图片对象。
- 抛出:
MapException- 地图服务组件异常信息。当名称为mapParameter.name的地图不存在时,抛出该异常。java.lang.IllegalArgumentException- 当出现以下情况时会抛出 IllegalArgumentException 异常:
- 参数 mapParameter 为空。
- 参数 outputOption 为空。
-
getDynamicPrjCoordsyses
public java.util.List<PrjCoordSys> getDynamicPrjCoordsyses(java.lang.String mapName) throws MapException
- 指定者:
getDynamicPrjCoordsyses在接口中Map- 抛出:
MapException
-
getChartFeatureInfoSpecs
public java.util.List<ChartFeatureInfoSpec> getChartFeatureInfoSpecs(java.lang.String mapName) throws MapException
海图功能用,获取海图所有物标类型。- 指定者:
getChartFeatureInfoSpecs在接口中Map- 抛出:
MapException
-
queryChart
public QueryResult queryChart(java.lang.String mapName, java.lang.String[] chartLayerNames, ChartQueryParameterSet chartQueryParams) throws MapException
海图功能用,物标属性查询。- 指定者:
queryChart在接口中Map- 抛出:
MapException
-
queryChart
public QueryResult queryChart(java.lang.String mapName, java.lang.String[] chartLayerNames, ChartQueryParameterSet chartQueryParams, Rectangle2D bounds) throws MapException
海图功能用,物标boudns查询- 指定者:
queryChart在接口中Map- 抛出:
MapException
-
queryChartFeatureByBounds
public ChartFeatureQueryResult queryChartFeatureByBounds(java.lang.String mapName, Rectangle2D bounds) throws MapException
- 指定者:
queryChartFeatureByBounds在接口中Map- 抛出:
MapException
-
getUTFGrid
public UTFGridResult getUTFGrid(UTFGridParameter gridParameter) throws MapException
根据地理范围从指定图层中提取UTFGrid对象。- 指定者:
getUTFGrid在接口中Map- 参数:
gridParameter- UTFGrid请求参数对象。- 返回:
- 返回UTFGrid对应JSONObject对象。
- 抛出:
MapException- 异常信息。
-
getDefaultMapParameterNoCache
public MapParameter getDefaultMapParameterNoCache(MapProvider mapProvider, java.lang.String mapName) throws MapException
- 抛出:
MapException
-
dispose
public void dispose()
释放该地图服务组件所占用的资源。
- 指定者:
dispose在接口中Disposable
-
dispose
public void dispose(boolean disposeProvidersInContext)
-
setComponentContext
public void setComponentContext(ComponentContext context)
设置地图服务组件上下文。
- 指定者:
setComponentContext在接口中ComponentContextAware- 参数:
context- 地图服务组件上下文。
-
setComponentContext
protected void setComponentContext(ComponentContext context, ImageTileCache<TileSourceInfo> tileCache, UTFGridTileCache<TileSourceInfo> utfGridTileCache, VectorTileCache<TileSourceInfo> vectorTileCache)
-
getTilesetInfos
public TilesetInfo[] getTilesetInfos(java.lang.String mapName)
返回指定地图对应的所有切片集
- 指定者:
getTilesetInfos在接口中Tileable- 参数:
mapName-- 返回:
- 从以下版本开始:
- 8.0.0
-
getProvider
protected MapProvider getProvider(java.lang.String name)
获取指定地图对应的地图服务提供者(MapProvider)。
- 参数:
name- 地图名称。该参数不能为空。- 返回:
- 返回一个 MapProvider 对象。
-
getQueryProvider
protected MapProvider getQueryProvider(java.lang.String name)
获取查询功能需要的地图服务提供者。
- 参数:
name- 地图名称- 返回:
- 返回一个MapProvider对象。
-
isExpired
protected boolean isExpired(long createTime, TileType type)
-
getMVTTile
public byte[] getMVTTile(VectorTileParameter vectorTileParameter) throws MapException
从接口复制的说明:VectorTileCapabilities获取MVT地图切片。- 指定者:
getMVTTile在接口中VectorTileCapabilities- 参数:
vectorTileParameter- 矢量地图切片参数。- 返回:
- MVT地图切片内容。
- 抛出:
MapException
-
getVectorTile
public VectorTileData getVectorTile(VectorTileParameter vectorTileParameter) throws MapException
从接口复制的说明:Map获取矢量地图切片。
- 指定者:
getVectorTile在接口中Map- 参数:
vectorTileParameter- 矢量地图切片参数。- 返回:
- 矢量地图切片内容。
- 抛出:
MapException
-
support
public boolean support(java.lang.String mapName, MapCapability capability)从接口复制的说明:Map判断地图是否支持相应功能。
-
queryByKeywords
public QueryResult queryByKeywords(java.lang.String mapName, KeywordsQueryParameterSet queryParameterSet) throws MapException
从接口复制的说明:Map根据关键字查询地图上的要素。- 指定者:
queryByKeywords在接口中Map- 参数:
mapName- 地图名。queryParameterSet- 查询参数集合。- 返回:
- 抛出:
MapException
-
getVectorStyle
public VectorStyle getVectorStyle(java.lang.String mapName, java.lang.String[] layerNames, VectorStyleType type) throws MapException
从接口复制的说明:VectorTileCapabilities获取指定地图中,指定矢量图层的样式。- 指定者:
getVectorStyle在接口中VectorTileCapabilities- 参数:
mapName- 地图名称。layerNames- 图层名称。type- 矢量样式类型。- 返回:
- 矢量样式字符串。
- 抛出:
MapException
-
getVectorStyle
public VectorStyle getVectorStyle(VectorStyleParameter vectorStyleParameter) throws MapException
从接口复制的说明:VectorTileCapabilities获取指定地图中,指定矢量图层的样式。- 指定者:
getVectorStyle在接口中VectorTileCapabilities- 参数:
vectorStyleParameter- 矢量风格参数。- 返回:
- 矢量样式字符串。
- 抛出:
MapException
-
updateVectorStyle
public void updateVectorStyle(java.lang.String mapName, java.lang.String layerName, VectorStyleType type, java.lang.String style)从接口复制的说明:Map更新指定地图中,指定矢量图层的样式。- 指定者:
updateVectorStyle在接口中Map- 参数:
mapName- 地图名称。layerName- 图层名称。type- 矢量样式类型。style- 新的样式。
-
listMVTSprites
public java.lang.String[] listMVTSprites(java.lang.String mapName)
从接口复制的说明:VectorTileCapabilities列出指定地图所有的Sprites名字。- 指定者:
listMVTSprites在接口中VectorTileCapabilities- 参数:
mapName- 地图名。- 返回:
- 所有的Sprites名字。
-
getMVTSpriteJson
public java.lang.String getMVTSpriteJson(java.lang.String mapName, java.lang.String spriteName)从接口复制的说明:VectorTileCapabilities获取指定地图指定Sprite的json字符串。- 指定者:
getMVTSpriteJson在接口中VectorTileCapabilities- 参数:
mapName- 地图名。spriteName- sprite名字。- 返回:
- Sprite的json字符串。
-
getMVTSpriteResource
public byte[] getMVTSpriteResource(java.lang.String mapName, java.lang.String spriteName)从接口复制的说明:VectorTileCapabilities获取指定地图指定Sprite的资源。- 指定者:
getMVTSpriteResource在接口中VectorTileCapabilities- 参数:
mapName- 地图名。spriteName- sprite名字。- 返回:
- Sprite的资源。
-
getMVTFonts
public byte[] getMVTFonts(java.lang.String mapName, java.lang.String fontstack, java.lang.String range)从接口复制的说明:VectorTileCapabilities获取指定地图sdf格式的字体数据。- 指定者:
getMVTFonts在接口中VectorTileCapabilities- 参数:
mapName- 地图名。fontstack- 字体名称。range- 编码区域。- 返回:
- 字体数据字节数组。
-
updateMap
public boolean updateMap(MapParameter mapParameter) throws MapException
从接口复制的说明:Map永久更新地图状态,会更新到磁盘中进行持久化。- 指定者:
updateMap在接口中Map- 参数:
mapParameter- 要更新的地图状态。- 返回:
- 是否更新成功。
- 抛出:
MapException
-
getProjectionExtent
public Rectangle2D getProjectionExtent(java.lang.String mapName)
从接口复制的说明:Map获取当前投影下的范围
- 指定者:
getProjectionExtent在接口中Map- 返回:
-
getFieldsByLayerName
public java.util.List<FieldInfo> getFieldsByLayerName(java.lang.String mapName, LayerFieldsQueryParameter layerFieldsQueryParameter)
从接口复制的说明:Map通过图层查询参数获取图层的fields信息- 指定者:
getFieldsByLayerName在接口中Map- 参数:
mapName- 地图名称,用于获取对应的providerlayerFieldsQueryParameter- 查询参数。- 返回:
- fields列表
-
getSymbol
public SymbolInfo getSymbol(java.lang.String mapName, int symbolId, ResourceType resourceType)
从接口复制的说明:Map获取symbol信息。
-
addSymbol
public int addSymbol(java.lang.String mapName, SymbolInfo symbolInfo, ResourceType resourceType)
-
-