From e97bdda71d80390609fcd54e7ad506cab64bf96b Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:42:26 +0100 Subject: [PATCH 1/8] Changes to traversal for arcgis --- .../TraversalContextExtensions.cs | 19 ++++- .../Operations/Receive/HostObjectBuilder.cs | 75 +++++++------------ .../Utils/INonNativeFeaturesUtils.cs | 4 +- .../Utils/NonNativeFeaturesUtils.cs | 36 ++++----- 4 files changed, 63 insertions(+), 71 deletions(-) diff --git a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs index b987cb1b45..d1210c1a35 100644 --- a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs +++ b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq; namespace Speckle.Core.Models.GraphTraversal; @@ -33,13 +35,24 @@ public static IEnumerable GetPropertyPath(this TraversalContext context) /// public static IEnumerable GetAscendantOfType(this TraversalContext context) where T : Base + { + return GetAscendantWhere(context, tc => tc is T).Cast(); + } + + /// + /// Walks up the tree, returning all typed ascendant, starting the closest , + /// walking up nodes + /// + /// + /// + public static IEnumerable GetAscendantWhere(this TraversalContext context, Func predicate) { TraversalContext? head = context; do { - if (head.Current is T c) + if (predicate.Invoke(head.Current)) { - yield return c; + yield return head.Current; } head = head.Parent; } while (head != null); 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 ce31b4775c..d5106a8184 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 @@ -9,6 +9,7 @@ using Speckle.Connectors.Utils.Conversion; using Speckle.Core.Models.GraphTraversal; using Speckle.Converters.ArcGIS3; +using RasterLayer = Objects.GIS.RasterLayer; namespace Speckle.Connectors.ArcGIS.Operations.Receive; @@ -34,52 +35,36 @@ GraphTraversal traverseFunction _traverseFunction = traverseFunction; } - public (string path, Geometry converted, string? parentId) ConvertNonNativeGeometries( - Base obj, - string[] path, - string? parentId, - List objectIds - ) + private (string path, Geometry converted) ConvertNonNativeGeometries(Base obj, string[] path) { Geometry converted = (Geometry)_converter.Convert(obj); - objectIds.Add(obj.id); List objPath = path.ToList(); objPath.Add(obj.speckle_type.Split(".")[^1]); - return ($"{string.Join("\\", objPath)}", converted, parentId); + return (string.Join("\\", objPath), converted); } - public (string path, string converted) ConvertNativeLayers(Collection obj, string[] path, List objectIds) + private (string path, string converted) ConvertNativeLayers(Collection obj, string[] path) { string converted = (string)_converter.Convert(obj); - objectIds.Add(obj.id); string objPath = $"{string.Join("\\", path)}\\{obj.name}"; return (objPath, converted); } - public string AddDatasetsToMap((string, string) databaseObj) + private string AddDatasetsToMap((string nestedLayerName, string datasetId) databaseObj) { + Uri uri = + new( + $"{_contextStack.Current.Document.SpeckleDatabasePath.AbsolutePath.Replace('/', '\\')}\\{databaseObj.datasetId}" + ); + Map map = _contextStack.Current.Document.Map; try { - return LayerFactory.Instance - .CreateLayer( - new Uri( - $"{_contextStack.Current.Document.SpeckleDatabasePath.AbsolutePath.Replace('/', '\\')}\\{databaseObj.Item2}" - ), - _contextStack.Current.Document.Map, - layerName: databaseObj.Item1 - ) - .URI; + return LayerFactory.Instance.CreateLayer(uri, map, layerName: databaseObj.nestedLayerName).URI; } catch (ArgumentException) { return StandaloneTableFactory.Instance - .CreateStandaloneTable( - new Uri( - $"{_contextStack.Current.Document.SpeckleDatabasePath.AbsolutePath.Replace('/', '\\')}\\{databaseObj.Item2}" - ), - _contextStack.Current.Document.Map, - tableName: databaseObj.Item1 - ) + .CreateStandaloneTable(uri, map, tableName: databaseObj.nestedLayerName) .URI; } } @@ -94,15 +79,13 @@ private string[] GetLayerPath(TraversalContext context) private bool HasGISParent(TraversalContext context) { - List vectorLayers = context - .GetAscendantOfType() - .Where(obj => obj != context.Current) - .ToList(); - List rasterLayers = context - .GetAscendantOfType() - .Where(obj => obj != context.Current) - .ToList(); - return vectorLayers.Count + rasterLayers.Count > 0; + List gisLayers = context.GetAscendantWhere(IsGISType).Where(obj => obj != context.Current).ToList(); + return gisLayers.Count > 0; + } + + private static bool IsGISType(Base obj) + { + return obj is RasterLayer or VectorLayer; } public HostObjectBuilderResult Build( @@ -116,31 +99,31 @@ CancellationToken cancellationToken // Prompt the UI conversion started. Progress bar will swoosh. onOperationProgressed?.Invoke("Converting", null); - // POC: This is where we will define our receive strategy, or maybe later somewhere else according to some setting pass from UI? var objectsToConvert = _traverseFunction .Traverse(rootObject) + .Where(ctx => ctx.Current is not Collection || IsGISType(ctx.Current)) .Where(ctx => HasGISParent(ctx) is false) - .Select(ctx => (GetLayerPath(ctx), ctx.Current, ctx.Parent?.Current.id)) .ToList(); int allCount = objectsToConvert.Count; int count = 0; - Dictionary convertedGeometries = new(); - List objectIds = new(); + Dictionary convertedGeometries = new(); List<(string path, string converted)> convertedGISObjects = new(); // 1. convert everything List results = new(objectsToConvert.Count); List bakedObjectIds = new(); - foreach (var item in objectsToConvert) + foreach (TraversalContext ctx in objectsToConvert) { - (string[] path, Base obj, string? parentId) = item; + string[] path = GetLayerPath(ctx); + Base obj = ctx.Current; + cancellationToken.ThrowIfCancellationRequested(); try { - if (obj is VectorLayer or Objects.GIS.RasterLayer) + if (IsGISType(obj)) { - var result = ConvertNativeLayers((Collection)obj, path, objectIds); + var result = ConvertNativeLayers((Collection)obj, path); convertedGISObjects.Add(result); // NOTE: Dim doesn't really know what is what - is the result.path the id of the obj? // TODO: is the type in here basically a GIS Layer? @@ -148,8 +131,8 @@ CancellationToken cancellationToken } else { - var result = ConvertNonNativeGeometries(obj, path, parentId, objectIds); - convertedGeometries[obj.id] = result; + var result = ConvertNonNativeGeometries(obj, path); + convertedGeometries[ctx] = result; // NOTE: Dim doesn't really know what is what - is the result.path the id of the obj? results.Add(new(Status.SUCCESS, obj, result.path, result.converted.GetType().ToString())); //POC: what native id?, path may not be unique diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/INonNativeFeaturesUtils.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/INonNativeFeaturesUtils.cs index 6ab9c32603..1f4295b457 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/INonNativeFeaturesUtils.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/INonNativeFeaturesUtils.cs @@ -1,8 +1,10 @@ +using Speckle.Core.Models.GraphTraversal; + namespace Speckle.Converters.ArcGIS3.Utils; public interface INonNativeFeaturesUtils { public List<(string parentPath, string converted)> WriteGeometriesToDatasets( - Dictionary convertedObjs + Dictionary convertedObjs ); } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/NonNativeFeaturesUtils.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/NonNativeFeaturesUtils.cs index cdb5226076..621ad260ca 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/NonNativeFeaturesUtils.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/NonNativeFeaturesUtils.cs @@ -5,6 +5,7 @@ using Speckle.Converters.Common; using FieldDescription = ArcGIS.Core.Data.DDL.FieldDescription; using Speckle.Core.Logging; +using Speckle.Core.Models.GraphTraversal; namespace Speckle.Converters.ArcGIS3.Utils; @@ -23,24 +24,25 @@ public NonNativeFeaturesUtils( } public List<(string parentPath, string converted)> WriteGeometriesToDatasets( - Dictionary convertedObjs + Dictionary convertedObjs ) { - List<(string, string)> result = new(); + List<(string parentPath, string converted)> result = new(); // 1. Sort features into groups by path and geom type Dictionary geometries, string? parentId)> geometryGroups = new(); foreach (var item in convertedObjs) { try { - string objId = item.Key; - (string parentPath, ACG.Geometry geom, string? parentId) = item.Value; + TraversalContext context = item.Key; + (string parentPath, ACG.Geometry geom) = item.Value; + string? parentId = context.Parent?.Current.id; // add dictionnary item if doesn't exist yet // Key must be unique per parent and speckle_type // Key is composed of parentId and parentPath (that contains speckle_type) string uniqueKey = $"{parentId}_{parentPath}"; - if (!geometryGroups.TryGetValue(uniqueKey, out (List geometries, string? parentId) value)) + if (!geometryGroups.TryGetValue(uniqueKey, out _)) { geometryGroups[uniqueKey] = (new List(), parentId); } @@ -57,26 +59,18 @@ public NonNativeFeaturesUtils( // 2. for each group create a Dataset and add geometries there as Features foreach (var item in geometryGroups) { + string uniqueKey = item.Key; // parentId_parentPath + string parentPath = uniqueKey.Split('_', 2)[^1]; + string speckle_type = parentPath.Split('\\')[^1]; + (List geomList, string? parentId) = item.Value; try { - string uniqueKey = item.Key; // parentId_parentPath - string parentPath = uniqueKey.Split('_', 2)[^1]; - string speckle_type = parentPath.Split("\\")[^1]; - (List geomList, string? parentId) = item.Value; - try - { - string converted = CreateDatasetInDatabase(speckle_type, geomList, parentId); - result.Add((parentPath, converted)); - } - catch (GeodatabaseGeometryException) - { - // do nothing if conversion of some geometry groups fails - } + string converted = CreateDatasetInDatabase(speckle_type, geomList, parentId); + result.Add((parentPath, converted)); } - catch (Exception e) when (!e.IsFatal()) + catch (GeodatabaseGeometryException) { - // POC: report, etc. - Debug.WriteLine("conversion error happened."); + // do nothing if writing of some geometry groups fails } } return result; From a3e1415337f7f73ae59c4242f1d3e003ed067da9 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:19:08 +0100 Subject: [PATCH 2/8] Changed filed type casting to use ConvertTo --- .../Utils/GISAttributeFieldType.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GISAttributeFieldType.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GISAttributeFieldType.cs index 64cb937987..332a6d077a 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GISAttributeFieldType.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GISAttributeFieldType.cs @@ -97,11 +97,11 @@ public static FieldType FieldTypeToNative(object fieldType) return fieldType switch { FieldType.String => (string)value, - FieldType.Single => (float)(double)value, - FieldType.Integer => (int)(long)value, // need this step because sent "ints" seem to be received as "longs" - FieldType.BigInteger => (long)value, - FieldType.SmallInteger => (short)(long)value, - FieldType.Double => (double)value, + FieldType.Single => Convert.ToSingle(value), + FieldType.Integer => Convert.ToInt32(value), // need this step because sent "ints" seem to be received as "longs" + FieldType.BigInteger => Convert.ToInt64(value), + FieldType.SmallInteger => Convert.ToInt16(value), + FieldType.Double => Convert.ToDouble(value), FieldType.Date => DateTime.Parse((string)value, null), FieldType.DateOnly => DateOnly.Parse((string)value), FieldType.TimeOnly => TimeOnly.Parse((string)value), From 930b4fba4bd41cc27e9bb2d2fdca58000a690d9b Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:26:21 +0100 Subject: [PATCH 3/8] Simplified GetAcendents --- .../TraversalContextExtensions.cs | 39 +++++++++---------- .../TraversalContextExtensionsTests.cs | 10 +++++ .../Operations/Receive/HostObjectBuilder.cs | 4 +- Directory.Build.props | 1 + 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs index d1210c1a35..5f99072301 100644 --- a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs +++ b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs @@ -1,5 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; +using System.Diagnostics.Contracts; using System.Linq; namespace Speckle.Core.Models.GraphTraversal; @@ -12,6 +12,7 @@ public static class TraversalContextExtensions /// /// /// + [Pure] public static IEnumerable GetPropertyPath(this TraversalContext context) { TraversalContext? head = context; @@ -28,33 +29,31 @@ public static IEnumerable GetPropertyPath(this TraversalContext context) } /// - /// Walks up the tree, returning all typed ascendant, starting the closest , - /// walking up nodes + /// Walks up the tree, returning all ascendant, including /// /// - /// - public static IEnumerable GetAscendantOfType(this TraversalContext context) - where T : Base + /// and all its ascendants + [Pure] + public static IEnumerable GetAscendants(this TraversalContext context) { - return GetAscendantWhere(context, tc => tc is T).Cast(); + TraversalContext? head = context; + do + { + yield return head.Current; + head = head.Parent; + } while (head != null); } /// - /// Walks up the tree, returning all typed ascendant, starting the closest , + /// Walks up the tree, returning all typed ascendant, starting the closest , /// walking up nodes /// /// - /// - public static IEnumerable GetAscendantWhere(this TraversalContext context, Func predicate) + /// and all its ascendants + [Pure] + public static IEnumerable GetAscendantOfType(this TraversalContext context) + where T : Base { - TraversalContext? head = context; - do - { - if (predicate.Invoke(head.Current)) - { - yield return head.Current; - } - head = head.Parent; - } while (head != null); + return context.GetAscendants().OfType(); } } diff --git a/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/TraversalContextExtensionsTests.cs b/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/TraversalContextExtensionsTests.cs index 9686e289bb..e8a38cf800 100644 --- a/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/TraversalContextExtensionsTests.cs +++ b/Core/Tests/Speckle.Core.Tests.Unit/Models/GraphTraversal/TraversalContextExtensionsTests.cs @@ -28,6 +28,16 @@ public void GetPropertyPath_ReturnsSequentialPath(int depth) Assert.That(path, Is.EquivalentTo(expected)); } + [TestCaseSource(nameof(TestDepths))] + public void GetAscendant(int depth) + { + var testData = CreateLinkedList(depth, i => new()); + + var all = TraversalContextExtensions.GetAscendants(testData).ToArray(); + + Assert.That(all, Has.Length.EqualTo(depth)); + } + [TestCaseSource(nameof(TestDepths))] public void GetAscendantOfType_AllBase(int depth) { 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 d5106a8184..200f17b1f6 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 @@ -1,3 +1,4 @@ +using System.Diagnostics.Contracts; using ArcGIS.Desktop.Mapping; using Speckle.Connectors.Utils.Builders; using Speckle.Converters.Common; @@ -79,10 +80,11 @@ private string[] GetLayerPath(TraversalContext context) private bool HasGISParent(TraversalContext context) { - List gisLayers = context.GetAscendantWhere(IsGISType).Where(obj => obj != context.Current).ToList(); + List gisLayers = context.GetAscendants().Where(IsGISType).Where(obj => obj != context.Current).ToList(); return gisLayers.Count > 0; } + [Pure] private static bool IsGISType(Base obj) { return obj is RasterLayer or VectorLayer; diff --git a/Directory.Build.props b/Directory.Build.props index a092bcd468..1757090c88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,6 +37,7 @@ CA1303;CA1304;CA1305;CA1307;CA1308;CA1309;CA1310;CA1311;CA2101; + CS9057; CA1815;CA1852;CA1812;CA1003;CA2109;CA1848;$(NoWarn) From bf25fb6c88ca98e742b6aef280adf760aa2e0369 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:28:33 +0100 Subject: [PATCH 4/8] xml comment --- Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs index 5f99072301..dab65ed446 100644 --- a/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs +++ b/Core/Core/Models/GraphTraversal/TraversalContextExtensions.cs @@ -49,7 +49,7 @@ public static IEnumerable GetAscendants(this TraversalContext context) /// walking up nodes /// /// - /// and all its ascendants + /// and all its ascendants of type [Pure] public static IEnumerable GetAscendantOfType(this TraversalContext context) where T : Base From 642a52445f65c285043ee9da5570feb688c01d06 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:43:51 +0100 Subject: [PATCH 5/8] Shuffled some functions around --- .../Operations/Receive/HostObjectBuilder.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 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 200f17b1f6..0c5ae1a7cd 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 @@ -70,26 +70,6 @@ private string AddDatasetsToMap((string nestedLayerName, string datasetId) datab } } - private string[] GetLayerPath(TraversalContext context) - { - string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); - string[] reverseOrderPath = - collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); - return reverseOrderPath.Reverse().ToArray(); - } - - private bool HasGISParent(TraversalContext context) - { - List gisLayers = context.GetAscendants().Where(IsGISType).Where(obj => obj != context.Current).ToList(); - return gisLayers.Count > 0; - } - - [Pure] - private static bool IsGISType(Base obj) - { - return obj is RasterLayer or VectorLayer; - } - public HostObjectBuilderResult Build( Base rootObject, string projectName, @@ -169,4 +149,24 @@ CancellationToken cancellationToken // TODO: validated a correct set regarding bakedobject ids return new(bakedObjectIds, results); } + + private static string[] GetLayerPath(TraversalContext context) + { + string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); + string[] reverseOrderPath = + collectionBasedPath.Length != 0 ? collectionBasedPath : context.GetPropertyPath().ToArray(); + return reverseOrderPath.Reverse().ToArray(); + } + + private static bool HasGISParent(TraversalContext context) + { + List gisLayers = context.GetAscendants().Where(IsGISType).Where(obj => obj != context.Current).ToList(); + return gisLayers.Count > 0; + } + + [Pure] + private static bool IsGISType(Base obj) + { + return obj is RasterLayer or VectorLayer; + } } From e236796260cf0ec97048a6bcf42e1d612e46ea23 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:44:52 +0100 Subject: [PATCH 6/8] More tweaks --- .../Operations/Receive/HostObjectBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) 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 0c5ae1a7cd..2b770782ef 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 @@ -150,6 +150,7 @@ CancellationToken cancellationToken return new(bakedObjectIds, results); } + [Pure] private static string[] GetLayerPath(TraversalContext context) { string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); @@ -158,6 +159,7 @@ private static string[] GetLayerPath(TraversalContext context) return reverseOrderPath.Reverse().ToArray(); } + [Pure] private static bool HasGISParent(TraversalContext context) { List gisLayers = context.GetAscendants().Where(IsGISType).Where(obj => obj != context.Current).ToList(); From 92b93280e71e6e50cf094ed8917d24df5c3b9f63 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:46:04 +0100 Subject: [PATCH 7/8] More changes --- .../Operations/Receive/RhinoHostObjectBuilder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs index 26215d4464..02f653f08a 100644 --- a/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7/Operations/Receive/RhinoHostObjectBuilder.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.Contracts; using Rhino; using Rhino.DocObjects; using Rhino.Geometry; @@ -175,7 +176,8 @@ private int GetAndCreateLayerFromPath(string[] path, string baseLayerName, Dicti return previousLayer.Index; } - private string[] GetLayerPath(TraversalContext context) + [Pure] + private static string[] GetLayerPath(TraversalContext context) { string[] collectionBasedPath = context.GetAscendantOfType().Select(c => c.name).ToArray(); string[] reverseOrderPath = From 544dad6677232d2a8f36362b3116cd2288a4db55 Mon Sep 17 00:00:00 2001 From: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com> Date: Thu, 6 Jun 2024 14:59:43 +0100 Subject: [PATCH 8/8] dumbdumb net versioning --- Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 1757090c88..a092bcd468 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,6 @@ CA1303;CA1304;CA1305;CA1307;CA1308;CA1309;CA1310;CA1311;CA2101; - CS9057; CA1815;CA1852;CA1812;CA1003;CA2109;CA1848;$(NoWarn)