From c5cba2d0fbbc7b3d99f2e0ee012df8a266b6fee6 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Tue, 26 Nov 2024 16:31:58 +0000 Subject: [PATCH 1/7] add Polygon to Geometry; add GisObject --- src/Speckle.Objects/Data/GisObject.cs | 14 ++++++++++++++ src/Speckle.Objects/Geometry/Polygon.cs | 16 ++++++++++++++++ src/Speckle.Objects/Interfaces.cs | 5 +++++ 3 files changed, 35 insertions(+) create mode 100644 src/Speckle.Objects/Data/GisObject.cs create mode 100644 src/Speckle.Objects/Geometry/Polygon.cs diff --git a/src/Speckle.Objects/Data/GisObject.cs b/src/Speckle.Objects/Data/GisObject.cs new file mode 100644 index 00000000..ee5c0e93 --- /dev/null +++ b/src/Speckle.Objects/Data/GisObject.cs @@ -0,0 +1,14 @@ +using Speckle.Sdk.Models; + +namespace Speckle.Objects.Data; + +/// +/// Represents an Autodesk.Revit.DB.Element object in Revit +/// +[SpeckleType("Objects.Data.GisObject")] +public class GisObject : Base, IGisObject +{ + public required string name { get; set; } + public required int type { get; set; } + public required IReadOnlyList displayValue { get; set; } +} diff --git a/src/Speckle.Objects/Geometry/Polygon.cs b/src/Speckle.Objects/Geometry/Polygon.cs new file mode 100644 index 00000000..be18d4ea --- /dev/null +++ b/src/Speckle.Objects/Geometry/Polygon.cs @@ -0,0 +1,16 @@ +using Speckle.Sdk.Models; + +namespace Speckle.Objects.Geometry; + +[SpeckleType("Objects.Geometry.Polygon")] +public class Polygon : Base +{ + public string units { get; set; } + public ICurve boundary { get; set; } + public List voids { get; set; } + + public Polygon() + { + voids = new List(); + } +} diff --git a/src/Speckle.Objects/Interfaces.cs b/src/Speckle.Objects/Interfaces.cs index f22af6fc..e423fb24 100644 --- a/src/Speckle.Objects/Interfaces.cs +++ b/src/Speckle.Objects/Interfaces.cs @@ -159,4 +159,9 @@ public interface ITeklaObject : IDataObject [DetachProperty] IReadOnlyList elements { get; } } + +public interface IGisObject : IDataObject +{ + int type { get; } // 0-Point, 1-Line, 2-Polygon +} #endregion From d29644522c0c9b020b9887b19c51e30aa94c5fae Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Wed, 27 Nov 2024 00:33:16 +0000 Subject: [PATCH 2/7] cleaning objects --- src/Speckle.Objects/Data/GisObject.cs | 2 +- src/Speckle.Objects/GIS/GisLayer.cs | 12 +++++ .../GIS/GisMultipatchFeature.cs | 19 ------- .../GIS/GisMultipatchGeometry.cs | 18 ------- .../GIS/GisNonGeometricFeature.cs | 9 ---- src/Speckle.Objects/GIS/GisPointFeature.cs | 21 -------- src/Speckle.Objects/GIS/GisPolygonFeature.cs | 16 ------ src/Speckle.Objects/GIS/GisPolylineFeature.cs | 21 -------- src/Speckle.Objects/GIS/PolygonGeometry.cs | 17 ------ src/Speckle.Objects/GIS/PolygonGeometry3d.cs | 6 --- src/Speckle.Objects/GIS/RasterElement.cs | 52 ------------------- src/Speckle.Objects/Interfaces.cs | 2 +- 12 files changed, 14 insertions(+), 181 deletions(-) create mode 100644 src/Speckle.Objects/GIS/GisLayer.cs delete mode 100644 src/Speckle.Objects/GIS/GisMultipatchFeature.cs delete mode 100644 src/Speckle.Objects/GIS/GisMultipatchGeometry.cs delete mode 100644 src/Speckle.Objects/GIS/GisNonGeometricFeature.cs delete mode 100644 src/Speckle.Objects/GIS/GisPointFeature.cs delete mode 100644 src/Speckle.Objects/GIS/GisPolygonFeature.cs delete mode 100644 src/Speckle.Objects/GIS/GisPolylineFeature.cs delete mode 100644 src/Speckle.Objects/GIS/PolygonGeometry.cs delete mode 100644 src/Speckle.Objects/GIS/PolygonGeometry3d.cs delete mode 100644 src/Speckle.Objects/GIS/RasterElement.cs diff --git a/src/Speckle.Objects/Data/GisObject.cs b/src/Speckle.Objects/Data/GisObject.cs index ee5c0e93..1915367c 100644 --- a/src/Speckle.Objects/Data/GisObject.cs +++ b/src/Speckle.Objects/Data/GisObject.cs @@ -9,6 +9,6 @@ namespace Speckle.Objects.Data; public class GisObject : Base, IGisObject { public required string name { get; set; } - public required int type { get; set; } + public required string type { get; set; } public required IReadOnlyList displayValue { get; set; } } diff --git a/src/Speckle.Objects/GIS/GisLayer.cs b/src/Speckle.Objects/GIS/GisLayer.cs new file mode 100644 index 00000000..7233dccb --- /dev/null +++ b/src/Speckle.Objects/GIS/GisLayer.cs @@ -0,0 +1,12 @@ +using Speckle.Sdk.Models; +using Speckle.Sdk.Models.Collections; + +namespace Speckle.Objects.GIS; + +[SpeckleType("Objects.GIS.VectorLayer")] +public class GisLayer : Collection +{ + public required CRS crs { get; set; } + public required string units { get; set; } + public required string type { get; set; } +} diff --git a/src/Speckle.Objects/GIS/GisMultipatchFeature.cs b/src/Speckle.Objects/GIS/GisMultipatchFeature.cs deleted file mode 100644 index 7de6a6da..00000000 --- a/src/Speckle.Objects/GIS/GisMultipatchFeature.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisMultipatchFeature")] -public class GisMultipatchFeature : Base, IGisFeature, IDisplayValue> -{ - public required Base attributes { get; set; } - - /// - /// Multipatch geometry should be of type or - /// - [DetachProperty] - public required List geometry { get; set; } - - [DetachProperty] - public required List displayValue { get; set; } -} diff --git a/src/Speckle.Objects/GIS/GisMultipatchGeometry.cs b/src/Speckle.Objects/GIS/GisMultipatchGeometry.cs deleted file mode 100644 index f4bc67db..00000000 --- a/src/Speckle.Objects/GIS/GisMultipatchGeometry.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisMultipatchGeometry")] -public class GisMultipatchGeometry : Base -{ - public string units { get; set; } - public List faces { get; set; } - public List vertices { get; set; } - public List? colors { get; set; } - - public GisMultipatchGeometry() - { - faces = new List(); - vertices = new List(); - } -} diff --git a/src/Speckle.Objects/GIS/GisNonGeometricFeature.cs b/src/Speckle.Objects/GIS/GisNonGeometricFeature.cs deleted file mode 100644 index d53c6b84..00000000 --- a/src/Speckle.Objects/GIS/GisNonGeometricFeature.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisNonGeometricFeature")] -public class GisNonGeometricFeature : Base, IGisFeature -{ - public required Base attributes { get; set; } -} diff --git a/src/Speckle.Objects/GIS/GisPointFeature.cs b/src/Speckle.Objects/GIS/GisPointFeature.cs deleted file mode 100644 index 57493268..00000000 --- a/src/Speckle.Objects/GIS/GisPointFeature.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Speckle.Newtonsoft.Json; -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisPointFeature")] -public class GisPointFeature : Base, IGisFeature, IDisplayValue> -{ - public required Base attributes { get; set; } - - [JsonIgnore] - public required List geometry - { - get => displayValue; - set => displayValue = value; - } - - [DetachProperty] - public List displayValue { get; set; } -} diff --git a/src/Speckle.Objects/GIS/GisPolygonFeature.cs b/src/Speckle.Objects/GIS/GisPolygonFeature.cs deleted file mode 100644 index 90c9d81f..00000000 --- a/src/Speckle.Objects/GIS/GisPolygonFeature.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisPolygonFeature")] -public class GisPolygonFeature : Base, IGisFeature, IDisplayValue> -{ - public required Base attributes { get; set; } - - [DetachProperty] - public required List geometry { get; set; } - - [DetachProperty] - public required List displayValue { get; set; } -} diff --git a/src/Speckle.Objects/GIS/GisPolylineFeature.cs b/src/Speckle.Objects/GIS/GisPolylineFeature.cs deleted file mode 100644 index 2f4b578d..00000000 --- a/src/Speckle.Objects/GIS/GisPolylineFeature.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Speckle.Newtonsoft.Json; -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisPolylineFeature")] -public class GisPolylineFeature : Base, IGisFeature, IDisplayValue> -{ - public required Base attributes { get; set; } - - [JsonIgnore] - public required List geometry - { - get => displayValue; - set => displayValue = value; - } - - [DetachProperty] - public List displayValue { get; set; } -} diff --git a/src/Speckle.Objects/GIS/PolygonGeometry.cs b/src/Speckle.Objects/GIS/PolygonGeometry.cs deleted file mode 100644 index 2a3a3cdb..00000000 --- a/src/Speckle.Objects/GIS/PolygonGeometry.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.PolygonGeometry")] -public class PolygonGeometry : Base -{ - public string units { get; set; } - public Polyline boundary { get; set; } - public List voids { get; set; } - - public PolygonGeometry() - { - voids = new List(); - } -} diff --git a/src/Speckle.Objects/GIS/PolygonGeometry3d.cs b/src/Speckle.Objects/GIS/PolygonGeometry3d.cs deleted file mode 100644 index 6a2ee318..00000000 --- a/src/Speckle.Objects/GIS/PolygonGeometry3d.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.PolygonGeometry3d")] -public class PolygonGeometry3d : PolygonGeometry { } diff --git a/src/Speckle.Objects/GIS/RasterElement.cs b/src/Speckle.Objects/GIS/RasterElement.cs deleted file mode 100644 index cb1b78fb..00000000 --- a/src/Speckle.Objects/GIS/RasterElement.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Speckle.Objects.Geometry; -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.RasterElement")] -public class RasterElement : Base -{ - public int band_count { get; set; } - public List band_names { get; set; } - public float x_origin { get; set; } - public float y_origin { get; set; } - public int x_size { get; set; } - public int y_size { get; set; } - public float x_resolution { get; set; } - public float y_resolution { get; set; } - public List noDataValue { get; set; } - - [DetachProperty] - public List displayValue { get; set; } - - public RasterElement() - { - displayValue = new List(); - band_names = new List(); - noDataValue = new List(); - } - - public RasterElement( - int bandCount, - List bandNames, - float xOrigin, - float yOrigin, - int xSize, - int ySize, - float xResolution, - float yResolution, - List noDataValue - ) - { - displayValue = new List(); - band_count = bandCount; - band_names = bandNames; - x_origin = xOrigin; - y_origin = yOrigin; - x_size = xSize; - y_size = ySize; - x_resolution = xResolution; - y_resolution = yResolution; - this.noDataValue = noDataValue; - } -} diff --git a/src/Speckle.Objects/Interfaces.cs b/src/Speckle.Objects/Interfaces.cs index e423fb24..f68e1a73 100644 --- a/src/Speckle.Objects/Interfaces.cs +++ b/src/Speckle.Objects/Interfaces.cs @@ -162,6 +162,6 @@ public interface ITeklaObject : IDataObject public interface IGisObject : IDataObject { - int type { get; } // 0-Point, 1-Line, 2-Polygon + string type { get; } } #endregion From ce80c1c27256d8b4b2e2ec0aaa4ddb2ce217ec8a Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Thu, 28 Nov 2024 13:19:16 +0000 Subject: [PATCH 3/7] removed final GIS classes --- src/Speckle.Objects/GIS/GisLayer.cs | 2 +- src/Speckle.Objects/GIS/RasterLayer.cs | 14 -------------- src/Speckle.Objects/GIS/VectorLayer.cs | 20 -------------------- 3 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 src/Speckle.Objects/GIS/RasterLayer.cs delete mode 100644 src/Speckle.Objects/GIS/VectorLayer.cs diff --git a/src/Speckle.Objects/GIS/GisLayer.cs b/src/Speckle.Objects/GIS/GisLayer.cs index 7233dccb..9ca22f58 100644 --- a/src/Speckle.Objects/GIS/GisLayer.cs +++ b/src/Speckle.Objects/GIS/GisLayer.cs @@ -3,7 +3,7 @@ namespace Speckle.Objects.GIS; -[SpeckleType("Objects.GIS.VectorLayer")] +[SpeckleType("Objects.GIS.GisLayer")] public class GisLayer : Collection { public required CRS crs { get; set; } diff --git a/src/Speckle.Objects/GIS/RasterLayer.cs b/src/Speckle.Objects/GIS/RasterLayer.cs deleted file mode 100644 index d0240cf9..00000000 --- a/src/Speckle.Objects/GIS/RasterLayer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Speckle.Sdk.Models; -using Speckle.Sdk.Models.Collections; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.RasterLayer")] -public class RasterLayer : Collection -{ - public CRS? crs { get; set; } - public string? units { get; set; } - public CRS? rasterCrs { get; set; } - public string? geomType { get; set; } - public Dictionary? renderer { get; set; } -} diff --git a/src/Speckle.Objects/GIS/VectorLayer.cs b/src/Speckle.Objects/GIS/VectorLayer.cs deleted file mode 100644 index 80673982..00000000 --- a/src/Speckle.Objects/GIS/VectorLayer.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Speckle.Sdk.Models; -using Speckle.Sdk.Models.Collections; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.VectorLayer")] -public class VectorLayer : Collection -{ - public CRS? crs { get; set; } - public string? units { get; set; } - public Base attributes { get; set; } - public string? geomType { get; set; } - public string? nativeGeomType { get; set; } - public Dictionary? renderer { get; set; } - - public VectorLayer() - { - attributes = new Base(); - } -} From 5e068e417027f34db507a12bd4e069d5f1718fa1 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Thu, 28 Nov 2024 16:10:02 +0000 Subject: [PATCH 4/7] remove IGisFeature interface --- src/Speckle.Objects/Interfaces.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Speckle.Objects/Interfaces.cs b/src/Speckle.Objects/Interfaces.cs index f68e1a73..78891472 100644 --- a/src/Speckle.Objects/Interfaces.cs +++ b/src/Speckle.Objects/Interfaces.cs @@ -85,14 +85,6 @@ public interface ITransformable : ISpeckleObject #endregion -#region GIS -public interface IGisFeature : ISpeckleObject -{ - Base attributes { get; set; } -} - -#endregion - #region Data objects /// From fd7874e92f2ae59da62aacab0107f9a09b3be775 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Fri, 29 Nov 2024 12:33:13 +0000 Subject: [PATCH 5/7] required keywords for CRS --- src/Speckle.Objects/GIS/CRS.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Speckle.Objects/GIS/CRS.cs b/src/Speckle.Objects/GIS/CRS.cs index ae4f04dc..5d4bdb30 100644 --- a/src/Speckle.Objects/GIS/CRS.cs +++ b/src/Speckle.Objects/GIS/CRS.cs @@ -5,9 +5,9 @@ namespace Speckle.Objects.GIS; [SpeckleType("Objects.GIS.CRS")] public class CRS : Base { - public string? name { get; set; } - public string? authority_id { get; set; } - public string? wkt { get; set; } + public required string name { get; set; } + public required string? authority_id { get; set; } + public required string wkt { get; set; } public string? units_native { get; set; } public float? offset_x { get; set; } public float? offset_y { get; set; } From 45486849a1298ca9c24abf10a594f97578e6dc64 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Tue, 3 Dec 2024 19:45:30 +0000 Subject: [PATCH 6/7] required boundary; renaming --- src/Speckle.Objects/Geometry/Polygon.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Speckle.Objects/Geometry/Polygon.cs b/src/Speckle.Objects/Geometry/Polygon.cs index be18d4ea..74b6f2ef 100644 --- a/src/Speckle.Objects/Geometry/Polygon.cs +++ b/src/Speckle.Objects/Geometry/Polygon.cs @@ -6,11 +6,11 @@ namespace Speckle.Objects.Geometry; public class Polygon : Base { public string units { get; set; } - public ICurve boundary { get; set; } - public List voids { get; set; } + public required ICurve boundary { get; set; } + public List innerLoops { get; set; } public Polygon() { - voids = new List(); + innerLoops = new List(); } } From 106f0731b365a85a870159671e66edaef891d312 Mon Sep 17 00:00:00 2001 From: KatKatKateryna Date: Wed, 4 Dec 2024 13:50:25 +0000 Subject: [PATCH 7/7] delete the rest of the classes --- src/Speckle.Objects/Data/GisObject.cs | 14 -------------- src/Speckle.Objects/GIS/CRS.cs | 15 --------------- src/Speckle.Objects/GIS/GisLayer.cs | 12 ------------ src/Speckle.Objects/Geometry/Polygon.cs | 16 ---------------- 4 files changed, 57 deletions(-) delete mode 100644 src/Speckle.Objects/Data/GisObject.cs delete mode 100644 src/Speckle.Objects/GIS/CRS.cs delete mode 100644 src/Speckle.Objects/GIS/GisLayer.cs delete mode 100644 src/Speckle.Objects/Geometry/Polygon.cs diff --git a/src/Speckle.Objects/Data/GisObject.cs b/src/Speckle.Objects/Data/GisObject.cs deleted file mode 100644 index 1915367c..00000000 --- a/src/Speckle.Objects/Data/GisObject.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.Data; - -/// -/// Represents an Autodesk.Revit.DB.Element object in Revit -/// -[SpeckleType("Objects.Data.GisObject")] -public class GisObject : Base, IGisObject -{ - public required string name { get; set; } - public required string type { get; set; } - public required IReadOnlyList displayValue { get; set; } -} diff --git a/src/Speckle.Objects/GIS/CRS.cs b/src/Speckle.Objects/GIS/CRS.cs deleted file mode 100644 index 5d4bdb30..00000000 --- a/src/Speckle.Objects/GIS/CRS.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.CRS")] -public class CRS : Base -{ - public required string name { get; set; } - public required string? authority_id { get; set; } - public required string wkt { get; set; } - public string? units_native { get; set; } - public float? offset_x { get; set; } - public float? offset_y { get; set; } - public float? rotation { get; set; } -} diff --git a/src/Speckle.Objects/GIS/GisLayer.cs b/src/Speckle.Objects/GIS/GisLayer.cs deleted file mode 100644 index 9ca22f58..00000000 --- a/src/Speckle.Objects/GIS/GisLayer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Speckle.Sdk.Models; -using Speckle.Sdk.Models.Collections; - -namespace Speckle.Objects.GIS; - -[SpeckleType("Objects.GIS.GisLayer")] -public class GisLayer : Collection -{ - public required CRS crs { get; set; } - public required string units { get; set; } - public required string type { get; set; } -} diff --git a/src/Speckle.Objects/Geometry/Polygon.cs b/src/Speckle.Objects/Geometry/Polygon.cs deleted file mode 100644 index 74b6f2ef..00000000 --- a/src/Speckle.Objects/Geometry/Polygon.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Speckle.Sdk.Models; - -namespace Speckle.Objects.Geometry; - -[SpeckleType("Objects.Geometry.Polygon")] -public class Polygon : Base -{ - public string units { get; set; } - public required ICurve boundary { get; set; } - public List innerLoops { get; set; } - - public Polygon() - { - innerLoops = new List(); - } -}