bruce-cesium 6.9.5 → 6.9.7
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 +67 -8
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +65 -5
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine-polygon.js +14 -0
- package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +15 -5
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +36 -0
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/entity-render-engine.d.ts +1 -5
- package/dist/types/utils/cesium-entity-styler.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1724,6 +1724,9 @@
|
|
|
1724
1724
|
function getDefaultTextureImage(graphic) {
|
|
1725
1725
|
return graphic[STORE_TEXTURE_IMAGE_KEY];
|
|
1726
1726
|
}
|
|
1727
|
+
function clearDefaultTextureImage(graphic) {
|
|
1728
|
+
delete graphic[STORE_TEXTURE_IMAGE_KEY];
|
|
1729
|
+
}
|
|
1727
1730
|
/**
|
|
1728
1731
|
* Returns a color property from a graphic.
|
|
1729
1732
|
* This will turn materials properties into colors before returning them.
|
|
@@ -2256,6 +2259,39 @@
|
|
|
2256
2259
|
}
|
|
2257
2260
|
}
|
|
2258
2261
|
CesiumEntityStyler.SetDefaultColor = SetDefaultColor;
|
|
2262
|
+
/*
|
|
2263
|
+
* Updates (or clears) the baked default texture image for a graphic's polygon parts.
|
|
2264
|
+
*/
|
|
2265
|
+
function SetDefaultTextureImage(params) {
|
|
2266
|
+
const { viewer, entity, image, requestRender } = params;
|
|
2267
|
+
if (!entity) {
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
const parts = exports.EntityUtils.GatherEntity({
|
|
2271
|
+
entity: entity,
|
|
2272
|
+
selectable: true
|
|
2273
|
+
});
|
|
2274
|
+
for (let i = 0; i < parts.length; i++) {
|
|
2275
|
+
const part = parts[i];
|
|
2276
|
+
if (!isAlive(viewer, part)) {
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2279
|
+
// Texture fill only applies to polygons.
|
|
2280
|
+
if (part instanceof Cesium.Entity && part.polygon) {
|
|
2281
|
+
if (image == null) {
|
|
2282
|
+
clearDefaultTextureImage(part.polygon);
|
|
2283
|
+
}
|
|
2284
|
+
else {
|
|
2285
|
+
storeDefaultTextureImage(part.polygon, image);
|
|
2286
|
+
}
|
|
2287
|
+
refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
if (requestRender != false) {
|
|
2291
|
+
viewer.scene.requestRender();
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
CesiumEntityStyler.SetDefaultTextureImage = SetDefaultTextureImage;
|
|
2259
2295
|
/**
|
|
2260
2296
|
* Updates the opacity of the graphic.
|
|
2261
2297
|
* This will multiply against the current colour's opacity before applying.
|
|
@@ -36754,9 +36790,23 @@
|
|
|
36754
36790
|
cEntity.polygon.classificationType = new Cesium.ConstantProperty(classification);
|
|
36755
36791
|
// TODO: animate the texture!
|
|
36756
36792
|
if (textureDataUri) {
|
|
36793
|
+
// Rebaking texture to ensure we don't revert to the wrong one later.
|
|
36757
36794
|
cEntity.polygon.material = fillMaterial;
|
|
36795
|
+
exports.CesiumEntityStyler.SetDefaultTextureImage({
|
|
36796
|
+
entity: cEntity,
|
|
36797
|
+
image: textureDataUri,
|
|
36798
|
+
viewer: params.viewer,
|
|
36799
|
+
requestRender: false
|
|
36800
|
+
});
|
|
36758
36801
|
}
|
|
36759
36802
|
else {
|
|
36803
|
+
// Clear any baked texture from a previous textured style so reverting to default uses the colour fill.
|
|
36804
|
+
exports.CesiumEntityStyler.SetDefaultTextureImage({
|
|
36805
|
+
entity: cEntity,
|
|
36806
|
+
image: null,
|
|
36807
|
+
viewer: params.viewer,
|
|
36808
|
+
requestRender: false
|
|
36809
|
+
});
|
|
36760
36810
|
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
36761
36811
|
// WARNING: polygon does not support animation (yet?).
|
|
36762
36812
|
exports.CesiumEntityStyler.SetDefaultColor({
|
|
@@ -37397,11 +37447,19 @@
|
|
|
37397
37447
|
return heightRef;
|
|
37398
37448
|
}
|
|
37399
37449
|
|
|
37400
|
-
|
|
37401
|
-
* Returns if the
|
|
37402
|
-
* @param rego
|
|
37403
|
-
* @param entity
|
|
37450
|
+
/*
|
|
37451
|
+
* Returns if the style applied to a rego differs from the one the zoom item now wants.
|
|
37404
37452
|
*/
|
|
37453
|
+
function isStyleChanged(rego, zoomItem) {
|
|
37454
|
+
var _a;
|
|
37455
|
+
if (!rego) {
|
|
37456
|
+
return false;
|
|
37457
|
+
}
|
|
37458
|
+
// Normalize the same way cEntity.styleId is set when rendering (see RenderGroup callers).
|
|
37459
|
+
const newStyleId = (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) == -1 ? -1 : (+(zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) || null);
|
|
37460
|
+
const oldStyleId = (_a = rego.styleId) !== null && _a !== void 0 ? _a : null;
|
|
37461
|
+
return newStyleId != oldStyleId;
|
|
37462
|
+
}
|
|
37405
37463
|
function isOutlineChanged$1(rego, entity) {
|
|
37406
37464
|
var _a, _b, _c, _d, _e, _f;
|
|
37407
37465
|
if (((_a = rego.outline) === null || _a === void 0 ? void 0 : _a.length) != ((_c = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.Outline) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
@@ -37584,6 +37642,7 @@
|
|
|
37584
37642
|
if (!params.force &&
|
|
37585
37643
|
newRenderId == oldRenderId &&
|
|
37586
37644
|
!(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
|
|
37645
|
+
!isStyleChanged(existingRego, zoomItem) &&
|
|
37587
37646
|
!isOutlineChanged$1(existingRego, entity)) {
|
|
37588
37647
|
// No sorting category needed. Already rendered the way we want.
|
|
37589
37648
|
cEntities.set(id, existingRego.visual);
|
|
@@ -38469,7 +38528,7 @@
|
|
|
38469
38528
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
38470
38529
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
38471
38530
|
|
|
38472
|
-
const VERSION = "6.9.
|
|
38531
|
+
const VERSION = "6.9.7";
|
|
38473
38532
|
/**
|
|
38474
38533
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
38475
38534
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|
|
@@ -38489,6 +38548,7 @@
|
|
|
38489
38548
|
exports.VERSION = VERSION;
|
|
38490
38549
|
exports.setENVIRONMENT = setENVIRONMENT;
|
|
38491
38550
|
exports.getENVIRONMENT = getENVIRONMENT;
|
|
38551
|
+
exports.isStyleChanged = isStyleChanged;
|
|
38492
38552
|
exports.isOutlineChanged = isOutlineChanged$1;
|
|
38493
38553
|
exports.CesiumParabola = CesiumParabola;
|
|
38494
38554
|
exports.createTileset = createTileset;
|