xgis-ol
Version:
基于openlayers + ol-ext库进行封装
153 lines (152 loc) • 5.91 kB
TypeScript
import { Projection, ProjectionLike } from 'ol/proj';
import { Options as TileLayerOptions } from 'ol/layer/BaseTile';
import { default as TileLayer } from 'ol/layer/Tile';
import { default as TileSource } from 'ol/source/Tile';
import { default as TileDebug } from 'ol/source/TileDebug';
import { default as TileGrid } from 'ol/tilegrid/TileGrid';
import { default as WMTSSource, Options as WMTSSourceOptions } from 'ol/source/WMTS';
import { default as WMTSTileGrid } from 'ol/tilegrid/WMTS';
import { IWMTSLayerInfo } from './Models';
import { default as XMap } from './XMap';
/**
* 辅助加载WMTS图层和天地图图层
*/
export default class WMTSTool {
private tdtKeys;
private xmap;
constructor(pXMap: XMap, ptdtKeys: string[]);
/**
* 设置天地图Key数组
* @param keys
*/
setTDTKeys(keys: string[]): void;
/**
* 通过Options参数添加WMTS图层(专业的)
* @param targetXMap 目标地图包装对象
* @param layerOption 图层选项
* @param sourceOption 数据源选项
* 包括下面:
* layerName: string,
* tileMatrixSet: string,
* tileURL: string,
* tileGrid: WMTSTileGrid,
* prj:Projection 图层投影
* style: string = "default",
* requestEncoding: RequestEncoding = "KVP",
* format: string = "image/png"
* @param alias 别名
* @returns
*/
addWMTSLayerByOptions2(targetXMap: XMap, layerOption: TileLayerOptions<WMTSSource>, sourceOption: WMTSSourceOptions, alias?: string): TileLayer<TileSource>;
/**
* 通过Options参数添加WMTS图层(专业的)
* @param layerOption 图层选项
* @param sourceOption 数据源选项
* 包括下面:
* layerName: string,
* tileMatrixSet: string,
* tileURL: string,
* tileGrid: WMTSTileGrid,
* prj:Projection 图层投影
* style: string = "default",
* requestEncoding: RequestEncoding = "KVP",
* format: string = "image/png"
* @param alias 别名
* @returns
*/
addWMTSLayerByOptions(layerOption: TileLayerOptions<WMTSSource>, sourceOption: WMTSSourceOptions, alias?: string): TileLayer<TileSource>;
/**
* 带别名的 加载WMTS图层
* @param aliasName 别名
* @param layerName 图层名
* @param tileMatrixSet 矩阵名
* @param tileURL 瓦片地址
* @param tileGrid 瓦片矩阵
* @param prjObj 投影对象,默认地图投影
* @param style 地图样式,可空
* @param minZoom 最小级别
* @param maxZoom 最大级别
* @returns
*/
addWMTSLayer2(aliasName: string, layerName: string, tileMatrixSet: string, tileURL: string, tileGrid?: WMTSTileGrid, prjObj?: Projection, style?: string, minZoom?: number, maxZoom?: number): TileLayer<TileSource>;
/**
* 加载WMTS图层的方法(之前的),注册图层管理
* @param layerName 图层名
* @param tileMatrixSet 矩阵集标识
* @param tileURL 瓦片地址,例如:http://192.168.1.109:9007/IMGWMTS
* @param tileGrid 瓦片矩阵,默认为天地图墨卡托矩阵
* @param prjObj 图层投影,默认为空,则使用地图投影
* @param style 默认为default
* @param requestEncoding 默认为KVP
* @param format 默认格式
* @param aliasName 图层别名
* @returns
*/
addWMTSLayer(layerName: string, tileMatrixSet: string, tileURL: string, tileGrid?: WMTSTileGrid, prjObj?: Projection, style?: string, requestEncoding?: "KVP" | "REST", format?: string): TileLayer<TileSource>;
/**
* 针对多投影的影像WMTS服务
* 根据自主的WMTS元数据,来加载WMTS
* @param pxMap
* @param res 自定义WMTS图层元数据
* @param layerName 图层名
*/
addWMTSLayerSelf(res: IWMTSLayerInfo, layerName: string): TileLayer<TileSource>;
getTDTAlias(layerName: string): string;
/**
* 添加天地图图层(注册图层管理)
* @param tdtLayer 图层名
* @param aliasName 别名
* @returns
*/
addTDTLayer(tdtLayer?: string, aliasName?: string): TileLayer<TileSource> | undefined;
/**
* 对外,单独给地图添加天地图图层(不注册图层管理)
* @param tdtKeys 天地图KEY集合
* @param xmap XMap对象
* @param tdtLayer 图层名
* @param aliasName 别名
* @returns
*/
addTDTLayerOnly(tdtLayer: string, aliasName?: string): TileLayer<TileSource> | undefined;
/**
* 获取天地图的URL地址数组
* @param layerName 图层名
* @param tdtKeys 天地图授权KEY集合
* @returns
*/
getTDTUrls(tdtLayer: string, tdtKeys: string[]): string[];
/**
* 通过WMTS图层,添加对应TileGrid的调试图层
* @param wmtsLayer WMTS图层
* @returns Debug图层
*/
addWMTSDebugLayer(wmtsLayer: TileLayer<TileSource>): TileLayer<TileDebug>;
/**
* 添加对应投影和TileGrid的调试图层
* @param xmap XMap地图
* @param tilegid TileGrid瓦片方案
* @param prjLike ProjectionLike投影对象
* @returns
*/
addTileDebugLayer(tilegid: TileGrid, prjLike: ProjectionLike): TileLayer<TileDebug>;
/**
* 加载离线天地图瓦片服务
*
* @param localTDTMapURL 模版地址,例如http://192.168.1.122:9000/DataServer?T={layerName}&x={x}&y={y}&l={z}
* @param tdtlayers
*
*/
addLocalTDTLayerXYZ(localTDTMapURL: string, tdtlayers: string[]): void;
/**
* 加载离线天地图的单个图层
* @param localTDTMapURL
* @param item
*/
addSingleLocalTDTLayerXYZ(localTDTMapURL: string, item: string): void;
/**
* 与PrjGridTool的getXMLOptionsFromCapabilities方法配合使用
* 通过传入XMLOptions对象加载WMTS图层
* @param xmlOptions
*/
addWMTSLayerByXMLOptions(xmlOptions: any): void;
}