Skip to content

Commit

Permalink
Add Polygon check after modifying video polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
lehecht committed Nov 16, 2023
1 parent 86b5cea commit 7a340c6
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ModifyInteraction from '@biigle/ol/interaction/Modify';
import TranslateInteraction from '../../../annotations/ol/TranslateInteraction';
import {shiftKeyOnly as shiftKeyOnlyCondition} from '@biigle/ol/events/condition';
import {singleClick as singleClickCondition} from '@biigle/ol/events/condition';
import * as PolygonValidator from "../../../annotations/ol/PolygonValidator";
const allowedSplitShapes = ['Point', 'Circle', 'Rectangle', 'WholeFrame'];
Expand Down Expand Up @@ -70,6 +71,17 @@ export default {
return this.featureRevisionMap[feature.getId()] !== feature.getRevision();
})
.map((feature) => {
// Check polygons
if (feature.getGeometry().getType() === 'Polygon') {
if (PolygonValidator.isInvalidPolygon(feature)) {
// Disallow polygons with less than three non-overlapping points
this.$emit('is-invalid-polygon')
return;
}
// If polygon is self-intersecting, create simple polygon
PolygonValidator.simplifyPolygon(feature);
}
return {
annotation: feature.get('annotation'),
points: this.getPointsFromGeometry(feature.getGeometry()),
Expand Down

0 comments on commit 7a340c6

Please sign in to comment.