bruce-cesium 3.7.3 → 3.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 +1171 -312
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1169 -310
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/cesium-animated-property.js +280 -0
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -0
- package/dist/lib/rendering/entity-render-engine.js +660 -278
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/getters/entity-filter-getter.js +69 -2
- package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +2 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +37 -20
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +10 -0
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +115 -5
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/cesium-animated-property.d.ts +88 -0
- package/dist/types/rendering/entity-render-engine.d.ts +10 -1
- package/dist/types/rendering/getters/entity-filter-getter.d.ts +15 -1
- package/dist/types/rendering/render-managers/common/shared-getters.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +2 -0
- package/dist/types/utils/cesium-entity-styler.d.ts +5 -0
- package/package.json +2 -2
|
@@ -55,6 +55,8 @@ var render_manager_1 = require("./render-managers/render-manager");
|
|
|
55
55
|
var js_utils_1 = require("../internal/js-utils");
|
|
56
56
|
var visual_register_culler_1 = require("./visual-register-culler");
|
|
57
57
|
var limited_log_1 = require("../internal/limited-log");
|
|
58
|
+
var cesium_entity_styler_1 = require("../utils/cesium-entity-styler");
|
|
59
|
+
var cesium_animated_property_1 = require("./cesium-animated-property");
|
|
58
60
|
function colorToCColor(color) {
|
|
59
61
|
return new Cesium.Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
60
62
|
}
|
|
@@ -450,7 +452,7 @@ var POINT_BILLBOARD_PADDING = 1;
|
|
|
450
452
|
var createCircleBillboard = function (size, colorCss) {
|
|
451
453
|
var key = size + "-" + colorCss;
|
|
452
454
|
var cacheData = _billboardCache.Get(key);
|
|
453
|
-
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.
|
|
455
|
+
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) && typeof (cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) == "string") {
|
|
454
456
|
return cacheData;
|
|
455
457
|
}
|
|
456
458
|
// Slight padding to avoid corners clipping.
|
|
@@ -464,7 +466,7 @@ var createCircleBillboard = function (size, colorCss) {
|
|
|
464
466
|
context.fillStyle = colorCss;
|
|
465
467
|
context.fill();
|
|
466
468
|
var data = {
|
|
467
|
-
|
|
469
|
+
canvasDataUri: canvas.toDataURL("image/png"),
|
|
468
470
|
colorCss: colorCss,
|
|
469
471
|
size: size,
|
|
470
472
|
height: canvasSize,
|
|
@@ -499,7 +501,7 @@ var createImageBillboard = function (url) {
|
|
|
499
501
|
var context = canvas_1.getContext("2d");
|
|
500
502
|
context.drawImage(image_1, 0, 0);
|
|
501
503
|
var data = {
|
|
502
|
-
|
|
504
|
+
canvasDataUri: canvas_1.toDataURL("image/png"),
|
|
503
505
|
height: image_1.height
|
|
504
506
|
};
|
|
505
507
|
res(data);
|
|
@@ -615,11 +617,11 @@ function extractMetadataFromFileUrl(url) {
|
|
|
615
617
|
var EntityRenderEngine;
|
|
616
618
|
(function (EntityRenderEngine) {
|
|
617
619
|
function Render(params) {
|
|
618
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
620
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
619
621
|
return __awaiter(this, void 0, void 0, function () {
|
|
620
|
-
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType,
|
|
621
|
-
return __generator(this, function (
|
|
622
|
-
switch (
|
|
622
|
+
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
|
|
623
|
+
return __generator(this, function (_m) {
|
|
624
|
+
switch (_m.label) {
|
|
623
625
|
case 0:
|
|
624
626
|
groupRenderParams = {
|
|
625
627
|
apiGetter: params.apiGetter,
|
|
@@ -661,21 +663,36 @@ var EntityRenderEngine;
|
|
|
661
663
|
displayType = bruce_models_1.ZoomControl.EDisplayType.Geometry;
|
|
662
664
|
}
|
|
663
665
|
if (displayType != bruce_models_1.ZoomControl.EDisplayType.Hidden) {
|
|
664
|
-
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
665
666
|
existingRego = params.visualRegister.GetRego({
|
|
666
667
|
entityId: id,
|
|
667
668
|
menuItemId: params.menuItemId
|
|
668
669
|
});
|
|
670
|
+
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
669
671
|
oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
|
|
670
|
-
if (!params.force &&
|
|
672
|
+
if (!params.force &&
|
|
673
|
+
newRenderId == oldRenderId &&
|
|
674
|
+
!(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
|
|
675
|
+
// If historic metadata is different then it's also stale.
|
|
676
|
+
((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.historicDateTime))) {
|
|
677
|
+
// No sorting category needed. Already rendered the way we want.
|
|
671
678
|
cEntities[id] = existingRego.visual;
|
|
672
679
|
}
|
|
673
680
|
else {
|
|
681
|
+
// Add so we can re-use the graphic and update it.
|
|
682
|
+
if (existingRego && newRenderId == oldRenderId) {
|
|
683
|
+
cEntities[id] = existingRego.visual;
|
|
684
|
+
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
685
|
+
existingRego.stale = false;
|
|
686
|
+
// Update metadata for the same reason.
|
|
687
|
+
existingRego.historicDateTime = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime;
|
|
688
|
+
existingRego.historicAttrKey = (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey;
|
|
689
|
+
existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
|
|
690
|
+
}
|
|
674
691
|
if (displayType == bruce_models_1.ZoomControl.EDisplayType.Model3D) {
|
|
675
692
|
models.push(entity);
|
|
676
693
|
}
|
|
677
694
|
else if (displayType == bruce_models_1.ZoomControl.EDisplayType.Geometry) {
|
|
678
|
-
if ((
|
|
695
|
+
if ((_h = (_g = entity.geometry) === null || _g === void 0 ? void 0 : _g.MultiGeometry) === null || _h === void 0 ? void 0 : _h.length) {
|
|
679
696
|
multiGeometry.push(entity);
|
|
680
697
|
}
|
|
681
698
|
else {
|
|
@@ -690,10 +707,10 @@ var EntityRenderEngine;
|
|
|
690
707
|
}
|
|
691
708
|
}
|
|
692
709
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
693
|
-
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
710
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
694
711
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
695
712
|
case 1:
|
|
696
|
-
mEntities =
|
|
713
|
+
mEntities = _m.sent();
|
|
697
714
|
for (i = 0; i < mParams.entities.length; i++) {
|
|
698
715
|
entity = mParams.entities[i];
|
|
699
716
|
id = entity.Bruce.ID;
|
|
@@ -705,20 +722,20 @@ var EntityRenderEngine;
|
|
|
705
722
|
multiGeometry.push(entity);
|
|
706
723
|
}
|
|
707
724
|
}
|
|
708
|
-
|
|
725
|
+
_m.label = 2;
|
|
709
726
|
case 2:
|
|
710
727
|
if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
|
|
711
728
|
_loop_1 = function (i) {
|
|
712
729
|
var entity, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
|
|
713
|
-
return __generator(this, function (
|
|
714
|
-
switch (
|
|
730
|
+
return __generator(this, function (_o) {
|
|
731
|
+
switch (_o.label) {
|
|
715
732
|
case 0:
|
|
716
733
|
entity = multiGeometry[i];
|
|
717
|
-
if (!((
|
|
734
|
+
if (!((_k = (_j = entity.geometry) === null || _j === void 0 ? void 0 : _j.MultiGeometry) === null || _k === void 0 ? void 0 : _k.length)) {
|
|
718
735
|
polygons.push(entity);
|
|
719
736
|
return [2 /*return*/, "continue"];
|
|
720
737
|
}
|
|
721
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
|
|
738
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
722
739
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
723
740
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
724
741
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: bruce_models_1.ObjectUtils.UId() }) });
|
|
@@ -727,7 +744,7 @@ var EntityRenderEngine;
|
|
|
727
744
|
}
|
|
728
745
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
729
746
|
case 1:
|
|
730
|
-
cPoly =
|
|
747
|
+
cPoly = _o.sent();
|
|
731
748
|
Object.keys(cPoly).forEach(function (key) {
|
|
732
749
|
if (cPoly[key]) {
|
|
733
750
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -736,7 +753,7 @@ var EntityRenderEngine;
|
|
|
736
753
|
rendered = Object.values(cPoly);
|
|
737
754
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
738
755
|
case 2:
|
|
739
|
-
cLines =
|
|
756
|
+
cLines = _o.sent();
|
|
740
757
|
Object.keys(cLines).forEach(function (key) {
|
|
741
758
|
if (cLines[key]) {
|
|
742
759
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -746,9 +763,9 @@ var EntityRenderEngine;
|
|
|
746
763
|
if (!!rendered.length) return [3 /*break*/, 4];
|
|
747
764
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
748
765
|
case 3:
|
|
749
|
-
cPoints =
|
|
766
|
+
cPoints = _o.sent();
|
|
750
767
|
rendered = rendered.concat(Object.values(cPoints));
|
|
751
|
-
|
|
768
|
+
_o.label = 4;
|
|
752
769
|
case 4:
|
|
753
770
|
rendered = rendered.filter(function (x) { return x != null; });
|
|
754
771
|
if (rendered.length) {
|
|
@@ -756,7 +773,7 @@ var EntityRenderEngine;
|
|
|
756
773
|
id: bruce_models_1.ObjectUtils.UId(10)
|
|
757
774
|
});
|
|
758
775
|
rootEntity_1._siblingGraphics = [];
|
|
759
|
-
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (
|
|
776
|
+
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_l = params.viewer) === null || _l === void 0 ? void 0 : _l.terrainProvider);
|
|
760
777
|
rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
|
|
761
778
|
cEntities[entity.Bruce.ID] = rootEntity_1;
|
|
762
779
|
firstEntity = rendered[0];
|
|
@@ -775,22 +792,22 @@ var EntityRenderEngine;
|
|
|
775
792
|
});
|
|
776
793
|
};
|
|
777
794
|
i = 0;
|
|
778
|
-
|
|
795
|
+
_m.label = 3;
|
|
779
796
|
case 3:
|
|
780
797
|
if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
|
|
781
798
|
return [5 /*yield**/, _loop_1(i)];
|
|
782
799
|
case 4:
|
|
783
|
-
|
|
784
|
-
|
|
800
|
+
_m.sent();
|
|
801
|
+
_m.label = 5;
|
|
785
802
|
case 5:
|
|
786
803
|
i++;
|
|
787
804
|
return [3 /*break*/, 3];
|
|
788
805
|
case 6:
|
|
789
806
|
if (!(polygons.length > 0)) return [3 /*break*/, 8];
|
|
790
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
807
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
791
808
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
792
809
|
case 7:
|
|
793
|
-
pEntities =
|
|
810
|
+
pEntities = _m.sent();
|
|
794
811
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
795
812
|
entity = pParams.entities[i];
|
|
796
813
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -801,13 +818,13 @@ var EntityRenderEngine;
|
|
|
801
818
|
polylines.push(entity);
|
|
802
819
|
}
|
|
803
820
|
}
|
|
804
|
-
|
|
821
|
+
_m.label = 8;
|
|
805
822
|
case 8:
|
|
806
823
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
807
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
824
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
808
825
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
809
826
|
case 9:
|
|
810
|
-
pEntities =
|
|
827
|
+
pEntities = _m.sent();
|
|
811
828
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
812
829
|
entity = pParams.entities[i];
|
|
813
830
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -818,13 +835,13 @@ var EntityRenderEngine;
|
|
|
818
835
|
points.push(entity);
|
|
819
836
|
}
|
|
820
837
|
}
|
|
821
|
-
|
|
838
|
+
_m.label = 10;
|
|
822
839
|
case 10:
|
|
823
840
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
824
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
841
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
825
842
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
826
843
|
case 11:
|
|
827
|
-
pEntities =
|
|
844
|
+
pEntities = _m.sent();
|
|
828
845
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
829
846
|
entity = pParams.entities[i];
|
|
830
847
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -832,7 +849,7 @@ var EntityRenderEngine;
|
|
|
832
849
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
833
850
|
}
|
|
834
851
|
}
|
|
835
|
-
|
|
852
|
+
_m.label = 12;
|
|
836
853
|
case 12: return [2 /*return*/, cEntities];
|
|
837
854
|
}
|
|
838
855
|
});
|
|
@@ -885,11 +902,11 @@ var EntityRenderEngine;
|
|
|
885
902
|
}
|
|
886
903
|
Point.CreateCircleBillboard = CreateCircleBillboard;
|
|
887
904
|
function Render(params) {
|
|
888
|
-
var _a, _b;
|
|
905
|
+
var _a, _b, _c, _d;
|
|
889
906
|
return __awaiter(this, void 0, void 0, function () {
|
|
890
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor,
|
|
891
|
-
return __generator(this, function (
|
|
892
|
-
switch (
|
|
907
|
+
var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor_1, heightRef, currentImgKey, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, heightRef, circleBillboard, disableDepthTest, imgKey, currentImgKey;
|
|
908
|
+
return __generator(this, function (_e) {
|
|
909
|
+
switch (_e.label) {
|
|
893
910
|
case 0:
|
|
894
911
|
entity = params.entity;
|
|
895
912
|
style = params.style;
|
|
@@ -902,6 +919,27 @@ var EntityRenderEngine;
|
|
|
902
919
|
}
|
|
903
920
|
cEntity = null;
|
|
904
921
|
siblings = [];
|
|
922
|
+
prepareExistingGraphic = function (cEntity, siblings) {
|
|
923
|
+
if (siblings === void 0) { siblings = 0; }
|
|
924
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
925
|
+
var parts = entity_utils_1.EntityUtils.GatherEntity({
|
|
926
|
+
entity: cEntity,
|
|
927
|
+
});
|
|
928
|
+
if (parts.length > 1) {
|
|
929
|
+
// We'll cull all except the allowed number of siblings.
|
|
930
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
931
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
932
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
933
|
+
var part = parts[i];
|
|
934
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
935
|
+
params.viewer.entities.remove(part);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
if (cEntity._parentEntity) {
|
|
939
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
};
|
|
905
943
|
if (!(type == bruce_models_1.Style.EPointType.Icon)) return [3 /*break*/, 9];
|
|
906
944
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
907
945
|
iconUrlRows.forEach(function (row) {
|
|
@@ -918,36 +956,36 @@ var EntityRenderEngine;
|
|
|
918
956
|
api = params.apiGetter.getApi(metadata.accountId);
|
|
919
957
|
return [4 /*yield*/, api.Loading];
|
|
920
958
|
case 1:
|
|
921
|
-
|
|
959
|
+
_e.sent();
|
|
922
960
|
iconUrl = bruce_models_1.ClientFile.GetUrl({
|
|
923
961
|
api: api,
|
|
924
962
|
fileId: metadata.fileId,
|
|
925
963
|
viaCdn: true
|
|
926
964
|
});
|
|
927
|
-
|
|
965
|
+
_e.label = 2;
|
|
928
966
|
case 2:
|
|
929
967
|
if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
|
|
930
968
|
return [4 /*yield*/, params.api.Loading];
|
|
931
969
|
case 3:
|
|
932
|
-
|
|
970
|
+
_e.sent();
|
|
933
971
|
iconUrl = bruce_models_1.ClientFile.GetUrl({
|
|
934
972
|
api: params.api,
|
|
935
973
|
fileId: style.iconId,
|
|
936
974
|
viaCdn: true
|
|
937
975
|
});
|
|
938
|
-
|
|
976
|
+
_e.label = 4;
|
|
939
977
|
case 4:
|
|
940
978
|
image = null;
|
|
941
979
|
if (!iconUrl) return [3 /*break*/, 8];
|
|
942
|
-
|
|
980
|
+
_e.label = 5;
|
|
943
981
|
case 5:
|
|
944
|
-
|
|
982
|
+
_e.trys.push([5, 7, , 8]);
|
|
945
983
|
return [4 /*yield*/, createImageBillboard(iconUrl)];
|
|
946
984
|
case 6:
|
|
947
|
-
image =
|
|
985
|
+
image = _e.sent();
|
|
948
986
|
return [3 /*break*/, 8];
|
|
949
987
|
case 7:
|
|
950
|
-
e_5 =
|
|
988
|
+
e_5 = _e.sent();
|
|
951
989
|
// Expanding the logging here so we can figure out why this is happening.
|
|
952
990
|
// Most of the time the file is missing but we're getting some strange errors so I am including logging on the API settings as well.
|
|
953
991
|
(0, limited_log_1.OneTimeError)("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
@@ -966,34 +1004,64 @@ var EntityRenderEngine;
|
|
|
966
1004
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
967
1005
|
if (iconScale > 0) {
|
|
968
1006
|
bColor = style.iconTintColor ? bruce_models_1.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
969
|
-
|
|
1007
|
+
cColor_1 = bColor ? colorToCColor(bColor) : undefined;
|
|
970
1008
|
heightRef = getHeightRef(style);
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1009
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
1010
|
+
cEntity = new Cesium.Entity({
|
|
1011
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1012
|
+
billboard: {
|
|
1013
|
+
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
1014
|
+
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
1015
|
+
image: image.canvasDataUri,
|
|
1016
|
+
heightReference: getHeightRef(style),
|
|
1017
|
+
scale: iconScale,
|
|
1018
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
1019
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
1020
|
+
color: new Cesium.CallbackProperty(function () { return cColor_1; }, true),
|
|
1021
|
+
// Would be great once we have a setting for this.
|
|
1022
|
+
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
1023
|
+
},
|
|
1024
|
+
position: entity_utils_1.EntityUtils.GetPos({
|
|
1025
|
+
viewer: params.viewer,
|
|
1026
|
+
entity: entity,
|
|
1027
|
+
recordHeightRef: heightRef,
|
|
1028
|
+
returnHeightRef: heightRef
|
|
1029
|
+
}),
|
|
1030
|
+
show: true
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
else {
|
|
1034
|
+
prepareExistingGraphic(params.rendered);
|
|
1035
|
+
cEntity = params.rendered;
|
|
1036
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
1037
|
+
if (currentImgKey != iconUrl) {
|
|
1038
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(image.canvasDataUri);
|
|
1039
|
+
}
|
|
1040
|
+
cEntity.billboard.scale = new Cesium.ConstantProperty(iconScale);
|
|
1041
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(getHeightRef(style));
|
|
1042
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
1043
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1044
|
+
cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
|
|
986
1045
|
viewer: params.viewer,
|
|
987
1046
|
entity: entity,
|
|
988
1047
|
recordHeightRef: heightRef,
|
|
989
1048
|
returnHeightRef: heightRef
|
|
990
|
-
})
|
|
991
|
-
|
|
992
|
-
|
|
1049
|
+
}));
|
|
1050
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1051
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1052
|
+
color: cColor_1,
|
|
1053
|
+
entity: cEntity,
|
|
1054
|
+
viewer: params.viewer,
|
|
1055
|
+
override: true,
|
|
1056
|
+
requestRender: false
|
|
1057
|
+
});
|
|
1058
|
+
cEntity.show = true;
|
|
1059
|
+
}
|
|
993
1060
|
cEntity.billboard._billboardSize = image.height;
|
|
1061
|
+
cEntity.billboard._billboardImgKey = iconUrl;
|
|
994
1062
|
}
|
|
995
1063
|
}
|
|
996
|
-
|
|
1064
|
+
_e.label = 9;
|
|
997
1065
|
case 9:
|
|
998
1066
|
if (type == bruce_models_1.Style.EPointType.Cylinder) {
|
|
999
1067
|
radius = (0, js_utils_1.EnsureNumber)(bruce_models_1.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
@@ -1018,46 +1086,97 @@ var EntityRenderEngine;
|
|
|
1018
1086
|
returnHeightRef: heightRef
|
|
1019
1087
|
});
|
|
1020
1088
|
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
semiMajorAxis: radius,
|
|
1025
|
-
semiMinorAxis: radius,
|
|
1026
|
-
material: cFill,
|
|
1027
|
-
outlineWidth: null,
|
|
1028
|
-
extrudedHeight: extrusion.value,
|
|
1029
|
-
heightReference: heightRef,
|
|
1030
|
-
extrudedHeightReference: extrusion.exHeightRef,
|
|
1031
|
-
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
1032
|
-
zIndex: 1,
|
|
1033
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1034
|
-
},
|
|
1035
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
1036
|
-
show: true
|
|
1037
|
-
});
|
|
1038
|
-
if (outline && outlineWidth > 0) {
|
|
1039
|
-
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
1040
|
-
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
1041
|
-
// This way they render in a uniform way.
|
|
1042
|
-
if (!outlineExtrusion.value && extrusion.value) {
|
|
1043
|
-
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
1044
|
-
}
|
|
1045
|
-
siblings.push(new Cesium.Entity({
|
|
1089
|
+
hasOutline = outline && outlineWidth > 0;
|
|
1090
|
+
if (!params.rendered || !params.rendered.ellipse) {
|
|
1091
|
+
cEntity = new Cesium.Entity({
|
|
1046
1092
|
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1047
1093
|
ellipse: {
|
|
1048
|
-
semiMajorAxis: radius
|
|
1049
|
-
semiMinorAxis: radius
|
|
1050
|
-
material:
|
|
1051
|
-
outlineWidth:
|
|
1052
|
-
extrudedHeight:
|
|
1094
|
+
semiMajorAxis: radius,
|
|
1095
|
+
semiMinorAxis: radius,
|
|
1096
|
+
material: cFill,
|
|
1097
|
+
outlineWidth: null,
|
|
1098
|
+
extrudedHeight: extrusion.value,
|
|
1053
1099
|
heightReference: heightRef,
|
|
1054
|
-
extrudedHeightReference:
|
|
1100
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
1055
1101
|
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
1056
|
-
zIndex:
|
|
1102
|
+
zIndex: 1,
|
|
1057
1103
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1058
1104
|
},
|
|
1059
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
1060
|
-
|
|
1105
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
1106
|
+
show: true
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
else {
|
|
1110
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
1111
|
+
cEntity = params.rendered;
|
|
1112
|
+
cEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius);
|
|
1113
|
+
cEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius);
|
|
1114
|
+
cEntity.ellipse.outlineWidth = undefined;
|
|
1115
|
+
cEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
1116
|
+
cEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1117
|
+
cEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
1118
|
+
cEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
1119
|
+
cEntity.ellipse.zIndex = new Cesium.ConstantProperty(1);
|
|
1120
|
+
cEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1121
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
|
|
1122
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1123
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
1124
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1125
|
+
color: cFill,
|
|
1126
|
+
entity: cEntity,
|
|
1127
|
+
viewer: params.viewer,
|
|
1128
|
+
override: true,
|
|
1129
|
+
requestRender: false
|
|
1130
|
+
});
|
|
1131
|
+
cEntity.show = true;
|
|
1132
|
+
}
|
|
1133
|
+
if (hasOutline) {
|
|
1134
|
+
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
1135
|
+
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
1136
|
+
// This way they render in a uniform way.
|
|
1137
|
+
if (!outlineExtrusion.value && extrusion.value) {
|
|
1138
|
+
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
1139
|
+
}
|
|
1140
|
+
outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
1141
|
+
if (outlineEntity && outlineEntity.ellipse) {
|
|
1142
|
+
outlineEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
1143
|
+
outlineEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
1144
|
+
outlineEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(outlineExtrusion.value);
|
|
1145
|
+
outlineEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1146
|
+
outlineEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(outlineExtrusion.exHeightRef);
|
|
1147
|
+
outlineEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
1148
|
+
outlineEntity.ellipse.zIndex = new Cesium.ConstantProperty(2);
|
|
1149
|
+
outlineEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1150
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1151
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
1152
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1153
|
+
color: cOutline,
|
|
1154
|
+
entity: outlineEntity,
|
|
1155
|
+
viewer: params.viewer,
|
|
1156
|
+
override: true,
|
|
1157
|
+
requestRender: false
|
|
1158
|
+
});
|
|
1159
|
+
outlineEntity.show = true;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
outlineEntity = new Cesium.Entity({
|
|
1163
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1164
|
+
ellipse: {
|
|
1165
|
+
semiMajorAxis: radius + outlineWidth,
|
|
1166
|
+
semiMinorAxis: radius + outlineWidth,
|
|
1167
|
+
material: cOutline,
|
|
1168
|
+
outlineWidth: undefined,
|
|
1169
|
+
extrudedHeight: outlineExtrusion.value,
|
|
1170
|
+
heightReference: heightRef,
|
|
1171
|
+
extrudedHeightReference: outlineExtrusion.exHeightRef,
|
|
1172
|
+
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
1173
|
+
zIndex: 2,
|
|
1174
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1175
|
+
},
|
|
1176
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
siblings.push(outlineEntity);
|
|
1061
1180
|
}
|
|
1062
1181
|
}
|
|
1063
1182
|
if (!cEntity) {
|
|
@@ -1074,33 +1193,66 @@ var EntityRenderEngine;
|
|
|
1074
1193
|
heightRef = getHeightRef(style);
|
|
1075
1194
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
1076
1195
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1196
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
1197
|
+
cEntity = new Cesium.Entity({
|
|
1198
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1199
|
+
// point: {
|
|
1200
|
+
// pixelSize: size,
|
|
1201
|
+
// color: cColor,
|
|
1202
|
+
// heightReference: getHeightRef(style),
|
|
1203
|
+
// distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1204
|
+
// },
|
|
1205
|
+
// We are generating a billboard instead of using the point.
|
|
1206
|
+
// This is because points were behaving strangely where they would appear oblong shapes.
|
|
1207
|
+
// This occurred consistently when rendering many icons and points at the same time.
|
|
1208
|
+
billboard: {
|
|
1209
|
+
height: circleBillboard.height,
|
|
1210
|
+
width: circleBillboard.width,
|
|
1211
|
+
image: circleBillboard.canvasDataUri,
|
|
1212
|
+
color: new Cesium.CallbackProperty(function () { return undefined; }, true),
|
|
1213
|
+
heightReference: heightRef,
|
|
1214
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
1215
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
|
|
1216
|
+
},
|
|
1217
|
+
position: entity_utils_1.EntityUtils.GetPos({
|
|
1218
|
+
viewer: params.viewer,
|
|
1219
|
+
entity: entity,
|
|
1220
|
+
recordHeightRef: heightRef,
|
|
1221
|
+
returnHeightRef: heightRef
|
|
1222
|
+
}),
|
|
1223
|
+
show: true
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
prepareExistingGraphic(params.rendered);
|
|
1228
|
+
cEntity = params.rendered;
|
|
1229
|
+
imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
|
|
1230
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
1231
|
+
if (currentImgKey != imgKey) {
|
|
1232
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(circleBillboard.canvasDataUri);
|
|
1233
|
+
}
|
|
1234
|
+
cEntity.billboard.height = new Cesium.ConstantProperty(circleBillboard.height);
|
|
1235
|
+
cEntity.billboard.width = new Cesium.ConstantProperty(circleBillboard.width);
|
|
1236
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1237
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1238
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
1239
|
+
cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
|
|
1097
1240
|
viewer: params.viewer,
|
|
1098
1241
|
entity: entity,
|
|
1099
1242
|
recordHeightRef: heightRef,
|
|
1100
1243
|
returnHeightRef: heightRef
|
|
1101
|
-
})
|
|
1102
|
-
|
|
1103
|
-
|
|
1244
|
+
}));
|
|
1245
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1246
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1247
|
+
color: cColor,
|
|
1248
|
+
entity: cEntity,
|
|
1249
|
+
viewer: params.viewer,
|
|
1250
|
+
override: true,
|
|
1251
|
+
requestRender: false
|
|
1252
|
+
});
|
|
1253
|
+
cEntity.show = true;
|
|
1254
|
+
cEntity.billboard._billboardImgKey = imgKey;
|
|
1255
|
+
}
|
|
1104
1256
|
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
1105
1257
|
}
|
|
1106
1258
|
if (cEntity) {
|
|
@@ -1113,16 +1265,16 @@ var EntityRenderEngine;
|
|
|
1113
1265
|
}
|
|
1114
1266
|
Point.Render = Render;
|
|
1115
1267
|
function RenderGroup(params) {
|
|
1116
|
-
var _a, _b, _c;
|
|
1268
|
+
var _a, _b, _c, _d;
|
|
1117
1269
|
return __awaiter(this, void 0, void 0, function () {
|
|
1118
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
1119
|
-
return __generator(this, function (
|
|
1120
|
-
switch (
|
|
1270
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_2;
|
|
1271
|
+
return __generator(this, function (_f) {
|
|
1272
|
+
switch (_f.label) {
|
|
1121
1273
|
case 0:
|
|
1122
1274
|
api = params.apiGetter.getApi();
|
|
1123
1275
|
cEntities = {};
|
|
1124
1276
|
i = 0;
|
|
1125
|
-
|
|
1277
|
+
_f.label = 1;
|
|
1126
1278
|
case 1:
|
|
1127
1279
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
1128
1280
|
entity = params.entities[i];
|
|
@@ -1130,13 +1282,13 @@ var EntityRenderEngine;
|
|
|
1130
1282
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
1131
1283
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1132
1284
|
case 2:
|
|
1133
|
-
|
|
1285
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
1134
1286
|
return [3 /*break*/, 4];
|
|
1135
1287
|
case 3:
|
|
1136
|
-
|
|
1137
|
-
|
|
1288
|
+
_e = zoomItem.Style;
|
|
1289
|
+
_f.label = 4;
|
|
1138
1290
|
case 4:
|
|
1139
|
-
style =
|
|
1291
|
+
style = _e;
|
|
1140
1292
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1141
1293
|
tags = [];
|
|
1142
1294
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -1145,8 +1297,8 @@ var EntityRenderEngine;
|
|
|
1145
1297
|
tagIds: tagIds
|
|
1146
1298
|
})];
|
|
1147
1299
|
case 5:
|
|
1148
|
-
tags = (
|
|
1149
|
-
|
|
1300
|
+
tags = (_f.sent()).tags;
|
|
1301
|
+
_f.label = 6;
|
|
1150
1302
|
case 6:
|
|
1151
1303
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
1152
1304
|
return [4 /*yield*/, Render({
|
|
@@ -1157,20 +1309,21 @@ var EntityRenderEngine;
|
|
|
1157
1309
|
api: api,
|
|
1158
1310
|
apiGetter: params.apiGetter,
|
|
1159
1311
|
maxDistance: zoomItem.MaxZoom,
|
|
1160
|
-
minDistance: zoomItem.MinZoom
|
|
1312
|
+
minDistance: zoomItem.MinZoom,
|
|
1313
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
1161
1314
|
})];
|
|
1162
1315
|
case 7:
|
|
1163
|
-
cEntity =
|
|
1316
|
+
cEntity = _f.sent();
|
|
1164
1317
|
if (!cEntity) return [3 /*break*/, 9];
|
|
1165
1318
|
return [4 /*yield*/, getName(api, entity)];
|
|
1166
1319
|
case 8:
|
|
1167
|
-
name_2 =
|
|
1320
|
+
name_2 = _f.sent();
|
|
1168
1321
|
cEntity.name = name_2;
|
|
1169
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
1170
|
-
|
|
1322
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
1323
|
+
_f.label = 9;
|
|
1171
1324
|
case 9:
|
|
1172
1325
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1173
|
-
|
|
1326
|
+
_f.label = 10;
|
|
1174
1327
|
case 10:
|
|
1175
1328
|
i++;
|
|
1176
1329
|
return [3 /*break*/, 1];
|
|
@@ -1255,52 +1408,110 @@ var EntityRenderEngine;
|
|
|
1255
1408
|
if (style.drapeOver == "ALL") {
|
|
1256
1409
|
classification = Cesium.ClassificationType.BOTH;
|
|
1257
1410
|
}
|
|
1258
|
-
var cEntity =
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1411
|
+
var cEntity = null;
|
|
1412
|
+
if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
|
|
1413
|
+
(!params.rendered.corridor && units == "m"))) {
|
|
1414
|
+
cEntity = new Cesium.Entity({
|
|
1415
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1416
|
+
polyline: units == "px" ? {
|
|
1417
|
+
positions: posses,
|
|
1418
|
+
material: cColor,
|
|
1419
|
+
width: width,
|
|
1420
|
+
classificationType: classification,
|
|
1421
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
1422
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
1423
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
1424
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1425
|
+
} : null,
|
|
1426
|
+
corridor: units == "m" ? {
|
|
1427
|
+
positions: posses,
|
|
1428
|
+
material: cColor,
|
|
1429
|
+
width: width,
|
|
1430
|
+
classificationType: classification,
|
|
1431
|
+
heightReference: heightRef,
|
|
1432
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
1433
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
1434
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
1435
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
1436
|
+
fill: true
|
|
1437
|
+
} : null,
|
|
1438
|
+
position: entity_utils_1.EntityUtils.GetPos({
|
|
1439
|
+
viewer: params.viewer,
|
|
1440
|
+
entity: entity,
|
|
1441
|
+
recordHeightRef: heightRef,
|
|
1442
|
+
returnHeightRef: heightRef
|
|
1443
|
+
}),
|
|
1444
|
+
show: true
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
1449
|
+
var parts = entity_utils_1.EntityUtils.GatherEntity({
|
|
1450
|
+
entity: cEntity,
|
|
1451
|
+
});
|
|
1452
|
+
if (parts.length > 1) {
|
|
1453
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
1454
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
1455
|
+
var part = parts[i];
|
|
1456
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
1457
|
+
params.viewer.entities.remove(part);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
cEntity._siblingGraphics = [];
|
|
1461
|
+
if (cEntity._parentEntity) {
|
|
1462
|
+
console.warn("Polyline.Render: Parent entity was not null. This should not happen.");
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
cEntity = params.rendered;
|
|
1466
|
+
if (units == "px") {
|
|
1467
|
+
cEntity.polyline.positions = new Cesium.ConstantProperty(posses);
|
|
1468
|
+
cEntity.polyline.width = new Cesium.ConstantProperty(width);
|
|
1469
|
+
cEntity.polyline.classificationType = new Cesium.ConstantProperty(classification);
|
|
1470
|
+
cEntity.polyline.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
1471
|
+
cEntity.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
1472
|
+
cEntity.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1473
|
+
cEntity.corridor = undefined;
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
cEntity.corridor.positions = new Cesium.ConstantProperty(posses);
|
|
1477
|
+
cEntity.corridor.width = new Cesium.ConstantProperty(width);
|
|
1478
|
+
cEntity.corridor.classificationType = new Cesium.ConstantProperty(classification);
|
|
1479
|
+
cEntity.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1480
|
+
cEntity.corridor.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
1481
|
+
cEntity.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
1482
|
+
cEntity.polyline = undefined;
|
|
1483
|
+
}
|
|
1484
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1485
|
+
// WARNING: polyline does not support animation (yet?).
|
|
1486
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1487
|
+
color: cColor,
|
|
1488
|
+
entity: cEntity,
|
|
1489
|
+
viewer: params.viewer,
|
|
1490
|
+
override: true,
|
|
1491
|
+
requestRender: false
|
|
1492
|
+
});
|
|
1493
|
+
cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
|
|
1283
1494
|
viewer: params.viewer,
|
|
1284
1495
|
entity: entity,
|
|
1285
1496
|
recordHeightRef: heightRef,
|
|
1286
1497
|
returnHeightRef: heightRef
|
|
1287
|
-
})
|
|
1288
|
-
show
|
|
1289
|
-
}
|
|
1498
|
+
}));
|
|
1499
|
+
cEntity.show = true;
|
|
1500
|
+
}
|
|
1290
1501
|
return cEntity;
|
|
1291
1502
|
}
|
|
1292
1503
|
Polyline.Render = Render;
|
|
1293
1504
|
function RenderGroup(params) {
|
|
1294
|
-
var _a, _b, _c;
|
|
1505
|
+
var _a, _b, _c, _d;
|
|
1295
1506
|
return __awaiter(this, void 0, void 0, function () {
|
|
1296
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
1297
|
-
return __generator(this, function (
|
|
1298
|
-
switch (
|
|
1507
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, lStyle, cEntity, name_3;
|
|
1508
|
+
return __generator(this, function (_f) {
|
|
1509
|
+
switch (_f.label) {
|
|
1299
1510
|
case 0:
|
|
1300
1511
|
api = params.apiGetter.getApi();
|
|
1301
1512
|
cEntities = {};
|
|
1302
1513
|
i = 0;
|
|
1303
|
-
|
|
1514
|
+
_f.label = 1;
|
|
1304
1515
|
case 1:
|
|
1305
1516
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
1306
1517
|
entity = params.entities[i];
|
|
@@ -1308,13 +1519,13 @@ var EntityRenderEngine;
|
|
|
1308
1519
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
1309
1520
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1310
1521
|
case 2:
|
|
1311
|
-
|
|
1522
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
1312
1523
|
return [3 /*break*/, 4];
|
|
1313
1524
|
case 3:
|
|
1314
|
-
|
|
1315
|
-
|
|
1525
|
+
_e = zoomItem.Style;
|
|
1526
|
+
_f.label = 4;
|
|
1316
1527
|
case 4:
|
|
1317
|
-
style =
|
|
1528
|
+
style = _e;
|
|
1318
1529
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1319
1530
|
tags = [];
|
|
1320
1531
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -1323,8 +1534,8 @@ var EntityRenderEngine;
|
|
|
1323
1534
|
tagIds: tagIds
|
|
1324
1535
|
})];
|
|
1325
1536
|
case 5:
|
|
1326
|
-
tags = (
|
|
1327
|
-
|
|
1537
|
+
tags = (_f.sent()).tags;
|
|
1538
|
+
_f.label = 6;
|
|
1328
1539
|
case 6:
|
|
1329
1540
|
lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
1330
1541
|
cEntity = Render({
|
|
@@ -1333,16 +1544,17 @@ var EntityRenderEngine;
|
|
|
1333
1544
|
tags: tags,
|
|
1334
1545
|
viewer: params.viewer,
|
|
1335
1546
|
maxDistance: zoomItem.MaxZoom,
|
|
1336
|
-
minDistance: zoomItem.MinZoom
|
|
1547
|
+
minDistance: zoomItem.MinZoom,
|
|
1548
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
1337
1549
|
});
|
|
1338
1550
|
if (!cEntity) return [3 /*break*/, 8];
|
|
1339
1551
|
return [4 /*yield*/, getName(api, entity)];
|
|
1340
1552
|
case 7:
|
|
1341
|
-
name_3 =
|
|
1553
|
+
name_3 = _f.sent();
|
|
1342
1554
|
cEntity.name = name_3;
|
|
1343
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
1555
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
1344
1556
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1345
|
-
|
|
1557
|
+
_f.label = 8;
|
|
1346
1558
|
case 8:
|
|
1347
1559
|
i++;
|
|
1348
1560
|
return [3 /*break*/, 1];
|
|
@@ -1356,7 +1568,7 @@ var EntityRenderEngine;
|
|
|
1356
1568
|
var Polygon;
|
|
1357
1569
|
(function (Polygon) {
|
|
1358
1570
|
function Render(params) {
|
|
1359
|
-
var _a, _b;
|
|
1571
|
+
var _a, _b, _c, _d;
|
|
1360
1572
|
var entity = params.entity;
|
|
1361
1573
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
1362
1574
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -1413,30 +1625,85 @@ var EntityRenderEngine;
|
|
|
1413
1625
|
if (style.drapeOver == "ALL") {
|
|
1414
1626
|
classification = Cesium.ClassificationType.BOTH;
|
|
1415
1627
|
}
|
|
1416
|
-
var
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1628
|
+
var prepareExistingGraphic = function (cEntity, siblings) {
|
|
1629
|
+
if (siblings === void 0) { siblings = 0; }
|
|
1630
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
1631
|
+
var parts = entity_utils_1.EntityUtils.GatherEntity({
|
|
1632
|
+
entity: cEntity,
|
|
1633
|
+
});
|
|
1634
|
+
if (parts.length > 1) {
|
|
1635
|
+
// We'll cull all except the allowed number of siblings.
|
|
1636
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
1637
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
1638
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
1639
|
+
var part = parts[i];
|
|
1640
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
1641
|
+
params.viewer.entities.remove(part);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (cEntity._parentEntity) {
|
|
1645
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
var hasOutline = width > 0 && cLineColor;
|
|
1650
|
+
var cEntity = null;
|
|
1651
|
+
if (!params.rendered || !params.rendered.polygon) {
|
|
1652
|
+
cEntity = new Cesium.Entity({
|
|
1653
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1654
|
+
polygon: {
|
|
1655
|
+
hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
|
|
1656
|
+
material: cFillColor,
|
|
1657
|
+
extrudedHeight: extrusion.value,
|
|
1658
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
1659
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
1660
|
+
heightReference: heightRef,
|
|
1661
|
+
classificationType: classification,
|
|
1662
|
+
perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
|
|
1663
|
+
zIndex: zIndex,
|
|
1664
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
|
|
1665
|
+
},
|
|
1666
|
+
position: entity_utils_1.EntityUtils.GetPos({
|
|
1667
|
+
viewer: params.viewer,
|
|
1668
|
+
entity: entity,
|
|
1669
|
+
recordHeightRef: heightRef,
|
|
1670
|
+
returnHeightRef: heightRef
|
|
1671
|
+
}),
|
|
1672
|
+
show: true
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
else {
|
|
1676
|
+
// Polygons can have more siblings for the related hole graphics.
|
|
1677
|
+
// So this is a "good enough" way rather than perfect as it only preserves the outline.
|
|
1678
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
1679
|
+
cEntity = params.rendered;
|
|
1680
|
+
cEntity.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })));
|
|
1681
|
+
cEntity.polygon.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
1682
|
+
cEntity.polygon.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
1683
|
+
cEntity.polygon.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
1684
|
+
cEntity.polygon.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1685
|
+
cEntity.polygon.classificationType = new Cesium.ConstantProperty(classification);
|
|
1686
|
+
cEntity.polygon.perPositionHeight = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true);
|
|
1687
|
+
cEntity.polygon.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
1688
|
+
cEntity.polygon.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
|
|
1689
|
+
cEntity.position = new Cesium.ConstantPositionProperty(entity_utils_1.EntityUtils.GetPos({
|
|
1431
1690
|
viewer: params.viewer,
|
|
1432
1691
|
entity: entity,
|
|
1433
1692
|
recordHeightRef: heightRef,
|
|
1434
1693
|
returnHeightRef: heightRef
|
|
1435
|
-
})
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1694
|
+
}));
|
|
1695
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
1696
|
+
// WARNING: polygon does not support animation (yet?).
|
|
1697
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
1698
|
+
color: cFillColor,
|
|
1699
|
+
entity: cEntity,
|
|
1700
|
+
viewer: params.viewer,
|
|
1701
|
+
override: true,
|
|
1702
|
+
requestRender: false
|
|
1703
|
+
});
|
|
1704
|
+
cEntity.show = true;
|
|
1705
|
+
}
|
|
1706
|
+
if (hasOutline) {
|
|
1440
1707
|
var borderHeight = undefined;
|
|
1441
1708
|
if (heightRef != Cesium.HeightReference.CLAMP_TO_GROUND) {
|
|
1442
1709
|
if (flattenPoints) {
|
|
@@ -1460,33 +1727,62 @@ var EntityRenderEngine;
|
|
|
1460
1727
|
else {
|
|
1461
1728
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
1462
1729
|
}
|
|
1463
|
-
var cEntityBorder =
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1730
|
+
var cEntityBorder = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
1731
|
+
cEntity._siblingGraphics = [];
|
|
1732
|
+
if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
|
|
1733
|
+
(!cEntityBorder.corridor && units == "m"))) {
|
|
1734
|
+
cEntityBorder = new Cesium.Entity({
|
|
1735
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1736
|
+
polyline: units == "px" ? new Cesium.PolylineGraphics({
|
|
1737
|
+
positions: borderPosses,
|
|
1738
|
+
material: cLineColor,
|
|
1739
|
+
width: width,
|
|
1740
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
1741
|
+
classificationType: Cesium.ClassificationType.TERRAIN,
|
|
1742
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
1743
|
+
zIndex: zIndex,
|
|
1744
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1745
|
+
}) : null,
|
|
1746
|
+
corridor: units == "m" ? {
|
|
1747
|
+
positions: borderPosses,
|
|
1748
|
+
material: cLineColor,
|
|
1749
|
+
heightReference: heightRef,
|
|
1750
|
+
height: borderHeight,
|
|
1751
|
+
width: width,
|
|
1752
|
+
fill: true,
|
|
1753
|
+
zIndex: zIndex + 1,
|
|
1754
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
1755
|
+
classificationType: classification,
|
|
1756
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
1757
|
+
shadows: Cesium.ShadowMode.ENABLED
|
|
1758
|
+
} : null,
|
|
1759
|
+
show: true
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
else {
|
|
1763
|
+
if (units == "px") {
|
|
1764
|
+
cEntityBorder.polyline.positions = new Cesium.ConstantProperty(borderPosses);
|
|
1765
|
+
cEntityBorder.polyline.width = new Cesium.ConstantProperty(width);
|
|
1766
|
+
cEntityBorder.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
1767
|
+
cEntityBorder.polyline.classificationType = new Cesium.ConstantProperty(Cesium.ClassificationType.TERRAIN);
|
|
1768
|
+
cEntityBorder.polyline.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
1769
|
+
cEntityBorder.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
1770
|
+
cEntityBorder.polyline.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
1771
|
+
cEntityBorder.corridor = undefined;
|
|
1772
|
+
}
|
|
1773
|
+
else {
|
|
1774
|
+
cEntityBorder.corridor.positions = new Cesium.ConstantProperty(borderPosses);
|
|
1775
|
+
cEntityBorder.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
1776
|
+
cEntityBorder.corridor.height = new Cesium.ConstantProperty(borderHeight);
|
|
1777
|
+
cEntityBorder.corridor.width = new Cesium.ConstantProperty(width);
|
|
1778
|
+
cEntityBorder.corridor.fill = new Cesium.ConstantProperty(true);
|
|
1779
|
+
cEntityBorder.corridor.zIndex = new Cesium.ConstantProperty(zIndex + 1);
|
|
1780
|
+
cEntityBorder.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
1781
|
+
cEntityBorder.corridor.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
1782
|
+
cEntityBorder.polyline = undefined;
|
|
1783
|
+
}
|
|
1784
|
+
cEntityBorder.show = true;
|
|
1785
|
+
}
|
|
1490
1786
|
cEntityBorder._parentEntity = cEntity;
|
|
1491
1787
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
1492
1788
|
for (var i = 0; i < holePosses.length; i++) {
|
|
@@ -1523,20 +1819,23 @@ var EntityRenderEngine;
|
|
|
1523
1819
|
cEntityHole._parentEntity = cEntity;
|
|
1524
1820
|
}
|
|
1525
1821
|
}
|
|
1822
|
+
else {
|
|
1823
|
+
cEntity._siblingGraphics = [];
|
|
1824
|
+
}
|
|
1526
1825
|
return cEntity;
|
|
1527
1826
|
}
|
|
1528
1827
|
Polygon.Render = Render;
|
|
1529
1828
|
function RenderGroup(params) {
|
|
1530
|
-
var _a, _b, _c;
|
|
1829
|
+
var _a, _b, _c, _d;
|
|
1531
1830
|
return __awaiter(this, void 0, void 0, function () {
|
|
1532
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
1533
|
-
return __generator(this, function (
|
|
1534
|
-
switch (
|
|
1831
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_4;
|
|
1832
|
+
return __generator(this, function (_f) {
|
|
1833
|
+
switch (_f.label) {
|
|
1535
1834
|
case 0:
|
|
1536
1835
|
api = params.apiGetter.getApi();
|
|
1537
1836
|
cEntities = {};
|
|
1538
1837
|
i = 0;
|
|
1539
|
-
|
|
1838
|
+
_f.label = 1;
|
|
1540
1839
|
case 1:
|
|
1541
1840
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
1542
1841
|
entity = params.entities[i];
|
|
@@ -1544,13 +1843,13 @@ var EntityRenderEngine;
|
|
|
1544
1843
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
1545
1844
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1546
1845
|
case 2:
|
|
1547
|
-
|
|
1846
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
1548
1847
|
return [3 /*break*/, 4];
|
|
1549
1848
|
case 3:
|
|
1550
|
-
|
|
1551
|
-
|
|
1849
|
+
_e = zoomItem.Style;
|
|
1850
|
+
_f.label = 4;
|
|
1552
1851
|
case 4:
|
|
1553
|
-
style =
|
|
1852
|
+
style = _e;
|
|
1554
1853
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1555
1854
|
tags = [];
|
|
1556
1855
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -1559,8 +1858,8 @@ var EntityRenderEngine;
|
|
|
1559
1858
|
tagIds: tagIds
|
|
1560
1859
|
})];
|
|
1561
1860
|
case 5:
|
|
1562
|
-
tags = (
|
|
1563
|
-
|
|
1861
|
+
tags = (_f.sent()).tags;
|
|
1862
|
+
_f.label = 6;
|
|
1564
1863
|
case 6:
|
|
1565
1864
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
1566
1865
|
cEntity = Render({
|
|
@@ -1569,16 +1868,17 @@ var EntityRenderEngine;
|
|
|
1569
1868
|
tags: tags,
|
|
1570
1869
|
viewer: params.viewer,
|
|
1571
1870
|
maxDistance: zoomItem.MaxZoom,
|
|
1572
|
-
minDistance: zoomItem.MinZoom
|
|
1871
|
+
minDistance: zoomItem.MinZoom,
|
|
1872
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
1573
1873
|
});
|
|
1574
1874
|
if (!cEntity) return [3 /*break*/, 8];
|
|
1575
1875
|
return [4 /*yield*/, getName(api, entity)];
|
|
1576
1876
|
case 7:
|
|
1577
|
-
name_4 =
|
|
1877
|
+
name_4 = _f.sent();
|
|
1578
1878
|
cEntity.name = name_4;
|
|
1579
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
1879
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
1580
1880
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1581
|
-
|
|
1881
|
+
_f.label = 8;
|
|
1582
1882
|
case 8:
|
|
1583
1883
|
i++;
|
|
1584
1884
|
return [3 /*break*/, 1];
|
|
@@ -1642,8 +1942,9 @@ var EntityRenderEngine;
|
|
|
1642
1942
|
color = colorToCColor(bColor);
|
|
1643
1943
|
}
|
|
1644
1944
|
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1945
|
+
/*
|
|
1946
|
+
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
1947
|
+
id: ObjectUtils.UId(10),
|
|
1647
1948
|
model: {
|
|
1648
1949
|
uri: params.lodUrl,
|
|
1649
1950
|
heightReference: heightRef,
|
|
@@ -1651,13 +1952,89 @@ var EntityRenderEngine;
|
|
|
1651
1952
|
shadows: Cesium.ShadowMode.ENABLED,
|
|
1652
1953
|
colorBlendAmount: blendAmount,
|
|
1653
1954
|
colorBlendMode: blendMode,
|
|
1654
|
-
color: color,
|
|
1955
|
+
color: new Cesium.CallbackProperty(() => color, true),
|
|
1655
1956
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1656
1957
|
},
|
|
1657
1958
|
orientation: new Cesium.ConstantProperty(orientation),
|
|
1658
1959
|
position: pos,
|
|
1659
1960
|
show: true
|
|
1660
1961
|
});
|
|
1962
|
+
*/
|
|
1963
|
+
var animateScale = null;
|
|
1964
|
+
var cEntity = params.rendered;
|
|
1965
|
+
if (!cEntity || !cEntity.model) {
|
|
1966
|
+
cEntity = new Cesium.Entity({
|
|
1967
|
+
id: bruce_models_1.ObjectUtils.UId(10),
|
|
1968
|
+
model: {
|
|
1969
|
+
uri: params.lodUrl,
|
|
1970
|
+
heightReference: heightRef,
|
|
1971
|
+
scale: new Cesium.CallbackProperty(function () { return scale * styleScale; }, true),
|
|
1972
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
1973
|
+
colorBlendAmount: blendAmount,
|
|
1974
|
+
colorBlendMode: blendMode,
|
|
1975
|
+
color: new Cesium.CallbackProperty(function () { return color; }, true),
|
|
1976
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
1977
|
+
},
|
|
1978
|
+
orientation: new Cesium.ConstantProperty(orientation),
|
|
1979
|
+
position: pos,
|
|
1980
|
+
show: true
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
else {
|
|
1984
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
1985
|
+
var parts = entity_utils_1.EntityUtils.GatherEntity({
|
|
1986
|
+
entity: cEntity,
|
|
1987
|
+
});
|
|
1988
|
+
if (parts.length > 1) {
|
|
1989
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
1990
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
1991
|
+
var part = parts[i];
|
|
1992
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
1993
|
+
params.viewer.entities.remove(part);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
cEntity._siblingGraphics = [];
|
|
1997
|
+
if (cEntity._parentEntity) {
|
|
1998
|
+
console.warn("Model3d.Render: Parent entity was not null. This should not happen.");
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
var currentUri = getValue(params.viewer, cEntity.model.uri);
|
|
2002
|
+
if (currentUri != params.lodUrl) {
|
|
2003
|
+
cEntity.model.uri = new Cesium.ConstantProperty(params.lodUrl);
|
|
2004
|
+
}
|
|
2005
|
+
cEntity.model.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
2006
|
+
cEntity.model.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
2007
|
+
cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
|
|
2008
|
+
cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
|
|
2009
|
+
cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
2010
|
+
cEntity.orientation = new Cesium.ConstantProperty(orientation);
|
|
2011
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos);
|
|
2012
|
+
// Same file but different scale. We'll animate the scale.
|
|
2013
|
+
var prevClientFileId = cEntity.model._clientFileId;
|
|
2014
|
+
if (prevClientFileId == params.lodClientFileId) {
|
|
2015
|
+
animateScale = new cesium_animated_property_1.CesiumAnimatedProperty.AnimateNumber({
|
|
2016
|
+
durationMs: 200,
|
|
2017
|
+
value: scale * styleScale,
|
|
2018
|
+
viewer: params.viewer,
|
|
2019
|
+
startValue: cEntity.model.scale,
|
|
2020
|
+
startPaused: true
|
|
2021
|
+
});
|
|
2022
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return animateScale.GetValue(); }, false);
|
|
2023
|
+
}
|
|
2024
|
+
else {
|
|
2025
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return scale * styleScale; }, true);
|
|
2026
|
+
}
|
|
2027
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
2028
|
+
// cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
|
|
2029
|
+
cesium_entity_styler_1.CesiumEntityStyler.SetDefaultColor({
|
|
2030
|
+
color: color,
|
|
2031
|
+
entity: cEntity,
|
|
2032
|
+
viewer: params.viewer,
|
|
2033
|
+
override: true,
|
|
2034
|
+
requestRender: false
|
|
2035
|
+
});
|
|
2036
|
+
cEntity.show = true;
|
|
2037
|
+
}
|
|
1661
2038
|
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
1662
2039
|
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
1663
2040
|
if (!heightProm) {
|
|
@@ -1736,6 +2113,10 @@ var EntityRenderEngine;
|
|
|
1736
2113
|
visual_register_culler_1.VisualRegisterCuller.MarkShouldRecheck(params.viewer);
|
|
1737
2114
|
}
|
|
1738
2115
|
}
|
|
2116
|
+
// Rough estimate on when the model is ready in the scene.
|
|
2117
|
+
if (animateScale) {
|
|
2118
|
+
animateScale.Play();
|
|
2119
|
+
}
|
|
1739
2120
|
});
|
|
1740
2121
|
var model = cEntity.model;
|
|
1741
2122
|
model._radiusLoaded = false;
|
|
@@ -1748,16 +2129,16 @@ var EntityRenderEngine;
|
|
|
1748
2129
|
}
|
|
1749
2130
|
Model3d.Render = Render;
|
|
1750
2131
|
function RenderGroup(params) {
|
|
1751
|
-
var _a, _b, _c, _d, _e;
|
|
2132
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1752
2133
|
return __awaiter(this, void 0, void 0, function () {
|
|
1753
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
1754
|
-
return __generator(this, function (
|
|
1755
|
-
switch (
|
|
2134
|
+
var api, cEntities, reqBody, i, entity, zoomItem, style, _g, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
2135
|
+
return __generator(this, function (_h) {
|
|
2136
|
+
switch (_h.label) {
|
|
1756
2137
|
case 0:
|
|
1757
2138
|
api = params.apiGetter.getApi();
|
|
1758
2139
|
return [4 /*yield*/, api.Loading];
|
|
1759
2140
|
case 1:
|
|
1760
|
-
|
|
2141
|
+
_h.sent();
|
|
1761
2142
|
cEntities = {};
|
|
1762
2143
|
reqBody = {
|
|
1763
2144
|
"strict": false,
|
|
@@ -1765,7 +2146,7 @@ var EntityRenderEngine;
|
|
|
1765
2146
|
"Items": []
|
|
1766
2147
|
};
|
|
1767
2148
|
i = 0;
|
|
1768
|
-
|
|
2149
|
+
_h.label = 2;
|
|
1769
2150
|
case 2:
|
|
1770
2151
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
1771
2152
|
entity = params.entities[i];
|
|
@@ -1773,13 +2154,13 @@ var EntityRenderEngine;
|
|
|
1773
2154
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
1774
2155
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1775
2156
|
case 3:
|
|
1776
|
-
|
|
2157
|
+
_g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
1777
2158
|
return [3 /*break*/, 5];
|
|
1778
2159
|
case 4:
|
|
1779
|
-
|
|
1780
|
-
|
|
2160
|
+
_g = zoomItem.Style;
|
|
2161
|
+
_h.label = 5;
|
|
1781
2162
|
case 5:
|
|
1782
|
-
style =
|
|
2163
|
+
style = _g;
|
|
1783
2164
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1784
2165
|
tags = [];
|
|
1785
2166
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -1788,8 +2169,8 @@ var EntityRenderEngine;
|
|
|
1788
2169
|
tagIds: tagIds
|
|
1789
2170
|
})];
|
|
1790
2171
|
case 6:
|
|
1791
|
-
tags = (
|
|
1792
|
-
|
|
2172
|
+
tags = (_h.sent()).tags;
|
|
2173
|
+
_h.label = 7;
|
|
1793
2174
|
case 7:
|
|
1794
2175
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
1795
2176
|
group = mStyle.lodGroup ? bruce_models_1.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -1810,7 +2191,7 @@ var EntityRenderEngine;
|
|
|
1810
2191
|
"group": group,
|
|
1811
2192
|
"level": level
|
|
1812
2193
|
});
|
|
1813
|
-
|
|
2194
|
+
_h.label = 8;
|
|
1814
2195
|
case 8:
|
|
1815
2196
|
i++;
|
|
1816
2197
|
return [3 /*break*/, 2];
|
|
@@ -1819,24 +2200,24 @@ var EntityRenderEngine;
|
|
|
1819
2200
|
filter: reqBody
|
|
1820
2201
|
})];
|
|
1821
2202
|
case 10:
|
|
1822
|
-
lodData = (
|
|
2203
|
+
lodData = (_h.sent()).lods;
|
|
1823
2204
|
_loop_2 = function (i) {
|
|
1824
|
-
var entity, zoomItem, style,
|
|
1825
|
-
return __generator(this, function (
|
|
1826
|
-
switch (
|
|
2205
|
+
var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
2206
|
+
return __generator(this, function (_k) {
|
|
2207
|
+
switch (_k.label) {
|
|
1827
2208
|
case 0:
|
|
1828
2209
|
entity = params.entities[i];
|
|
1829
2210
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
1830
2211
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
1831
2212
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1832
2213
|
case 1:
|
|
1833
|
-
|
|
2214
|
+
_j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
1834
2215
|
return [3 /*break*/, 3];
|
|
1835
2216
|
case 2:
|
|
1836
|
-
|
|
1837
|
-
|
|
2217
|
+
_j = zoomItem.Style;
|
|
2218
|
+
_k.label = 3;
|
|
1838
2219
|
case 3:
|
|
1839
|
-
style =
|
|
2220
|
+
style = _j;
|
|
1840
2221
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1841
2222
|
tags = [];
|
|
1842
2223
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -1845,8 +2226,8 @@ var EntityRenderEngine;
|
|
|
1845
2226
|
tagIds: tagIds
|
|
1846
2227
|
})];
|
|
1847
2228
|
case 4:
|
|
1848
|
-
tags = (
|
|
1849
|
-
|
|
2229
|
+
tags = (_k.sent()).tags;
|
|
2230
|
+
_k.label = 5;
|
|
1850
2231
|
case 5:
|
|
1851
2232
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
1852
2233
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -1854,6 +2235,7 @@ var EntityRenderEngine;
|
|
|
1854
2235
|
}
|
|
1855
2236
|
mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
|
|
1856
2237
|
cEntity = Render({
|
|
2238
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
|
|
1857
2239
|
entity: entity,
|
|
1858
2240
|
style: mStyle,
|
|
1859
2241
|
tags: tags,
|
|
@@ -1870,23 +2252,23 @@ var EntityRenderEngine;
|
|
|
1870
2252
|
if (!cEntity) return [3 /*break*/, 7];
|
|
1871
2253
|
return [4 /*yield*/, getName(api, entity)];
|
|
1872
2254
|
case 6:
|
|
1873
|
-
name_5 =
|
|
2255
|
+
name_5 = _k.sent();
|
|
1874
2256
|
cEntity.name = name_5;
|
|
1875
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
2257
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
|
|
1876
2258
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1877
|
-
|
|
2259
|
+
_k.label = 7;
|
|
1878
2260
|
case 7: return [2 /*return*/];
|
|
1879
2261
|
}
|
|
1880
2262
|
});
|
|
1881
2263
|
};
|
|
1882
2264
|
i = 0;
|
|
1883
|
-
|
|
2265
|
+
_h.label = 11;
|
|
1884
2266
|
case 11:
|
|
1885
2267
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
1886
2268
|
return [5 /*yield**/, _loop_2(i)];
|
|
1887
2269
|
case 12:
|
|
1888
|
-
|
|
1889
|
-
|
|
2270
|
+
_h.sent();
|
|
2271
|
+
_h.label = 13;
|
|
1890
2272
|
case 13:
|
|
1891
2273
|
i++;
|
|
1892
2274
|
return [3 /*break*/, 11];
|