cesium_dev_kit 1.0.48 → 1.0.50
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/.babelrc +13 -0
- package/dist/ColorDeal.js +59 -0
- package/dist/common.js +40 -0
- package/dist/index.js +23 -13561
- package/dist/initConf.js +188 -0
- package/dist/libs/Analysis.js +779 -0
- package/dist/libs/Base.js +950 -0
- package/dist/libs/ChartLayer.js +24 -0
- package/dist/libs/Control.js +947 -0
- package/dist/libs/CustomCesiumPlugin.js +92 -0
- package/dist/libs/DomUtil.js +105 -0
- package/dist/libs/Draw.js +704 -0
- package/dist/libs/Graphics.js +734 -0
- package/dist/libs/MapvLayer.js +26 -0
- package/dist/libs/Material.js +590 -0
- package/dist/libs/Math2d.js +559 -0
- package/dist/libs/Math3d.js +646 -0
- package/dist/libs/PassEffect.js +154 -0
- package/dist/libs/Plugin.js +751 -0
- package/dist/libs/Primitive.js +1559 -0
- package/dist/libs/Shaders.js +298 -0
- package/dist/libs/ThreeJs.js +190 -0
- package/dist/libs/cesium-plugin.js +3387 -0
- package/dist/libs/index.js +117 -0
- package/dist/libs/plot/AttackArrow.js +266 -0
- package/dist/libs/plot/BasePlot.js +41 -0
- package/dist/libs/plot/PincerArrow.js +278 -0
- package/dist/libs/plot/StraightArrow.js +244 -0
- package/dist/libs/plot/algorithm.js +315 -0
- package/dist/libs/plot/index.js +19 -0
- package/dist/libs/plot/plotUtil.js +242 -0
- package/index.js +1 -1
- package/package.json +5 -12
- package/dist/index.min.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* mapv 插件
|
|
5
|
+
*/
|
|
6
|
+
function MapvLayer() {
|
|
7
|
+
this._mapvLayer = null;
|
|
8
|
+
}
|
|
9
|
+
MapvLayer.prototype = {
|
|
10
|
+
createMapvLayer(option) {
|
|
11
|
+
if (this._viewer && option) {
|
|
12
|
+
this._mapvLayer = new mapv.cesiumMapLayer(this._viewer, new mapv.DataSet([]), option || {});
|
|
13
|
+
this._viewer.scene.canvas.setAttribute('tabIndex', 0);
|
|
14
|
+
return this._mapvLayer;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
setMapvData(dataSet, option) {
|
|
18
|
+
if (dataSet && option) {
|
|
19
|
+
this._mapvLayer && this._mapvLayer.update({
|
|
20
|
+
data: dataSet,
|
|
21
|
+
option: option
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
removeMapvLayer() {}
|
|
26
|
+
};
|
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Material = Material;
|
|
7
|
+
let Cesium = null;
|
|
8
|
+
/**
|
|
9
|
+
* 材质模块
|
|
10
|
+
* @param {*} viewer
|
|
11
|
+
*/
|
|
12
|
+
function Material(viewer, cesiumGlobal) {
|
|
13
|
+
if (viewer) {
|
|
14
|
+
Cesium = cesiumGlobal;
|
|
15
|
+
this._installMaterial();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
Material.prototype = {
|
|
19
|
+
/**
|
|
20
|
+
* 添加材质线
|
|
21
|
+
* 动态炫光线
|
|
22
|
+
* @param {*} options
|
|
23
|
+
*/
|
|
24
|
+
addMaterialLineGraphics: function (options) {
|
|
25
|
+
if (this._viewer && options && options.image) {
|
|
26
|
+
// 初始化自定义材质线
|
|
27
|
+
this._initPolylineCustomMaterialProperty(options);
|
|
28
|
+
var _entity = this.createGraphics();
|
|
29
|
+
_entity.polyline = {
|
|
30
|
+
positions: options.positions,
|
|
31
|
+
material: new Cesium.PolylineCustomMaterialProperty({
|
|
32
|
+
color: options.color || Cesium.Color.RED,
|
|
33
|
+
duration: options.duration || 500
|
|
34
|
+
}),
|
|
35
|
+
width: options.width
|
|
36
|
+
};
|
|
37
|
+
return this._viewer.entities.add(_entity);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* 获取一个材质线
|
|
42
|
+
* @param {*} options
|
|
43
|
+
*/
|
|
44
|
+
getCustomMaterialLine: function (options) {
|
|
45
|
+
if (this._viewer && options && options.image) {
|
|
46
|
+
// 初始化自定义材质线
|
|
47
|
+
return this._initPolylineCustomMaterialProperty(options);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
// 动态初始化材质线
|
|
51
|
+
_initPolylineCustomMaterialProperty(options) {
|
|
52
|
+
if (options) {
|
|
53
|
+
var Color = Cesium.Color,
|
|
54
|
+
defaultValue = Cesium.defaultValue,
|
|
55
|
+
defined = Cesium.defined,
|
|
56
|
+
defineProperties = Object.defineProperties,
|
|
57
|
+
Event = Cesium.Event,
|
|
58
|
+
createPropertyDescriptor = Cesium.createPropertyDescriptor,
|
|
59
|
+
Property = Cesium.Property,
|
|
60
|
+
Material = Cesium.Material,
|
|
61
|
+
defaultColor = Color.WHITE,
|
|
62
|
+
MaterialType = options.MaterialType || 'wallType' + parseInt(Math.random() * 1000);
|
|
63
|
+
const PolylineCustomMaterialProperty = function (options) {
|
|
64
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
65
|
+
this._definitionChanged = new Event();
|
|
66
|
+
this._color = undefined;
|
|
67
|
+
this._colorSubscription = undefined;
|
|
68
|
+
this.color = options.color || Cesium.Color.BLUE;
|
|
69
|
+
this.duration = options.duration || 1000;
|
|
70
|
+
this._time = undefined;
|
|
71
|
+
};
|
|
72
|
+
defineProperties(PolylineCustomMaterialProperty.prototype, {
|
|
73
|
+
isvarant: {
|
|
74
|
+
get: function () {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
definitionChanged: {
|
|
79
|
+
get: function () {
|
|
80
|
+
return this._definitionChanged;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
color: createPropertyDescriptor('color')
|
|
84
|
+
});
|
|
85
|
+
PolylineCustomMaterialProperty.prototype.getType = function () {
|
|
86
|
+
return MaterialType;
|
|
87
|
+
};
|
|
88
|
+
PolylineCustomMaterialProperty.prototype.getValue = function (time, result) {
|
|
89
|
+
if (!defined(result)) {
|
|
90
|
+
result = {};
|
|
91
|
+
}
|
|
92
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, defaultColor, result.color);
|
|
93
|
+
result.image = options.image;
|
|
94
|
+
if (this._time === undefined) {
|
|
95
|
+
this._time = time.secondsOfDay;
|
|
96
|
+
}
|
|
97
|
+
result.time = (time.secondsOfDay - this._time) * 1000 / this.duration;
|
|
98
|
+
return result;
|
|
99
|
+
};
|
|
100
|
+
PolylineCustomMaterialProperty.prototype.equals = function (other) {
|
|
101
|
+
return this === other ||
|
|
102
|
+
//
|
|
103
|
+
other instanceof PolylineCustomMaterialProperty && Property.equals(this._color, other._color);
|
|
104
|
+
};
|
|
105
|
+
Material._materialCache.addMaterial(MaterialType, {
|
|
106
|
+
fabric: {
|
|
107
|
+
type: MaterialType,
|
|
108
|
+
uniforms: {
|
|
109
|
+
color: options.color || new Cesium.Color(1.0, 0.0, 0.0, 0.5),
|
|
110
|
+
image: options.image,
|
|
111
|
+
time: options.color.time || 0
|
|
112
|
+
},
|
|
113
|
+
source: this._getDynamicLineShader({
|
|
114
|
+
get: true
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
translucent: function () {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return new PolylineCustomMaterialProperty(options);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* 动态围栏
|
|
126
|
+
* 炫光墙体
|
|
127
|
+
* @param {*} options
|
|
128
|
+
*/
|
|
129
|
+
addMaterialWallGraphics: function (options) {
|
|
130
|
+
if (this._viewer && options && options.image) {
|
|
131
|
+
// 初始化自定义材质
|
|
132
|
+
this._initWallCustomMaterialProperty(options);
|
|
133
|
+
var _entity = this.createGraphics();
|
|
134
|
+
_entity.wall = {
|
|
135
|
+
positions: options.positions,
|
|
136
|
+
material: new Cesium.Scene.WallLinkCustomMaterialProperty({
|
|
137
|
+
color: options.color || Cesium.Color.RED,
|
|
138
|
+
duration: options.duration || 500
|
|
139
|
+
}),
|
|
140
|
+
width: options.width
|
|
141
|
+
};
|
|
142
|
+
return this._viewer.entities.add(_entity);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* 获取一个材质围栏
|
|
147
|
+
* @param {*} options
|
|
148
|
+
*/
|
|
149
|
+
getCustomMaterialWall: function (options) {
|
|
150
|
+
if (this._viewer && options && options.image) {
|
|
151
|
+
return this._initWallCustomMaterialProperty(options);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
// 动态初始化材质线
|
|
155
|
+
_initWallCustomMaterialProperty(options) {
|
|
156
|
+
var Color = Cesium.Color,
|
|
157
|
+
defaultValue = Cesium.defaultValue,
|
|
158
|
+
defined = Cesium.defined,
|
|
159
|
+
defineProperties = Object.defineProperties,
|
|
160
|
+
Event = Cesium.Event,
|
|
161
|
+
createPropertyDescriptor = Cesium.createPropertyDescriptor,
|
|
162
|
+
Property = Cesium.Property,
|
|
163
|
+
Material = Cesium.Material,
|
|
164
|
+
MaterialType = options.MaterialType || 'wallType' + parseInt(Math.random() * 1000);
|
|
165
|
+
const WallLinkCustomMaterialProperty = function (options) {
|
|
166
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
167
|
+
this._definitionChanged = new Event();
|
|
168
|
+
this._color = undefined;
|
|
169
|
+
this._colorSubscription = undefined;
|
|
170
|
+
this.color = options.color || Color.BLUE;
|
|
171
|
+
this.duration = options.duration || 3000;
|
|
172
|
+
this._time = new Date().getTime();
|
|
173
|
+
};
|
|
174
|
+
defineProperties(WallLinkCustomMaterialProperty.prototype, {
|
|
175
|
+
isvarant: {
|
|
176
|
+
get: function () {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
definitionChanged: {
|
|
181
|
+
get: function () {
|
|
182
|
+
return this._definitionChanged;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
color: createPropertyDescriptor('color')
|
|
186
|
+
});
|
|
187
|
+
WallLinkCustomMaterialProperty.prototype.getType = function () {
|
|
188
|
+
return MaterialType;
|
|
189
|
+
};
|
|
190
|
+
WallLinkCustomMaterialProperty.prototype.getValue = function (time, result) {
|
|
191
|
+
if (!defined(result)) {
|
|
192
|
+
result = {};
|
|
193
|
+
}
|
|
194
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, Color.WHITE, result.color);
|
|
195
|
+
result.image = options.image;
|
|
196
|
+
result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
|
|
197
|
+
return result;
|
|
198
|
+
};
|
|
199
|
+
WallLinkCustomMaterialProperty.prototype.equals = function (other) {
|
|
200
|
+
return this === other || other instanceof WallLinkCustomMaterialProperty && Property.equals(this._color, other._color);
|
|
201
|
+
};
|
|
202
|
+
//动态墙
|
|
203
|
+
Material._materialCache.addMaterial(MaterialType, {
|
|
204
|
+
fabric: {
|
|
205
|
+
type: MaterialType,
|
|
206
|
+
uniforms: {
|
|
207
|
+
color: new Color(1.0, 0.0, 0.0, 0.5),
|
|
208
|
+
image: options.image,
|
|
209
|
+
time: 0
|
|
210
|
+
},
|
|
211
|
+
source: this._getDirectionWallShader({
|
|
212
|
+
get: true,
|
|
213
|
+
count: options.count,
|
|
214
|
+
freely: options.freely,
|
|
215
|
+
direction: options.direction
|
|
216
|
+
})
|
|
217
|
+
},
|
|
218
|
+
translucent: function () {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
Cesium.Scene.WallLinkCustomMaterialProperty = WallLinkCustomMaterialProperty;
|
|
223
|
+
return new WallLinkCustomMaterialProperty(options);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* 安装默认拓展材质
|
|
227
|
+
*/
|
|
228
|
+
_installMaterial: function () {
|
|
229
|
+
this._installWaveCircleMaterial();
|
|
230
|
+
this._installCircleFadeMaterial();
|
|
231
|
+
this._installCityLineMaterial();
|
|
232
|
+
this._installWarnMaterial();
|
|
233
|
+
this._installFlowMaterial();
|
|
234
|
+
},
|
|
235
|
+
// 波动圆材质
|
|
236
|
+
_installWaveCircleMaterial: function () {
|
|
237
|
+
var _self = this,
|
|
238
|
+
Color = Cesium.Color,
|
|
239
|
+
defaultValue = Cesium.defaultValue,
|
|
240
|
+
defineProperties = Object.defineProperties,
|
|
241
|
+
Event = Cesium.Event,
|
|
242
|
+
Property = Cesium.Property,
|
|
243
|
+
Material = Cesium.Material;
|
|
244
|
+
function CircleWaveMaterialProperty(options) {
|
|
245
|
+
options = options || {};
|
|
246
|
+
this._definitionChanged = new Event();
|
|
247
|
+
this._color = undefined;
|
|
248
|
+
this._colorSubscription = undefined;
|
|
249
|
+
this._duration = undefined;
|
|
250
|
+
this._durationSubscription = undefined;
|
|
251
|
+
this.color = defaultValue(options.color, Color.fromBytes(0, 255, 255, 255));
|
|
252
|
+
this.duration = defaultValue(options.duration, 45);
|
|
253
|
+
this.count = Math.max(defaultValue(options.count, 2), 1);
|
|
254
|
+
this.gradient = defaultValue(options.gradient, 0.1);
|
|
255
|
+
if (this.gradient < 0) {
|
|
256
|
+
this.gradient = 0;
|
|
257
|
+
} else if (this.gradient > 1) {
|
|
258
|
+
this.gradient = 1;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
defineProperties(CircleWaveMaterialProperty.prototype, {
|
|
262
|
+
isConstant: {
|
|
263
|
+
get: function () {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
definitionChanged: {
|
|
268
|
+
get: function () {
|
|
269
|
+
return this._definitionChanged;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
CircleWaveMaterialProperty.prototype.getType = function () {
|
|
274
|
+
return Material.CircleWaveType;
|
|
275
|
+
};
|
|
276
|
+
CircleWaveMaterialProperty.prototype.getValue = function (time, result) {
|
|
277
|
+
if (!result) {
|
|
278
|
+
result = {};
|
|
279
|
+
}
|
|
280
|
+
result.color = Property.getValueOrUndefined(this._color, time);
|
|
281
|
+
result.duration = this._duration;
|
|
282
|
+
result.count = this.count;
|
|
283
|
+
result.gradient = this.gradient;
|
|
284
|
+
return result;
|
|
285
|
+
};
|
|
286
|
+
CircleWaveMaterialProperty.prototype.equals = function (other) {
|
|
287
|
+
return this === other || other instanceof CircleWaveMaterialProperty && Cesium.Property.equals(this._color, other._color);
|
|
288
|
+
};
|
|
289
|
+
defineProperties(CircleWaveMaterialProperty.prototype, {
|
|
290
|
+
color: Cesium.createPropertyDescriptor('color'),
|
|
291
|
+
duration: Cesium.createPropertyDescriptor('duration')
|
|
292
|
+
});
|
|
293
|
+
Cesium.Scene.CircleWaveMaterialProperty = CircleWaveMaterialProperty;
|
|
294
|
+
Material.CircleWaveType = 'CircleWave';
|
|
295
|
+
Material._materialCache.addMaterial(Material.CircleWaveType, {
|
|
296
|
+
fabric: {
|
|
297
|
+
type: Material.CircleWaveType,
|
|
298
|
+
uniforms: {
|
|
299
|
+
color: new Color(1.0, 0.0, 0.0, 0.7),
|
|
300
|
+
duration: 45,
|
|
301
|
+
count: 1,
|
|
302
|
+
gradient: 0.1
|
|
303
|
+
},
|
|
304
|
+
source: _self._getDynamicCircleShader({
|
|
305
|
+
get: true
|
|
306
|
+
})
|
|
307
|
+
},
|
|
308
|
+
translucent: function () {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
// 渐变圆
|
|
314
|
+
_installCircleFadeMaterial: function () {
|
|
315
|
+
var Color = Cesium.Color,
|
|
316
|
+
defaultValue = Cesium.defaultValue,
|
|
317
|
+
defineProperties = Object.defineProperties,
|
|
318
|
+
Event = Cesium.Event,
|
|
319
|
+
Property = Cesium.Property,
|
|
320
|
+
Material = Cesium.Material,
|
|
321
|
+
_color = new Color(0, 0, 0, 0);
|
|
322
|
+
function CircleFadeMaterialProperty(options) {
|
|
323
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
324
|
+
this._definitionChanged = new Event();
|
|
325
|
+
this._color = void 0;
|
|
326
|
+
this._colorSubscription = void 0;
|
|
327
|
+
this.color = defaultValue(options.color, _color);
|
|
328
|
+
this._duration = options.duration || 1e3;
|
|
329
|
+
this._time = void 0;
|
|
330
|
+
}
|
|
331
|
+
defineProperties(CircleFadeMaterialProperty.prototype, {
|
|
332
|
+
isConstant: {
|
|
333
|
+
get: function () {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
definitionChanged: {
|
|
338
|
+
get: function () {
|
|
339
|
+
return this._definitionChanged;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
CircleFadeMaterialProperty.prototype.getType = function () {
|
|
344
|
+
return Material.CircleFadeMaterialType;
|
|
345
|
+
};
|
|
346
|
+
CircleFadeMaterialProperty.prototype.getValue = function (time, result) {
|
|
347
|
+
if (!result) {
|
|
348
|
+
result = {};
|
|
349
|
+
}
|
|
350
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, _color, result.color), void 0 === this._time && (this._time = new Date().getTime()), result.time = (new Date().getTime() - this._time) / this._duration;
|
|
351
|
+
return result;
|
|
352
|
+
};
|
|
353
|
+
CircleFadeMaterialProperty.prototype.equals = function (other) {
|
|
354
|
+
return this === other || other instanceof CircleFadeMaterialProperty && Cesium.Property.equals(this._color, other._color);
|
|
355
|
+
};
|
|
356
|
+
defineProperties(CircleFadeMaterialProperty.prototype, {
|
|
357
|
+
color: Cesium.createPropertyDescriptor('color')
|
|
358
|
+
});
|
|
359
|
+
Cesium.Scene.CircleFadeMaterialProperty = CircleFadeMaterialProperty;
|
|
360
|
+
Material.CircleFadeMaterialType = 'CircleFadeMaterial';
|
|
361
|
+
Material._materialCache.addMaterial(Material.CircleFadeMaterialType, {
|
|
362
|
+
fabric: {
|
|
363
|
+
type: Material.CircleFadeMaterialType,
|
|
364
|
+
uniforms: {
|
|
365
|
+
color: new Color(1, 0, 0, 1),
|
|
366
|
+
time: 1
|
|
367
|
+
},
|
|
368
|
+
source: this._getCircleFadeShader({
|
|
369
|
+
get: true
|
|
370
|
+
})
|
|
371
|
+
},
|
|
372
|
+
translucent: function () {
|
|
373
|
+
return !0;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
// 城市光效线
|
|
378
|
+
_installCityLineMaterial: function () {
|
|
379
|
+
var Color = Cesium.Color,
|
|
380
|
+
defaultValue = Cesium.defaultValue,
|
|
381
|
+
defined = Cesium.defined,
|
|
382
|
+
defineProperties = Object.defineProperties,
|
|
383
|
+
Event = Cesium.Event,
|
|
384
|
+
createPropertyDescriptor = Cesium.createPropertyDescriptor,
|
|
385
|
+
Property = Cesium.Property,
|
|
386
|
+
Material = Cesium.Material,
|
|
387
|
+
defaultColor = Color.WHITE;
|
|
388
|
+
function PolylineCityLinkMaterialProperty(options) {
|
|
389
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
390
|
+
this._definitionChanged = new Event();
|
|
391
|
+
this._color = undefined;
|
|
392
|
+
this._colorSubscription = undefined;
|
|
393
|
+
this.color = options.color || Cesium.Color.BLUE;
|
|
394
|
+
this.duration = options.duration || 1000;
|
|
395
|
+
this._time = undefined;
|
|
396
|
+
this._img = options.imgUrl || Material.PolylineCityLinkImage;
|
|
397
|
+
}
|
|
398
|
+
defineProperties(PolylineCityLinkMaterialProperty.prototype, {
|
|
399
|
+
isvarant: {
|
|
400
|
+
get: function () {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
definitionChanged: {
|
|
405
|
+
get: function () {
|
|
406
|
+
return this._definitionChanged;
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
color: createPropertyDescriptor('color')
|
|
410
|
+
});
|
|
411
|
+
PolylineCityLinkMaterialProperty.prototype.getType = function () {
|
|
412
|
+
return Material.PolylineCityLinkType;
|
|
413
|
+
};
|
|
414
|
+
PolylineCityLinkMaterialProperty.prototype.getValue = function (time, result) {
|
|
415
|
+
if (!defined(result)) {
|
|
416
|
+
result = {};
|
|
417
|
+
}
|
|
418
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, defaultColor, result.color);
|
|
419
|
+
result.image = this._img; //Material.PolylineCityLinkImage
|
|
420
|
+
if (this._time === undefined) {
|
|
421
|
+
this._time = time.secondsOfDay;
|
|
422
|
+
}
|
|
423
|
+
result.time = (time.secondsOfDay - this._time) * 1000 / this.duration;
|
|
424
|
+
return result;
|
|
425
|
+
};
|
|
426
|
+
PolylineCityLinkMaterialProperty.prototype.equals = function (other) {
|
|
427
|
+
return this === other ||
|
|
428
|
+
//
|
|
429
|
+
other instanceof PolylineCityLinkMaterialProperty && Property.equals(this._color, other._color);
|
|
430
|
+
};
|
|
431
|
+
Cesium.Scene.PolylineCityLinkMaterialProperty = PolylineCityLinkMaterialProperty;
|
|
432
|
+
Material.PolylineCityLinkType = 'PolylineCityLink';
|
|
433
|
+
Material.PolylineCityLinkImage = 'static/data/images/Textures/meteor_01.png';
|
|
434
|
+
Material._materialCache.addMaterial(Material.PolylineCityLinkType, {
|
|
435
|
+
fabric: {
|
|
436
|
+
type: Material.PolylineCityLinkType,
|
|
437
|
+
uniforms: {
|
|
438
|
+
color: new Color(1, 0, 0, 1.0),
|
|
439
|
+
image: Material.PolylineCityLinkImage,
|
|
440
|
+
time: 0
|
|
441
|
+
},
|
|
442
|
+
source: this._getDynamicLightLineShader({
|
|
443
|
+
get: true
|
|
444
|
+
})
|
|
445
|
+
},
|
|
446
|
+
translucent: function () {
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
},
|
|
451
|
+
// 城市警示墙
|
|
452
|
+
_installWarnMaterial: function () {
|
|
453
|
+
var Color = Cesium.Color,
|
|
454
|
+
defaultValue = Cesium.defaultValue,
|
|
455
|
+
defined = Cesium.defined,
|
|
456
|
+
defineProperties = Object.defineProperties,
|
|
457
|
+
Event = Cesium.Event,
|
|
458
|
+
createPropertyDescriptor = Cesium.createPropertyDescriptor,
|
|
459
|
+
Property = Cesium.Property,
|
|
460
|
+
Material = Cesium.Material;
|
|
461
|
+
function WarnLinkMaterialProperty(options) {
|
|
462
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
463
|
+
this._definitionChanged = new Event();
|
|
464
|
+
this._color = undefined;
|
|
465
|
+
this._colorSubscription = undefined;
|
|
466
|
+
this.color = options.color || Color.BLUE;
|
|
467
|
+
this.duration = options.duration || 3000;
|
|
468
|
+
this._time = new Date().getTime();
|
|
469
|
+
}
|
|
470
|
+
defineProperties(WarnLinkMaterialProperty.prototype, {
|
|
471
|
+
isvarant: {
|
|
472
|
+
get: function () {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
definitionChanged: {
|
|
477
|
+
get: function () {
|
|
478
|
+
return this._definitionChanged;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
WarnLinkMaterialProperty.prototype.getType = function () {
|
|
483
|
+
return Material.WarnLinkType;
|
|
484
|
+
};
|
|
485
|
+
WarnLinkMaterialProperty.prototype.getValue = function (time, result) {
|
|
486
|
+
if (!defined(result)) {
|
|
487
|
+
result = {};
|
|
488
|
+
}
|
|
489
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, Color.WHITE, result.color);
|
|
490
|
+
result.image = Material.WarnLinkImage;
|
|
491
|
+
result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
|
|
492
|
+
return result;
|
|
493
|
+
};
|
|
494
|
+
WarnLinkMaterialProperty.prototype.equals = function (other) {
|
|
495
|
+
return this === other || other instanceof WarnLinkMaterialProperty && Property.equals(this._color, other._color);
|
|
496
|
+
};
|
|
497
|
+
defineProperties(WarnLinkMaterialProperty.prototype, {
|
|
498
|
+
color: createPropertyDescriptor('color')
|
|
499
|
+
});
|
|
500
|
+
Cesium.Scene.WarnLinkMaterialProperty = WarnLinkMaterialProperty;
|
|
501
|
+
Material.WarnLinkType = 'WarnWallLinkType';
|
|
502
|
+
Material.WarnLinkImage = 'static/data/images/Textures/jsx2.png';
|
|
503
|
+
Material._materialCache.addMaterial(Material.WarnLinkType, {
|
|
504
|
+
fabric: {
|
|
505
|
+
type: Material.WarnLinkType,
|
|
506
|
+
uniforms: {
|
|
507
|
+
color: new Color(1.0, 0.0, 0.0, 0.5),
|
|
508
|
+
image: Material.WarnLinkImage,
|
|
509
|
+
time: 0
|
|
510
|
+
},
|
|
511
|
+
source: this._getDirectionWallShader({
|
|
512
|
+
get: true,
|
|
513
|
+
count: 10.0,
|
|
514
|
+
freely: 'cross',
|
|
515
|
+
direction: '-'
|
|
516
|
+
})
|
|
517
|
+
},
|
|
518
|
+
translucent: function () {
|
|
519
|
+
return true;
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
// 轨迹流动线
|
|
524
|
+
_installFlowMaterial: function () {
|
|
525
|
+
var Color = Cesium.Color,
|
|
526
|
+
defaultValue = Cesium.defaultValue,
|
|
527
|
+
defineProperties = Object.defineProperties,
|
|
528
|
+
Event = Cesium.Event,
|
|
529
|
+
createPropertyDescriptor = Cesium.createPropertyDescriptor,
|
|
530
|
+
Property = Cesium.Property,
|
|
531
|
+
Material = Cesium.Material;
|
|
532
|
+
function PolylineFlowMaterialProperty(options) {
|
|
533
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
534
|
+
this._definitionChanged = new Event();
|
|
535
|
+
this._color = undefined;
|
|
536
|
+
this._colorSubscription = undefined;
|
|
537
|
+
this.color = options.color || Color.fromBytes(0, 255, 255, 255);
|
|
538
|
+
this._duration = undefined;
|
|
539
|
+
this._durationSubscription = undefined;
|
|
540
|
+
this.duration = defaultValue(options.duration, 45);
|
|
541
|
+
}
|
|
542
|
+
defineProperties(PolylineFlowMaterialProperty.prototype, {
|
|
543
|
+
isConstant: {
|
|
544
|
+
get: function () {
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
definitionChanged: {
|
|
549
|
+
get: function () {
|
|
550
|
+
return this._definitionChanged;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
PolylineFlowMaterialProperty.prototype.getType = function () {
|
|
555
|
+
return Material.PolylineFlowType;
|
|
556
|
+
};
|
|
557
|
+
PolylineFlowMaterialProperty.prototype.getValue = function (time, result) {
|
|
558
|
+
if (!result) {
|
|
559
|
+
result = {};
|
|
560
|
+
}
|
|
561
|
+
result.color = Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
|
|
562
|
+
result.duration = this._duration;
|
|
563
|
+
return result;
|
|
564
|
+
};
|
|
565
|
+
PolylineFlowMaterialProperty.prototype.equals = function (other) {
|
|
566
|
+
return this === other || other instanceof PolylineFlowMaterialProperty && Property.equals(this._color, other._color);
|
|
567
|
+
};
|
|
568
|
+
defineProperties(PolylineFlowMaterialProperty.prototype, {
|
|
569
|
+
color: createPropertyDescriptor('color'),
|
|
570
|
+
duration: createPropertyDescriptor('duration')
|
|
571
|
+
});
|
|
572
|
+
Cesium.Scene.PolylineFlowMaterialProperty = PolylineFlowMaterialProperty;
|
|
573
|
+
Material.PolylineFlowType = 'PolylineFlow';
|
|
574
|
+
Material._materialCache.addMaterial(Material.PolylineFlowType, {
|
|
575
|
+
fabric: {
|
|
576
|
+
type: Material.PolylineFlowType,
|
|
577
|
+
uniforms: {
|
|
578
|
+
color: new Color(1.0, 1.0, 2.0, 0.7),
|
|
579
|
+
duration: 45
|
|
580
|
+
},
|
|
581
|
+
source: this._getFlowLineShader({
|
|
582
|
+
get: true
|
|
583
|
+
})
|
|
584
|
+
},
|
|
585
|
+
translucent: function () {
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
};
|