-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix (specklepy): update polyline class to use closed flag #394
base: v3-dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave a comment based on C# description, otherwise other recommendations are optional and non-critical 🙌
""" | ||
if len(self.value) < 6: # need at least 2 points to be closed | ||
if len(points) < 6: # need at least 2 points to be closed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least 3 points for non-overlapping start-end coordinates to make a closed shape, and at least 4 points for start-end coordinates to possibly overlap
assert closed_poly.is_closed() | ||
# Test with closed flag | ||
open_poly = Polyline(value=open_square_coords, units=Units.m) | ||
closed_poly = Polyline(value=closed_square_coords, units=Units.m, closed=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically doesn't make difference for this test, but the "value" should be =open_square_coords, to create (what we expect to be) a valid speckle polyline (following C# class)
This applies to all usages of "closed_square_coords" in the tests. It should only be used to test the static .is_closed method, but not to construct a Polyline
@@ -13,24 +14,28 @@ class Polyline(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Polyline" | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a comment here from C# to make it clear how "closed" Polyline should look like: "/// If true, do not add the last point to the value list. Polyline first and last points should be unique."
closed
bool property to directly get and setis_closed()
from an instance method to static method. still accessible but not tightly coupled.