biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
12 stars 15 forks source link

Reject invalid annotation shapes #769

Closed lehecht closed 6 months ago

lehecht commented 7 months ago

Reject invalid annotation shapes by not saving them on frontend side and rejecting them on the backend side. Additionally extend tests.

mzur commented 7 months ago

Is there any issue besides #763 associated with this PR?

lehecht commented 7 months ago

I don't think so. Bug #770 is also located where changes of this PR were made, but it was not caused by these changes.

mzur commented 7 months ago

Will #770 be fixed by this PR? Then please add it to the "development" section on the right so it will be closed with this PR.

lehecht commented 7 months ago

Will #770 be fixed by this PR? Then please add it to the "development" section on the right so it will be closed with this PR.

No, it won't.

lehecht commented 7 months ago

@mzur Why can a line just contain one point in this test? Is it permissible for a polygon to be a line?

mzur commented 7 months ago

Why can a line just contain one point in this test?

I see no particular reason. This is probably one aspect of the validation that can be improved.

Is it permissible for a polygon to be a line?

No, the last point of a polygon must be equal to the first point. I think this is validated somewhere, too :thinking:

Edit: https://github.com/biigle/core/commit/cc75bb70d2d2abe53904b7219e20a205af3816cf

I guess with the current validation, you can make a line with three points (a, b, a). I'm not sure if we should disallow this.

lehecht commented 6 months ago

I guess with the current validation, you can make a line with three points (a, b, a). I'm not sure if we should disallow this.

@mzur Should I leave it like it is?

lehecht commented 6 months ago

@mzur I also found a test where a polygon can be a point. Should this be kept that way, too?

mzur commented 6 months ago

Should I leave it like it is?

If it's not too much effort, I think this should be rejected. Polygons with a zero size could cause all sorts of issues.

I also found a test where a polygon can be a point. Should this be kept that way, too?

No. Also not the "point-line" (in the test above).