Class: PolylineVolume

PolylineVolume

用于三维中绘制管道要素

// 计算 shape
function computeCircle(radius) {
  const positions = [];
  for (let i = 0; i < 360; i++) {
    const radians = CesiumMath.toRadians(i);
    positions.push({
      x: radius * Math.cos(radians),
      y: radius * Math.sin(radians)
    });
  }
  return positions;
}
// 添加图层
const layer = new EntityLayer().addToViewer(this.$viewer);
const polylineVolume = new PolylineVolume(
  [
    new Position(118.78653636, 31.91315607, -0.14395184),
    new Position(118.78717476, 31.91365014, 0.9309363),
    new Position(118.78773082, 31.91401772, 0.65392468),
    new Position(118.78792258, 31.91435828, 4.09293584)
  ],
  computeCircle(5)
).addToLayer(layer);
polylineVolume.setStyle({
  material: Color.fromCssColor("rgba(241,12,12,0.9)"),
  outline: false
});
// 注册 polylineVolume 鼠标移入事件
polylineVolume.on(MouseEventType.CLICK, evt => {
  console.log(evt);
});

new PolylineVolume(positions, shape)

overlay/base/PolylineVolume.js, line 49
Name Type Description
positions Array.<Position>

坐标串

shape Array.<Cartesian2>

要拉伸的形状的位置数组

Extends

Classes

PolylineVolume

Members

attr

覆盖物的额外属性设置

readonlydelegate

覆盖物的代理对象

id

设置覆盖物的业务 id

readonlyoverlayEvent

覆盖物的事件对象

readonlyoverlayId

覆盖物唯一标识

show

覆盖物的可见性

readonlystate

覆盖物的状态

Methods

staticPolylineVolume.fromEntity(entity, shape){any}

overlay/base/PolylineVolume.js, line 145

从 entity 中解析出 PolylineVolume

Name Type Description
entity Entity
shape Cartesian2

要拉伸的形状的位置数组

Returns:
Type Description
any

inherited addToLayer(layer){Overlay}

overlay/Overlay.js, line 242

添加到指定图层

Name Type Description
layer EntityLayer

指定图层

Returns:
Type Description
Overlay

inherited fire(type, params){Overlay}

overlay/Overlay.js, line 282

触发事件

Name Type Description
type *
params *
Returns:
Type Description
Overlay

inherited off(type, callback, context){Overlay}

overlay/Overlay.js, line 270

注销事件

Name Type Description
type *

事件类型

callback *

监听回调

context *
Returns:
Type Description
Overlay

inherited on(type, callback, context){Overlay}

overlay/Overlay.js, line 257

注册事件

Name Type Description
type *

事件类型

callback *

监听回调

context *
Returns:
Type Description
Overlay

inherited remove(){Overlay}

overlay/Overlay.js, line 229

从图层上移出

Returns:
Type Description
Overlay

setStyle(style){PolylineVolume}

overlay/base/PolylineVolume.js, line 128

设置管道要素的样式

Name Type Description
style Object

样式可选属性

// 样式参数(可选)
{
  "cornerType": 0, //转角类别,0:圆角、1:直角、2:斜角
  "fill": true, //是否用提供的材料填充多边形。
  "material": Color.WHITE, //材质
  "outline": false, //是否显示边框
  "outlineColor": Color.BLACK, //边框颜色
  "outlineWidth": 0, //边框宽度
  "shadows": 0, //阴影类型,0:禁用、1:启用 、2:投射、3:接受
  "distanceDisplayCondition": {
    "near": 0, //最近距离
    "far": Number.MAX_VALUE //最远距离
  } //根据距离设置可见
}
Returns:
Type Description
PolylineVolume