bruce-models 3.4.4 → 3.4.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-models.es5.js +73 -44
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +72 -43
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity.js +51 -21
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity.d.ts +3 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -2869,6 +2869,28 @@ var PathUtils;
|
|
|
2869
2869
|
PathUtils.ParseLegacy = ParseLegacy;
|
|
2870
2870
|
})(PathUtils || (PathUtils = {}));
|
|
2871
2871
|
|
|
2872
|
+
/**
|
|
2873
|
+
* Describes an expectation on what should be rendered for a menu item-
|
|
2874
|
+
* between a min-max distance of an entity to the camera.
|
|
2875
|
+
*/
|
|
2876
|
+
var ZoomControl;
|
|
2877
|
+
(function (ZoomControl) {
|
|
2878
|
+
/**
|
|
2879
|
+
* Available display types for a menu item.
|
|
2880
|
+
*/
|
|
2881
|
+
let EDisplayType;
|
|
2882
|
+
(function (EDisplayType) {
|
|
2883
|
+
// Hidden means it will not be rendered.
|
|
2884
|
+
EDisplayType["Hidden"] = "hidden";
|
|
2885
|
+
// Point will try render a point based on any available Entity data.
|
|
2886
|
+
EDisplayType["Point"] = "point";
|
|
2887
|
+
// Geometry means it will try render multi-geometry, polygon, polyline, or point in order of priority.
|
|
2888
|
+
EDisplayType["Geometry"] = "geometry";
|
|
2889
|
+
// 3D means it will try render 3D model, multi-geometry, polygon, polyline, or point in order of priority.
|
|
2890
|
+
EDisplayType["Model3D"] = "3d";
|
|
2891
|
+
})(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
|
|
2892
|
+
})(ZoomControl || (ZoomControl = {}));
|
|
2893
|
+
|
|
2872
2894
|
/**
|
|
2873
2895
|
* Describes the "Entity" concept within Nextspace.
|
|
2874
2896
|
* An entity is a JSON blob containing both internal data and user-defined data.
|
|
@@ -3389,11 +3411,28 @@ var Entity;
|
|
|
3389
3411
|
}
|
|
3390
3412
|
Entity.GetList = GetList;
|
|
3391
3413
|
function ToGeoJson(params) {
|
|
3392
|
-
const { entities, excludeAltitude, altitude, includeUserData } = params;
|
|
3414
|
+
const { entities, excludeAltitude, altitude, includeUserData, allowedDisplayTypes } = params;
|
|
3393
3415
|
const features = [];
|
|
3416
|
+
const allowPoint = allowedDisplayTypes == null || allowedDisplayTypes.includes(ZoomControl.EDisplayType.Point);
|
|
3417
|
+
const allowGeometry = allowedDisplayTypes == null || allowedDisplayTypes.includes(ZoomControl.EDisplayType.Geometry);
|
|
3394
3418
|
const cloneObj = (obj) => {
|
|
3395
3419
|
return JSON.parse(JSON.stringify(obj));
|
|
3396
3420
|
};
|
|
3421
|
+
const areCoordinatesEqual = (coord1, coord2) => {
|
|
3422
|
+
return coord1[0] === coord2[0] && coord1[1] === coord2[1] && (coord1[2] === coord2[2] || (coord1.length < 3 && coord2.length < 3));
|
|
3423
|
+
};
|
|
3424
|
+
const removeConsecutiveDuplicates = (coordinates) => {
|
|
3425
|
+
return coordinates.filter((coord, index, array) => {
|
|
3426
|
+
return index === 0 || !areCoordinatesEqual(coord, array[index - 1]);
|
|
3427
|
+
});
|
|
3428
|
+
};
|
|
3429
|
+
const closePolygonCoordinates = (coordinates) => {
|
|
3430
|
+
if (coordinates.length > 0 && !areCoordinatesEqual(coordinates[0], coordinates[coordinates.length - 1])) {
|
|
3431
|
+
const firstPointCopy = [...coordinates[0]];
|
|
3432
|
+
coordinates.push(firstPointCopy);
|
|
3433
|
+
}
|
|
3434
|
+
return coordinates;
|
|
3435
|
+
};
|
|
3397
3436
|
const populateProperties = (feature, entity) => {
|
|
3398
3437
|
let properties = null;
|
|
3399
3438
|
// All properties.
|
|
@@ -3414,45 +3453,57 @@ var Entity;
|
|
|
3414
3453
|
feature.properties = properties;
|
|
3415
3454
|
};
|
|
3416
3455
|
const processGeometry = (geometry, entity) => {
|
|
3456
|
+
var _a, _b;
|
|
3417
3457
|
const feature = {
|
|
3418
|
-
type:
|
|
3458
|
+
type: "Feature",
|
|
3419
3459
|
properties: {},
|
|
3420
3460
|
geometry: null
|
|
3421
3461
|
};
|
|
3422
3462
|
populateProperties(feature, entity);
|
|
3423
|
-
if (geometry.
|
|
3463
|
+
if (((_a = geometry.MultiGeometry) === null || _a === void 0 ? void 0 : _a.length) && allowGeometry) {
|
|
3464
|
+
geometry.MultiGeometry.forEach(geo => processGeometry(geo, entity));
|
|
3465
|
+
return;
|
|
3466
|
+
}
|
|
3467
|
+
else if (((_b = geometry.Polygon) === null || _b === void 0 ? void 0 : _b.length) && allowGeometry) {
|
|
3424
3468
|
const sortedPolygons = geometry.Polygon.sort((a, b) => a.Facing === Geometry.EPolygonRingType.Boundaries ? -1 : 1);
|
|
3425
|
-
const coordinates = sortedPolygons.map(polygonRing => polygonRing.LinearRing.split(' ').map(coord => {
|
|
3469
|
+
const coordinates = sortedPolygons.map(polygonRing => closePolygonCoordinates(removeConsecutiveDuplicates(polygonRing.LinearRing.split(' ').map(coord => {
|
|
3426
3470
|
const [lon, lat, alt] = coord.split(',').map(Number);
|
|
3427
3471
|
return excludeAltitude ? [lon, lat] : [lon, lat, altitude !== undefined ? altitude : (alt !== undefined ? alt : [])];
|
|
3428
|
-
}));
|
|
3472
|
+
}))));
|
|
3473
|
+
// Check if the polygon has at least 4 points.
|
|
3474
|
+
const isValidPolygon = coordinates.every(polygon => polygon.length >= 4);
|
|
3475
|
+
if (!isValidPolygon) {
|
|
3476
|
+
// Perhaps try other geometry instead of returning?
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3429
3479
|
feature.geometry = {
|
|
3430
|
-
type:
|
|
3480
|
+
type: "Polygon",
|
|
3431
3481
|
coordinates: coordinates,
|
|
3432
3482
|
};
|
|
3433
3483
|
}
|
|
3434
|
-
if (geometry.
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3484
|
+
else if (geometry.LineString && (allowedDisplayTypes == null || allowedDisplayTypes.includes(ZoomControl.EDisplayType.Geometry))) {
|
|
3485
|
+
const coordinates = removeConsecutiveDuplicates(geometry.LineString.split(' ').map(coord => {
|
|
3486
|
+
const [lon, lat, alt] = coord.split(',').map(Number);
|
|
3487
|
+
return excludeAltitude ? [lon, lat] : [lon, lat, altitude !== undefined ? altitude : (alt !== undefined ? alt : [])];
|
|
3488
|
+
}));
|
|
3489
|
+
// Check if the polyline has at least 2 points.
|
|
3490
|
+
if (coordinates.length < 2) {
|
|
3491
|
+
// Perhaps try other geometry instead of returning?
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3437
3494
|
feature.geometry = {
|
|
3438
|
-
type:
|
|
3495
|
+
type: "LineString",
|
|
3439
3496
|
coordinates,
|
|
3440
3497
|
};
|
|
3441
3498
|
}
|
|
3442
|
-
if (geometry.
|
|
3443
|
-
const
|
|
3444
|
-
|
|
3445
|
-
return excludeAltitude ? [lon, lat] : [lon, lat, altitude !== undefined ? altitude : (alt !== undefined ? alt : [])];
|
|
3446
|
-
});
|
|
3499
|
+
else if (geometry.Point && allowPoint) {
|
|
3500
|
+
const [lon, lat, alt] = geometry.Point.split(',').map(Number);
|
|
3501
|
+
const coordinates = excludeAltitude ? [lon, lat] : [lon, lat, altitude !== undefined ? altitude : (alt !== undefined ? alt : [])];
|
|
3447
3502
|
feature.geometry = {
|
|
3448
|
-
type:
|
|
3503
|
+
type: "Point",
|
|
3449
3504
|
coordinates,
|
|
3450
3505
|
};
|
|
3451
3506
|
}
|
|
3452
|
-
if (geometry.MultiGeometry) {
|
|
3453
|
-
geometry.MultiGeometry.forEach(geo => processGeometry(geo, entity));
|
|
3454
|
-
return;
|
|
3455
|
-
}
|
|
3456
3507
|
features.push(feature);
|
|
3457
3508
|
};
|
|
3458
3509
|
entities.forEach(entity => {
|
|
@@ -3469,7 +3520,7 @@ var Entity;
|
|
|
3469
3520
|
processGeometry(geometry, entity);
|
|
3470
3521
|
});
|
|
3471
3522
|
return {
|
|
3472
|
-
type:
|
|
3523
|
+
type: "FeatureCollection",
|
|
3473
3524
|
features,
|
|
3474
3525
|
};
|
|
3475
3526
|
}
|
|
@@ -7076,28 +7127,6 @@ var ProgramKey;
|
|
|
7076
7127
|
ProgramKey.Update = Update;
|
|
7077
7128
|
})(ProgramKey || (ProgramKey = {}));
|
|
7078
7129
|
|
|
7079
|
-
/**
|
|
7080
|
-
* Describes an expectation on what should be rendered for a menu item-
|
|
7081
|
-
* between a min-max distance of an entity to the camera.
|
|
7082
|
-
*/
|
|
7083
|
-
var ZoomControl;
|
|
7084
|
-
(function (ZoomControl) {
|
|
7085
|
-
/**
|
|
7086
|
-
* Available display types for a menu item.
|
|
7087
|
-
*/
|
|
7088
|
-
let EDisplayType;
|
|
7089
|
-
(function (EDisplayType) {
|
|
7090
|
-
// Hidden means it will not be rendered.
|
|
7091
|
-
EDisplayType["Hidden"] = "hidden";
|
|
7092
|
-
// Point will try render a point based on any available Entity data.
|
|
7093
|
-
EDisplayType["Point"] = "point";
|
|
7094
|
-
// Geometry means it will try render multi-geometry, polygon, polyline, or point in order of priority.
|
|
7095
|
-
EDisplayType["Geometry"] = "geometry";
|
|
7096
|
-
// 3D means it will try render 3D model, multi-geometry, polygon, polyline, or point in order of priority.
|
|
7097
|
-
EDisplayType["Model3D"] = "3d";
|
|
7098
|
-
})(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
|
|
7099
|
-
})(ZoomControl || (ZoomControl = {}));
|
|
7100
|
-
|
|
7101
7130
|
/**
|
|
7102
7131
|
* Describes the "Tileset" concept in Nextspace.
|
|
7103
7132
|
*
|
|
@@ -10796,7 +10825,7 @@ var DataSource;
|
|
|
10796
10825
|
DataSource.GetList = GetList;
|
|
10797
10826
|
})(DataSource || (DataSource = {}));
|
|
10798
10827
|
|
|
10799
|
-
const VERSION = "3.4.
|
|
10828
|
+
const VERSION = "3.4.5";
|
|
10800
10829
|
|
|
10801
10830
|
export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
10802
10831
|
//# sourceMappingURL=bruce-models.es5.js.map
|