bigmap-plugin 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +1394 -1390
- package/dist/bigmap-plugin.js +635 -615
- package/dist/bigmap-plugin.umd.cjs +39 -39
- package/dist/index.d.ts +54 -11
- package/dist/libs/bigemap/bigemap.css +838 -1
- package/dist/libs/bigemap/bm.geometryutil.js +754 -1
- package/dist/libs/bigemap/bmgl-header.js +110 -2
- package/dist/libs/bigemap/circleWave.js +284 -34
- package/dist/libs/bigemap/moveMarker.js +74 -1
- package/dist/libs/bigemap/widgets.css +1 -1
- package/package.json +66 -66
- package/dist/libs/bigemap/bigemap-gl.js +0 -1
|
@@ -1,2 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
(function () {
|
|
2
|
+
"use strict";
|
|
3
|
+
var defaultAction;
|
|
4
|
+
var bucket = window.location.href;
|
|
5
|
+
var pos = bucket.lastIndexOf("/");
|
|
6
|
+
if (pos > 0 && pos < bucket.length - 1) {
|
|
7
|
+
bucket = bucket.substring(pos + 1);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
window.Sandcastle = {
|
|
11
|
+
bucket: bucket,
|
|
12
|
+
declare: function () { },
|
|
13
|
+
highlight: function () { },
|
|
14
|
+
registered: [],
|
|
15
|
+
finishedLoading: function () {
|
|
16
|
+
window.Sandcastle.reset();
|
|
17
|
+
|
|
18
|
+
if (defaultAction) {
|
|
19
|
+
window.Sandcastle.highlight(defaultAction);
|
|
20
|
+
defaultAction();
|
|
21
|
+
defaultAction = undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
document.body.className = document.body.className.replace(
|
|
25
|
+
/(?:\s|^)sandcastle-loading(?:\s|$)/,
|
|
26
|
+
" "
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
addToggleButton: function (text, checked, onchange, toolbarID) {
|
|
30
|
+
window.Sandcastle.declare(onchange);
|
|
31
|
+
var input = document.createElement("input");
|
|
32
|
+
input.checked = checked;
|
|
33
|
+
input.type = "checkbox";
|
|
34
|
+
input.style.pointerEvents = "none";
|
|
35
|
+
var label = document.createElement("label");
|
|
36
|
+
label.appendChild(input);
|
|
37
|
+
label.appendChild(document.createTextNode(text));
|
|
38
|
+
label.style.pointerEvents = "none";
|
|
39
|
+
var button = document.createElement("button");
|
|
40
|
+
button.type = "button";
|
|
41
|
+
button.className = "cesium-button";
|
|
42
|
+
button.appendChild(label);
|
|
43
|
+
|
|
44
|
+
button.onclick = function () {
|
|
45
|
+
window.Sandcastle.reset();
|
|
46
|
+
window.Sandcastle.highlight(onchange);
|
|
47
|
+
input.checked = !input.checked;
|
|
48
|
+
onchange(input.checked);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
document.getElementById(toolbarID || "toolbar").appendChild(button);
|
|
52
|
+
},
|
|
53
|
+
addToolbarButton: function (text, onclick, toolbarID) {
|
|
54
|
+
window.Sandcastle.declare(onclick);
|
|
55
|
+
var button = document.createElement("button");
|
|
56
|
+
button.type = "button";
|
|
57
|
+
button.className = "cesium-button";
|
|
58
|
+
button.onclick = function () {
|
|
59
|
+
window.Sandcastle.reset();
|
|
60
|
+
window.Sandcastle.highlight(onclick);
|
|
61
|
+
onclick();
|
|
62
|
+
};
|
|
63
|
+
button.textContent = text;
|
|
64
|
+
document.getElementById(toolbarID || "toolbar").appendChild(button);
|
|
65
|
+
},
|
|
66
|
+
addDefaultToolbarButton: function (text, onclick, toolbarID) {
|
|
67
|
+
window.Sandcastle.addToolbarButton(text, onclick, toolbarID);
|
|
68
|
+
defaultAction = onclick;
|
|
69
|
+
},
|
|
70
|
+
addDefaultToolbarMenu: function (options, toolbarID) {
|
|
71
|
+
window.Sandcastle.addToolbarMenu(options, toolbarID);
|
|
72
|
+
defaultAction = options[0].onselect;
|
|
73
|
+
},
|
|
74
|
+
addToolbarMenu: function (options, toolbarID) {
|
|
75
|
+
var menu = document.createElement("select");
|
|
76
|
+
menu.className = "cesium-button";
|
|
77
|
+
menu.onchange = function () {
|
|
78
|
+
window.Sandcastle.reset();
|
|
79
|
+
var item = options[menu.selectedIndex];
|
|
80
|
+
if (item && typeof item.onselect === "function") {
|
|
81
|
+
item.onselect();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
document.getElementById(toolbarID || "toolbar").appendChild(menu);
|
|
85
|
+
|
|
86
|
+
if (!defaultAction && typeof options[0].onselect === "function") {
|
|
87
|
+
defaultAction = options[0].onselect;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (var i = 0, len = options.length; i < len; ++i) {
|
|
91
|
+
var option = document.createElement("option");
|
|
92
|
+
option.textContent = options[i].text;
|
|
93
|
+
option.value = options[i].value;
|
|
94
|
+
menu.appendChild(option);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
reset: function () { },
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
if (window.location.protocol === "file:") {
|
|
101
|
+
if (
|
|
102
|
+
window.confirm(
|
|
103
|
+
"You must host this app on a web server.\nSee contributor's guide for more info?"
|
|
104
|
+
)
|
|
105
|
+
) {
|
|
106
|
+
window.location =
|
|
107
|
+
"https://github.com/CesiumGS/cesium/wiki/Contributor%27s-Guide";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
@@ -1,34 +1,284 @@
|
|
|
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
|
-
|
|
1
|
+
/***
|
|
2
|
+
* 鍏竟褰㈡墿鏁f晥鏋�
|
|
3
|
+
* 鍙傝€僩itee寮€婧恡s浠g爜
|
|
4
|
+
* 鍙栨秷import鍜宔xport锛屾暣鍚堜袱涓被
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// 鐐规晥鏋滈泦鍚� 鐖剁被
|
|
8
|
+
class Effect {
|
|
9
|
+
viewer;
|
|
10
|
+
id;
|
|
11
|
+
duration;
|
|
12
|
+
maxRadius;
|
|
13
|
+
pointDraged;
|
|
14
|
+
leftDownFlag;
|
|
15
|
+
update_position;
|
|
16
|
+
constructor(viewer, id) {
|
|
17
|
+
this.viewer = viewer
|
|
18
|
+
this.id = id
|
|
19
|
+
this.duration = 1000
|
|
20
|
+
this.maxRadius = 1000
|
|
21
|
+
this.pointDraged = null
|
|
22
|
+
this.leftDownFlag = false
|
|
23
|
+
}
|
|
24
|
+
change_duration(d) {
|
|
25
|
+
this.duration = d
|
|
26
|
+
}
|
|
27
|
+
change_color(val) {
|
|
28
|
+
const curEntity = this.viewer.entities.getById(this.id)
|
|
29
|
+
curEntity._ellipse._material.color = new bmgl.Color.fromCssColorString(
|
|
30
|
+
val
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
change_position(p) {
|
|
34
|
+
const cartesian3 = bmgl.Cartesian3.fromDegrees(
|
|
35
|
+
parseFloat(p[0]),
|
|
36
|
+
parseFloat(p[1]),
|
|
37
|
+
parseFloat(p[2])
|
|
38
|
+
)
|
|
39
|
+
const curEntity = this.viewer.entities.getById(this.id)
|
|
40
|
+
curEntity.position = cartesian3
|
|
41
|
+
}
|
|
42
|
+
del() {
|
|
43
|
+
this.viewer.entities.removeById(this.id)
|
|
44
|
+
}
|
|
45
|
+
add(
|
|
46
|
+
position,
|
|
47
|
+
color,
|
|
48
|
+
maxRadius,
|
|
49
|
+
duration,
|
|
50
|
+
isEdit = false
|
|
51
|
+
) {
|
|
52
|
+
const _this = this
|
|
53
|
+
this.duration = duration
|
|
54
|
+
this.maxRadius = maxRadius
|
|
55
|
+
if (!isEdit) {
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function leftDownAction(e) {
|
|
60
|
+
_this.pointDraged = _this.viewer.scene.pick(e.position) // 閫夊彇褰撳墠鐨別ntity
|
|
61
|
+
if (
|
|
62
|
+
_this.pointDraged &&
|
|
63
|
+
_this.pointDraged.id &&
|
|
64
|
+
_this.pointDraged.id.id === _this.id
|
|
65
|
+
) {
|
|
66
|
+
_this.leftDownFlag = true
|
|
67
|
+
_this.viewer.scene.screenSpaceCameraController.enableRotate = false // 閿佸畾鐩告満
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function leftUpAction(e) {
|
|
72
|
+
_this.leftDownFlag = false
|
|
73
|
+
_this.pointDraged = null
|
|
74
|
+
_this.viewer.scene.screenSpaceCameraController.enableRotate = true // 瑙i攣鐩告満
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function mouseMoveAction(e) {
|
|
78
|
+
if (
|
|
79
|
+
_this.leftDownFlag === true &&
|
|
80
|
+
_this.pointDraged !== null &&
|
|
81
|
+
_this.pointDraged !== undefined
|
|
82
|
+
) {
|
|
83
|
+
const ray = _this.viewer.camera.getPickRay(e.endPosition)
|
|
84
|
+
const cartesian = _this.viewer.scene.globe.pick(ray, _this.viewer.scene)
|
|
85
|
+
_this.pointDraged.id.position = cartesian // 姝ゅ鏍规嵁鍏蜂綋entity鏉ュ鐞嗭紝涔熷彲鑳芥槸pointDraged.id.position=cartesian;
|
|
86
|
+
// 杩欓噷绗涘崱灏斿潗鏍囪浆 缁忕含搴�
|
|
87
|
+
const ellipsoid = _this.viewer.scene.globe.ellipsoid
|
|
88
|
+
const cartographic = ellipsoid.cartesianToCartographic(cartesian)
|
|
89
|
+
const lat = bmgl.Math.toDegrees(cartographic.latitude)
|
|
90
|
+
const lng = bmgl.Math.toDegrees(cartographic.longitude)
|
|
91
|
+
let alt = cartographic.height
|
|
92
|
+
alt = alt < 0 ? 0 : alt
|
|
93
|
+
if (_this.update_position) {
|
|
94
|
+
_this.update_position([lng.toFixed(8), lat.toFixed(8), alt])
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.viewer.screenSpaceEventHandler.setInputAction(
|
|
100
|
+
leftDownAction,
|
|
101
|
+
bmgl.ScreenSpaceEventType.LEFT_DOWN
|
|
102
|
+
)
|
|
103
|
+
this.viewer.screenSpaceEventHandler.setInputAction(
|
|
104
|
+
leftUpAction,
|
|
105
|
+
bmgl.ScreenSpaceEventType.LEFT_UP
|
|
106
|
+
)
|
|
107
|
+
this.viewer.screenSpaceEventHandler.setInputAction(
|
|
108
|
+
mouseMoveAction,
|
|
109
|
+
bmgl.ScreenSpaceEventType.MOUSE_MOVE
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 姘存尝绾规墿鏁f潗璐�
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* @param {*} color 棰滆壊
|
|
119
|
+
* @param {*} duration 鎸佺画鏃堕棿 姣
|
|
120
|
+
* @param {*} count 娉㈡氮鏁伴噺
|
|
121
|
+
* @param {*} gradient 娓愬彉鏇茬巼
|
|
122
|
+
*/
|
|
123
|
+
function CircleWaveMaterialProperty(ob) {
|
|
124
|
+
this._definitionChanged = new bmgl.Event()
|
|
125
|
+
this._color = undefined
|
|
126
|
+
this._colorSubscription = undefined
|
|
127
|
+
this.color = ob.color
|
|
128
|
+
this.duration = bmgl.defaultValue(ob.duration, 1000)
|
|
129
|
+
this.count = bmgl.defaultValue(ob.count, 2)
|
|
130
|
+
if (this.count <= 0) {
|
|
131
|
+
this.count = 1
|
|
132
|
+
}
|
|
133
|
+
this.gradient = bmgl.defaultValue(ob.gradient, 0.1)
|
|
134
|
+
if (this.gradient === 0) {
|
|
135
|
+
this.gradient = 0
|
|
136
|
+
}
|
|
137
|
+
if (this.gradient > 1) {
|
|
138
|
+
this.gradient = 1
|
|
139
|
+
}
|
|
140
|
+
this._time = new Date().getTime()
|
|
141
|
+
}
|
|
142
|
+
Object.defineProperties(CircleWaveMaterialProperty.prototype, {
|
|
143
|
+
isConstant: {
|
|
144
|
+
get: function () {
|
|
145
|
+
return false
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
definitionChanged: {
|
|
149
|
+
get: function () {
|
|
150
|
+
return this._definitionChanged
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
color: bmgl.createPropertyDescriptor('color'),
|
|
154
|
+
duration: bmgl.createPropertyDescriptor('duration'),
|
|
155
|
+
count: bmgl.createPropertyDescriptor('count'),
|
|
156
|
+
})
|
|
157
|
+
CircleWaveMaterialProperty.prototype.getType = function (_time) {
|
|
158
|
+
return bmgl.Material.CircleWaveMaterialType
|
|
159
|
+
}
|
|
160
|
+
CircleWaveMaterialProperty.prototype.getValue = function (
|
|
161
|
+
time,
|
|
162
|
+
result
|
|
163
|
+
) {
|
|
164
|
+
if (!bmgl.defined(result)) {
|
|
165
|
+
result = {}
|
|
166
|
+
}
|
|
167
|
+
result.color = bmgl.Property.getValueOrClonedDefault(
|
|
168
|
+
this._color,
|
|
169
|
+
time,
|
|
170
|
+
bmgl.Color.WHITE,
|
|
171
|
+
result.color
|
|
172
|
+
)
|
|
173
|
+
result.time =
|
|
174
|
+
((new Date().getTime() - this._time) % this.duration) / this.duration
|
|
175
|
+
result.count = this.count
|
|
176
|
+
result.gradient = 1 + 10 * (1 - this.gradient)
|
|
177
|
+
return result
|
|
178
|
+
}
|
|
179
|
+
CircleWaveMaterialProperty.prototype.equals = function (other) {
|
|
180
|
+
const reData = (
|
|
181
|
+
this === other ||
|
|
182
|
+
(other instanceof CircleWaveMaterialProperty &&
|
|
183
|
+
bmgl.Property.equals(this._color, other._color))
|
|
184
|
+
)
|
|
185
|
+
return reData
|
|
186
|
+
}
|
|
187
|
+
bmgl.CircleWaveMaterialProperty = CircleWaveMaterialProperty
|
|
188
|
+
bmgl.Material.CircleWaveMaterialType = 'CircleWaveMaterial'
|
|
189
|
+
bmgl.Material.CircleWaveSource = `
|
|
190
|
+
czm_material czm_getMaterial(czm_materialInput materialInput) {
|
|
191
|
+
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
192
|
+
material.diffuse = 1.5 * color.rgb;
|
|
193
|
+
vec2 st = materialInput.st;
|
|
194
|
+
vec3 str = materialInput.str;
|
|
195
|
+
float dis = distance(st, vec2(0.5, 0.5));
|
|
196
|
+
float per = fract(time);
|
|
197
|
+
if (abs(str.z) > 0.001) {
|
|
198
|
+
discard;
|
|
199
|
+
}
|
|
200
|
+
if (dis > 0.5) {
|
|
201
|
+
discard;
|
|
202
|
+
} else {
|
|
203
|
+
float perDis = 0.5 / count;
|
|
204
|
+
float disNum;
|
|
205
|
+
float bl = .0;
|
|
206
|
+
for (int i = 0; i <= 9; i++) {
|
|
207
|
+
if (float(i) <= count) {
|
|
208
|
+
disNum = perDis *float(i) - dis + per / count;
|
|
209
|
+
if (disNum > 0.0) {
|
|
210
|
+
if (disNum < perDis) {
|
|
211
|
+
bl = 1.0 - disNum / perDis;
|
|
212
|
+
} else if(disNum - perDis < perDis) {
|
|
213
|
+
bl = 1.0 - abs(1.0 - disNum / perDis);
|
|
214
|
+
}
|
|
215
|
+
material.alpha = pow(bl, gradient);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return material;
|
|
221
|
+
}
|
|
222
|
+
`
|
|
223
|
+
bmgl.Material._materialCache.addMaterial(
|
|
224
|
+
bmgl.Material.CircleWaveMaterialType, {
|
|
225
|
+
fabric: {
|
|
226
|
+
type: bmgl.Material.CircleWaveMaterialType,
|
|
227
|
+
uniforms: {
|
|
228
|
+
color: new bmgl.Color(1, 0, 0, 1),
|
|
229
|
+
time: 1,
|
|
230
|
+
count: 1,
|
|
231
|
+
gradient: 0.1,
|
|
232
|
+
},
|
|
233
|
+
source: bmgl.Material.CircleWaveSource,
|
|
234
|
+
},
|
|
235
|
+
translucent: function (material) {
|
|
236
|
+
return true
|
|
237
|
+
},
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
// 姘存尝绾�
|
|
242
|
+
class CircleWave extends Effect {
|
|
243
|
+
count;
|
|
244
|
+
constructor(viewer, id) {
|
|
245
|
+
super(viewer, id)
|
|
246
|
+
}
|
|
247
|
+
change_duration(d) {
|
|
248
|
+
super.change_duration(d)
|
|
249
|
+
const curEntity = this.viewer.entities.getById(this.id)
|
|
250
|
+
curEntity._ellipse._material.duration = d
|
|
251
|
+
}
|
|
252
|
+
change_waveCount(d) {
|
|
253
|
+
const curEntity = this.viewer.entities.getById(this.id)
|
|
254
|
+
curEntity._ellipse._material.count = d
|
|
255
|
+
}
|
|
256
|
+
add(position, color, maxRadius, duration, isedit = false, count = 3) {
|
|
257
|
+
super.add(position, color, maxRadius, duration, isedit)
|
|
258
|
+
const _this = this
|
|
259
|
+
this.count = count
|
|
260
|
+
this.viewer.entities.add({
|
|
261
|
+
id: _this.id,
|
|
262
|
+
position: bmgl.Cartesian3.fromDegrees(
|
|
263
|
+
position[0],
|
|
264
|
+
position[1],
|
|
265
|
+
position[2]
|
|
266
|
+
),
|
|
267
|
+
ellipse: {
|
|
268
|
+
// height: position[2],
|
|
269
|
+
semiMinorAxis: new bmgl.CallbackProperty(function (n) {
|
|
270
|
+
return _this.maxRadius
|
|
271
|
+
}, false),
|
|
272
|
+
semiMajorAxis: new bmgl.CallbackProperty(function (n) {
|
|
273
|
+
return _this.maxRadius
|
|
274
|
+
}, false),
|
|
275
|
+
material: new bmgl.CircleWaveMaterialProperty({
|
|
276
|
+
duration: duration,
|
|
277
|
+
gradient: 0,
|
|
278
|
+
color: new bmgl.Color.fromCssColorString(color),
|
|
279
|
+
count: count,
|
|
280
|
+
}),
|
|
281
|
+
},
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -1 +1,74 @@
|
|
|
1
|
-
BM.Marker.addInitHook(function
|
|
1
|
+
BM.Marker.addInitHook(function () {
|
|
2
|
+
this.moveOptions = {
|
|
3
|
+
origin: null,
|
|
4
|
+
timer: null,
|
|
5
|
+
done: 0,
|
|
6
|
+
path: null,
|
|
7
|
+
length: 0,
|
|
8
|
+
replay: true
|
|
9
|
+
};
|
|
10
|
+
this.setSpeed = function (speed) {
|
|
11
|
+
this.moveOptions.speed = isNaN(parseFloat(speed)) || parseFloat(speed) <= 0 ? 200 : parseFloat(speed);
|
|
12
|
+
};
|
|
13
|
+
this.getSpeed = function () {
|
|
14
|
+
return this.moveOptions.speed;
|
|
15
|
+
};
|
|
16
|
+
this.moveAlong = function (path, speed, param) {
|
|
17
|
+
path = path instanceof BM.Polyline ? path : new BM.Polyline(path);
|
|
18
|
+
this.moveOptions.path = path;
|
|
19
|
+
this.moveOptions.replay = param.replay ?? true;
|
|
20
|
+
this.moveOptions.length = BM.GeometryUtil.length(path);
|
|
21
|
+
this.moveOptions.speed = isNaN(parseFloat(speed)) || parseFloat(speed <= 0) ? 200 : parseFloat(speed);
|
|
22
|
+
this._move();
|
|
23
|
+
setTimeout(()=>{
|
|
24
|
+
console.log(this);
|
|
25
|
+
},5000)
|
|
26
|
+
};
|
|
27
|
+
this.pauseMove = function () {
|
|
28
|
+
clearInterval(this.moveOptions.timer);
|
|
29
|
+
this.moveOptions.timer = null;
|
|
30
|
+
};
|
|
31
|
+
this.resumeMove = function () {
|
|
32
|
+
if(!this.moveOptions.path){
|
|
33
|
+
throw('未导入路径');
|
|
34
|
+
}
|
|
35
|
+
this._move();
|
|
36
|
+
};
|
|
37
|
+
this.stopMove = function () {
|
|
38
|
+
this.pauseMove();
|
|
39
|
+
this.moveOptions.done = 0;
|
|
40
|
+
};
|
|
41
|
+
this._move = function () {
|
|
42
|
+
if (this.moveOptions.timer) return;
|
|
43
|
+
let _t = this;
|
|
44
|
+
this.moveOptions.timer = setInterval(function () {
|
|
45
|
+
let done = _t.moveOptions.done;
|
|
46
|
+
done += _t.moveOptions.speed / 1000 * 20;
|
|
47
|
+
let radio = done / _t.moveOptions.length;
|
|
48
|
+
if (_t.moveOptions.replay) {
|
|
49
|
+
radio >= 1 ? (radio = 0, done = 0) : true;
|
|
50
|
+
} else {
|
|
51
|
+
if (radio >= 1) {
|
|
52
|
+
let p = BM.GeometryUtil.interpolateOnLine(_t._map, _t.moveOptions.path, true);
|
|
53
|
+
p.predecessor+=1;
|
|
54
|
+
let passed = _t.moveOptions.path.getLatLngs().slice(0, p.predecessor+1);
|
|
55
|
+
_t.fire('update_position', { path: passed, index: p.predecessor });
|
|
56
|
+
_t.stopMove();
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_t.moveOptions.done = done;
|
|
61
|
+
let p = BM.GeometryUtil.interpolateOnLine(_t._map, _t.moveOptions.path, radio);
|
|
62
|
+
_t.setLatLng(p.latLng);
|
|
63
|
+
let pre_p = _t.moveOptions.path.getLatLngs()[p.predecessor];
|
|
64
|
+
if (pre_p) {
|
|
65
|
+
let passed = _t.moveOptions.path.getLatLngs().slice(0, p.predecessor + 1);
|
|
66
|
+
passed.push(p.latLng);
|
|
67
|
+
_t.fire('update_position', { path: passed, index: p.predecessor });
|
|
68
|
+
let deg = BM.GeometryUtil.computeAngle(_t._map.project(pre_p), _t._map.project(p.latLng))
|
|
69
|
+
_t._icon.style.transformOrigin = '50% 50%';
|
|
70
|
+
_t._icon.style.transform += ' rotateZ(' + deg + 'deg)';
|
|
71
|
+
}
|
|
72
|
+
}, 20);
|
|
73
|
+
}
|
|
74
|
+
});
|