@vtx/cs-map 1.0.2 → 1.0.4
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/lib/_util/getComponentProps.js +1 -1
- package/lib/_util/getDefaultMapInfo.js +3 -3
- package/lib/_util/getSystemInfo.js +3 -3
- package/lib/_util/http.js +3 -3
- package/lib/_util/http.js.map +1 -1
- package/lib/_util/layer.js +3 -3
- package/lib/_util/layer.js.map +1 -1
- package/lib/_util/useSet.js +4 -4
- package/lib/_util/useSet.js.map +1 -1
- package/lib/assets/bz.png +0 -0
- package/lib/assets/ll.png +0 -0
- package/lib/assets/sw.png +0 -0
- package/lib/assets/yl.png +0 -0
- package/lib/feature-layer/FeatureLayer.js +12 -15
- package/lib/feature-layer/FeatureLayer.js.map +1 -1
- package/lib/feature-layer/createFeatureCollection.js +4 -4
- package/lib/feature-layer/createFeatureCollection.js.map +1 -1
- package/lib/feature-layer/index.js +2 -2
- package/lib/feature-layer/index.js.map +1 -1
- package/lib/map/Popup.js +6 -6
- package/lib/map/Popup.js.map +1 -1
- package/lib/map/base/imagery/amap/AmapImageryProvider.js +6 -11
- package/lib/map/base/imagery/amap/AmapImageryProvider.js.map +1 -1
- package/lib/map/base/imagery/amap/AmapMercatorTilingScheme.js +13 -18
- package/lib/map/base/imagery/amap/AmapMercatorTilingScheme.js.map +1 -1
- package/lib/map/base/imagery/baidu/BaiduImageryProvider.js +16 -21
- package/lib/map/base/imagery/baidu/BaiduImageryProvider.js.map +1 -1
- package/lib/map/base/imagery/baidu/BaiduMercatorProjection.js +1 -7
- package/lib/map/base/imagery/baidu/BaiduMercatorProjection.js.map +1 -1
- package/lib/map/base/imagery/baidu/BaiduMercatorTilingScheme.js +17 -22
- package/lib/map/base/imagery/baidu/BaiduMercatorTilingScheme.js.map +1 -1
- package/lib/map/base/imagery/geoq/GeoQImageryProvider.js +6 -11
- package/lib/map/base/imagery/geoq/GeoQImageryProvider.js.map +1 -1
- package/lib/map/base/imagery/google/GoogleImageryProvider.js +6 -11
- package/lib/map/base/imagery/google/GoogleImageryProvider.js.map +1 -1
- package/lib/map/base/imagery/tdt/TdtImageryProvider.js +7 -12
- package/lib/map/base/imagery/tdt/TdtImageryProvider.js.map +1 -1
- package/lib/map/base/imagery/tencent/TencentImageryProvider.js +6 -11
- package/lib/map/base/imagery/tencent/TencentImageryProvider.js.map +1 -1
- package/lib/map/{transform → base/imagery/transform}/AmapMercatorTilingScheme.js +12 -17
- package/lib/map/base/imagery/transform/AmapMercatorTilingScheme.js.map +1 -0
- package/lib/map/base/{transform → imagery/transform}/CoordTransform.js +1 -6
- package/lib/map/base/imagery/transform/CoordTransform.js.map +1 -0
- package/lib/map/base/index.js +0 -4
- package/lib/map/base/index.js.map +1 -1
- package/lib/map/index.js +16 -15
- package/lib/map/index.js.map +1 -1
- package/lib/map/material/AroundPoint.js +6 -15
- package/lib/map/material/AroundPoint.js.map +1 -1
- package/lib/map/material/ODLineLayer.js +13 -15
- package/lib/map/material/ODLineLayer.js.map +1 -1
- package/lib/map/material/PolylineTrailLinkMaterialProperty.js +14 -14
- package/lib/map/material/PolylineTrailLinkMaterialProperty.js.map +1 -1
- package/lib/map/material/PolylineTrailMaterialProperty.js +14 -14
- package/lib/map/material/PolylineTrailMaterialProperty.js.map +1 -1
- package/lib/map/material/TilesBuilding.js +7 -9
- package/lib/map/material/TilesBuilding.js.map +1 -1
- package/lib/map/material/assets/colors1.png +0 -0
- package/lib/map/material/assets/colors2.png +0 -0
- package/lib/map/material/index.js +0 -4
- package/lib/map/material/index.js.map +1 -1
- package/lib/marker/Marker.js +4 -5
- package/lib/marker/Marker.js.map +1 -1
- package/lib/marker/index.js +1 -1
- package/lib/point/Point.js +4 -5
- package/lib/point/Point.js.map +1 -1
- package/lib/point/index.js +1 -1
- package/lib/polygon/Polygon.js +5 -6
- package/lib/polygon/Polygon.js.map +1 -1
- package/lib/polygon/index.js +1 -1
- package/lib/polyline/Polyline.js +12 -19
- package/lib/polyline/Polyline.js.map +1 -1
- package/lib/polyline/index.js +1 -1
- package/lib/renderer/index.js +21 -19
- package/lib/renderer/index.js.map +1 -1
- package/package.json +3 -2
- package/lib/map/base/transform/CoordTransform.js.map +0 -1
- package/lib/map/getBaseLayers.js +0 -51
- package/lib/map/getBaseLayers.js.map +0 -1
- package/lib/map/transform/AmapMercatorTilingScheme.js.map +0 -1
- package/lib/map/transform/CoordTransform.js +0 -179
- package/lib/map/transform/CoordTransform.js.map +0 -1
|
@@ -4,22 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
7
|
+
var _cesium = require("cesium");
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
12
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
-
* @Description: 相机绕点旋转
|
|
17
|
-
* @Version: 1.0
|
|
18
|
-
* @Author: Julian
|
|
19
|
-
* @Date: 2022-05-06 21:42:26
|
|
20
|
-
* @LastEditors: Julian
|
|
21
|
-
* @LastEditTime: 2022-05-08 16:32:25
|
|
22
|
-
*/
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
14
|
var AroundPoint = /*#__PURE__*/function () {
|
|
24
15
|
function AroundPoint(_ref) {
|
|
25
16
|
var viewer = _ref.viewer,
|
|
@@ -38,7 +29,7 @@ var AroundPoint = /*#__PURE__*/function () {
|
|
|
38
29
|
}, {
|
|
39
30
|
key: "_unbindEvent",
|
|
40
31
|
value: function _unbindEvent() {
|
|
41
|
-
this._viewer.camera.lookAtTransform(
|
|
32
|
+
this._viewer.camera.lookAtTransform(_cesium.Matrix4.IDENTITY);
|
|
42
33
|
this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);
|
|
43
34
|
}
|
|
44
35
|
}, {
|
|
@@ -62,11 +53,11 @@ var AroundPoint = /*#__PURE__*/function () {
|
|
|
62
53
|
value: function _aroundPoint() {
|
|
63
54
|
var heading = this._viewer.camera.heading;
|
|
64
55
|
var pitch = this._viewer.camera.pitch;
|
|
65
|
-
heading +=
|
|
56
|
+
heading += _cesium.Math.toRadians(this._amount);
|
|
66
57
|
if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
|
|
67
58
|
heading = 0;
|
|
68
59
|
}
|
|
69
|
-
this._viewer.camera.lookAt(this._position, new
|
|
60
|
+
this._viewer.camera.lookAt(this._position, new _cesium.HeadingPitchRange(heading, pitch, 5000.0));
|
|
70
61
|
}
|
|
71
62
|
}]);
|
|
72
63
|
return AroundPoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AroundPoint.js","names":["
|
|
1
|
+
{"version":3,"file":"AroundPoint.js","names":["_cesium","require","_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","Number","AroundPoint","_ref","viewer","amount","position","_viewer","_amount","_position","value","_bindEvent","clock","onTick","addEventListener","_aroundPoint","_unbindEvent","camera","lookAtTransform","Matrix4","IDENTITY","removeEventListener","start","shouldAnimate","stop","heading","pitch","CesiumMath","toRadians","Math","PI","lookAt","HeadingPitchRange","exports"],"sources":["map/material/AroundPoint.js"],"sourcesContent":["import {Matrix4, HeadingPitchRange, Math as CesiumMath} from 'cesium';\n\nexport default class AroundPoint {\n constructor({viewer, amount, position}) {\n this._viewer = viewer;\n this._amount = amount;\n this._position = position;\n }\n\n _bindEvent() {\n this._viewer.clock.onTick.addEventListener(this._aroundPoint, this);\n }\n\n _unbindEvent() {\n this._viewer.camera.lookAtTransform(Matrix4.IDENTITY);\n this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);\n }\n\n start() {\n this._viewer.clock.shouldAnimate = true;\n this._unbindEvent();\n this._bindEvent();\n return this;\n }\n\n stop() {\n this._unbindEvent();\n return this;\n }\n\n // 相机绕点旋转函数\n _aroundPoint() {\n let heading = this._viewer.camera.heading;\n let pitch = this._viewer.camera.pitch;\n\n\n heading += CesiumMath.toRadians(this._amount);\n if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {\n heading = 0;\n }\n\n this._viewer.camera.lookAt(\n this._position,\n new HeadingPitchRange(\n heading,\n pitch,\n 5000.0,\n )\n )\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAsE,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,gBAAAC,QAAA,EAAAC,WAAA,UAAAD,QAAA,YAAAC,WAAA,eAAAC,SAAA;AAAA,SAAAC,kBAAAC,MAAA,EAAAC,KAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA,UAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA,GAAAE,UAAA,CAAAC,UAAA,GAAAD,UAAA,CAAAC,UAAA,WAAAD,UAAA,CAAAE,Y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B,IAAI,CAACtB,SAAS,EACd,IAAIuB,yBAAiB,CACnBP,OAAO,EACPC,KAAK,EACL,MACF,CACF,CAAC;IACH;EAAC;EAAA,OAAAxB,WAAA;AAAA;AAAA+B,OAAA,cAAA/B,WAAA"}
|
|
@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
7
|
+
var _cesium = require("cesium");
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -16,8 +14,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
16
14
|
var ODLineLayer = /*#__PURE__*/function () {
|
|
17
15
|
function ODLineLayer(viewer, linData) {
|
|
18
16
|
_classCallCheck(this, ODLineLayer);
|
|
19
|
-
if (!
|
|
20
|
-
throw new
|
|
17
|
+
if (!(0, _cesium.defined)(viewer)) {
|
|
18
|
+
throw new _cesium.DeveloperError('viewer is required');
|
|
21
19
|
}
|
|
22
20
|
this.viewer = viewer;
|
|
23
21
|
this.primitive = null;
|
|
@@ -37,13 +35,13 @@ var ODLineLayer = /*#__PURE__*/function () {
|
|
|
37
35
|
//
|
|
38
36
|
// busLines.push({
|
|
39
37
|
// positions: linData,
|
|
40
|
-
// color: new
|
|
38
|
+
// color: new Color(0.5, 0.6, 0.0, 1.0),
|
|
41
39
|
// });
|
|
42
40
|
// })
|
|
43
41
|
|
|
44
42
|
busLines.push({
|
|
45
43
|
positions: linData,
|
|
46
|
-
color: new
|
|
44
|
+
color: new _cesium.Color(0.5, 0.6, 0.0, 1.0)
|
|
47
45
|
});
|
|
48
46
|
this.addLineDatas(busLines, viewer);
|
|
49
47
|
}
|
|
@@ -53,20 +51,20 @@ var ODLineLayer = /*#__PURE__*/function () {
|
|
|
53
51
|
var _this = this;
|
|
54
52
|
var scene = viewer.scene;
|
|
55
53
|
busLines.forEach(function (line) {
|
|
56
|
-
_this.primitive = new
|
|
57
|
-
geometryInstances: new
|
|
58
|
-
geometry: new
|
|
59
|
-
positions:
|
|
54
|
+
_this.primitive = new _cesium.Primitive({
|
|
55
|
+
geometryInstances: new _cesium.GeometryInstance({
|
|
56
|
+
geometry: new _cesium.PolylineGeometry({
|
|
57
|
+
positions: _cesium.Cartesian3.fromDegreesArray(line.positions),
|
|
60
58
|
width: 5
|
|
61
59
|
})
|
|
62
60
|
}),
|
|
63
|
-
appearance: new
|
|
64
|
-
material: new
|
|
61
|
+
appearance: new _cesium.PolylineMaterialAppearance({
|
|
62
|
+
material: new _cesium.Material({
|
|
65
63
|
fabric: {
|
|
66
64
|
type: 'ODLineMaterial',
|
|
67
65
|
uniforms: {
|
|
68
66
|
color_0: line.color,
|
|
69
|
-
colorImage:
|
|
67
|
+
colorImage: _cesium.Color.AQUA,
|
|
70
68
|
totoalFrameCount_1: 400
|
|
71
69
|
},
|
|
72
70
|
source: "\n uniform float totoalFrameCount_1;\n uniform vec4 color_0;\n uniform vec4 colorImage;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t = mod(czm_frameNumber, totoalFrameCount_1) / totoalFrameCount_1;\n t *= 1.03;\n float alpha = smoothstep(t - 0.1, t, st.s) * step(-t, -st.s);\n alpha += 0.1;\n alpha *= step(-0.4, -abs(0.5-st.t));\n // material.diffuse = color_0.rgb;\n material.diffuse = (colorImage.rgb+color_0.rgb);\n material.alpha = alpha;\n return material;\n }\n "
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ODLineLayer.js","names":["
|
|
1
|
+
{"version":3,"file":"ODLineLayer.js","names":["_cesium","require","_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","Number","ODLineLayer","viewer","linData","defined","DeveloperError","primitive","loadLinesData","value","busLines","push","positions","color","Color","addLineDatas","_this","scene","forEach","line","Primitive","geometryInstances","GeometryInstance","geometry","PolylineGeometry","Cartesian3","fromDegreesArray","width","appearance","PolylineMaterialAppearance","material","Material","fabric","type","uniforms","color_0","colorImage","AQUA","totoalFrameCount_1","source","translucent","faceForward","closed","console","log","primitives","add","destroy","remove","_default","exports"],"sources":["map/material/ODLineLayer.js"],"sourcesContent":["import {defined, DeveloperError, Color, Primitive, GeometryInstance, PolylineGeometry, Cartesian3} from 'cesium';\nimport {PolylineMaterialAppearance, Material} from 'cesium';\n\nclass ODLineLayer {\n constructor(viewer, linData) {\n if (!defined(viewer)) {\n throw new DeveloperError('viewer is required');\n }\n this.viewer = viewer;\n this.primitive = null;\n this.loadLinesData(this.viewer, linData);\n }\n\n loadLinesData(viewer, linData) {\n const busLines = [];\n // linData.forEach(i => {\n //\n // let points = []\n // i.forEach(c => {\n // points.push(c[0], c[1])\n // });\n // // points.push(points[0], points[1])\n //\n // busLines.push({\n // positions: linData,\n // color: new Color(0.5, 0.6, 0.0, 1.0),\n // });\n // })\n\n busLines.push({\n positions: linData,\n color: new Color(0.5, 0.6, 0.0, 1.0),\n });\n\n this.addLineDatas(busLines, viewer);\n }\n\n addLineDatas(busLines, viewer) {\n let scene = viewer.scene;\n busLines.forEach(line => {\n this.primitive = new Primitive({\n geometryInstances: new GeometryInstance({\n geometry: new PolylineGeometry({\n positions: Cartesian3.fromDegreesArray(line.positions),\n width: 5,\n }),\n }),\n appearance: new PolylineMaterialAppearance({\n material: new Material({\n fabric: {\n type: 'ODLineMaterial',\n uniforms: {\n color_0: line.color,\n colorImage: Color.AQUA,\n totoalFrameCount_1: 400,\n },\n source: `\n uniform float totoalFrameCount_1;\n uniform vec4 color_0;\n uniform vec4 colorImage;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t = mod(czm_frameNumber, totoalFrameCount_1) / totoalFrameCount_1;\n t *= 1.03;\n float alpha = smoothstep(t - 0.1, t, st.s) * step(-t, -st.s);\n alpha += 0.1;\n alpha *= step(-0.4, -abs(0.5-st.t));\n // material.diffuse = color_0.rgb;\n material.diffuse = (colorImage.rgb+color_0.rgb);\n material.alpha = alpha;\n return material;\n }\n `,\n },\n translucent: true,\n }),\n faceForward: false,\n closed: false,\n }),\n });\n console.log(this.primitive, 'this.primitive');\n scene.primitives.add(this.primitive);\n });\n }\n\n destroy() {\n this.primitive && this.viewer.scene.primitives.remove(this.primitive);\n }\n}\n\nexport default ODLineLayer;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAiH,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,gBAAAC,QAAA,EAAAC,WAAA,UAAAD,QAAA,YAAAC,WAAA,eAAAC,SAAA;AAAA,SAAAC,kBAAAC,MAAA,EAAAC,KAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA,UAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA,GAAAE,UAAA,CAAAC,UAAA,GAAAD,UAAA,CAAAC,UAAA,WAAAD,UAAA,CAAAE,YAAA,wBAAAF,UAAA,EAAAA,UAAA,CAAAG,QAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAT,MAAA,EAAAU,cAAA,CAAAN,UAAA,CAAAO,GAAA,GAAAP,UAAA;AAAA,SAAAQ,aAAAf,WAAA,EAAAgB,UAAA,EAAAC,WAAA,QAAAD,UAAA,EAAAd,iBAAA,CAAAF,WAAA,CAAAH,SAA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,KAAA,EAED,SAAAsC,QAAA,EAAU;MACR,IAAI,CAACxC,SAAS,IAAI,IAAI,CAACJ,MAAM,CAACc,KAAK,CAAC4B,UAAU,CAACG,MAAM,CAAC,IAAI,CAACzC,SAAS,CAAC;IACvE;EAAC;EAAA,OAAAL,WAAA;AAAA;AAAA,IAAA+C,QAAA,GAGY/C,WAAW;AAAAgD,OAAA,cAAAD,QAAA"}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
function _typeof(
|
|
7
|
+
var _cesium = require("cesium");
|
|
8
|
+
var _colors = _interopRequireDefault(require("./assets/colors1.png"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
12
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -17,12 +17,12 @@ var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function () {
|
|
|
17
17
|
function PolylineTrailLinkMaterialProperty() {
|
|
18
18
|
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
19
|
_classCallCheck(this, PolylineTrailLinkMaterialProperty);
|
|
20
|
-
this._definitionChanged = new
|
|
20
|
+
this._definitionChanged = new _cesium.Event();
|
|
21
21
|
this._color = undefined;
|
|
22
22
|
this._colorSubscription = undefined;
|
|
23
|
-
this.color = option.color ? option.color : new
|
|
23
|
+
this.color = option.color ? option.color : new _cesium.Color(0.0, 0.0, 1.0, 0.5);
|
|
24
24
|
this.duration = option.duration ? option.duration : 5000;
|
|
25
|
-
this.image = option.image ? option.image :
|
|
25
|
+
this.image = option.image ? option.image : _colors["default"];
|
|
26
26
|
this._time = new Date().getTime();
|
|
27
27
|
// 类型(会自动加载到 cesium 中)
|
|
28
28
|
this.type = option.type ? option.type : 'PolylineTrailLink';
|
|
@@ -40,10 +40,10 @@ var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function () {
|
|
|
40
40
|
key: "getValue",
|
|
41
41
|
value: function getValue(time, result) {
|
|
42
42
|
var _result = result;
|
|
43
|
-
if (!
|
|
43
|
+
if (!(0, _cesium.defined)(_result)) {
|
|
44
44
|
_result = {};
|
|
45
45
|
}
|
|
46
|
-
_result.color =
|
|
46
|
+
_result.color = _cesium.Property.getValueOrClonedDefault(this._color, time, _cesium.Color.WHITE, _result.color);
|
|
47
47
|
_result.image = this.trailImage;
|
|
48
48
|
_result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
|
|
49
49
|
return _result;
|
|
@@ -51,17 +51,17 @@ var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function () {
|
|
|
51
51
|
}, {
|
|
52
52
|
key: "equals",
|
|
53
53
|
value: function equals(other) {
|
|
54
|
-
return this === other || other instanceof PolylineTrailLinkMaterialProperty &&
|
|
54
|
+
return this === other || other instanceof PolylineTrailLinkMaterialProperty && _cesium.Property.equals(this._color, other._color);
|
|
55
55
|
}
|
|
56
56
|
}, {
|
|
57
57
|
key: "addMaterial",
|
|
58
58
|
value: function addMaterial() {
|
|
59
59
|
var _this = this;
|
|
60
|
-
|
|
60
|
+
_cesium.Material._materialCache.addMaterial(this.type, {
|
|
61
61
|
fabric: {
|
|
62
62
|
type: this.type,
|
|
63
63
|
uniforms: {
|
|
64
|
-
color: new
|
|
64
|
+
color: new _cesium.Color(0.0, 0.0, 1.0, 0.5),
|
|
65
65
|
image: this.image,
|
|
66
66
|
time: 100
|
|
67
67
|
},
|
|
@@ -72,7 +72,7 @@ var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function () {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
// 注意
|
|
75
|
+
// 注意 defineProperties 会报错,需要改为 Object
|
|
76
76
|
Object.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {
|
|
77
77
|
isConstant: {
|
|
78
78
|
get: function get() {
|
|
@@ -87,7 +87,7 @@ var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function () {
|
|
|
87
87
|
configurable: true
|
|
88
88
|
},
|
|
89
89
|
color: {
|
|
90
|
-
value:
|
|
90
|
+
value: (0, _cesium.createPropertyDescriptor)('color'),
|
|
91
91
|
configurable: true,
|
|
92
92
|
writable: true
|
|
93
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineTrailLinkMaterialProperty.js","names":["
|
|
1
|
+
{"version":3,"file":"PolylineTrailLinkMaterialProperty.js","names":["_cesium","require","_colors","_interopRequireDefault","obj","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","Number","PolylineTrailLinkMaterialProperty","option","arguments","_definitionChanged","Event","_color","_colorSubscription","color","Color","duration","image","img","_time","Date","getTime","type","source","addMaterial","value","getType","getValue","time","result","_result","defined","Property","getValueOrClonedDefault","WHITE","trailImage","equals","other","_this","Material","_materialCache","fabric","uniforms","translucent","defineProperties","isConstant","get","definitionChanged","createPropertyDescriptor","_default","exports"],"sources":["map/material/PolylineTrailLinkMaterialProperty.js"],"sourcesContent":["import {Event, Color, Property, createPropertyDescriptor, Material, defined} from 'cesium';\nimport img from './assets/colors1.png';\n\nclass PolylineTrailLinkMaterialProperty {\n constructor(option = {}) {\n this._definitionChanged = new Event();\n this._color = undefined;\n this._colorSubscription = undefined;\n this.color = option.color ? option.color : new Color(0.0, 0.0, 1.0, 0.5);\n this.duration = option.duration ? option.duration : 5000;\n this.image = option.image ? option.image : img;\n this._time = new Date().getTime();\n // 类型(会自动加载到 cesium 中)\n this.type = option.type ? option.type : 'PolylineTrailLink';\n\n // 着色器\n this.source = option.source\n ? option.source\n : `\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb;\n return material;\n }\n `;\n\n this.addMaterial();\n }\n\n getType() {\n return 'PolylineTrailLink';\n }\n\n getValue(time, result) {\n let _result = result;\n if (!defined(_result)) {\n _result = {};\n }\n\n _result.color = Property.getValueOrClonedDefault(\n this._color,\n time,\n Color.WHITE,\n _result.color,\n );\n _result.image = this.trailImage;\n _result.time = ((new Date().getTime() - this._time) % this.duration) / this.duration;\n\n return _result;\n }\n\n equals(other) {\n return (\n this === other ||\n (other instanceof PolylineTrailLinkMaterialProperty &&\n Property.equals(this._color, other._color))\n );\n }\n\n addMaterial() {\n Material._materialCache.addMaterial(this.type, {\n fabric: {\n type: this.type,\n uniforms: {\n color: new Color(0.0, 0.0, 1.0, 0.5),\n image: this.image,\n time: 100,\n },\n source: this.source,\n },\n\n translucent: () => {\n return true;\n },\n });\n\n // 注意 defineProperties 会报错,需要改为 Object\n Object.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {\n isConstant: {\n get: () => {\n return false;\n },\n configurable: true,\n },\n definitionChanged: {\n get: () => {\n return this._definitionChanged;\n },\n configurable: true,\n },\n color: {\n value: createPropertyDescriptor('color'),\n configurable: true,\n writable: true,\n },\n });\n }\n}\n\nexport default PolylineTrailLinkMaterialProperty;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAAA,SAAAK,gBAAAC,QAAA,EAAAC,WAAA,UAAAD,QAAA,YAAAC,WAAA,eAAAC,SAAA;AAAA,SAAAC,kBAAAC,MAAA,EAAAC,KAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA,UAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA,GAAAE,UAAA,CAAAC,UAAA,GAAAD,UAAA,CAAAC,UAAA,WAAAD,UAAA,CAAAE,YAAA,wBAAAF,UAAA,EAAAA,UAAA,CAAAG,QAAA,SAAAC,MAAA,CAAAC,cAAA,CAAAT,MAAA,EAAAU,cAAA,CAAAN,UAAA,CAAAO,GAAA,GAAAP,UAAA;AAAA,SAAAQ,aAAAf,WAAA,EAAAgB,UAAA,EAAAC,WAAA,QAAAD,UAAA,EAAAd,iBAAA,CAAAF,WAAA,CAAAH,SAAA,EAAAmB,UAAA,OAAAC,WA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
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
function _typeof(
|
|
7
|
+
var _cesium = require("cesium");
|
|
8
|
+
var _colors = _interopRequireDefault(require("./assets/colors2.png"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
12
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -17,13 +17,13 @@ var PolylineTrailMaterialProperty = /*#__PURE__*/function () {
|
|
|
17
17
|
function PolylineTrailMaterialProperty() {
|
|
18
18
|
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19
19
|
_classCallCheck(this, PolylineTrailMaterialProperty);
|
|
20
|
-
this._definitionChanged = new
|
|
20
|
+
this._definitionChanged = new _cesium.Event();
|
|
21
21
|
this._color = undefined;
|
|
22
22
|
this._colorSubscription = undefined;
|
|
23
23
|
this._time = new Date().getTime();
|
|
24
|
-
this.color = option.color ? option.color :
|
|
24
|
+
this.color = option.color ? option.color : _cesium.Color.fromCssColorString('rgba(90, 90, 255, 1)');
|
|
25
25
|
this.duration = option.duration ? option.duration : 5000;
|
|
26
|
-
this.trailImage = option.trailImage ? option.trailImage :
|
|
26
|
+
this.trailImage = option.trailImage ? option.trailImage : _colors["default"];
|
|
27
27
|
|
|
28
28
|
// 类型(会自动加载到 cesium 中)
|
|
29
29
|
this.type = option.type ? option.type : 'PolylineTrail';
|
|
@@ -41,10 +41,10 @@ var PolylineTrailMaterialProperty = /*#__PURE__*/function () {
|
|
|
41
41
|
key: "getValue",
|
|
42
42
|
value: function getValue(time, result) {
|
|
43
43
|
var _result = result;
|
|
44
|
-
if (!
|
|
44
|
+
if (!(0, _cesium.defined)(_result)) {
|
|
45
45
|
_result = {};
|
|
46
46
|
}
|
|
47
|
-
_result.color =
|
|
47
|
+
_result.color = _cesium.Property.getValueOrClonedDefault(this._color, time, _cesium.Color.WHITE, _result.color);
|
|
48
48
|
_result.image = this.trailImage;
|
|
49
49
|
_result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
|
|
50
50
|
return _result;
|
|
@@ -52,17 +52,17 @@ var PolylineTrailMaterialProperty = /*#__PURE__*/function () {
|
|
|
52
52
|
}, {
|
|
53
53
|
key: "equals",
|
|
54
54
|
value: function equals(other) {
|
|
55
|
-
return this === other || other instanceof PolylineTrailMaterialProperty &&
|
|
55
|
+
return this === other || other instanceof PolylineTrailMaterialProperty && _cesium.Property.equals(this._color, other._color);
|
|
56
56
|
}
|
|
57
57
|
}, {
|
|
58
58
|
key: "addMaterial",
|
|
59
59
|
value: function addMaterial() {
|
|
60
60
|
var _this = this;
|
|
61
|
-
|
|
61
|
+
_cesium.Material._materialCache.addMaterial(this.type, {
|
|
62
62
|
fabric: {
|
|
63
63
|
type: this.type,
|
|
64
64
|
uniforms: {
|
|
65
|
-
color: new
|
|
65
|
+
color: new _cesium.Color(1.0, 0.0, 0.0, 0.5),
|
|
66
66
|
image: this.trailImage,
|
|
67
67
|
time: 100
|
|
68
68
|
},
|
|
@@ -73,7 +73,7 @@ var PolylineTrailMaterialProperty = /*#__PURE__*/function () {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
// 注意
|
|
76
|
+
// 注意 defineProperties 会报错,需要改为 Object
|
|
77
77
|
Object.defineProperties(PolylineTrailMaterialProperty.prototype, {
|
|
78
78
|
isConstant: {
|
|
79
79
|
get: function get() {
|
|
@@ -88,7 +88,7 @@ var PolylineTrailMaterialProperty = /*#__PURE__*/function () {
|
|
|
88
88
|
configurable: true
|
|
89
89
|
},
|
|
90
90
|
color: {
|
|
91
|
-
value:
|
|
91
|
+
value: (0, _cesium.createPropertyDescriptor)('color'),
|
|
92
92
|
configurable: true,
|
|
93
93
|
writable: true
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolylineTrailMaterialProperty.js","names":["
|
|
1
|
+
{"version":3,"file":"PolylineTrailMaterialProperty.js","names":["_cesium","require","_colors","_interopRequireDefault","obj","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","Number","PolylineTrailMaterialProperty","option","arguments","_definitionChanged","Event","_color","_colorSubscription","_time","Date","getTime","color","Color","fromCssColorString","duration","trailImage","img","type","source","addMaterial","value","getType","getValue","time","result","_result","defined","Property","getValueOrClonedDefault","WHITE","image","equals","other","_this","Material","_materialCache","fabric","uniforms","translucent","defineProperties","isConstant","get","definitionChanged","createPropertyDescriptor","_default","exports"],"sources":["map/material/PolylineTrailMaterialProperty.js"],"sourcesContent":["import {Event, Color, Property, createPropertyDescriptor, Material, defined} from 'cesium';\nimport img from './assets/colors2.png';\n\nclass PolylineTrailMaterialProperty {\n constructor(option = {}) {\n this._definitionChanged = new Event();\n this._color = undefined;\n this._colorSubscription = undefined;\n this._time = new Date().getTime();\n\n this.color = option.color\n ? option.color\n : Color.fromCssColorString('rgba(90, 90, 255, 1)');\n this.duration = option.duration ? option.duration : 5000;\n this.trailImage = option.trailImage ? option.trailImage : img;\n\n // 类型(会自动加载到 cesium 中)\n this.type = option.type ? option.type : 'PolylineTrail';\n\n // 着色器\n this.source = option.source\n ? option.source\n : `\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n return material;\n }\n `;\n this.addMaterial();\n }\n\n getType() {\n return 'PolylineTrail';\n }\n\n getValue(time, result) {\n let _result = result;\n if (!defined(_result)) {\n _result = {};\n }\n\n _result.color = Property.getValueOrClonedDefault(\n this._color,\n time,\n Color.WHITE,\n _result.color,\n );\n _result.image = this.trailImage;\n _result.time = ((new Date().getTime() - this._time) % this.duration) / this.duration;\n\n return _result;\n }\n\n equals(other) {\n return (\n this === other ||\n (other instanceof PolylineTrailMaterialProperty &&\n Property.equals(this._color, other._color))\n );\n }\n\n addMaterial() {\n Material._materialCache.addMaterial(this.type, {\n fabric: {\n type: this.type,\n uniforms: {\n color: new Color(1.0, 0.0, 0.0, 0.5),\n image: this.trailImage,\n time: 100,\n },\n source: this.source,\n },\n\n translucent: () => {\n return true;\n },\n });\n\n // 注意 defineProperties 会报错,需要改为 Object\n Object.defineProperties(PolylineTrailMaterialProperty.prototype, {\n isConstant: {\n get: () => {\n return false;\n },\n configurable: true,\n },\n definitionChanged: {\n get: () => {\n return this._definitionChanged;\n },\n configurable: true,\n },\n color: {\n value: createPropertyDescriptor('color'),\n configurable: true,\n writable: true,\n },\n });\n }\n}\n\nexport default PolylineTrailMaterialProperty;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAA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YACtBQ,IAAI,EAAE;UACR,CAAC;UACDL,MAAM,EAAE,IAAI,CAACA;QACf,CAAC;QAEDoB,WAAW,EAAE,SAAAA,YAAA,EAAM;UACjB,OAAO,IAAI;QACb;MACF,CAAC,CAAC;;MAEF;MACAvD,MAAM,CAACwD,gBAAgB,CAACtC,6BAA6B,CAAChC,SAAS,EAAE;QAC/DuE,UAAU,EAAE;UACVC,GAAG,EAAE,SAAAA,IAAA,EAAM;YACT,OAAO,KAAK;UACd,CAAC;UACD5D,YAAY,EAAE;QAChB,CAAC;QACD6D,iBAAiB,EAAE;UACjBD,GAAG,EAAE,SAAAA,IAAA,EAAM;YACT,OAAOR,KAAI,CAAC7B,kBAAkB;UAChC,CAAC;UACDvB,YAAY,EAAE;QAChB,CAAC;QACD8B,KAAK,EAAE;UACLS,KAAK,EAAE,IAAAuB,gCAAwB,EAAC,OAAO,CAAC;UACxC9D,YAAY,EAAE,IAAI;UAClBC,QAAQ,EAAE;QACZ;MACF,CAAC,CAAC;IACJ;EAAC;EAAA,OAAAmB,6BAAA;AAAA;AAAA,IAAA2C,QAAA,GAGY3C,6BAA6B;AAAA4C,OAAA,cAAAD,QAAA"}
|
|
@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
7
|
+
var _cesium = require("cesium");
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -36,9 +34,9 @@ var TilesBuilding = /*#__PURE__*/function () {
|
|
|
36
34
|
key: "load",
|
|
37
35
|
value: function load(url) {
|
|
38
36
|
var viewer = this.viewer;
|
|
39
|
-
return viewer.scene.primitives.add(new
|
|
37
|
+
return viewer.scene.primitives.add(new _cesium.Cesium3DTileset({
|
|
40
38
|
url: url,
|
|
41
|
-
modelMatrix:
|
|
39
|
+
modelMatrix: _cesium.Matrix4.fromArray([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
|
|
42
40
|
maximumMemoryUsage: 100,
|
|
43
41
|
//不可设置太高,目标机子空闲内存值以内,防止浏览器过于卡
|
|
44
42
|
maximumScreenSpaceError: 50,
|
|
@@ -140,7 +138,7 @@ var TilesBuilding = /*#__PURE__*/function () {
|
|
|
140
138
|
v_position = 'v_pos';
|
|
141
139
|
}
|
|
142
140
|
var color = "vec4(".concat(feature.color.toString(), ")");
|
|
143
|
-
model._rendererResources.sourceShaders[program.fragmentShader] = "varying vec3 ".concat(v_position, ";\n
|
|
141
|
+
model._rendererResources.sourceShaders[program.fragmentShader] = "varying vec3 ".concat(v_position, ";\n void main(void) {\n vec4 position = czm_inverseModelView * vec4(").concat(v_position, ", 1);\n float glowRange = 360.0;\n gl_FragColor = ").concat(color, ";\n gl_FragColor = vec4(0.2, 0.8, 1.0, 0.5);\n gl_FragColor *= vec4(vec3(position.y / 140.0), 3);\n }");
|
|
144
142
|
});
|
|
145
143
|
model._shouldRegenerateShaders = true;
|
|
146
144
|
}
|
|
@@ -186,7 +184,7 @@ var TilesBuilding = /*#__PURE__*/function () {
|
|
|
186
184
|
}, {
|
|
187
185
|
key: "renderHeight",
|
|
188
186
|
value: function renderHeight() {
|
|
189
|
-
this.tiles.style = new
|
|
187
|
+
this.tiles.style = new _cesium.Cesium3DTileStyle({
|
|
190
188
|
color: {
|
|
191
189
|
conditions: [['${height} < 20', 'rgb(255, 237, 160)'], ['${height} >= 25 && ${height} < 30', 'rgb(254, 217, 118)'], ['${height} >= 30 && ${height} < 35', 'rgb(254, 178, 76)'], ['${height} >= 35 && ${height} < 40', 'rgb(253, 141, 60)'], ['${height} >= 40', 'rgb(252, 78, 42)']]
|
|
192
190
|
}
|
|
@@ -196,7 +194,7 @@ var TilesBuilding = /*#__PURE__*/function () {
|
|
|
196
194
|
key: "renderCustom",
|
|
197
195
|
value: function renderCustom(color) {
|
|
198
196
|
if (color) {
|
|
199
|
-
this.tiles.style = new
|
|
197
|
+
this.tiles.style = new _cesium.Cesium3DTileStyle({
|
|
200
198
|
color: {
|
|
201
199
|
conditions: [['${height} > 0', "color(\"".concat(color, "\")")]]
|
|
202
200
|
}
|