xyj3d API 文档 - v1.0.0
    正在准备搜索索引...

    动态水面 Primitive。

    用 Cesium.Primitive + PolygonGeometry + EllipsoidSurfaceAppearance 渲染一块水面, 默认材质是库内注册的 WaterSurface(三组解析正弦波 + 菲涅尔 + 太阳高光), 所以不需要任何贴图就能看到流动的波纹。

    也可以传入自己的 material(任意 BaseProperty 子类),此时会用它 getType() / getValue() 的结果去 Cesium.Material.fromType()。

    const lake = new xyj3d.primitive.WaterPrimitive(
    [
    { lng: 116.38, lat: 39.9, alt: 0 },
    { lng: 116.40, lat: 39.9, alt: 0 },
    { lng: 116.40, lat: 39.92, alt: 0 },
    { lng: 116.38, lat: 39.92, alt: 0 },
    ],
    [],
    { height: 8, color: '#2196c9', deepColor: '#04202f', speed: 1.4 }
    )
    lake.addTo(layer)

    层级 (查看层级一览)

    索引

    构造函数

    • 构造方法

      参数

      参数名称类型默认值描述信息
      positionsPosition—任意类型的坐标数组
      holesPosition—多边形内环坐标数组,详情查看 Cesium.PolygonHierarchy
      styleRecord—样式,见 WaterPrimitive#setStyle

      返回 WaterPrimitive

    属性

    graphicId: string

    地图覆盖物基础类

    id: string

    地图覆盖物基础类

    show: boolean

    地图覆盖物基础类

    attr: Record<string, unknown>

    地图覆盖物基础类

    allowDrillPicking: unknown

    地图覆盖物基础类

    graphicEvent: GraphicEvent

    地图覆盖物基础类

    graphic: Graphic

    地图覆盖物基础类

    state: string

    地图覆盖物基础类

    contextMenu: unknown

    地图覆盖物基础类

    type: string

    图形类型

    positions: Position[]

    任意类型的坐标

    holes: Position[][]

    内环坐标数组

    方法

    • 参数

      参数名称类型默认值描述信息
      typestring—

      返回 unknown

    • 参数

      参数名称类型默认值描述信息
      typestring—

      返回 unknown

    • 为实体设置文字标签,仅对 Cesium.Entity 类型的图形生效

      参数

      参数名称类型默认值描述信息
      textstring—文字内容
      textStyleRecord—文字样式,参考 Cesium.Label 属性

      返回 Graphic

      this - 当前实体对象

    • 把当前实体从所属图层移除

      返回 Graphic

      this - 当前实体对象

    • 将实体加入图层

      参数

      参数名称类型默认值描述信息
      layerxyj3d—图层

      返回 Graphic

      this - 当前实体对象

      Layer

    • 注册图形事件

      参数

      参数名称类型默认值描述信息
      typestring—事件类型
      callbackunknown—事件回调
      contextRecord—回调上下文

      返回 Graphic

      this - 当前实体对象

    • 取消图形事件

      参数

      参数名称类型默认值描述信息
      typestring—事件类型
      callbackunknown—事件回调
      contextRecord—回调上下文

      返回 Graphic

      this - 当前实体对象

    • 触发图形事件

      参数

      参数名称类型默认值描述信息
      typestring—事件类型
      paramsRecord—事件携带参数

      返回 Graphic

      this - 当前实体对象

    • 触发图形事件

      参数

      参数名称类型默认值描述信息
      typestring—事件类型

      返回 Graphic

      this - 当前实体对象

    • 触发图形事件

      参数

      参数名称类型默认值描述信息
      typestring—事件类型

      返回 Graphic

      this - 当前实体对象

    • 设置样式

      参数

      • style: Record<string, unknown>

        样式

        • color

          浅水色(垂直视角看到的水色)

        • deepColor

          深水色(掠射/背光时看到的水色)

        • height

          水面高度(米),perPositionHeight 为 true 时忽略

        • perPositionHeight

          是否用每个顶点自身的高度

        • speed

          流速,越大波纹跑得越快

        • waveScale

          波纹密度,越大越碎

        • waveStrength

          波纹法线扰动强度

        • specularIntensity

          太阳高光强度

        • specularPower

          高光锐度

        • rippleHighlight

          波纹明暗起伏

        • material

          自定义材质,传了就不再拼 WaterSurface

      返回 Graphic

      • 返回自己,链式调用