bruce-cesium 2.7.4 → 2.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +92 -121
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +91 -120
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +13 -2
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +2 -4
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/widgets/common/draw-3d-polygon.js +26 -54
- package/dist/lib/widgets/common/draw-3d-polygon.js.map +1 -1
- package/dist/lib/widgets/common/draw-3d-polyline.js +46 -56
- package/dist/lib/widgets/common/draw-3d-polyline.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1764,7 +1764,7 @@
|
|
|
1764
1764
|
}
|
|
1765
1765
|
function getStyle(api, entity, styleId) {
|
|
1766
1766
|
return __awaiter(this, void 0, void 0, function () {
|
|
1767
|
-
var style, e_2, typeId, type, e_3;
|
|
1767
|
+
var style, e_2, typeId, type, e_3, hideError, error, code;
|
|
1768
1768
|
return __generator(this, function (_a) {
|
|
1769
1769
|
switch (_a.label) {
|
|
1770
1770
|
case 0:
|
|
@@ -1807,7 +1807,18 @@
|
|
|
1807
1807
|
return [3 /*break*/, 9];
|
|
1808
1808
|
case 8:
|
|
1809
1809
|
e_3 = _a.sent();
|
|
1810
|
-
|
|
1810
|
+
hideError = false;
|
|
1811
|
+
// TODO: we need a util for extracting code + message rather than writing all this every time.
|
|
1812
|
+
if (e_3 && typeof e_3 == "object" && e_3.ERROR) {
|
|
1813
|
+
error = e_3.ERROR;
|
|
1814
|
+
code = error && typeof error == "object" ? error.Code : "";
|
|
1815
|
+
// Avoiding logging a common error.
|
|
1816
|
+
// This happens when rendering entities that don't have records.
|
|
1817
|
+
hideError = String(code).toLowerCase() == "notfound";
|
|
1818
|
+
}
|
|
1819
|
+
if (!hideError) {
|
|
1820
|
+
console.error(e_3);
|
|
1821
|
+
}
|
|
1811
1822
|
return [3 /*break*/, 9];
|
|
1812
1823
|
case 9: return [2 /*return*/, style];
|
|
1813
1824
|
}
|
|
@@ -5506,16 +5517,14 @@
|
|
|
5506
5517
|
viewer: this.viewer,
|
|
5507
5518
|
// Unfortunately this searches as an "AND" rather than "OR" which does not meet our needs here.
|
|
5508
5519
|
// So for multiple tags we'll manually sort on UI end...
|
|
5509
|
-
tagIds: tagsToRender
|
|
5520
|
+
tagIds: (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [],
|
|
5510
5521
|
debugShowBounds: Boolean(window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
|
|
5511
5522
|
cdn: this.item.cdnEnabled
|
|
5512
5523
|
});
|
|
5513
5524
|
var minMax = exports.RenderManager.GetZoomMinMax({
|
|
5514
5525
|
zoomControl: this.item.CameraZoomSettings
|
|
5515
5526
|
});
|
|
5516
|
-
|
|
5517
|
-
// So for multiple tags we'll manually sort on UI end...
|
|
5518
|
-
this.getter.IncludeMenuItem(this.item.id, tagsToRender.length == 1 ? tagsToRender : [], minMax[0], minMax[1]);
|
|
5527
|
+
this.getter.IncludeMenuItem(this.item.id, (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [], minMax[0], minMax[1]);
|
|
5519
5528
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
|
|
5520
5529
|
if (isTagItem) {
|
|
5521
5530
|
_this.distributeForRender(entities.filter(function (entity) {
|
|
@@ -12383,71 +12392,43 @@
|
|
|
12383
12392
|
})(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
|
|
12384
12393
|
|
|
12385
12394
|
var DEFAULT_SMOOTH_MULTIPLIER = 0;
|
|
12386
|
-
function
|
|
12387
|
-
var
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
var x1 = carto1.longitude;
|
|
12391
|
-
var y1 = carto1.latitude;
|
|
12392
|
-
var x2 = carto2.longitude;
|
|
12393
|
-
var y2 = carto2.latitude;
|
|
12394
|
-
var x3 = carto3.longitude;
|
|
12395
|
-
var y3 = carto3.latitude;
|
|
12396
|
-
var A = x1 - x2;
|
|
12397
|
-
var B = y1 - y2;
|
|
12398
|
-
var C = x3 - x2;
|
|
12399
|
-
var D = y3 - y2;
|
|
12400
|
-
var dot = A * C + B * D;
|
|
12401
|
-
var lenSq = C * C + D * D;
|
|
12402
|
-
var param = dot / lenSq;
|
|
12403
|
-
var xx;
|
|
12404
|
-
var yy;
|
|
12405
|
-
if (param < 0 || x2 == x3 && y2 == y3) {
|
|
12406
|
-
xx = x2;
|
|
12407
|
-
yy = y2;
|
|
12408
|
-
}
|
|
12409
|
-
else if (param > 1) {
|
|
12410
|
-
xx = x3;
|
|
12411
|
-
yy = y3;
|
|
12395
|
+
function distanceToSegment$1(p, v, w) {
|
|
12396
|
+
var l2 = Cesium.Cartesian3.distanceSquared(v, w);
|
|
12397
|
+
if (l2 === 0) {
|
|
12398
|
+
return Cesium.Cartesian3.distance(p, v);
|
|
12412
12399
|
}
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12400
|
+
var t = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(p, v, new Cesium.Cartesian3()), Cesium.Cartesian3.subtract(w, v, new Cesium.Cartesian3())) / l2;
|
|
12401
|
+
if (t < 0) {
|
|
12402
|
+
return Cesium.Cartesian3.distance(p, v);
|
|
12403
|
+
}
|
|
12404
|
+
if (t > 1) {
|
|
12405
|
+
return Cesium.Cartesian3.distance(p, w);
|
|
12416
12406
|
}
|
|
12417
|
-
var
|
|
12418
|
-
|
|
12419
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
12407
|
+
var projection = Cesium.Cartesian3.add(v, Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(w, v, new Cesium.Cartesian3()), t, new Cesium.Cartesian3()), new Cesium.Cartesian3());
|
|
12408
|
+
return Cesium.Cartesian3.distance(p, projection);
|
|
12420
12409
|
}
|
|
12410
|
+
/**
|
|
12411
|
+
* Returns splice index into a list of positions to insert a new position.
|
|
12412
|
+
* @param positions List of positions to insert into.
|
|
12413
|
+
* @param pos3d New position to insert.
|
|
12414
|
+
* @returns Index to insert at.
|
|
12415
|
+
*/
|
|
12421
12416
|
function getInsertIndex(positions, pos3d) {
|
|
12422
12417
|
if (positions.length < 2) {
|
|
12423
12418
|
return 0;
|
|
12424
12419
|
}
|
|
12420
|
+
var minDistance = Infinity;
|
|
12425
12421
|
var index = -1;
|
|
12426
|
-
|
|
12427
|
-
var
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
pos2 = positions[0];
|
|
12434
|
-
pos2Index = 0;
|
|
12435
|
-
}
|
|
12436
|
-
else {
|
|
12437
|
-
pos2 = positions[j + 1];
|
|
12438
|
-
pos2Index = j + 1;
|
|
12439
|
-
}
|
|
12440
|
-
if (bruceModels.Cartes.ValidateCartes3(pos1), bruceModels.Cartes.ValidateCartes3(pos2)) {
|
|
12441
|
-
var length_1 = avgDistanceFromPointPair(pos3d, pos1, pos2);
|
|
12442
|
-
if (index == -1 || length_1 < distance) {
|
|
12443
|
-
var insertIndex = pos2Index == 0 ? 0 : j > pos2Index ? j : pos2Index;
|
|
12444
|
-
index = insertIndex;
|
|
12445
|
-
distance = length_1;
|
|
12446
|
-
}
|
|
12447
|
-
}
|
|
12422
|
+
for (var i = 0; i < positions.length; i++) {
|
|
12423
|
+
var pos1 = positions[i];
|
|
12424
|
+
var pos2 = i < positions.length - 1 ? positions[i + 1] : positions[0];
|
|
12425
|
+
var dist = distanceToSegment$1(pos3d, pos1, pos2);
|
|
12426
|
+
if (dist < minDistance) {
|
|
12427
|
+
minDistance = dist;
|
|
12428
|
+
index = i + 1;
|
|
12448
12429
|
}
|
|
12449
12430
|
}
|
|
12450
|
-
return index
|
|
12431
|
+
return index;
|
|
12451
12432
|
}
|
|
12452
12433
|
var OUTLINE_COLOR = "rgba(51, 177, 255, 0.2)";
|
|
12453
12434
|
var FILL_COLOR = "#33B1FF";
|
|
@@ -12850,71 +12831,61 @@
|
|
|
12850
12831
|
}());
|
|
12851
12832
|
|
|
12852
12833
|
var DEFAULT_SMOOTH_MULTIPLIER$1 = 0;
|
|
12853
|
-
function
|
|
12854
|
-
var
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
var x1 = carto1.longitude;
|
|
12858
|
-
var y1 = carto1.latitude;
|
|
12859
|
-
var x2 = carto2.longitude;
|
|
12860
|
-
var y2 = carto2.latitude;
|
|
12861
|
-
var x3 = carto3.longitude;
|
|
12862
|
-
var y3 = carto3.latitude;
|
|
12863
|
-
var A = x1 - x2;
|
|
12864
|
-
var B = y1 - y2;
|
|
12865
|
-
var C = x3 - x2;
|
|
12866
|
-
var D = y3 - y2;
|
|
12867
|
-
var dot = A * C + B * D;
|
|
12868
|
-
var lenSq = C * C + D * D;
|
|
12869
|
-
var param = dot / lenSq;
|
|
12870
|
-
var xx;
|
|
12871
|
-
var yy;
|
|
12872
|
-
if (param < 0 || x2 == x3 && y2 == y3) {
|
|
12873
|
-
xx = x2;
|
|
12874
|
-
yy = y2;
|
|
12875
|
-
}
|
|
12876
|
-
else if (param > 1) {
|
|
12877
|
-
xx = x3;
|
|
12878
|
-
yy = y3;
|
|
12834
|
+
function distanceToSegment$2(p, v, w) {
|
|
12835
|
+
var l2 = Cesium.Cartesian3.distanceSquared(v, w);
|
|
12836
|
+
if (l2 === 0) {
|
|
12837
|
+
return Cesium.Cartesian3.distance(p, v);
|
|
12879
12838
|
}
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12839
|
+
var t = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(p, v, new Cesium.Cartesian3()), Cesium.Cartesian3.subtract(w, v, new Cesium.Cartesian3())) / l2;
|
|
12840
|
+
if (t < 0) {
|
|
12841
|
+
return Cesium.Cartesian3.distance(p, v);
|
|
12883
12842
|
}
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12843
|
+
if (t > 1) {
|
|
12844
|
+
return Cesium.Cartesian3.distance(p, w);
|
|
12845
|
+
}
|
|
12846
|
+
var projection = Cesium.Cartesian3.add(v, Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(w, v, new Cesium.Cartesian3()), t, new Cesium.Cartesian3()), new Cesium.Cartesian3());
|
|
12847
|
+
return Cesium.Cartesian3.distance(p, projection);
|
|
12887
12848
|
}
|
|
12849
|
+
/**
|
|
12850
|
+
* Returns splice index into a list of positions to insert a new position.
|
|
12851
|
+
* @param positions List of positions to insert into.
|
|
12852
|
+
* @param pos3d New position to insert.
|
|
12853
|
+
* @returns Index to insert at.
|
|
12854
|
+
*/
|
|
12888
12855
|
function getInsertIndex$1(positions, pos3d) {
|
|
12889
12856
|
if (positions.length < 2) {
|
|
12890
12857
|
return 0;
|
|
12891
12858
|
}
|
|
12892
|
-
var
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12859
|
+
var minDistance = Infinity;
|
|
12860
|
+
var index = -1;
|
|
12861
|
+
// Check against segments
|
|
12862
|
+
for (var i = 0; i < positions.length - 1; i++) {
|
|
12863
|
+
var pos1 = positions[i];
|
|
12864
|
+
var pos2 = positions[i + 1];
|
|
12865
|
+
var dist = distanceToSegment$2(pos3d, pos1, pos2);
|
|
12866
|
+
if (dist < minDistance) {
|
|
12867
|
+
minDistance = dist;
|
|
12868
|
+
index = i + 1;
|
|
12869
|
+
}
|
|
12870
|
+
}
|
|
12871
|
+
// Check against start point
|
|
12872
|
+
var startDist = Cesium.Cartesian3.distance(pos3d, positions[0]);
|
|
12873
|
+
if (startDist <= minDistance) {
|
|
12874
|
+
index = 0;
|
|
12875
|
+
minDistance = startDist;
|
|
12876
|
+
console.log("Insert at start");
|
|
12877
|
+
}
|
|
12878
|
+
else {
|
|
12879
|
+
console.log("Start distance was longer than cur distance. ".concat(startDist, " > ").concat(minDistance));
|
|
12880
|
+
}
|
|
12881
|
+
// Check against end point
|
|
12882
|
+
var endDist = Cesium.Cartesian3.distance(pos3d, positions[positions.length - 1]);
|
|
12883
|
+
if (endDist <= minDistance) {
|
|
12884
|
+
index = positions.length;
|
|
12885
|
+
console.log("Insert at end");
|
|
12886
|
+
}
|
|
12887
|
+
else {
|
|
12888
|
+
console.log("End distance was longer than cur distance. ".concat(endDist, " > ").concat(minDistance));
|
|
12918
12889
|
}
|
|
12919
12890
|
return index;
|
|
12920
12891
|
}
|
|
@@ -15218,7 +15189,7 @@
|
|
|
15218
15189
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
15219
15190
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
15220
15191
|
|
|
15221
|
-
var VERSION$1 = "2.7.
|
|
15192
|
+
var VERSION$1 = "2.7.5";
|
|
15222
15193
|
|
|
15223
15194
|
exports.VERSION = VERSION$1;
|
|
15224
15195
|
exports.CesiumViewMonitor = CesiumViewMonitor;
|