FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

【站点】【杨琨】【添加示例】 · MapGIS/WebClient-JavaScript@3b857a3 · GitHub

Commit 3b857a3

Browse files
committed
【站点】【杨琨】【添加示例】
1 parent c0d7344 commit 3b857a3

2 files changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
4+
<head>
5+
<meta charset='utf-8' />
6+
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
7+
<title>标绘工具(三维)</title>
8+
<!--引入第三方的jquery脚本库-->
9+
<script include="jquery" src="./static/libs/include-lib-local.js"></script>
10+
<script src="./static/libs/include-cesium-local.js"></script>
11+
<!--当前示例页面样式表引用-->
12+
<link rel="stylesheet" href="./static/demo/cesium-new/example/style.css" />
13+
<style>
14+
.mapgis-3d-button{
15+
padding: 10px;
16+
border-radius: 4px;
17+
background: white;
18+
position: absolute;
19+
top: 10px;
20+
left: 10px;
21+
cursor: pointer;
22+
}
23+
</style>
24+
<script>
25+
'use strict';
26+
//定义三维视图的主要类
27+
var viewer;
28+
// 设置太阳时间
29+
//UTC
30+
var utc = Cesium.JulianDate.fromDate(new Date('2021/05/04 12:00:00'));
31+
//北京时间=UTC+8=GMT+8
32+
viewer.clockViewModel.currentTime = Cesium.JulianDate.addHours(utc, 8, new Cesium.JulianDate());
33+
34+
//标绘图层对象
35+
var graphicsLayer;
36+
//绘制参数
37+
var drawOptions;
38+
//绘制类型,默认为绘制点
39+
var draw3DType;
40+
41+
//地图初始化函数
42+
function init() {
43+
//构造三维视图类(视图容器div的id,三维视图设置参数)
44+
viewer = new Cesium.Viewer('mapgis-3d-viewer', {});
45+
viewer.showPosition();
46+
47+
//加载楼房数据
48+
var url = 'http://192.168.88.204:8089/M3D/1.0/ks_buildings_result/ks_buildings_result.mcj';
49+
var options = {
50+
debugWireframe: false,
51+
debugShowBoundingVolume: false,
52+
maximumScreenSpaceError: 4
53+
};
54+
viewer.scene.layers.appendM3DLayer(url, options);
55+
56+
//初始化编辑结束函数
57+
function finishEdit(result) {
58+
console.log('finishEdit:', result);
59+
}
60+
//初始化绘制结束函数
61+
function getGraphic(result) {
62+
console.log('绘制结束:', result);
63+
}
64+
//初始化标绘图层
65+
graphicsLayer = new Cesium.GraphicsLayer(viewer, { finishEdit: finishEdit, getGraphic: getGraphic });
66+
}
67+
68+
//选择绘制类型
69+
function selectDrawType() {
70+
draw3DType = $('select option:selected').val();
71+
}
72+
73+
//开始绘制
74+
function startDraw() {
75+
draw3DType = draw3DType || 'circle';
76+
//停止上一次绘制
77+
graphicsLayer.stopDrawing();
78+
switch (draw3DType){
79+
//绘制圆柱体
80+
case 'circle':
81+
graphicsLayer.startDrawing({
82+
type: 'circle',
83+
style: {
84+
color: Cesium.Color.LIGHTPINK,
85+
extrudedHeight: 100
86+
}
87+
});
88+
break;
89+
}
90+
}
91+
</script>
92+
</head>
93+
94+
<body onload="init()">
95+
<div id="mapgis-3d-viewer">
96+
</div>
97+
<select class="mapgis-3d-button" onchange="selectDrawType()">
98+
<option value ="circle">绘制圆柱体</option>
99+
</select>
100+
<div onclick="startDraw()" style="left: 130px" class="mapgis-3d-button">开始绘制</div>
101+
</body>
102+
103+
</html>

‎website/public/static/demo/config/config-cesium-new.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@
297297
"icon": "measure-plot.png",
298298
"update": "最后更新时间:2022-03-14"
299299
},
300+
{
301+
"name": "标绘工具(3D)",
302+
"file": "graohic-layer-3d",
303+
"diffcult": "1",
304+
"detail": "",
305+
"icon": "measure-plot.png",
306+
"update": "最后更新时间:2022-03-14"
307+
},
300308
{
301309
"name": "模型编辑",
302310
"file": "tool-edit",

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL