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

RobustLineIntersector defensive copyWithZ check to avoid exception with CoordinateXY or CoordinateXYM #1071

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

jodygarnett
Copy link
Contributor

Defensive check prevents copyWithZ, copyWithZInterpolate methods from throwing an exception when the target coordinate is CoordinateXY or CoordinateXYM.

This is in addition to the existing defensive check to avoid doing anything if the z vale was Double.NaN.

This mitigates but does not solve #375 which is due to the intermixing of Coordinate and CoordinateXY values in GeoTools clipping code.

@jodygarnett jodygarnett added this to the 1.20.0 milestone Aug 23, 2024
@jodygarnett jodygarnett force-pushed the copyWithZ_check branch 2 times, most recently from dc8f9f5 to 234dbf0 Compare August 23, 2024 22:37
Defensive check prevents copyWithZ, copyWithZInterpolate methods from throwing an exception when the target coordinate is CoordinateXY or CoordinateXYM.

This is in addition to the existing defensive check to avoid doing anything if the z vale was Double.NaN.
@jodygarnett
Copy link
Contributor Author

This is minimal change to avoid exception.

I looked at "casting" coordinates to solve #375 but am uncomfortable doing so in performance sensitive code.

@dr-jts
Copy link
Contributor

dr-jts commented Aug 23, 2024

Looks good to me.

@jodygarnett jodygarnett changed the title RobustLineIntersector defensive copyWithZ check before calling Coordinate.setZ(value) RobustLineIntersector defensive copyWithZ check to avoid exception with CoordinateXY or CoordinateXYM Aug 23, 2024
@jodygarnett jodygarnett merged commit b99f94e into locationtech:master Aug 23, 2024
2 checks passed
@jodygarnett jodygarnett deleted the copyWithZ_check branch August 23, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants