类名 GroundPrimitiveLayer

# new GroundPrimitiveLayer(options, url)

参数:

名称 类型 默认值 描述
options Object

构造参数

id String getGUID()

图层id

url Cesium.Resource | String

options.url 服务地址,格式如下:
1、IGS1.0服务基地址:http://{ip}:{port}/igs/rest/mrms/docs/{文件夹名(可选)}:{serviceName}
2、IGS2.0服务基地址:http://{ip}:{port}/igs/rest/services/{文件夹名(可选)}/{serviceName}/MapServer

options.layers String null

要显示的子图层id,多个子图层以逗号分隔,'layer1,layer2,...',如果要显示所有层,则请传一个空字符串

options.viewer Cesium.Viewer

cesium视图对象

options.spatialReference SpatialReference new SpatialReference({wkid: 4326})

图层空间参考系,默认4326参考系

options.layerType LayerType 'igs-map-image'

图层类型,默认为IGS地图图片图层。支持'igs-map-image'IGS地图图片图层、'wms'OGC-WMS图层、'arcgis-map-image'ArcGIS地图图片图层。

options.layerExtent Extent

图层显示范围

options.extendProps Extent {}

图层服务额外属性。例如MWS服务可传service、styles

options.layerRectangle Extent

图层显示范围

options.show Extent

图层显示范围

options.normalTileWidth Array 1280

通用出图图片宽度,默认为1280px

options.httpMethod String 'GET'

HTTP请求方式,"GET"、"POST",默认为GET请求

options.headers Object null

HTTP请求头,传入方式见下方示例,请严格按照HTTP请求头属性填写,可传入请求方式为POST时的编码方式,默认方式为"text/plain",请注意IGS.NET版本服务目前只支持"text/plain"的编码方式

options.enablePickFeatures Boolean false

是否启用瓦片要素获取

options.minimumLevel number 0

图层最小请求瓦片级别,小于该级别不再请求瓦片

options.maximumLevel number

图层最大请求瓦片级别,大于该级别不再请求瓦片

options.gdbps Array []

gdbps地址数组

options.filters String null

用户指定的图层过滤条件,它由多个键值对组成,值为过滤条件

options.extensions Array []

自定义扩展参数,将参数里面的对象解析出来拼装在出图地址后面

options.proxy String null

转发代理

options.dynamicLayers Array []

动态图层信息

options.build2DImageResource function null

重载build2DImageResource方法,来重载瓦片的请求逻辑

options.clientId String Math.random().toString(36).substring(2)

客户端id,用户的唯一标识;在地图服务中,调用接口时如果修改了地图的状态,包括设置动态投影、设置图层显示隐藏等,为了提升并发性能,服务端会根据clientId来生成临时地图,最佳做法是一个浏览器生成一个固定的唯一值;建议普通用户不要传该参数,webclient会根据当前浏览器生成一个固定的唯一值

options.isAntialiasing Boolean | undefined

返回的图片时,是否开启服务端抗锯齿功能;启用抗锯齿功能后,显示效果会更清晰,但会导致出图速度变慢,true表示开启抗锯齿,false表示关闭抗锯齿,如果没有设置,则默认应用地图文档(MapX)上的设置参数

options.classificationType Cesium.ClassificationType Cesium.ClassificationType.TERRAIN

贴图模式,分为贴地形、贴模型、两者都贴三种模式

示例

添加WMS图层示例

// ES5引入方式
const { IGSMapImageLayer, WMSLayer } = zondy.layer
const { GroundPrimitiveLayer } = zondy.cesium
const { initializeOptions } = zondy.cesium.util
// ES6引入方式
import { IGSMapImageLayer } from "@mapgis/webclient-common"
import { GroundPrimitiveLayer, initializeOptions } from "@mapgis/webclient-cesium-plugin"
// 初始化igs地图图片图层
const igsMapImageLayer = new IGSMapImageLayer({
  // url: "http://webclient.smaryun.com:8089/igs/rest/services/Map/湖北省3857/MapServer",
  url: "http://webclient.smaryun.com:8089/igs/rest/services/Map/WorldMKTVector/MapServer",
  renderMode: "image",
})

// 初始化wms图层
const wmsLayer = new WMSLayer({
  // 服务基地址
  url: "http://webclient.smaryun.com:8089/igs/rest/services/Map/湖北省4326/WMSServer",
  renderMode: "image",
})
igsMapImageLayer.load().then((layer) => {
  // 获取GroundPrimitiveLayer的初始化参数
  const options = initializeOptions(layer, viewer)
  const groundPrimitiveLayer =
    new zondy.cesium.GroundPrimitiveLayer(
      Object.assign(options, {
        viewer: viewer,
      })
    )
  // 添加图形
  groundPrimitiveLayer.addLayer()
  // 移除图形
  // groundPrimitiveLayer.removeLayer()
})
wmsLayer.load().then((layer) => {
  // 获取provider的初始化参数
  const options = initializeOptions(layer, viewer)
  const groundPrimitiveLayer =
    new GroundPrimitiveLayer(
      Object.assign(options, {
        viewer: viewer,
      })
    )
  // 添加图形
  groundPrimitiveLayer.addLayer()
  // 移除图形
  // groundPrimitiveLayer.removeLayer()
})

// 初始化arcgis地图图片图层
const arcgisMapImageLayer = new ArcGISMapImageLayer({
  // 服务基地址
  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer",
  renderMode: "image",
})
arcgisMapImageLayer.load().then((layer) => {
  // 获取provider的初始化参数
  const options = initializeOptions(layer, viewer)
  const groundPrimitiveLayer = new GroundPrimitiveLayer(
    Object.assign(options, {
      viewer: viewer,
    })
  )
  // 添加图形
  groundPrimitiveLayer.addLayer()
  // 移除图形
  // groundPrimitiveLayer.removeLayer()
})

成员变量

String

# static id

图层id

PrimitivesCollection

# primitivesCollection

空间裁剪范围

方法

# addLayer()

添加图形

# removeLayer()

移除图形

构造函数
成员变量
方法
事件