# FacilityBuild
创建设施建造
let draw = new GeowayGlobe.Draw({
viewer: viewer,
});
draw.create(
"POLYLINE",
{
style: {
material: Cesium.Color.fromCssColorString("#00ffff"),
},
},
(_entity, _positions) => {
viewer.entities.remove(_entity);
let positions = _positions;
let lastPoint = positions[0];
let cartographic = Cesium.Cartographic.fromCartesian(lastPoint);
let groundHeight = viewer.scene.globe.getHeight(cartographic);
let pierHeight = 16;
let height = groundHeight + pierHeight;
let metaModel = GeowayGlobe.MetaModel.railway;
this.facilityBuild = new GeowayGlobe.FacilityBuild({
viewer,
positions,
height,
metaModel,
echarts: echarts,
});
this.facilityBuild.generateFacilities((result) => {
console.log(result);
});
}
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# FacilityBuild options 构造属性
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
viewer | 地球实例 | Object | viewer |
positions | 建造区域 | Array | Null |
height | 建造高度 | Number | Null |
metaModel | 相关的模型 | String | Null |