diff --git a/src/specklepy/objects/GIS/__init__.py b/src/specklepy/objects/GIS/__init__.py index e3b536c..0385de2 100644 --- a/src/specklepy/objects/GIS/__init__.py +++ b/src/specklepy/objects/GIS/__init__.py @@ -12,6 +12,7 @@ from specklepy.objects.GIS.geometry import ( GisLineElement, GisPointElement, GisPolygonElement, + GisPolygonGeometry, GisRasterElement, PolygonGeometry, PolygonGeometry3d, @@ -21,6 +22,7 @@ from specklepy.objects.GIS.layers import RasterLayer, VectorLayer __all__ = [ "VectorLayer", "RasterLayer", + "GisPolygonGeometry", "PolygonGeometry", "PolygonGeometry3d", "GisPolygonElement", diff --git a/src/specklepy/objects/GIS/features.py b/src/specklepy/objects/GIS/features.py index 7e6a89e..7b85afa 100644 --- a/src/specklepy/objects/GIS/features.py +++ b/src/specklepy/objects/GIS/features.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from specklepy.objects.base import Base from specklepy.objects.geometry import Mesh, Point, Polyline @@ -10,6 +10,12 @@ class GisNonGeometricFeature(Base, speckle_type="Objects.GIS.GisNonGeometricFeat attributes: Base + def __init__( + self, + attributes: Optional[Base] = None, + ) -> None: + self.attributes = attributes or Base() + class GisPointFeature( Base, @@ -25,6 +31,14 @@ class GisPointFeature( def geometry(self) -> List[Point]: return self.displayValue + def __init__( + self, + attributes: Optional[Base] = None, + displayValue: Optional[List[Point]] = None, + ) -> None: + self.attributes = attributes or Base() + displayValue = displayValue or [] + class GisPolylineFeature( Base, @@ -40,6 +54,14 @@ class GisPolylineFeature( def geometry(self) -> List[Polyline]: return self.displayValue + def __init__( + self, + attributes: Optional[Base] = None, + displayValue: Optional[List[Point]] = None, + ) -> None: + self.attributes = attributes or Base() + displayValue = displayValue or [] + class GisPolygonFeature( Base, @@ -52,6 +74,16 @@ class GisPolygonFeature( displayValue: List[Mesh] geometry: List[PolygonGeometry] + def __init__( + self, + geometry: List[PolygonGeometry], + attributes: Optional[Base] = None, + displayValue: Optional[List[Point]] = None, + ) -> None: + self.geometry = geometry + self.attributes = attributes or Base() + displayValue = displayValue or [] + class GisMultipatchFeature( Base, @@ -63,3 +95,13 @@ class GisMultipatchFeature( attributes: Base displayValue: List[Mesh] geometry: List[Base] # GisMultipatchGeometry or PolygonGeometry3d + + def __init__( + self, + geometry: List[Base], + attributes: Optional[Base] = None, + displayValue: Optional[List[Point]] = None, + ) -> None: + self.geometry = geometry + self.attributes = attributes or Base() + displayValue = displayValue or [] diff --git a/src/specklepy/objects/GIS/geometry.py b/src/specklepy/objects/GIS/geometry.py index cb7fe57..a3d4769 100644 --- a/src/specklepy/objects/GIS/geometry.py +++ b/src/specklepy/objects/GIS/geometry.py @@ -14,26 +14,36 @@ from specklepy.objects.geometry import ( ) -class PolygonGeometry( - Base, speckle_type="Objects.GIS.PolygonGeometry", detachable={"displayValue"} -): +class PolygonGeometry(Base, speckle_type="Objects.GIS.PolygonGeometry"): """GIS Polygon Geometry""" boundary: Polyline voids: List[Polyline] - displayValue: List[Mesh] + + def __init__( + self, + boundary: Polyline, + voids: Optional[List[Polyline]] = None, + ) -> None: + self.boundary = boundary + self.voids = voids or [] + + +GisPolygonGeometry = PolygonGeometry class PolygonGeometry3d( PolygonGeometry, speckle_type="Objects.GIS.PolygonGeometry3d", - detachable={"displayValue"}, ): """GIS Polygon3d Geometry""" - boundary: Polyline - voids: List[Polyline] - displayValue: List[Mesh] + def __init__( + self, + boundary: Polyline, + voids: Optional[List[Polyline]] = None, + ) -> None: + super().__init__(boundary=boundary, voids=voids) @deprecated(version="2.20", reason="Replaced with GisPolygonFeature")