bruce-models 3.4.0 → 3.4.2

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,66 @@ 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
+ const { ID } = entity.Bruce;
3948
+ const { geometry } = entity;
3949
+ processGeometry(geometry, ID);
3950
+ });
3951
+ return {
3952
+ type: 'FeatureCollection',
3953
+ features,
3954
+ };
3955
+ }
3956
+ Geometry.ToGeoJson = ToGeoJson;
3897
3957
  })(Geometry || (Geometry = {}));
3898
3958
 
3899
3959
  var Bounds;
@@ -10710,7 +10770,7 @@ var DataSource;
10710
10770
  DataSource.GetList = GetList;
10711
10771
  })(DataSource || (DataSource = {}));
10712
10772
 
10713
- const VERSION = "3.4.0";
10773
+ const VERSION = "3.4.2";
10714
10774
 
10715
10775
  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
10776
  //# sourceMappingURL=bruce-models.es5.js.map