-
Notifications
You must be signed in to change notification settings - Fork 19
feat(#591): add geofence xpath function #604
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 33f6134 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
latin-panda
left a comment
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.
Looks good! I have a question mainly to confirm the feature's behavior, and a suggestion to add a couple of test cases that make that clear.
approving to unblock
| * @param polygon the closed list of geoshape coordinates defining the polygon 'fence'. | ||
| * @return true if the location is inside the polygon; false otherwise. | ||
| * | ||
| * Adapted from https://wrfranklin.org/Research/Short_Notes/pnpoly.html: |
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.
💛
| }; | ||
|
|
||
| [ | ||
| { expression: '0.5 0.5 0 0', expected: true }, // inside |
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.
Please add a case where:
- The point is one of the vertices
- The point is on a segment (directly on the polygon line) but not a vertex
| * return c; | ||
| * } | ||
| */ | ||
| const calculateIsPointInGPSPolygon = (point: Geopoint, polygon: Geotrace) => { |
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.
Returns True if the specified point is inside the specified geoshape, False otherwise.
Is it safe to assume that it excludes points that are vertices or points on the segment (perimeter line)?
I tested this, and it returns false.
Closes #591
I have verified this PR works in these browsers (latest versions):
What else has been done to verify that this works as intended?
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Do we need any specific form for testing your changes? If so, please attach one.
The included test form uses the function: packages/common/src/fixtures/geolocation/geofence.xml
What's changed