bruce-models 3.4.1 → 3.4.3

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.
@@ -3894,6 +3894,74 @@ var Geometry;
3894
3894
  return geometry;
3895
3895
  }
3896
3896
  Geometry.ParseGeometry = ParseGeometry;
3897
+ function ToGeoJson(params) {
3898
+ const { entities, excludeAltitude } = params;
3899
+ const features = [];
3900
+ const processGeometry = (geometry, ID) => {
3901
+ if (geometry.Polygon) {
3902
+ const sortedPolygons = geometry.Polygon.sort((a, b) => a.Facing === EPolygonRingType.Boundaries ? -1 : 1);
3903
+ const coordinates = sortedPolygons.map(polygonRing => polygonRing.LinearRing.split(' ').map(coord => {
3904
+ const [lon, lat, alt] = coord.split(',').map(Number);
3905
+ return excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
3906
+ }));
3907
+ features.push({
3908
+ type: 'Feature',
3909
+ properties: { ID },
3910
+ geometry: {
3911
+ type: 'Polygon',
3912
+ coordinates: coordinates,
3913
+ }
3914
+ });
3915
+ }
3916
+ if (geometry.Point) {
3917
+ const [lon, lat, alt] = geometry.Point.split(',').map(Number);
3918
+ const coordinates = excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
3919
+ features.push({
3920
+ type: 'Feature',
3921
+ properties: { ID },
3922
+ geometry: {
3923
+ type: 'Point',
3924
+ coordinates,
3925
+ }
3926
+ });
3927
+ }
3928
+ if (geometry.LineString) {
3929
+ const coordinates = geometry.LineString.split(' ').map(coord => {
3930
+ const [lon, lat, alt] = coord.split(',').map(Number);
3931
+ return excludeAltitude ? [lon, lat] : [lon, lat, ...(alt ? [alt] : [])];
3932
+ });
3933
+ features.push({
3934
+ type: 'Feature',
3935
+ properties: { ID },
3936
+ geometry: {
3937
+ type: 'LineString',
3938
+ coordinates,
3939
+ }
3940
+ });
3941
+ }
3942
+ if (geometry.MultiGeometry) {
3943
+ geometry.MultiGeometry.forEach(geo => processGeometry(geo, ID));
3944
+ }
3945
+ };
3946
+ entities.forEach(entity => {
3947
+ var _a, _b, _c;
3948
+ if (!((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID)) {
3949
+ return;
3950
+ }
3951
+ let geometry = entity.geometry;
3952
+ if (!geometry && (((_b = entity.location) === null || _b === void 0 ? void 0 : _b.longitude) && ((_c = entity.location) === null || _c === void 0 ? void 0 : _c.latitude))) {
3953
+ geometry = {
3954
+ Point: `${entity.location.longitude},${entity.location.latitude}` + (entity.location.altitude != null ? `,${entity.location.altitude}` : ""),
3955
+ };
3956
+ }
3957
+ processGeometry(geometry, entity.Bruce.ID);
3958
+ });
3959
+ return {
3960
+ type: 'FeatureCollection',
3961
+ features,
3962
+ };
3963
+ }
3964
+ Geometry.ToGeoJson = ToGeoJson;
3897
3965
  })(Geometry || (Geometry = {}));
3898
3966
 
3899
3967
  var Bounds;
@@ -10710,7 +10778,7 @@ var DataSource;
10710
10778
  DataSource.GetList = GetList;
10711
10779
  })(DataSource || (DataSource = {}));
10712
10780
 
10713
- const VERSION = "3.4.1";
10781
+ const VERSION = "3.4.3";
10714
10782
 
10715
10783
  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 };
10716
10784
  //# sourceMappingURL=bruce-models.es5.js.map