@mapgis/webclient-vue-cesium 10.5.5-1 → 10.5.5-6
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/README.md +46 -49
- package/dist-libs/webclient-vue-cesium.common.js +191087 -0
- package/dist-libs/webclient-vue-cesium.css +1 -1
- package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
- package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
- package/docs/.vuepress/config.js +47 -46
- package/docs/README.md +5 -4
- package/docs/api/analysis/Aspect.md +236 -0
- package/docs/api/analysis/Contour.md +240 -0
- package/docs/api/analysis/CutFill.md +306 -0
- package/docs/api/analysis/DynamicSection.md +336 -0
- package/docs/api/analysis/Excavate.md +3 -11
- package/docs/api/analysis/Flood.md +177 -200
- package/docs/api/analysis/HeightLimited.md +7 -4
- package/docs/api/analysis/ParticleEffects.md +549 -0
- package/docs/api/analysis/Profile.md +464 -0
- package/docs/api/analysis/Shadow.md +76 -13
- package/docs/api/analysis/Sightline.md +66 -13
- package/docs/api/analysis/Skyline.md +144 -29
- package/docs/api/analysis/Slope.md +236 -0
- package/docs/api/analysis/Viewshed.md +100 -21
- package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
- package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
- package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
- package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
- package/docs/api/layer/OGC/Wms.png +0 -0
- package/docs/api/layer/marker/DynamicMarker.md +81 -0
- package/docs/api/layer/marker/dynamicmarker.png +0 -0
- package/docs/api/layer/marker/selects.png +0 -0
- package/docs/api/layer/vectortile/vectortile.md +10 -0
- package/docs/api/m3d/image/layer_control_1.png +0 -0
- package/docs/api/m3d/image/layer_control_2.png +0 -0
- package/docs/api/m3d/image/layer_control_3.png +0 -0
- package/docs/api/m3d/m3d.md +13 -2
- package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
- package/docs/api/ui/draw.md +68 -40
- package/docs/api/ui/link.md +8 -1
- package/docs/api/ui/marker.md +19 -1
- package/docs/api/ui/measure.md +82 -10
- package/docs/api/ui/table.md +6 -6
- package/docs/guide/README.md +26 -23
- package/docs/guide/basemap.md +35 -33
- package/docs/guide/markers&popups.md +46 -53
- package/docs/plugin_components/create_storybook.md +241 -0
- package/docs/plugin_components/img.png +0 -0
- package/docs/plugin_components/img_1.png +0 -0
- package/docs/plugin_components/img_10.png +0 -0
- package/docs/plugin_components/img_2.png +0 -0
- package/docs/plugin_components/img_3.png +0 -0
- package/docs/plugin_components/img_4.png +0 -0
- package/docs/plugin_components/img_5.png +0 -0
- package/docs/plugin_components/img_6.png +0 -0
- package/docs/plugin_components/img_7.png +0 -0
- package/docs/plugin_components/img_8.png +0 -0
- package/docs/version/diff.md +4 -4
- package/docs/version/version.md +81 -0
- package/package.json +5 -5
- package/src/cdn/cdn_component.js +62 -0
- package/src/component.js +20 -2
- package/src/components/Analysis/Aspect.vue +318 -0
- package/src/components/Analysis/Contour.vue +257 -0
- package/src/components/Analysis/CutFill.vue +581 -0
- package/src/components/Analysis/DynamicCutting.vue +98 -59
- package/src/components/Analysis/DynamicSection.vue +494 -0
- package/src/components/Analysis/Excavate.vue +133 -87
- package/src/components/Analysis/Flood.vue +395 -487
- package/src/components/Analysis/Flood.vue-- +630 -0
- package/src/components/Analysis/HeightLimited.vue +66 -47
- package/src/components/Analysis/ModelFlatten.vue +2 -2
- package/src/components/Analysis/Profile.vue +503 -0
- package/src/components/Analysis/Shadow.vue +220 -309
- package/src/components/Analysis/Sightline.vue +393 -375
- package/src/components/Analysis/SkyLine.vue +283 -93
- package/src/components/Analysis/Slope.vue +317 -0
- package/src/components/Analysis/Viewshed.vue +806 -373
- package/src/components/Analysis/skyline2dChartOptions.js +66 -0
- package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
- package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
- package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
- package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
- package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
- package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
- package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
- package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
- package/src/components/M3D/3DTilesetOptions.js +23 -1
- package/src/components/M3D/G3D.vue +150 -0
- package/src/components/M3D/M3d.vue +142 -32
- package/src/components/M3D/M3dSet.vue +118 -0
- package/src/components/M3D/M3dType.js +24 -0
- package/src/components/Overlay/Mapv3dLayer.vue +2 -0
- package/src/components/Overlay/ParticleEffects.vue +545 -0
- package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
- package/src/components/Overlay/mapv/MapvLayer.js +372 -324
- package/src/components/Overlay/mapv/SuperCluster.js +611 -0
- package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
- package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
- package/src/components/UI/Controls/Draw/Draw.vue +320 -92
- package/src/components/UI/Controls/Legend/Legend.vue +55 -51
- package/src/components/UI/Controls/Link/Link.vue +59 -37
- package/src/components/UI/Controls/Measure/Measure.vue +75 -33
- package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
- package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
- package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
- package/src/components/UI/Geojson/Popup.vue +101 -0
- package/src/components/UI/Marker/Marker.vue +185 -48
- package/src/components/UI/Popup/Popup.vue +21 -64
- package/src/components/Utils/common/color-util.js +159 -0
- package/src/components/Utils/util.js +311 -231
- package/src/components/WebGlobe/manager.js +81 -3
- package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
- package/src/components/WebGlobe/util.js +173 -0
- package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
- package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
- package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
- package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
- package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
- package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
- package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
- package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
- package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
- package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
- package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
- package/src/components/Overlay/Mapv.vue +0 -142
- package/src/components/Overlay/MapvHeater.vue +0 -98
|
@@ -1,35 +1,96 @@
|
|
|
1
|
-
export const checkType =
|
|
1
|
+
export const checkType = val =>
|
|
2
|
+
Object.prototype.toString.call(val).slice(8, -1);
|
|
2
3
|
|
|
3
|
-
export const toKebabCase =
|
|
4
|
-
|
|
4
|
+
export const toKebabCase = str =>
|
|
5
|
+
str
|
|
6
|
+
.replace(new RegExp("[A-Z]", "g"), letter => `-${letter.toLowerCase()}`)
|
|
7
|
+
.replace(new RegExp("^-"), "");
|
|
5
8
|
/**
|
|
6
9
|
* 通过 class 名获取 Dom 元素。
|
|
7
10
|
* @param {Array<Element>} htmlCollection Dom元素集合。
|
|
8
11
|
* @param {String} className class 名称。
|
|
9
12
|
*/
|
|
10
13
|
export const getDocumentByClassName = (htmlCollection, className) => {
|
|
11
|
-
let temp
|
|
12
|
-
const BreakException = {}
|
|
14
|
+
let temp;
|
|
15
|
+
const BreakException = {};
|
|
13
16
|
try {
|
|
14
|
-
Array.prototype.slice.call(htmlCollection).forEach(
|
|
17
|
+
Array.prototype.slice.call(htmlCollection).forEach(element => {
|
|
15
18
|
if (element.className === className) {
|
|
16
|
-
temp = element
|
|
17
|
-
throw BreakException
|
|
19
|
+
temp = element;
|
|
20
|
+
throw BreakException;
|
|
18
21
|
}
|
|
19
|
-
})
|
|
22
|
+
});
|
|
20
23
|
} catch (e) {
|
|
21
|
-
if (e !== BreakException) throw e
|
|
24
|
+
if (e !== BreakException) throw e;
|
|
22
25
|
}
|
|
23
|
-
return temp
|
|
24
|
-
}
|
|
26
|
+
return temp;
|
|
27
|
+
};
|
|
25
28
|
/**
|
|
26
29
|
* 判断传入的对象是否是方法。
|
|
27
30
|
* @param {*} value
|
|
28
31
|
* @returns {Boolean}
|
|
29
32
|
*/
|
|
30
|
-
export function isFunction
|
|
31
|
-
return typeof value ===
|
|
33
|
+
export function isFunction(value) {
|
|
34
|
+
return typeof value === "function";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 是否有效数据
|
|
39
|
+
* @param {*} v
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export function isDef(v) {
|
|
43
|
+
return v !== undefined && v !== null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 校验数据的原始数据类型
|
|
48
|
+
* @param {*} v
|
|
49
|
+
* @returns {string}
|
|
50
|
+
*/
|
|
51
|
+
export function typeOf(v) {
|
|
52
|
+
const _toString = Object.prototype.toString;
|
|
53
|
+
let res;
|
|
54
|
+
switch (_toString.call(v)) {
|
|
55
|
+
case "[object Object]":
|
|
56
|
+
res = "object";
|
|
57
|
+
break;
|
|
58
|
+
case "[object Array]":
|
|
59
|
+
res = "array";
|
|
60
|
+
break;
|
|
61
|
+
case "[object Function]":
|
|
62
|
+
res = "function";
|
|
63
|
+
break;
|
|
64
|
+
case "[object String]":
|
|
65
|
+
res = "string";
|
|
66
|
+
break;
|
|
67
|
+
case "[object Number]":
|
|
68
|
+
res = "number";
|
|
69
|
+
break;
|
|
70
|
+
case "[object Symbol]":
|
|
71
|
+
res = "symbol";
|
|
72
|
+
break;
|
|
73
|
+
case "[object Undefined]":
|
|
74
|
+
res = "undefined";
|
|
75
|
+
break;
|
|
76
|
+
case "[object Null]":
|
|
77
|
+
res = "null";
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return res;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 是否空对象
|
|
87
|
+
* @param {*} v
|
|
88
|
+
* @returns {boolean}
|
|
89
|
+
*/
|
|
90
|
+
export function isEmptyObj(v) {
|
|
91
|
+
return !isDef(v) || (typeOf(v, "object") && !Object.keys(v).length);
|
|
32
92
|
}
|
|
93
|
+
|
|
33
94
|
/**
|
|
34
95
|
* 验证是否是经纬度。
|
|
35
96
|
* @param {Number} longitude
|
|
@@ -37,26 +98,30 @@ export function isFunction (value) {
|
|
|
37
98
|
* @returns {Boolean}
|
|
38
99
|
*/
|
|
39
100
|
export function lnglatValidator(longitude, latitude) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
101
|
+
// 经度,整数部分为0-180小数部分为0到6位
|
|
102
|
+
// const longreg = /^(-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,15})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,15}|180)$/
|
|
103
|
+
const longreg = new RegExp(
|
|
104
|
+
"^(-|\\+)?(((d|[1-9]d|1[0-7]d|0{1,3}).d{0,15})|(d|[1-9]d|1[0-7]d|0{1,3})|180.0{0,15}|180)$"
|
|
105
|
+
);
|
|
106
|
+
if (!longreg.test(longitude)) {
|
|
107
|
+
return false;
|
|
108
|
+
} // 纬度,整数部分为0-90小数部分为0到6位
|
|
109
|
+
// const latreg = /^(-|\+)?([0-8]?\d{1}\.\d{0,15}|90\.0{0,15}|[0-8]?\d{1}|90)$/
|
|
110
|
+
const latreg = new RegExp(
|
|
111
|
+
"^(-|\\+)?([0-8]?d{1}.d{0,15}|90.0{0,15}|[0-8]?d{1}|90)$"
|
|
112
|
+
);
|
|
113
|
+
if (!latreg.test(latitude)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
52
117
|
}
|
|
53
118
|
/**
|
|
54
119
|
* 普通对象 {x: number, y: number } 转换为 Cesium.Cartesian2 对象
|
|
55
120
|
* @param {Object} val
|
|
56
121
|
* @returns {Object}
|
|
57
122
|
*/
|
|
58
|
-
export function makeCartesian2
|
|
59
|
-
return val && new Cesium.Cartesian2(val.x, val.y)
|
|
123
|
+
export function makeCartesian2(val) {
|
|
124
|
+
return val && new Cesium.Cartesian2(val.x, val.y);
|
|
60
125
|
}
|
|
61
126
|
|
|
62
127
|
/**
|
|
@@ -64,13 +129,13 @@ export function makeCartesian2 (val) {
|
|
|
64
129
|
* @param {Object} val
|
|
65
130
|
* @returns {Object}
|
|
66
131
|
*/
|
|
67
|
-
export function makeCartesian3
|
|
68
|
-
if (val && Object.prototype.hasOwnProperty.call(val,
|
|
69
|
-
return new Cesium.Cartesian3(val.x, val.y, val.z)
|
|
70
|
-
} else if (val && Object.prototype.hasOwnProperty.call(val,
|
|
71
|
-
return Cesium.Cartesian3.fromDegrees(val.lng, val.lat, val.height)
|
|
132
|
+
export function makeCartesian3(val) {
|
|
133
|
+
if (val && Object.prototype.hasOwnProperty.call(val, "x")) {
|
|
134
|
+
return new Cesium.Cartesian3(val.x, val.y, val.z);
|
|
135
|
+
} else if (val && Object.prototype.hasOwnProperty.call(val, "lng")) {
|
|
136
|
+
return Cesium.Cartesian3.fromDegrees(val.lng, val.lat, val.height);
|
|
72
137
|
}
|
|
73
|
-
return val
|
|
138
|
+
return val;
|
|
74
139
|
}
|
|
75
140
|
|
|
76
141
|
/**
|
|
@@ -78,99 +143,104 @@ export function makeCartesian3 (val) {
|
|
|
78
143
|
* @param {Array} val
|
|
79
144
|
* @returns {Array<Cartesian3>}
|
|
80
145
|
*/
|
|
81
|
-
export function makeCartesian3Array
|
|
146
|
+
export function makeCartesian3Array(vals) {
|
|
82
147
|
if (vals && vals instanceof Array && vals[0] instanceof Cesium.Cartesian3) {
|
|
83
|
-
return vals
|
|
148
|
+
return vals;
|
|
84
149
|
}
|
|
85
150
|
|
|
86
|
-
const coordinates = []
|
|
87
|
-
vals.forEach(
|
|
88
|
-
coordinates.push(item.lng)
|
|
89
|
-
coordinates.push(item.lat)
|
|
90
|
-
coordinates.push(item.height)
|
|
91
|
-
})
|
|
151
|
+
const coordinates = [];
|
|
152
|
+
vals.forEach(item => {
|
|
153
|
+
coordinates.push(item.lng);
|
|
154
|
+
coordinates.push(item.lat);
|
|
155
|
+
coordinates.push(item.height);
|
|
156
|
+
});
|
|
92
157
|
|
|
93
|
-
return coordinates.length >= 3
|
|
158
|
+
return coordinates.length >= 3
|
|
159
|
+
? Cesium.Cartesian3.fromDegreesArrayHeights(coordinates)
|
|
160
|
+
: vals;
|
|
94
161
|
}
|
|
95
162
|
/**
|
|
96
163
|
* 普通数组 [lng, lat, ……,lng, lat] 转换为 Cesium.Cartesian2 数组
|
|
97
164
|
* @param {Array} vals
|
|
98
165
|
* @returns {Array<Cartesian2>}
|
|
99
166
|
*/
|
|
100
|
-
export function makeCartesian2Array
|
|
101
|
-
const cartesian2Array = []
|
|
102
|
-
vals.forEach(
|
|
103
|
-
cartesian2Array.push(new Cesium.Cartesian2(item.x, item.y))
|
|
104
|
-
})
|
|
105
|
-
return cartesian2Array
|
|
167
|
+
export function makeCartesian2Array(vals) {
|
|
168
|
+
const cartesian2Array = [];
|
|
169
|
+
vals.forEach(item => {
|
|
170
|
+
cartesian2Array.push(new Cesium.Cartesian2(item.x, item.y));
|
|
171
|
+
});
|
|
172
|
+
return cartesian2Array;
|
|
106
173
|
}
|
|
107
174
|
|
|
108
175
|
/**
|
|
109
176
|
*
|
|
110
177
|
* @param {Object} val
|
|
111
178
|
*/
|
|
112
|
-
export function makeQuaternion
|
|
113
|
-
return val.x ? new Cesium.Quaternion(val.x, val.y, val.z, val.w) : val
|
|
179
|
+
export function makeQuaternion(val) {
|
|
180
|
+
return val.x ? new Cesium.Quaternion(val.x, val.y, val.z, val.w) : val;
|
|
114
181
|
}
|
|
115
182
|
|
|
116
183
|
/**
|
|
117
184
|
* 解析 HierarchyJson
|
|
118
185
|
* @param {Object} val
|
|
119
186
|
*/
|
|
120
|
-
function parsePolygonHierarchyJson
|
|
121
|
-
val.forEach(
|
|
122
|
-
element.positions = makeCartesian3Array(element.positions)
|
|
187
|
+
function parsePolygonHierarchyJson(val) {
|
|
188
|
+
val.forEach(element => {
|
|
189
|
+
element.positions = makeCartesian3Array(element.positions);
|
|
123
190
|
if (element.holes) {
|
|
124
|
-
parsePolygonHierarchyJson(element.holes)
|
|
191
|
+
parsePolygonHierarchyJson(element.holes);
|
|
125
192
|
}
|
|
126
|
-
})
|
|
193
|
+
});
|
|
127
194
|
}
|
|
128
195
|
|
|
129
196
|
/**
|
|
130
197
|
* 普通数组或对象转 Cesium.PolygonHierarchy 对象。
|
|
131
198
|
* @param {Object|Array} val
|
|
132
199
|
*/
|
|
133
|
-
export function makePolygonHierarchy
|
|
200
|
+
export function makePolygonHierarchy(val) {
|
|
134
201
|
if (val instanceof Array && val.length >= 3) {
|
|
135
|
-
return new Cesium.PolygonHierarchy(makeCartesian3Array(val))
|
|
202
|
+
return new Cesium.PolygonHierarchy(makeCartesian3Array(val));
|
|
136
203
|
}
|
|
137
204
|
if (Cesium.defined(val.positions)) {
|
|
138
|
-
val.positions = makeCartesian3Array(val.positions)
|
|
139
|
-
parsePolygonHierarchyJson(val.holes)
|
|
205
|
+
val.positions = makeCartesian3Array(val.positions);
|
|
206
|
+
parsePolygonHierarchyJson(val.holes);
|
|
140
207
|
}
|
|
141
208
|
|
|
142
|
-
return val
|
|
209
|
+
return val;
|
|
143
210
|
}
|
|
144
211
|
/**
|
|
145
212
|
* 普通对象 {near: number, nearValue: number, far: number, farValue: number} 转 Cesium.NearFarScalar 对象。
|
|
146
213
|
* @param {Object} val
|
|
147
214
|
* @returns {NearFarScalar}
|
|
148
215
|
*/
|
|
149
|
-
export function makeNearFarScalar
|
|
150
|
-
return
|
|
216
|
+
export function makeNearFarScalar(val) {
|
|
217
|
+
return (
|
|
218
|
+
val &&
|
|
219
|
+
new Cesium.NearFarScalar(val.near, val.nearValue, val.far, val.farValue)
|
|
220
|
+
);
|
|
151
221
|
}
|
|
152
222
|
/**
|
|
153
223
|
* 普通对象 {near: number, far: number} 转 Cesium.DistanceDisplayCondition 对象。
|
|
154
224
|
* @param {Object} val
|
|
155
225
|
* @returns {DistanceDisplayCondition}
|
|
156
226
|
*/
|
|
157
|
-
export function makeDistanceDisplayCondition
|
|
158
|
-
return val && new Cesium.DistanceDisplayCondition(val.near, val.far)
|
|
227
|
+
export function makeDistanceDisplayCondition(val) {
|
|
228
|
+
return val && new Cesium.DistanceDisplayCondition(val.near, val.far);
|
|
159
229
|
}
|
|
160
230
|
/**
|
|
161
231
|
* 普通对象或数组 [r, g, b, a] 或字符串转 Cesium.Color 对象。
|
|
162
232
|
* @param {String|Array|Object} val
|
|
163
233
|
* @returns {Color}
|
|
164
234
|
*/
|
|
165
|
-
export function makeColor
|
|
235
|
+
export function makeColor(val) {
|
|
166
236
|
if (val instanceof Cesium.Color) {
|
|
167
|
-
return val
|
|
237
|
+
return val;
|
|
168
238
|
} else if (val instanceof Array) {
|
|
169
|
-
return new Cesium.Color(val[0], val[1], val[2], val[3])
|
|
170
|
-
} else if (typeof val ===
|
|
171
|
-
return Cesium.Color.fromCssColorString(val)
|
|
239
|
+
return new Cesium.Color(val[0], val[1], val[2], val[3]);
|
|
240
|
+
} else if (typeof val === "string") {
|
|
241
|
+
return Cesium.Color.fromCssColorString(val);
|
|
172
242
|
}
|
|
173
|
-
return val
|
|
243
|
+
return val;
|
|
174
244
|
}
|
|
175
245
|
|
|
176
246
|
/**
|
|
@@ -178,30 +248,29 @@ export function makeColor (val) {
|
|
|
178
248
|
* @param {String|Array|Object} val
|
|
179
249
|
*/
|
|
180
250
|
export function makeMaterial(val) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return val
|
|
251
|
+
// if (
|
|
252
|
+
// val instanceof Array ||
|
|
253
|
+
// (typeof val === 'string' && !/(.*)\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$/.test(val))
|
|
254
|
+
// ) {
|
|
255
|
+
// return makeColor(val)
|
|
256
|
+
// }
|
|
257
|
+
const regExp = new RegExp(
|
|
258
|
+
"(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$"
|
|
259
|
+
);
|
|
260
|
+
if (val instanceof Array || (typeof val === "string" && !regExp.test(val))) {
|
|
261
|
+
return makeColor(val);
|
|
262
|
+
}
|
|
263
|
+
// else if (val && val.hasOwnProperty('fabric')) {
|
|
264
|
+
// return new Cesium.Material({
|
|
265
|
+
// fabric: {
|
|
266
|
+
// type: 'Color',
|
|
267
|
+
// uniforms: {
|
|
268
|
+
// color: new Cesium.Color(1.0, 1.0, 0.0, 1.0)
|
|
269
|
+
// }
|
|
270
|
+
// }
|
|
271
|
+
// })
|
|
272
|
+
// }
|
|
273
|
+
return val;
|
|
205
274
|
}
|
|
206
275
|
|
|
207
276
|
/**
|
|
@@ -210,11 +279,14 @@ export function makeMaterial(val) {
|
|
|
210
279
|
* @returns {Rectangle}
|
|
211
280
|
*/
|
|
212
281
|
export function makeRectangle(val) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
282
|
+
// Entiy 的 rectangle 属性不能调用这个方法
|
|
283
|
+
if (val instanceof Cesium.RectangleGraphics) {
|
|
284
|
+
return val;
|
|
285
|
+
}
|
|
286
|
+
return (
|
|
287
|
+
val &&
|
|
288
|
+
Cesium.Rectangle.fromDegrees(val.west, val.south, val.east, val.north)
|
|
289
|
+
);
|
|
218
290
|
}
|
|
219
291
|
|
|
220
292
|
/**
|
|
@@ -223,7 +295,9 @@ export function makeRectangle(val) {
|
|
|
223
295
|
* @returns {BoundingRectangle}
|
|
224
296
|
*/
|
|
225
297
|
export function makeBoundingRectangle(val) {
|
|
226
|
-
|
|
298
|
+
return (
|
|
299
|
+
val && new Cesium.BoundingRectangle(val.x, val.y, val.width, val.height)
|
|
300
|
+
);
|
|
227
301
|
}
|
|
228
302
|
|
|
229
303
|
/**
|
|
@@ -232,15 +306,15 @@ export function makeBoundingRectangle(val) {
|
|
|
232
306
|
* @returns {Plane}
|
|
233
307
|
*/
|
|
234
308
|
export function makePlane(val) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
309
|
+
// Entiy 和 PlaneGraphics 都有个 plane 属性 要区别一下
|
|
310
|
+
if (val instanceof Cesium.PlaneGraphics) {
|
|
311
|
+
return val;
|
|
312
|
+
}
|
|
313
|
+
if (val) {
|
|
314
|
+
Cesium.Cartesian3.normalize(makeCartesian3(val.normal), val.normal);
|
|
315
|
+
return new Cesium.Plane(val.normal, val.distance);
|
|
316
|
+
}
|
|
317
|
+
return val;
|
|
244
318
|
}
|
|
245
319
|
|
|
246
320
|
/**
|
|
@@ -248,138 +322,144 @@ export function makePlane(val) {
|
|
|
248
322
|
* @param {*} val
|
|
249
323
|
*/
|
|
250
324
|
export function makeTranslationRotationScale(val) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
)
|
|
325
|
+
return (
|
|
326
|
+
val &&
|
|
327
|
+
new Cesium.TranslationRotationScale(
|
|
328
|
+
makeCartesian3(val.translation),
|
|
329
|
+
makeQuaternion(val.rotation),
|
|
330
|
+
makeCartesian3(val.scale)
|
|
258
331
|
)
|
|
332
|
+
);
|
|
259
333
|
}
|
|
260
334
|
|
|
261
335
|
export function makeOptions(val) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
336
|
+
const cmpName = this.$options.name;
|
|
337
|
+
switch (cmpName) {
|
|
338
|
+
case "vc-datasource-geojson":
|
|
339
|
+
const result = {};
|
|
340
|
+
Object.assign(result, val);
|
|
341
|
+
result &&
|
|
342
|
+
result.markerColor &&
|
|
343
|
+
(result.markerColor = makeColor(result.markerColor));
|
|
344
|
+
result && result.stroke && (result.stroke = makeColor(result.stroke));
|
|
345
|
+
result && result.fill && (result.fill = makeColor(result.fill));
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
return val;
|
|
273
349
|
}
|
|
274
350
|
|
|
275
351
|
export function dirname(path) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
352
|
+
if (typeof path !== "string") path = path + "";
|
|
353
|
+
if (path.length === 0) return ".";
|
|
354
|
+
var code = path.charCodeAt(0);
|
|
355
|
+
var hasRoot = code === 47; /* / */
|
|
356
|
+
var end = -1;
|
|
357
|
+
var matchedSlash = true;
|
|
358
|
+
for (var i = path.length - 1; i >= 1; --i) {
|
|
359
|
+
code = path.charCodeAt(i);
|
|
360
|
+
if (code === 47 /* / */) {
|
|
361
|
+
if (!matchedSlash) {
|
|
362
|
+
end = i;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
// We saw the first non-path separator
|
|
367
|
+
matchedSlash = false;
|
|
293
368
|
}
|
|
369
|
+
}
|
|
294
370
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
371
|
+
if (end === -1) return hasRoot ? "/" : ".";
|
|
372
|
+
if (hasRoot && end === 1) {
|
|
373
|
+
// return '//';
|
|
374
|
+
// Backwards-compat fix:
|
|
375
|
+
return "/";
|
|
376
|
+
}
|
|
377
|
+
return path.slice(0, end);
|
|
302
378
|
}
|
|
303
379
|
|
|
304
380
|
export function Platform() {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
381
|
+
var ua = navigator.userAgent;
|
|
382
|
+
// var isWindowsPhone = /(?:Windows Phone)/.test(ua)
|
|
383
|
+
const windowsPone = new RegExp("(?:Windows Phone)");
|
|
384
|
+
var isWindowsPhone = windowsPone.test(ua);
|
|
385
|
+
// var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone
|
|
386
|
+
const symbianOs = new RegExp("(?:SymbianOS)");
|
|
387
|
+
var isSymbian = symbianOs.test(ua) || isWindowsPhone;
|
|
388
|
+
// var isAndroid = /(?:Android)/.test(ua)
|
|
389
|
+
const android = new RegExp("(?:Android)");
|
|
390
|
+
var isAndroid = android.test(ua);
|
|
391
|
+
// var isFireFox = /(?:Firefox)/.test(ua)
|
|
392
|
+
const firefox = new RegExp("(?:Firefox)");
|
|
393
|
+
var isFireFox = firefox.test(ua);
|
|
394
|
+
// var isChrome = /(?:Chrome|CriOS)/.test(ua)
|
|
395
|
+
const chrome = new RegExp("(?:Chrome|CriOS)");
|
|
396
|
+
var isChrome = chrome.test(ua);
|
|
397
|
+
|
|
398
|
+
// var isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua))
|
|
399
|
+
const ipadOrplaybook = new RegExp("(?:iPad|PlayBook)");
|
|
400
|
+
const mobile = new RegExp("(?:Mobile)");
|
|
401
|
+
const tablet = new RegExp("(?:Tablet)");
|
|
402
|
+
var isTablet =
|
|
403
|
+
ipadOrplaybook.test(ua) ||
|
|
404
|
+
(isAndroid && !mobile.test(ua)) ||
|
|
405
|
+
(isFireFox && tablet.test(ua));
|
|
406
|
+
// var isPhone = /(?:iPhone)/.test(ua) && !isTablet
|
|
407
|
+
const iphone = new RegExp("(?:iPhone)");
|
|
408
|
+
var isPhone = iphone.test(ua) && !isTablet;
|
|
409
|
+
var isPc = !isPhone && !isAndroid && !isSymbian;
|
|
410
|
+
return {
|
|
411
|
+
isTablet: isTablet,
|
|
412
|
+
isPhone: isPhone,
|
|
413
|
+
isAndroid: isAndroid,
|
|
414
|
+
isPc: isPc,
|
|
415
|
+
isChrome: isChrome
|
|
416
|
+
};
|
|
338
417
|
}
|
|
339
418
|
|
|
340
419
|
export function captureScreenshot(viewer, showSplitter = false) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
420
|
+
const { when } = Cesium;
|
|
421
|
+
const deferred = when.defer();
|
|
422
|
+
const scene = viewer.scene;
|
|
423
|
+
var removeCallback = scene.postRender.addEventListener(function() {
|
|
424
|
+
removeCallback();
|
|
425
|
+
try {
|
|
426
|
+
const cesiumCanvas = viewer.scene.canvas;
|
|
427
|
+
|
|
428
|
+
// If we're using the splitter, draw the split position as a vertical white line.
|
|
429
|
+
let canvas = cesiumCanvas;
|
|
430
|
+
// if (showSplitter) {
|
|
431
|
+
// canvas = document.createElement('canvas')
|
|
432
|
+
// canvas.width = cesiumCanvas.width
|
|
433
|
+
// canvas.height = cesiumCanvas.height
|
|
434
|
+
|
|
435
|
+
// const context = canvas.getContext('2d')
|
|
436
|
+
// context.drawImage(cesiumCanvas, 0, 0)
|
|
437
|
+
|
|
438
|
+
// const x = viewer.splitPosition * cesiumCanvas.width
|
|
439
|
+
// context.strokeStyle = this.terria.baseMapContrastColor
|
|
440
|
+
// context.beginPath()
|
|
441
|
+
// context.moveTo(x, 0)
|
|
442
|
+
// context.lineTo(x, cesiumCanvas.height)
|
|
443
|
+
// context.stroke()
|
|
444
|
+
// }
|
|
445
|
+
|
|
446
|
+
deferred.resolve(canvas.toDataURL("image/png"));
|
|
447
|
+
} catch (e) {
|
|
448
|
+
deferred.reject(e);
|
|
449
|
+
}
|
|
450
|
+
}, this);
|
|
451
|
+
|
|
452
|
+
scene.render(viewer.clock.currentTime);
|
|
453
|
+
|
|
454
|
+
return deferred.promise;
|
|
376
455
|
}
|
|
377
456
|
|
|
378
457
|
export function getAllAttribution(viewer) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
458
|
+
const credits = viewer.scene.frameState.creditDisplay._currentFrameCredits.screenCredits.values.concat(
|
|
459
|
+
viewer.scene.frameState.creditDisplay._currentFrameCredits.lightboxCredits
|
|
460
|
+
.values
|
|
461
|
+
);
|
|
462
|
+
return credits.map(credit => credit.html);
|
|
383
463
|
}
|
|
384
464
|
|
|
385
465
|
/**
|
|
@@ -388,12 +468,12 @@ export function getAllAttribution(viewer) {
|
|
|
388
468
|
* @param name String 对象名称
|
|
389
469
|
* */
|
|
390
470
|
export function getCesiumBaseObject(vm, name) {
|
|
391
|
-
|
|
471
|
+
let baseObject = vm[name];
|
|
472
|
+
if (!baseObject) {
|
|
473
|
+
baseObject = window[name];
|
|
392
474
|
if (!baseObject) {
|
|
393
|
-
|
|
394
|
-
if (!baseObject) {
|
|
395
|
-
throw new Error("未找到可用的" + name + "对象!");
|
|
396
|
-
}
|
|
475
|
+
throw new Error("未找到可用的" + name + "对象!");
|
|
397
476
|
}
|
|
398
|
-
|
|
399
|
-
|
|
477
|
+
}
|
|
478
|
+
return baseObject;
|
|
479
|
+
}
|