From c110112608e6bf9a2a535034aef067c586cad6f7 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Tue, 25 Jun 2024 13:48:20 +0100 Subject: [PATCH] save GIS incoming SpatialReference to ContextStack; delete Revit origin implementation for now --- .../Operations/Receive/HostObjectBuilder.cs | 7 +++---- .../Layers/FeatureClassToHostConverter.cs | 1 + .../ArcGIS/Speckle.Converters.ArcGIS3/Utils/CRSorigin.cs | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/HostObjectBuilder.cs b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/HostObjectBuilder.cs index 125270ed6e..70f314d925 100644 --- a/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/HostObjectBuilder.cs +++ b/DUI3-DX/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/HostObjectBuilder.cs @@ -47,11 +47,10 @@ CancellationToken cancellationToken // Prompt the UI conversion started. Progress bar will swoosh. onOperationProgressed?.Invoke("Converting", null); - // Receive geo-located data in the correct place - // 1. From Revit - CRSorigin? dataOrigin = CRSorigin.FromRevitData(rootObject); + // Browse for any trace of geolocation in non-GIS apps (e.g. Revit: implemented, Blender: todo on Blender side, Civil3d: ?) + CRSorigin? dataOrigin = null; // e.g. CRSorigin.FromRevitData(rootObject); - // save SpatialReference, use it for dataset writing + // save SpatialReference (overwrite default Map.SpatialRef), use it for dataset writing if (dataOrigin is CRSorigin crsOrigin) { SpatialReference incomingSpatialRef = crsOrigin.CreateCustomCRS(); diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs index 0a084ffee8..57befa464d 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs @@ -88,6 +88,7 @@ public FeatureClass Convert(VectorLayer target) wktString = target.crs.wkt.ToString(); } ACG.SpatialReference spatialRef = ACG.SpatialReferenceBuilder.CreateSpatialReference(wktString); + _contextStack.Current.Document.IncomingSpatialReference = spatialRef; // create Fields List fields = _fieldsUtils.GetFieldsFromSpeckleLayer(target); diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/CRSorigin.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/CRSorigin.cs index 9118b59b86..dfeccf5f54 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/CRSorigin.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/CRSorigin.cs @@ -25,6 +25,7 @@ public CRSorigin(double latDegrees, double lonDegrees) public static CRSorigin? FromRevitData(Base rootObject) { + // rewrite function to take into account Local reference point in Revit, and Transformation matrix foreach (KeyValuePair prop in rootObject.GetMembers(DynamicBaseMemberType.Dynamic)) { if (prop.Key == "info")