Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collections namespace, clean PolygonGeometry class #351

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions src/specklepy/objects/GIS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
GisPolygonElement,
GisPolygonGeometry,
GisRasterElement,
PolygonGeometry,
)
from specklepy.objects.GIS.layers import RasterLayer, VectorLayer

__all__ = [
"VectorLayer",
"RasterLayer",
"GisPolygonGeometry",
"PolygonGeometry",
"GisPolygonElement",
"GisLineElement",
"GisPointElement",
Expand Down
12 changes: 6 additions & 6 deletions src/specklepy/objects/GIS/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
)


class GisPolygonGeometry(
Base, speckle_type="Objects.GIS.PolygonGeometry", detachable={"displayValue"}
):
class PolygonGeometry(Base, speckle_type="Objects.GIS.PolygonGeometry"):
"""GIS Polygon Geometry"""

boundary: Optional[Union[Polyline, Arc, Line, Circle, Polycurve]] = None
voids: Optional[List[Union[Polyline, Arc, Line, Circle, Polycurve]]] = None
displayValue: Optional[List[Mesh]] = None
boundary: Optional[Polyline]
voids: Optional[List[Polyline]]


GisPolygonGeometry = PolygonGeometry


class GisPolygonElement(Base, speckle_type="Objects.GIS.PolygonElement"):
Expand Down
10 changes: 10 additions & 0 deletions src/specklepy/objects/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,19 @@ class RevitParameter(Base, speckle_type="Objects.BuiltElements.Revit.Parameter")
isTypeParameter: bool = False


@deprecated(version="2.20", reason="Namespace changed, collectionType deprecated")
class Collection(
Base, speckle_type="Speckle.Core.Models.Collection", detachable={"elements"}
):
name: Optional[str] = None
collectionType: Optional[str] = None
elements: Optional[List[Base]] = None


class Collection( # noqa: F811
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will two classes with the same name work? is that what this F811 suppression is for?
I'm a bit worried that this may break the Blender connector...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JR-Morgan oops didn't see your review 🙈
yep, I tested, and it is the same way it works with VectorLayer for example. But I am open to any other possibility, it's just I haven't found a way to safely change one speckle_type to another

Base,
speckle_type="Speckle.Core.Models.Collections.Collection",
detachable={"elements"},
):
name: Optional[str] = None
elements: Optional[List[Base]]