bruce-cesium 1.4.7 → 1.4.8
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 +90 -70
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +89 -69
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +89 -69
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, Entity as Entity$1, BatchedDataGetter, EntityRelationType, Tileset, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
|
|
2
|
-
import { Cartesian2, Cartographic, Math as Math$1, Cartesian3, Color, HeightReference, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange,
|
|
2
|
+
import { Cartesian2, Cartographic, Math as Math$1, Cartesian3, Color, HeightReference, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, KmlDataSource, createOsmBuildings, Cesium3DTileStyle, Rectangle, CallbackProperty, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
|
|
3
3
|
|
|
4
4
|
var TIME_LAG = 300;
|
|
5
5
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -1164,20 +1164,21 @@ function getStyle(api, entity, styleId) {
|
|
|
1164
1164
|
});
|
|
1165
1165
|
});
|
|
1166
1166
|
}
|
|
1167
|
-
function getRenderGroupId(zoomItem) {
|
|
1167
|
+
function getRenderGroupId(zoomItem, terrain) {
|
|
1168
|
+
var isFlatTerrain = terrain instanceof EllipsoidTerrainProvider;
|
|
1168
1169
|
if (!zoomItem) {
|
|
1169
1170
|
return null;
|
|
1170
1171
|
}
|
|
1171
|
-
return zoomItem.MinZoom + "-" + zoomItem.MaxZoom;
|
|
1172
|
+
return zoomItem.MinZoom + "-" + zoomItem.MaxZoom + "-" + isFlatTerrain;
|
|
1172
1173
|
}
|
|
1173
1174
|
var EntityRenderEngine;
|
|
1174
1175
|
(function (EntityRenderEngine) {
|
|
1175
1176
|
function Render(params) {
|
|
1176
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1177
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1177
1178
|
return __awaiter(this, void 0, void 0, function () {
|
|
1178
1179
|
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, newRenderId, existingRego, 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;
|
|
1179
|
-
return __generator(this, function (
|
|
1180
|
-
switch (
|
|
1180
|
+
return __generator(this, function (_j) {
|
|
1181
|
+
switch (_j.label) {
|
|
1181
1182
|
case 0:
|
|
1182
1183
|
groupRenderParams = {
|
|
1183
1184
|
apiGetter: params.apiGetter,
|
|
@@ -1219,12 +1220,12 @@ var EntityRenderEngine;
|
|
|
1219
1220
|
displayType = ZoomControl.EDisplayType.Geometry;
|
|
1220
1221
|
}
|
|
1221
1222
|
if (displayType != ZoomControl.EDisplayType.Hidden) {
|
|
1222
|
-
newRenderId = getRenderGroupId(zoomItem);
|
|
1223
|
+
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
1223
1224
|
existingRego = params.visualRegister.GetRego({
|
|
1224
1225
|
entityId: id,
|
|
1225
1226
|
menuItemId: params.menuItemId
|
|
1226
1227
|
});
|
|
1227
|
-
oldRenderId = (
|
|
1228
|
+
oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
|
|
1228
1229
|
if (newRenderId == oldRenderId && !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale)) {
|
|
1229
1230
|
cEntities[id] = existingRego.visual;
|
|
1230
1231
|
}
|
|
@@ -1233,7 +1234,7 @@ var EntityRenderEngine;
|
|
|
1233
1234
|
models.push(entity);
|
|
1234
1235
|
}
|
|
1235
1236
|
else if (displayType == ZoomControl.EDisplayType.Geometry) {
|
|
1236
|
-
if ((
|
|
1237
|
+
if ((_e = (_d = entity.geometry) === null || _d === void 0 ? void 0 : _d.MultiGeometry) === null || _e === void 0 ? void 0 : _e.length) {
|
|
1237
1238
|
multiGeometry.push(entity);
|
|
1238
1239
|
}
|
|
1239
1240
|
else {
|
|
@@ -1251,7 +1252,7 @@ var EntityRenderEngine;
|
|
|
1251
1252
|
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
1252
1253
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
1253
1254
|
case 1:
|
|
1254
|
-
mEntities =
|
|
1255
|
+
mEntities = _j.sent();
|
|
1255
1256
|
for (i = 0; i < mParams.entities.length; i++) {
|
|
1256
1257
|
entity = mParams.entities[i];
|
|
1257
1258
|
id = entity.Bruce.ID;
|
|
@@ -1263,7 +1264,7 @@ var EntityRenderEngine;
|
|
|
1263
1264
|
multiGeometry.push(entity);
|
|
1264
1265
|
}
|
|
1265
1266
|
}
|
|
1266
|
-
|
|
1267
|
+
_j.label = 2;
|
|
1267
1268
|
case 2:
|
|
1268
1269
|
if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
|
|
1269
1270
|
_loop_1 = function (i) {
|
|
@@ -1272,7 +1273,7 @@ var EntityRenderEngine;
|
|
|
1272
1273
|
switch (_a.label) {
|
|
1273
1274
|
case 0:
|
|
1274
1275
|
entity = multiGeometry[i];
|
|
1275
|
-
if (!((
|
|
1276
|
+
if (!((_g = (_f = entity.geometry) === null || _f === void 0 ? void 0 : _f.MultiGeometry) === null || _g === void 0 ? void 0 : _g.length)) {
|
|
1276
1277
|
polygons.push(entity);
|
|
1277
1278
|
return [2 /*return*/, "continue"];
|
|
1278
1279
|
}
|
|
@@ -1310,12 +1311,12 @@ var EntityRenderEngine;
|
|
|
1310
1311
|
rootEntity_1 = new Entity({});
|
|
1311
1312
|
params.viewer.entities.add(rootEntity_1);
|
|
1312
1313
|
rootEntity_1._siblingGraphics = [];
|
|
1313
|
-
rootEntity_1._renderGroup = getRenderGroupId(zoomItem);
|
|
1314
|
+
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_h = params.viewer) === null || _h === void 0 ? void 0 : _h.terrainProvider);
|
|
1314
1315
|
rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
|
|
1315
1316
|
cEntities[entity.Bruce.ID] = rootEntity_1;
|
|
1316
1317
|
firstEntity = rendered[0];
|
|
1317
1318
|
if (firstEntity) {
|
|
1318
|
-
rootEntity_1.position = getValue(params.viewer, firstEntity.position
|
|
1319
|
+
rootEntity_1.position = getValue(params.viewer, firstEntity.position);
|
|
1319
1320
|
}
|
|
1320
1321
|
rendered.forEach(function (child) {
|
|
1321
1322
|
child._parentEntity = rootEntity_1;
|
|
@@ -1329,13 +1330,13 @@ var EntityRenderEngine;
|
|
|
1329
1330
|
});
|
|
1330
1331
|
};
|
|
1331
1332
|
i = 0;
|
|
1332
|
-
|
|
1333
|
+
_j.label = 3;
|
|
1333
1334
|
case 3:
|
|
1334
1335
|
if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
|
|
1335
1336
|
return [5 /*yield**/, _loop_1(i)];
|
|
1336
1337
|
case 4:
|
|
1337
|
-
|
|
1338
|
-
|
|
1338
|
+
_j.sent();
|
|
1339
|
+
_j.label = 5;
|
|
1339
1340
|
case 5:
|
|
1340
1341
|
i++;
|
|
1341
1342
|
return [3 /*break*/, 3];
|
|
@@ -1344,7 +1345,7 @@ var EntityRenderEngine;
|
|
|
1344
1345
|
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
1345
1346
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
1346
1347
|
case 7:
|
|
1347
|
-
pEntities =
|
|
1348
|
+
pEntities = _j.sent();
|
|
1348
1349
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
1349
1350
|
entity = pParams.entities[i];
|
|
1350
1351
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -1355,13 +1356,13 @@ var EntityRenderEngine;
|
|
|
1355
1356
|
polylines.push(entity);
|
|
1356
1357
|
}
|
|
1357
1358
|
}
|
|
1358
|
-
|
|
1359
|
+
_j.label = 8;
|
|
1359
1360
|
case 8:
|
|
1360
1361
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
1361
1362
|
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
1362
1363
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
1363
1364
|
case 9:
|
|
1364
|
-
pEntities =
|
|
1365
|
+
pEntities = _j.sent();
|
|
1365
1366
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
1366
1367
|
entity = pParams.entities[i];
|
|
1367
1368
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -1372,13 +1373,13 @@ var EntityRenderEngine;
|
|
|
1372
1373
|
points.push(entity);
|
|
1373
1374
|
}
|
|
1374
1375
|
}
|
|
1375
|
-
|
|
1376
|
+
_j.label = 10;
|
|
1376
1377
|
case 10:
|
|
1377
1378
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
1378
1379
|
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
1379
1380
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
1380
1381
|
case 11:
|
|
1381
|
-
pEntities =
|
|
1382
|
+
pEntities = _j.sent();
|
|
1382
1383
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
1383
1384
|
entity = pParams.entities[i];
|
|
1384
1385
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -1386,7 +1387,7 @@ var EntityRenderEngine;
|
|
|
1386
1387
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1387
1388
|
}
|
|
1388
1389
|
}
|
|
1389
|
-
|
|
1390
|
+
_j.label = 12;
|
|
1390
1391
|
case 12: return [2 /*return*/, cEntities];
|
|
1391
1392
|
}
|
|
1392
1393
|
});
|
|
@@ -1581,23 +1582,23 @@ var EntityRenderEngine;
|
|
|
1581
1582
|
}
|
|
1582
1583
|
Point.Render = Render;
|
|
1583
1584
|
function RenderGroup(params) {
|
|
1584
|
-
var _a, _b;
|
|
1585
|
+
var _a, _b, _c;
|
|
1585
1586
|
return __awaiter(this, void 0, void 0, function () {
|
|
1586
1587
|
var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity;
|
|
1587
|
-
return __generator(this, function (
|
|
1588
|
-
switch (
|
|
1588
|
+
return __generator(this, function (_d) {
|
|
1589
|
+
switch (_d.label) {
|
|
1589
1590
|
case 0:
|
|
1590
1591
|
api = params.apiGetter.getApi();
|
|
1591
1592
|
cEntities = {};
|
|
1592
1593
|
i = 0;
|
|
1593
|
-
|
|
1594
|
+
_d.label = 1;
|
|
1594
1595
|
case 1:
|
|
1595
1596
|
if (!(i < params.entities.length)) return [3 /*break*/, 6];
|
|
1596
1597
|
entity = params.entities[i];
|
|
1597
1598
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
1598
1599
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1599
1600
|
case 2:
|
|
1600
|
-
style =
|
|
1601
|
+
style = _d.sent();
|
|
1601
1602
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1602
1603
|
tags = [];
|
|
1603
1604
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 4];
|
|
@@ -1606,8 +1607,8 @@ var EntityRenderEngine;
|
|
|
1606
1607
|
tagIds: tagIds
|
|
1607
1608
|
})];
|
|
1608
1609
|
case 3:
|
|
1609
|
-
tags = (
|
|
1610
|
-
|
|
1610
|
+
tags = (_d.sent()).tags;
|
|
1611
|
+
_d.label = 4;
|
|
1611
1612
|
case 4:
|
|
1612
1613
|
pStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
1613
1614
|
cEntity = Render({
|
|
@@ -1617,9 +1618,9 @@ var EntityRenderEngine;
|
|
|
1617
1618
|
viewer: params.viewer,
|
|
1618
1619
|
api: api
|
|
1619
1620
|
});
|
|
1620
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem);
|
|
1621
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
|
|
1621
1622
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1622
|
-
|
|
1623
|
+
_d.label = 5;
|
|
1623
1624
|
case 5:
|
|
1624
1625
|
i++;
|
|
1625
1626
|
return [3 /*break*/, 1];
|
|
@@ -1633,7 +1634,7 @@ var EntityRenderEngine;
|
|
|
1633
1634
|
var Polyline;
|
|
1634
1635
|
(function (Polyline) {
|
|
1635
1636
|
function Render(params) {
|
|
1636
|
-
var _a;
|
|
1637
|
+
var _a, _b;
|
|
1637
1638
|
var entity = params.entity;
|
|
1638
1639
|
var line = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.LineString;
|
|
1639
1640
|
var points = line && typeof line == "string" ? Geometry.ParsePoints(line) : [];
|
|
@@ -1650,7 +1651,17 @@ var EntityRenderEngine;
|
|
|
1650
1651
|
if (!isValid) {
|
|
1651
1652
|
return null;
|
|
1652
1653
|
}
|
|
1653
|
-
var
|
|
1654
|
+
var style = params.style;
|
|
1655
|
+
var heightRef = getHeightRef(style);
|
|
1656
|
+
var flattenPoints = false;
|
|
1657
|
+
// We gain a lot of performance when not clamping.
|
|
1658
|
+
// If there is no terrain we can safely not clamp.
|
|
1659
|
+
if (heightRef == HeightReference.CLAMP_TO_GROUND &&
|
|
1660
|
+
((_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider) instanceof EllipsoidTerrainProvider) {
|
|
1661
|
+
heightRef = HeightReference.NONE;
|
|
1662
|
+
flattenPoints = true;
|
|
1663
|
+
}
|
|
1664
|
+
var posses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(flattenPoints ? 0 : x.altitude)); });
|
|
1654
1665
|
// Making sure no 0 length lines coming through.
|
|
1655
1666
|
// Ideally we would measure the full line but I fear that's too expensive.
|
|
1656
1667
|
if (posses.length == 2 || posses.length == 3) {
|
|
@@ -1666,7 +1677,6 @@ var EntityRenderEngine;
|
|
|
1666
1677
|
return null;
|
|
1667
1678
|
}
|
|
1668
1679
|
}
|
|
1669
|
-
var style = params.style;
|
|
1670
1680
|
var bColor = style.lineColor ? Calculator.GetColor(style.lineColor, entity, params.tags) : null;
|
|
1671
1681
|
var cColor = bColor ? colorToCColor(bColor) : Color.RED;
|
|
1672
1682
|
var width = style.lineWidth ? Calculator.GetNumber(style.lineWidth, entity, params.tags) : null;
|
|
@@ -1677,7 +1687,6 @@ var EntityRenderEngine;
|
|
|
1677
1687
|
if (width <= 0) {
|
|
1678
1688
|
return null;
|
|
1679
1689
|
}
|
|
1680
|
-
var heightRef = getHeightRef(style);
|
|
1681
1690
|
var cEntity = new Entity({
|
|
1682
1691
|
polyline: {
|
|
1683
1692
|
positions: posses,
|
|
@@ -1699,23 +1708,23 @@ var EntityRenderEngine;
|
|
|
1699
1708
|
}
|
|
1700
1709
|
Polyline.Render = Render;
|
|
1701
1710
|
function RenderGroup(params) {
|
|
1702
|
-
var _a, _b;
|
|
1711
|
+
var _a, _b, _c;
|
|
1703
1712
|
return __awaiter(this, void 0, void 0, function () {
|
|
1704
1713
|
var api, cEntities, i, entity, zoomItem, style, tagIds, tags, lStyle, cEntity;
|
|
1705
|
-
return __generator(this, function (
|
|
1706
|
-
switch (
|
|
1714
|
+
return __generator(this, function (_d) {
|
|
1715
|
+
switch (_d.label) {
|
|
1707
1716
|
case 0:
|
|
1708
1717
|
api = params.apiGetter.getApi();
|
|
1709
1718
|
cEntities = {};
|
|
1710
1719
|
i = 0;
|
|
1711
|
-
|
|
1720
|
+
_d.label = 1;
|
|
1712
1721
|
case 1:
|
|
1713
1722
|
if (!(i < params.entities.length)) return [3 /*break*/, 6];
|
|
1714
1723
|
entity = params.entities[i];
|
|
1715
1724
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
1716
1725
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1717
1726
|
case 2:
|
|
1718
|
-
style =
|
|
1727
|
+
style = _d.sent();
|
|
1719
1728
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1720
1729
|
tags = [];
|
|
1721
1730
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 4];
|
|
@@ -1724,8 +1733,8 @@ var EntityRenderEngine;
|
|
|
1724
1733
|
tagIds: tagIds
|
|
1725
1734
|
})];
|
|
1726
1735
|
case 3:
|
|
1727
|
-
tags = (
|
|
1728
|
-
|
|
1736
|
+
tags = (_d.sent()).tags;
|
|
1737
|
+
_d.label = 4;
|
|
1729
1738
|
case 4:
|
|
1730
1739
|
lStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
1731
1740
|
cEntity = Render({
|
|
@@ -1735,10 +1744,10 @@ var EntityRenderEngine;
|
|
|
1735
1744
|
viewer: params.viewer
|
|
1736
1745
|
});
|
|
1737
1746
|
if (cEntity) {
|
|
1738
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem);
|
|
1747
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
|
|
1739
1748
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1740
1749
|
}
|
|
1741
|
-
|
|
1750
|
+
_d.label = 5;
|
|
1742
1751
|
case 5:
|
|
1743
1752
|
i++;
|
|
1744
1753
|
return [3 /*break*/, 1];
|
|
@@ -1752,7 +1761,7 @@ var EntityRenderEngine;
|
|
|
1752
1761
|
var Polygon;
|
|
1753
1762
|
(function (Polygon) {
|
|
1754
1763
|
function Render(params) {
|
|
1755
|
-
var _a;
|
|
1764
|
+
var _a, _b;
|
|
1756
1765
|
var entity = params.entity;
|
|
1757
1766
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
1758
1767
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -1778,10 +1787,16 @@ var EntityRenderEngine;
|
|
|
1778
1787
|
Cartes.CloseRing3(posses);
|
|
1779
1788
|
var extrusion = getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
|
|
1780
1789
|
posses = extrusion.posses;
|
|
1790
|
+
var flattenPoints = false;
|
|
1791
|
+
if (heightRef == HeightReference.CLAMP_TO_GROUND &&
|
|
1792
|
+
((_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider) instanceof EllipsoidTerrainProvider) {
|
|
1793
|
+
heightRef = HeightReference.NONE;
|
|
1794
|
+
flattenPoints = true;
|
|
1795
|
+
}
|
|
1781
1796
|
var holeRings = pRings.filter(function (x) { return x.Facing == Geometry.EPolygonRingType.Hole; });
|
|
1782
1797
|
var holePosses = holeRings.map(function (x) {
|
|
1783
1798
|
var points = Geometry.ParsePoints(x.LinearRing);
|
|
1784
|
-
return points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)); });
|
|
1799
|
+
return points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(flattenPoints ? 0 : x.altitude)); });
|
|
1785
1800
|
});
|
|
1786
1801
|
var zIndex = getZIndex(style, entity, params.tags);
|
|
1787
1802
|
var cEntity = new Entity({
|
|
@@ -1804,9 +1819,14 @@ var EntityRenderEngine;
|
|
|
1804
1819
|
});
|
|
1805
1820
|
cEntity._siblingGraphics = [];
|
|
1806
1821
|
if (width > 0 && cLineColor) {
|
|
1822
|
+
var borderPosses = posses;
|
|
1823
|
+
if (flattenPoints) {
|
|
1824
|
+
borderPosses = points.map(function (x) { return Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(0)); });
|
|
1825
|
+
Cartes.CloseRing3(borderPosses);
|
|
1826
|
+
}
|
|
1807
1827
|
var cEntityBorder = new Entity({
|
|
1808
1828
|
polyline: new PolylineGraphics({
|
|
1809
|
-
positions:
|
|
1829
|
+
positions: borderPosses,
|
|
1810
1830
|
material: cLineColor,
|
|
1811
1831
|
width: width,
|
|
1812
1832
|
clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
|
|
@@ -1844,23 +1864,23 @@ var EntityRenderEngine;
|
|
|
1844
1864
|
}
|
|
1845
1865
|
Polygon.Render = Render;
|
|
1846
1866
|
function RenderGroup(params) {
|
|
1847
|
-
var _a, _b;
|
|
1867
|
+
var _a, _b, _c;
|
|
1848
1868
|
return __awaiter(this, void 0, void 0, function () {
|
|
1849
1869
|
var api, cEntities, i, entity, zoomItem, style, tagIds, tags, pStyle, cEntity;
|
|
1850
|
-
return __generator(this, function (
|
|
1851
|
-
switch (
|
|
1870
|
+
return __generator(this, function (_d) {
|
|
1871
|
+
switch (_d.label) {
|
|
1852
1872
|
case 0:
|
|
1853
1873
|
api = params.apiGetter.getApi();
|
|
1854
1874
|
cEntities = {};
|
|
1855
1875
|
i = 0;
|
|
1856
|
-
|
|
1876
|
+
_d.label = 1;
|
|
1857
1877
|
case 1:
|
|
1858
1878
|
if (!(i < params.entities.length)) return [3 /*break*/, 6];
|
|
1859
1879
|
entity = params.entities[i];
|
|
1860
1880
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
1861
1881
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1862
1882
|
case 2:
|
|
1863
|
-
style =
|
|
1883
|
+
style = _d.sent();
|
|
1864
1884
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1865
1885
|
tags = [];
|
|
1866
1886
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 4];
|
|
@@ -1869,8 +1889,8 @@ var EntityRenderEngine;
|
|
|
1869
1889
|
tagIds: tagIds
|
|
1870
1890
|
})];
|
|
1871
1891
|
case 3:
|
|
1872
|
-
tags = (
|
|
1873
|
-
|
|
1892
|
+
tags = (_d.sent()).tags;
|
|
1893
|
+
_d.label = 4;
|
|
1874
1894
|
case 4:
|
|
1875
1895
|
pStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
1876
1896
|
cEntity = Render({
|
|
@@ -1880,10 +1900,10 @@ var EntityRenderEngine;
|
|
|
1880
1900
|
viewer: params.viewer
|
|
1881
1901
|
});
|
|
1882
1902
|
if (cEntity) {
|
|
1883
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem);
|
|
1903
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
|
|
1884
1904
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1885
1905
|
}
|
|
1886
|
-
|
|
1906
|
+
_d.label = 5;
|
|
1887
1907
|
case 5:
|
|
1888
1908
|
i++;
|
|
1889
1909
|
return [3 /*break*/, 1];
|
|
@@ -1969,11 +1989,11 @@ var EntityRenderEngine;
|
|
|
1969
1989
|
}
|
|
1970
1990
|
Model3d.Render = Render;
|
|
1971
1991
|
function RenderGroup(params) {
|
|
1972
|
-
var _a, _b, _c, _d;
|
|
1992
|
+
var _a, _b, _c, _d, _e;
|
|
1973
1993
|
return __awaiter(this, void 0, void 0, function () {
|
|
1974
1994
|
var api, cEntities, reqBody, i, entity, zoomItem, style, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
1975
|
-
return __generator(this, function (
|
|
1976
|
-
switch (
|
|
1995
|
+
return __generator(this, function (_f) {
|
|
1996
|
+
switch (_f.label) {
|
|
1977
1997
|
case 0:
|
|
1978
1998
|
api = params.apiGetter.getApi();
|
|
1979
1999
|
cEntities = {};
|
|
@@ -1983,14 +2003,14 @@ var EntityRenderEngine;
|
|
|
1983
2003
|
"Items": []
|
|
1984
2004
|
};
|
|
1985
2005
|
i = 0;
|
|
1986
|
-
|
|
2006
|
+
_f.label = 1;
|
|
1987
2007
|
case 1:
|
|
1988
2008
|
if (!(i < params.entities.length)) return [3 /*break*/, 6];
|
|
1989
2009
|
entity = params.entities[i];
|
|
1990
2010
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
1991
2011
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
1992
2012
|
case 2:
|
|
1993
|
-
style =
|
|
2013
|
+
style = _f.sent();
|
|
1994
2014
|
tagIds = entity.Bruce["Layer.ID"];
|
|
1995
2015
|
tags = [];
|
|
1996
2016
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 4];
|
|
@@ -1999,8 +2019,8 @@ var EntityRenderEngine;
|
|
|
1999
2019
|
tagIds: tagIds
|
|
2000
2020
|
})];
|
|
2001
2021
|
case 3:
|
|
2002
|
-
tags = (
|
|
2003
|
-
|
|
2022
|
+
tags = (_f.sent()).tags;
|
|
2023
|
+
_f.label = 4;
|
|
2004
2024
|
case 4:
|
|
2005
2025
|
mStyle = (_b = (_a = style === null || style === void 0 ? void 0 : style.Settings) === null || _a === void 0 ? void 0 : _a.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
2006
2026
|
group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -2021,7 +2041,7 @@ var EntityRenderEngine;
|
|
|
2021
2041
|
"group": group,
|
|
2022
2042
|
"level": level
|
|
2023
2043
|
});
|
|
2024
|
-
|
|
2044
|
+
_f.label = 5;
|
|
2025
2045
|
case 5:
|
|
2026
2046
|
i++;
|
|
2027
2047
|
return [3 /*break*/, 1];
|
|
@@ -2030,7 +2050,7 @@ var EntityRenderEngine;
|
|
|
2030
2050
|
filter: reqBody
|
|
2031
2051
|
})];
|
|
2032
2052
|
case 7:
|
|
2033
|
-
lodData = (
|
|
2053
|
+
lodData = (_f.sent()).lods;
|
|
2034
2054
|
_loop_2 = function (i) {
|
|
2035
2055
|
var entity, zoomItem, style, tagIds, tags, lod, mStyle, cEntity;
|
|
2036
2056
|
return __generator(this, function (_a) {
|
|
@@ -2069,7 +2089,7 @@ var EntityRenderEngine;
|
|
|
2069
2089
|
lodClientFileId: lod.clientFileId
|
|
2070
2090
|
});
|
|
2071
2091
|
if (cEntity) {
|
|
2072
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem);
|
|
2092
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_e = params.viewer) === null || _e === void 0 ? void 0 : _e.terrainProvider);
|
|
2073
2093
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
2074
2094
|
}
|
|
2075
2095
|
return [2 /*return*/];
|
|
@@ -2077,13 +2097,13 @@ var EntityRenderEngine;
|
|
|
2077
2097
|
});
|
|
2078
2098
|
};
|
|
2079
2099
|
i = 0;
|
|
2080
|
-
|
|
2100
|
+
_f.label = 8;
|
|
2081
2101
|
case 8:
|
|
2082
2102
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
2083
2103
|
return [5 /*yield**/, _loop_2(i)];
|
|
2084
2104
|
case 9:
|
|
2085
|
-
|
|
2086
|
-
|
|
2105
|
+
_f.sent();
|
|
2106
|
+
_f.label = 10;
|
|
2087
2107
|
case 10:
|
|
2088
2108
|
i++;
|
|
2089
2109
|
return [3 /*break*/, 8];
|