presentation.html
5.33 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/JavaScript.js"></script>
<script src="../../js/popupJS.js"></script>
<link rel="stylesheet" href="../../css/layer.css">
<link rel="stylesheet" href="../../icon/iconfont.css">
</head>
<body marginwidth="0" marginheight="0">
<div id="mainDiv" class="dialog donghua">
<h1 class="title" onmousedown="MouseDown(event)" onmouseup="MouseUp(event)" onmouseout="MouseUp(event)">
动画演示<i class="guanbibtn" onclick="Close()">X</i>
</h1>
<div class="main">
<div class="tool">
<i class="iconfont icon-tianjia-" title="新增演示工具" onclick="addNewDonghua()"></i>
</div>
<div class="tool">
<i class="iconfont icon-tianjia-" title="新增" onclick="addFly()"></i>
<i class="iconfont icon-bofang" title="播放" onclick="play()"></i>
<i class="iconfont icon-zanting" title="暂停" onclick="pause()"></i>
<i class="iconfont icon-daobo" title="倒退" onclick="previous()"></i>
<i class="iconfont icon-dancibofang-" title="播放一次" onclick="playOnce()"></i>
<i class="iconfont icon-xunhuan-" title="无线循环" onclick="loop()"></i>
<i class="iconfont icon--" title="删除节点" onclick="delFly()"></i>
</div>
<ul class="ul" id="liitems">
<li class="item">
<span class="check"></span>
<span class="id">ID</span>
<span class="describe">描述</span>
</li>
</ul>
</div>
</div>
<script>
var flymode = [];
var presentation = undefined;
var seletValue = -1;
function addView() {
alert("aa");
}
function addNewDonghua() {
//无论 presentation是否为undefined,都需要创建演示工具
var sgWorld = CreateSGObj();
presentation = sgWorld.Creator.CreatePresentation(
"",
"演示工具"
);
sgWorld.ProjectTree.EditItem(presentation.ID, 1);
flymode = [];
selectValue = -1;
alert("已创建新的演示工具!");
}
function addFly() {
if (presentation !== undefined) {
var index = flymode.length + 1;
flymode.push({ index: index, describe: "位置信息" });
// playIndex = 0;
// sgWorld.Command.Execute(1099, 0);//添加位置的命令
//获取当前的视角位置,并将其加入到演示工具中
var sgWorld = CreateSGObj();
var currentPos = sgWorld.Navigate.GetPosition(0);
//演示工具新添加了一个移动摄像机到不同位置的演示步骤
presentation.CreateLocationStep(1, 0, "", currentPos);
var str = "<li class='item' >" +
"<span class='check'>" +
"<input type='radio' class='checkStep' name='checkStep' />" +
"</span>" +
"<span class='id'>" + index + "</span>" +
"<span class='describe'>位置信息</span></li>";
$(".ul").append(str);
}
}
function play() {
if (presentation !== undefined) {
//播放
if (presentation.PresentationStatus === 1) {
//PS_NOTPLAYING = 1
presentation.PlayMode = 0;
presentation.PlayAlgorithm = 1;
presentation.PlaySpeedFactor = 2;
presentation.Play(0);
} else if (presentation.PresentationStatus === 2) {
presentation.Resume(); //让演示工具从暂停的那一步恢复演示
}
}
}
function pause() {
//暂停
if (
presentation !== undefined &&
presentation.PresentationStatus === 0
) {
presentation.Pause();
}
}
function previous() {
//上一步
if (presentation !== undefined) {
// sgWorld.Command.Execute(1114, 0);
presentation.PreviousStep();
presentation.Resume();
}
}
function playOnce() {
//播放一次
if (presentation !== undefined) presentation.LoopRoute = false;
}
function loop() {
//循环
if (presentation !== undefined) presentation.LoopRoute = true;
}
function delFly() {
//获取单选框中选中的对象的index(序号),用于删除在演示工具中的节点
if (presentation !== undefined) {
let delIndex = $('input[class="checkStep"]:checked').index('input[class="checkStep"]');
if (delIndex !== -1) {
flymode.splice(delIndex, 1);
presentation.DeleteStep(delIndex);
$(".item").eq(delIndex + 1).remove();
}
}
}
</script>
</body>
</html>