diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PointFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PointFeatureToSpeckleConverter.cs deleted file mode 100644 index 7b53a664de..0000000000 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PointFeatureToSpeckleConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; -using Speckle.Converters.Common; - -namespace Speckle.Converters.ArcGIS3.Features; - -[NameAndRankValue(nameof(ACG.MapPoint), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class PointFeatureToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter -{ - private readonly IConversionContextStack _contextStack; - - public PointFeatureToSpeckleConverter(IConversionContextStack contextStack) - { - _contextStack = contextStack; - } - - public Base Convert(object target) => Convert((ACG.MapPoint)target); - - public Base Convert(ACG.MapPoint target) - { - if ( - ACG.GeometryEngine.Instance.Project(target, _contextStack.Current.Document.Map.SpatialReference) - is not ACG.MapPoint reprojectedPt - ) - { - throw new SpeckleConversionException( - $"Conversion to Spatial Reference {_contextStack.Current.Document.Map.SpatialReference} failed" - ); - } - List geometry = - new() { new SOG.Point(reprojectedPt.X, reprojectedPt.Y, reprojectedPt.Z, _contextStack.Current.SpeckleUnits) }; - - return geometry[0]; - } -} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/ArcToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/ArcToHostConverter.cs deleted file mode 100644 index ec46307cfc..0000000000 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/ArcToHostConverter.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Speckle.Converters.Common; -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; - -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; - -//TODO: Ellipses don't convert correctly, see Autocad test stream -//[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class CurveToHostConverter : IToHostTopLevelConverter, ITypedConverter -{ - private readonly ITypedConverter _pointConverter; - - public CurveToHostConverter(ITypedConverter pointConverter) - { - _pointConverter = pointConverter; - } - - public object Convert(Base target) => Convert((SOG.Arc)target); - - public ACG.Polyline Convert(SOG.Arc target) - { - // Determine the number of vertices to create along the arc - int numVertices = Math.Max((int)target.length, 50); // Determine based on desired segment length or other criteria - List pointsOriginal = new(); - - // get correct direction - double? angleStart = target.startAngle; - double? fullAngle = target.endAngle - target.startAngle; - double? radius = target.radius; - - if (angleStart == null || fullAngle == null || radius == null) - { - throw new SpeckleConversionException("Conversion failed: Arc doesn't have start & end angle or radius"); - } - - // Calculate the vertices along the arc - for (int i = 0; i <= numVertices; i++) - { - // Calculate the point along the arc - double angle = (double)angleStart + (double)fullAngle * (i / (double)numVertices); - SOG.Point pointOnArc = - new( - target.plane.origin.x + (double)radius * Math.Cos(angle), - target.plane.origin.y + (double)radius * Math.Sin(angle), - target.plane.origin.z - ); - - pointsOriginal.Add(pointOnArc); - } - - var points = pointsOriginal.Select(x => _pointConverter.Convert(x)); - return new ACG.PolylineBuilderEx(points, ACG.AttributeFlags.HasZ).ToGeometry(); - } -} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/EllipseToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/EllipseToHostConverter.cs deleted file mode 100644 index 94ee04b951..0000000000 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/EllipseToHostConverter.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Speckle.Converters.Common; -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; - -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; - -//TODO: Ellipses don't convert correctly, see Autocad test stream -// [NameAndRankValue(nameof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class EllipseToHostConverter : IToHostTopLevelConverter, ITypedConverter -{ - private readonly ITypedConverter _pointConverter; - - public EllipseToHostConverter(ITypedConverter pointConverter) - { - _pointConverter = pointConverter; - } - - public object Convert(Base target) => Convert((SOG.Ellipse)target); - - public ACG.Polyline Convert(SOG.Ellipse target) - { - // Determine the number of vertices to create along the Ellipse - int numVertices = Math.Max((int)target.length, 100); // Determine based on desired segment length or other criteria - List pointsOriginal = new(); - - if (target.firstRadius == null || target.secondRadius == null) - { - throw new SpeckleConversionException("Conversion failed: Ellipse doesn't have 1st and 2nd radius"); - } - - // Calculate the vertices along the arc - for (int i = 0; i <= numVertices; i++) - { - // Calculate the point along the arc - double angle = 2 * Math.PI * (i / (double)numVertices); - SOG.Point pointOnEllipse = - new( - target.plane.origin.x + (double)target.secondRadius * Math.Cos(angle), - target.plane.origin.y + (double)target.firstRadius * Math.Sin(angle), - target.plane.origin.z - ); - - pointsOriginal.Add(pointOnEllipse); - } - if (pointsOriginal[0] != pointsOriginal[^1]) - { - pointsOriginal.Add(pointsOriginal[0]); - } - - var points = pointsOriginal.Select(x => _pointConverter.Convert(x)); - return new ACG.PolylineBuilderEx(points, ACG.AttributeFlags.HasZ).ToGeometry(); - } -} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolycurveToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolycurveToHostConverter.cs deleted file mode 100644 index 35adddb385..0000000000 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolycurveToHostConverter.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Speckle.Converters.Common; -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; - -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; - -[NameAndRankValue(nameof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] -public class PolycurveToHostConverter : IToHostTopLevelConverter, ITypedConverter -{ - private readonly ITypedConverter _pointConverter; - private readonly IRootToHostConverter _converter; - - public PolycurveToHostConverter( - ITypedConverter pointConverter, - IRootToHostConverter converter - ) - { - _pointConverter = pointConverter; - _converter = converter; - } - - public object Convert(Base target) => Convert((SOG.Polycurve)target); - - public ACG.Polyline Convert(SOG.Polycurve target) - { - List points = new(); - foreach (var segment in target.segments) - { - if (segment is SOG.Arc) - { - throw new NotImplementedException("Polycurves with arc segments are not supported"); - } - ACG.Polyline converted = (ACG.Polyline)_converter.Convert((Base)segment); - List newPts = converted.Points.ToList(); - - // reverse new segment if needed - if (points.Count > 0 && newPts.Count > 0 && points[^1] != newPts[0] && points[^1] == newPts[^1]) - { - newPts.Reverse(); - } - points.AddRange(newPts); - } - - return new ACG.PolylineBuilderEx(points, ACG.AttributeFlags.HasZ).ToGeometry(); - } -} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/SegmentCollectionToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/SegmentCollectionToSpeckleConverter.cs deleted file mode 100644 index 2d3c93fce8..0000000000 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/SegmentCollectionToSpeckleConverter.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Speckle.Converters.Common; -using Speckle.Converters.Common.Objects; - -namespace Speckle.Converters.ArcGIS3.Geometry; - -public class SegmentCollectionToSpeckleConverter : ITypedConverter -{ - private readonly IConversionContextStack _contextStack; - private readonly ITypedConverter _pointConverter; - - public SegmentCollectionToSpeckleConverter( - IConversionContextStack contextStack, - ITypedConverter pointConverter - ) - { - _contextStack = contextStack; - _pointConverter = pointConverter; - } - - public SOG.Polyline Convert(ACG.ReadOnlySegmentCollection target) - { - // https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic8480.html - double len = 0; - - List points = new(); - foreach (var segment in target) - { - len += segment.Length; - - // specific conversion per segment type - switch (segment.SegmentType) - { - case ACG.SegmentType.Line: - points = AddPtsToPolylinePts( - points, - new List() - { - _pointConverter.Convert(segment.StartPoint), - _pointConverter.Convert(segment.EndPoint) - } - ); - break; - default: - throw new SpeckleConversionException($"Segment of type '{segment.SegmentType}' cannot be converted"); - } - } - SOG.Polyline polyline = - new(points.SelectMany(pt => new[] { pt.x, pt.y, pt.z }).ToList(), _contextStack.Current.SpeckleUnits) { }; - - return polyline; - } - - private List AddPtsToPolylinePts(List points, List newSegmentPts) - { - if (points.Count == 0 || points[^1] != newSegmentPts[0]) - { - points.AddRange(newSegmentPts); - } - else - { - points.AddRange(newSegmentPts.GetRange(1, newSegmentPts.Count - 1)); - } - return points; - } -} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/CurveToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/CurveToHostConverter.cs new file mode 100644 index 0000000000..57bd7b3c83 --- /dev/null +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/CurveToHostConverter.cs @@ -0,0 +1,52 @@ +using Objects; +using Speckle.Converters.Common.Objects; + +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; + +public class CurveToHostConverter : ITypedConverter +{ + private readonly ITypedConverter _lineConverter; + private readonly ITypedConverter _arcConverter; + private readonly ITypedConverter _ellipseConverter; + private readonly ITypedConverter _circleConverter; + private readonly ITypedConverter _polylineConverter; + private readonly ITypedConverter _polyCurveConverter; + + public CurveToHostConverter( + ITypedConverter lineConverter, + ITypedConverter arcConverter, + ITypedConverter ellipseConverter, + ITypedConverter circleConverter, + ITypedConverter polylineConverter, + ITypedConverter polyCurveConverter + ) + { + _lineConverter = lineConverter; + _arcConverter = arcConverter; + _ellipseConverter = ellipseConverter; + _circleConverter = circleConverter; + _polylineConverter = polylineConverter; + _polyCurveConverter = polyCurveConverter; + } + + /// + /// Converts a given ICurve object to an ACG.Polyline object. + /// + /// The ICurve object to convert. + /// The converted RG.Curve object. + /// Thrown when the conversion is not supported for the given type of curve. + /// ⚠️ This conversion does NOT perform scaling. + public ACG.Polyline Convert(ICurve target) => + target switch + { + SOG.Line line => _lineConverter.Convert(line), + SOG.Arc arc => _arcConverter.Convert(arc), + SOG.Circle circle => _circleConverter.Convert(circle), + SOG.Ellipse ellipse => _ellipseConverter.Convert(ellipse), + SOG.Spiral spiral => _polylineConverter.Convert(spiral.displayValue), + SOG.Polyline polyline => _polylineConverter.Convert(polyline), + SOG.Curve curve => _polylineConverter.Convert(curve.displayValue), + SOG.Polycurve polyCurve => _polyCurveConverter.Convert(polyCurve), + _ => throw new NotSupportedException($"Unable to convert curves of type {target.GetType().Name}") + }; +} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/FeatureClassToHostConverter.cs similarity index 99% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/FeatureClassToHostConverter.cs index 0a084ffee8..d491ca2a1e 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/FeatureClassToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/FeatureClassToHostConverter.cs @@ -8,7 +8,7 @@ using Speckle.Core.Models; using FieldDescription = ArcGIS.Core.Data.DDL.FieldDescription; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class FeatureClassToHostConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/GeometryToHostConverter.cs similarity index 98% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/GeometryToHostConverter.cs index 2ee8dc31d2..9ec0f3d279 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/GeometryToHostConverter.cs @@ -2,7 +2,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class GeometryToHostConverter : ITypedConverter, ACG.Geometry> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MeshListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MeshListToHostConverter.cs similarity index 72% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MeshListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MeshListToHostConverter.cs index 7730f54308..941f6ac70f 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MeshListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MeshListToHostConverter.cs @@ -2,15 +2,20 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class MeshListToHostConverter : ITypedConverter, ACG.Multipatch> { private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; - public MeshListToHostConverter(ITypedConverter pointConverter) + public MeshListToHostConverter( + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) { _pointConverter = pointConverter; + _contextStack = contextStack; } public ACG.Multipatch Convert(List target) @@ -19,7 +24,7 @@ public ACG.Multipatch Convert(List target) { throw new SpeckleConversionException("Feature contains no geometries"); } - ACG.MultipatchBuilderEx multipatchPart = new(); + ACG.MultipatchBuilderEx multipatchPart = new(_contextStack.Current.Document.Map.SpatialReference); foreach (SOG.Mesh part in target) { part.TriangulateMesh(); diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MultipatchListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MultipatchListToHostConverter.cs similarity index 93% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MultipatchListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MultipatchListToHostConverter.cs index e2a4d6028e..44c961e9bc 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/MultipatchListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/MultipatchListToHostConverter.cs @@ -1,7 +1,7 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class MultipatchListToHostConverter : ITypedConverter, ACG.Multipatch> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PointListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointListToHostConverter.cs similarity index 91% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PointListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointListToHostConverter.cs index ac1d3e5467..e1204f36c5 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PointListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointListToHostConverter.cs @@ -1,7 +1,7 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class PointListToHostConverter : ITypedConverter, ACG.Multipoint> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointSingleToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointSingleToHostConverter.cs similarity index 84% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointSingleToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointSingleToHostConverter.cs index e30ec589e5..75bb57b476 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointSingleToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointSingleToHostConverter.cs @@ -3,7 +3,7 @@ using Speckle.Core.Kits; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class PointToHostConverter : ITypedConverter { @@ -22,7 +22,8 @@ public ACG.MapPoint Convert(SOG.Point target) return new ACG.MapPointBuilderEx( target.x * scaleFactor, target.y * scaleFactor, - target.z * scaleFactor + target.z * scaleFactor, + _contextStack.Current.Document.Map.SpatialReference ).ToGeometry(); } } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointcloudLayerToHostConverter.cs similarity index 90% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointcloudLayerToHostConverter.cs index 2011596618..fa04b92fa0 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PointcloudLayerToHostConverter.cs @@ -3,7 +3,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class PointcloudLayerToHostConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/Polygon3dListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/Polygon3dListToHostConverter.cs similarity index 95% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/Polygon3dListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/Polygon3dListToHostConverter.cs index 72f6951056..5d68c5be91 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/Polygon3dListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/Polygon3dListToHostConverter.cs @@ -1,7 +1,7 @@ -using Speckle.Converters.Common.Objects; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class Polygon3dListToHostConverter : ITypedConverter, ACG.Multipatch> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolygonListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolygonListToHostConverter.cs similarity index 94% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolygonListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolygonListToHostConverter.cs index b6aa76cb1c..6acc30b826 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolygonListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolygonListToHostConverter.cs @@ -1,7 +1,7 @@ -using Speckle.Converters.Common.Objects; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class PolygonListToHostConverter : ITypedConverter, ACG.Polygon> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolylineListToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolylineListToHostConverter.cs similarity index 92% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolylineListToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolylineListToHostConverter.cs index 97983c42bf..d512a23d94 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GisFeatureGeometriesToHost/PolylineListToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/PolylineListToHostConverter.cs @@ -1,7 +1,7 @@ -using Speckle.Converters.Common.Objects; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry.GisFeatureGeometriesToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class PolylineListToHostConverter : ITypedConverter, ACG.Polyline> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/TableToHostConverter.cs similarity index 98% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/TableToHostConverter.cs index 374f09c23d..8af12954d6 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/Raw/TableToHostConverter.cs @@ -1,13 +1,13 @@ +using ArcGIS.Core.Data; using ArcGIS.Core.Data.DDL; using ArcGIS.Core.Data.Exceptions; -using ArcGIS.Core.Data; using Objects.GIS; using Speckle.Converters.ArcGIS3.Utils; +using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; using FieldDescription = ArcGIS.Core.Data.DDL.FieldDescription; -using Speckle.Converters.Common; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToHost.Raw; public class TableLayerToHostConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs new file mode 100644 index 0000000000..f334713612 --- /dev/null +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs @@ -0,0 +1,47 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; + +[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class ArcToHostConverter : IToHostTopLevelConverter, ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; + + public ArcToHostConverter( + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _contextStack = contextStack; + } + + public object Convert(Base target) => Convert((SOG.Arc)target); + + public ACG.Polyline Convert(SOG.Arc target) + { + if (target.startPoint.z != target.midPoint.z || target.startPoint.z != target.endPoint.z) + { + throw new ArgumentException("Only Arc in XY plane are supported"); + } + ACG.MapPoint fromPt = _pointConverter.Convert(target.startPoint); + ACG.MapPoint toPt = _pointConverter.Convert(target.endPoint); + ACG.MapPoint midPt = _pointConverter.Convert(target.midPoint); + + ACG.EllipticArcSegment segment = ACG.EllipticArcBuilderEx.CreateCircularArc( + fromPt, + toPt, + new ACG.Coordinate2D(midPt), + _contextStack.Current.Document.Map.SpatialReference + ); + + return new ACG.PolylineBuilderEx( + segment, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); + } +} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/CircleToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs similarity index 72% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/CircleToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs index d4ffe06c35..089ac64b1b 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/CircleToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs @@ -3,7 +3,7 @@ using Speckle.Core.Kits; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CircleToHostConverter : IToHostTopLevelConverter, ITypedConverter @@ -28,6 +28,12 @@ public ACG.Polyline Convert(SOG.Circle target) { throw new SpeckleConversionException("Conversion failed: Circle doesn't have a radius"); } + if ( + target.plane.normal.x != 0 || target.plane.normal.y != 0 || target.plane.xdir.z != 0 || target.plane.ydir.z != 0 + ) + { + throw new ArgumentException("Only Circles in XY plane are supported"); + } // create a native ArcGIS circle segment ACG.MapPoint centerPt = _pointConverter.Convert(target.plane.origin); @@ -36,11 +42,14 @@ public ACG.Polyline Convert(SOG.Circle target) ACG.EllipticArcSegment circleSegment = ACG.EllipticArcBuilderEx.CreateCircle( new ACG.Coordinate2D(centerPt.X, centerPt.Y), (double)target.radius * scaleFactor, - ACG.ArcOrientation.ArcClockwise + ACG.ArcOrientation.ArcClockwise, + _contextStack.Current.Document.Map.SpatialReference ); - var circlePolyline = new ACG.PolylineBuilderEx(circleSegment, ACG.AttributeFlags.HasZ).ToGeometry(); - - return circlePolyline; + return new ACG.PolylineBuilderEx( + circleSegment, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); } } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs new file mode 100644 index 0000000000..d839109fb2 --- /dev/null +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs @@ -0,0 +1,70 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Kits; +using Speckle.Core.Models; + +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; + +[NameAndRankValue(nameof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class EllipseToHostConverter : IToHostTopLevelConverter, ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; + + public EllipseToHostConverter( + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _contextStack = contextStack; + } + + public object Convert(Base target) => Convert((SOG.Ellipse)target); + + public ACG.Polyline Convert(SOG.Ellipse target) + { + // dummy check + if (target.firstRadius == null || target.secondRadius == null) + { + throw new ArgumentException("Ellipse is missing the first or second radius"); + } + if ( + target.plane.normal.x != 0 || target.plane.normal.y != 0 || target.plane.xdir.z != 0 || target.plane.ydir.z != 0 + ) + { + throw new ArgumentException("Only Ellipses in XY plane are supported"); + } + + ACG.MapPoint centerPt = _pointConverter.Convert(target.plane.origin); + double scaleFactor = Units.GetConversionFactor(target.units, _contextStack.Current.SpeckleUnits); + + // set default values + double angle = Math.Atan2(target.plane.xdir.y, target.plane.xdir.x); + double majorAxisRadius = (double)target.firstRadius; + double minorAxisRatio = (double)target.secondRadius / majorAxisRadius; + + // adjust if needed + if (minorAxisRatio > 1) + { + majorAxisRadius = (double)target.secondRadius; + minorAxisRatio = 1 / minorAxisRatio; + angle += Math.PI / 2; + } + + ACG.EllipticArcSegment segment = ACG.EllipticArcBuilderEx.CreateEllipse( + new ACG.Coordinate2D(centerPt), + angle, + majorAxisRadius * scaleFactor, + minorAxisRatio, + ACG.ArcOrientation.ArcCounterClockwise, + _contextStack.Current.Document.Map.SpatialReference + ); + + return new ACG.PolylineBuilderEx( + segment, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); + } +} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/FallbackToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs similarity index 96% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/FallbackToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs index ec9f1eef77..0f777c297c 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/FallbackToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs @@ -2,7 +2,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(DisplayableObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class FallbackToHostConverter : IToHostTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/LineToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs similarity index 58% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/LineToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs index 60a1447d7b..ab562f2395 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/LineToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs @@ -2,16 +2,21 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class LineSingleToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; - public LineSingleToHostConverter(ITypedConverter pointConverter) + public LineSingleToHostConverter( + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) { _pointConverter = pointConverter; + _contextStack = contextStack; } public object Convert(Base target) => Convert((SOG.Line)target); @@ -20,6 +25,10 @@ public ACG.Polyline Convert(SOG.Line target) { List originalPoints = new() { target.start, target.end }; IEnumerable points = originalPoints.Select(x => _pointConverter.Convert(x)); - return new ACG.PolylineBuilderEx(points, ACG.AttributeFlags.HasZ).ToGeometry(); + return new ACG.PolylineBuilderEx( + points, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); } } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/MeshToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs similarity index 91% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/MeshToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs index 8de4c957e4..d9f60803f5 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/MeshToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs @@ -2,7 +2,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshToHostConverter : IToHostTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PointToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs similarity index 89% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PointToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs index abf671574a..4fe87d57ac 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PointToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs @@ -2,7 +2,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointToHostConverter : IToHostTopLevelConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs new file mode 100644 index 0000000000..ba57e347f6 --- /dev/null +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs @@ -0,0 +1,60 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; + +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; + +[NameAndRankValue(nameof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class PolycurveToHostConverter : IToHostTopLevelConverter, ITypedConverter +{ + private readonly ITypedConverter _pointConverter; + private readonly IRootToHostConverter _converter; + private readonly IConversionContextStack _contextStack; + + public PolycurveToHostConverter( + ITypedConverter pointConverter, + IRootToHostConverter converter, + IConversionContextStack contextStack + ) + { + _pointConverter = pointConverter; + _converter = converter; + _contextStack = contextStack; + } + + public object Convert(Base target) => Convert((SOG.Polycurve)target); + + public ACG.Polyline Convert(SOG.Polycurve target) + { + ACG.MapPoint? lastConvertedPt = null; + List segments = new(); + + foreach (var segment in target.segments) + { + ACG.Polyline converted = (ACG.Polyline)_converter.Convert((Base)segment); //CurveConverter.NotNull().Convert(segment); + List segmentPts = converted.Points.ToList(); + + if ( + lastConvertedPt != null + && segmentPts.Count > 0 + && ( + Math.Round(lastConvertedPt.X, 6) != Math.Round(segmentPts[0].X, 6) + || Math.Round(lastConvertedPt.Y, 6) != Math.Round(segmentPts[0].Y, 6) + || Math.Round(lastConvertedPt.Z, 6) != Math.Round(segmentPts[0].Z, 6) + ) + ) + { + throw new SpeckleConversionException("Polycurve segments are not in a correct sequence/orientation"); + } + + lastConvertedPt = segmentPts[^1]; + segments.Add(converted); + } + + return new ACG.PolylineBuilderEx( + segments, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); + } +} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolylineToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs similarity index 61% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolylineToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs index 6615607b98..d32e32d022 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/ISpeckleObjectToHost/PolylineToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs @@ -2,16 +2,21 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Geometry.ISpeckleObjectToHost; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolylineToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; + private readonly IConversionContextStack _contextStack; - public PolylineToHostConverter(ITypedConverter pointConverter) + public PolylineToHostConverter( + ITypedConverter pointConverter, + IConversionContextStack contextStack + ) { _pointConverter = pointConverter; + _contextStack = contextStack; } public object Convert(Base target) => Convert((SOG.Polyline)target); @@ -24,6 +29,10 @@ public ACG.Polyline Convert(SOG.Polyline target) { points.Add(points[0]); } - return new ACG.PolylineBuilderEx(points, ACG.AttributeFlags.HasZ).ToGeometry(); + return new ACG.PolylineBuilderEx( + points, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); } } diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/RasterLayerToHostConverter.cs similarity index 90% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/RasterLayerToHostConverter.cs index f97cbc5dd8..6ffb334009 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/RasterLayerToHostConverter.cs @@ -3,7 +3,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(RasterLayer), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class RasterLayerToHostConverter : IToHostTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToHostConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/VectorLayerToHostConverter.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToHostConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/VectorLayerToHostConverter.cs index d4438f7339..5c7dd8c9eb 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToHostConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/VectorLayerToHostConverter.cs @@ -6,7 +6,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; [NameAndRankValue(nameof(VectorLayer), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class VectorLayerToHostConverter : IToHostTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/EnvelopBoxToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/EnvelopBoxToSpeckleConverter.cs similarity index 96% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/EnvelopBoxToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/EnvelopBoxToSpeckleConverter.cs index 15dad97faf..0296c5d328 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/EnvelopBoxToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/EnvelopBoxToSpeckleConverter.cs @@ -1,9 +1,9 @@ using ArcGIS.Core.Geometry; -using Speckle.Converters.Common.Objects; -using Speckle.Converters.Common; using Objects.Primitive; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class EnvelopToSpeckleConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToSpeckleBase.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GeometryToSpeckleBase.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToSpeckleBase.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GeometryToSpeckleBase.cs index db4c5cab66..951432f74c 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GeometryToSpeckleBase.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GeometryToSpeckleBase.cs @@ -2,7 +2,7 @@ using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class GeometryToSpeckleBaseList : ITypedConverter> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisFeatureToSpeckleConverter.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisFeatureToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisFeatureToSpeckleConverter.cs index a3c9d41e40..aa82bf5a2c 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisFeatureToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisFeatureToSpeckleConverter.cs @@ -1,11 +1,10 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; using ArcGIS.Core.Data; -using Speckle.Converters.ArcGIS3.Geometry; -using Speckle.Converters.Common; using Speckle.Converters.ArcGIS3.Utils; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class GisFeatureToSpeckleConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisRasterToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisRasterToSpeckleConverter.cs similarity index 99% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisRasterToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisRasterToSpeckleConverter.cs index af3e268b8b..7d67bfd67c 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/GisRasterToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/GisRasterToSpeckleConverter.cs @@ -1,10 +1,10 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; -using Objects.GIS; using ArcGIS.Core.Data.Raster; +using Objects.GIS; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class GisRasterToSpeckleConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipatchFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipatchFeatureToSpeckleConverter.cs similarity index 98% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipatchFeatureToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipatchFeatureToSpeckleConverter.cs index 2e15ae765b..7b60ee416f 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipatchFeatureToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipatchFeatureToSpeckleConverter.cs @@ -1,9 +1,9 @@ -using Speckle.Converters.Common.Objects; +using Speckle.Converters.ArcGIS3.Utils; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; using Speckle.Core.Models; -using Speckle.Converters.ArcGIS3.Geometry; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class MultipatchFeatureToSpeckleConverter : ITypedConverter> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipointFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipointFeatureToSpeckleConverter.cs similarity index 92% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipointFeatureToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipointFeatureToSpeckleConverter.cs index c7e1669038..c6d6299ffb 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/MultipointFeatureToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/MultipointFeatureToSpeckleConverter.cs @@ -1,6 +1,6 @@ using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class MultipointFeatureToSpeckleConverter : ITypedConverter> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PointToSpeckleConverter.cs similarity index 95% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PointToSpeckleConverter.cs index 9b0859318b..46ffb8f937 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/PointToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PointToSpeckleConverter.cs @@ -1,8 +1,8 @@ using ArcGIS.Core.Geometry; -using Speckle.Converters.Common.Objects; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Geometry; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class PointToSpeckleConverter : ITypedConverter { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolygonFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolygonFeatureToSpeckleConverter.cs similarity index 96% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolygonFeatureToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolygonFeatureToSpeckleConverter.cs index 3bbf377d3b..23034aa454 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolygonFeatureToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolygonFeatureToSpeckleConverter.cs @@ -1,8 +1,8 @@ -using Speckle.Converters.Common.Objects; using Objects.GIS; using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class PolygonFeatureToSpeckleConverter : ITypedConverter> { diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolylineFeatureToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolylineFeatureToSpeckleConverter.cs similarity index 91% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolylineFeatureToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolylineFeatureToSpeckleConverter.cs index 92bc6ff70e..a8cc1a99d3 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Features/PolylineFeatureToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/PolylineFeatureToSpeckleConverter.cs @@ -1,7 +1,7 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; -namespace Speckle.Converters.ArcGIS3.Features; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; public class PolyineFeatureToSpeckleConverter : ITypedConverter> { @@ -23,7 +23,7 @@ public PolyineFeatureToSpeckleConverter( List polylineList = new(); ACG.Polyline polylineToConvert = target; - // segmentize the polylines with curves using precision value of the Map's Spatial Reference + // densify the polylines with curves using precision value of the Map's Spatial Reference if (target.HasCurves is true) { double tolerance = _contextStack.Current.Document.Map.SpatialReference.XYTolerance; @@ -32,11 +32,11 @@ public PolyineFeatureToSpeckleConverter( target, tolerance * conversionFactorToMeter ); - polylineToConvert = (ACG.Polyline)densifiedPolyline; if (densifiedPolyline == null) { throw new ArgumentException("Polyline densification failed"); } + polylineToConvert = (ACG.Polyline)densifiedPolyline; } foreach (var segmentCollection in polylineToConvert.Parts) diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/SegmentCollectionToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/SegmentCollectionToSpeckleConverter.cs new file mode 100644 index 0000000000..f0b71ef47c --- /dev/null +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/SegmentCollectionToSpeckleConverter.cs @@ -0,0 +1,98 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; + +namespace Speckle.Converters.ArcGIS3.ToSpeckle.Raw; + +public class SegmentCollectionToSpeckleConverter : ITypedConverter +{ + private readonly IConversionContextStack _contextStack; + private readonly ITypedConverter _pointConverter; + + public SegmentCollectionToSpeckleConverter( + IConversionContextStack contextStack, + ITypedConverter pointConverter + ) + { + _contextStack = contextStack; + _pointConverter = pointConverter; + } + + public SOG.Polyline Convert(ACG.ReadOnlySegmentCollection target) + { + // https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic8480.html + double len = 0; + + List points = new(); + foreach (var segment in target) + { + len += segment.Length; + + if (segment.SegmentType != ACG.SegmentType.Line) + { + // densify the segments with curves using precision value of the Map's Spatial Reference + ACG.Polyline polylineFromSegment = new ACG.PolylineBuilderEx( + segment, + ACG.AttributeFlags.HasZ, + _contextStack.Current.Document.Map.SpatialReference + ).ToGeometry(); + + double tolerance = _contextStack.Current.Document.Map.SpatialReference.XYTolerance; + double conversionFactorToMeter = _contextStack.Current.Document.Map.SpatialReference.Unit.ConversionFactor; + var densifiedPolyline = ACG.GeometryEngine.Instance.DensifyByDeviation( + polylineFromSegment, + tolerance * conversionFactorToMeter + ); + if (densifiedPolyline == null) + { + throw new ArgumentException("Segment densification failed"); + } + + ACG.Polyline polylineToConvert = (ACG.Polyline)densifiedPolyline; + // add points from each segment of the densified original segment + ACG.ReadOnlyPartCollection subParts = polylineToConvert.Parts; + foreach (ACG.ReadOnlySegmentCollection subSegments in subParts) + { + foreach (ACG.Segment? subSegment in subSegments) + { + points = AddPtsToPolylinePts( + points, + new List() + { + _pointConverter.Convert(subSegment.StartPoint), + _pointConverter.Convert(subSegment.EndPoint) + } + ); + } + } + } + else + { + points = AddPtsToPolylinePts( + points, + new List() + { + _pointConverter.Convert(segment.StartPoint), + _pointConverter.Convert(segment.EndPoint) + } + ); + } + } + SOG.Polyline polyline = + new(points.SelectMany(pt => new[] { pt.x, pt.y, pt.z }).ToList(), _contextStack.Current.SpeckleUnits) { }; + + return polyline; + } + + private List AddPtsToPolylinePts(List points, List newSegmentPts) + { + if (points.Count == 0 || points[^1] != newSegmentPts[0]) + { + points.AddRange(newSegmentPts); + } + else + { + points.AddRange(newSegmentPts.GetRange(1, newSegmentPts.Count - 1)); + } + return points; + } +} diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/PointcloudLayerToSpeckleConverter.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/PointcloudLayerToSpeckleConverter.cs index 6c1590aaa3..2ad672dea9 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/PointcloudLayerToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/PointcloudLayerToSpeckleConverter.cs @@ -1,13 +1,12 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Converters.Common; -using ArcGIS.Desktop.Mapping; -using ArcGIS.Core.Data.Analyst3D; using ArcGIS.Core.CIM; -using Speckle.Converters.ArcGIS3.Geometry; -using Speckle.Core.Models; +using ArcGIS.Core.Data.Analyst3D; +using ArcGIS.Desktop.Mapping; using Speckle.Converters.ArcGIS3.Utils; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.TopLevel; [NameAndRankValue(nameof(LasDatasetLayer), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointCloudToSpeckleConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/RasterLayerToSpeckleConverter.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/RasterLayerToSpeckleConverter.cs index 3afee5b6c3..22a93c52a9 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/RasterLayerToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/RasterLayerToSpeckleConverter.cs @@ -1,12 +1,12 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; +using ArcGIS.Core.Data.Raster; +using ArcGIS.Core.Geometry; using Objects.GIS; using Speckle.Converters.Common; -using ArcGIS.Core.Geometry; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; using RasterLayer = ArcGIS.Desktop.Mapping.RasterLayer; -using ArcGIS.Core.Data.Raster; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.TopLevel; [NameAndRankValue(nameof(RasterLayer), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class RasterLayerToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/TableToSpeckleConverter.cs similarity index 97% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/TableToSpeckleConverter.cs index 110f752fc9..7649211f18 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/TableToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/TableToSpeckleConverter.cs @@ -1,11 +1,11 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; +using ArcGIS.Core.Data; +using ArcGIS.Desktop.Mapping; using Objects.GIS; using Speckle.Converters.Common; -using ArcGIS.Desktop.Mapping; -using ArcGIS.Core.Data; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.TopLevel; [NameAndRankValue(nameof(StandaloneTable), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class StandaloneTableToSpeckleConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToSpeckleConverter.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/VectorLayerToSpeckleConverter.cs similarity index 98% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToSpeckleConverter.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/VectorLayerToSpeckleConverter.cs index 5712ecc8ee..8d2a36e33f 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Layers/VectorLayerToSpeckleConverter.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/VectorLayerToSpeckleConverter.cs @@ -1,14 +1,14 @@ -using Speckle.Converters.Common.Objects; -using Speckle.Core.Models; -using Objects.GIS; -using Speckle.Converters.Common; -using ArcGIS.Desktop.Mapping; +using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; +using ArcGIS.Desktop.Mapping; +using Objects.GIS; using Speckle.Converters.ArcGIS3.Utils; -using ArcGIS.Core.CIM; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Core.Models; -namespace Speckle.Converters.ArcGIS3.Layers; +namespace Speckle.Converters.ArcGIS3.ToSpeckle.TopLevel; [NameAndRankValue(nameof(FeatureLayer), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class VectorLayerToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter diff --git a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GeometryExtension.cs b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GeometryExtension.cs similarity index 99% rename from DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GeometryExtension.cs rename to DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GeometryExtension.cs index cd0e8bfbd0..1bc46399f2 100644 --- a/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Geometry/GeometryExtension.cs +++ b/DUI3-DX/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/GeometryExtension.cs @@ -1,7 +1,7 @@ using ArcGIS.Core.CIM; using Speckle.Converters.Common; -namespace Speckle.Converters.ArcGIS3.Geometry; +namespace Speckle.Converters.ArcGIS3.Utils; public static class GeometryUtils {