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

feat(AnnotationEngine) mechanism for drawing polygon with unlimited points #32

Merged
merged 1 commit into from
Nov 8, 2021

Conversation

dimitrilahaye
Copy link
Contributor

No description provided.

@dimitrilahaye dimitrilahaye marked this pull request as ready for review October 29, 2021 23:36
@dimitrilahaye dimitrilahaye force-pushed the feat/add-polygon branch 3 times, most recently from 32e2103 to 55e2dc4 Compare November 1, 2021 20:22
LDVerdier
LDVerdier previously approved these changes Nov 5, 2021
LDVerdier
LDVerdier previously approved these changes Nov 5, 2021
src/annotation-engine/stories.tsx Show resolved Hide resolved
src/annotation-engine/stories.tsx Show resolved Hide resolved
src/annotation-engine/stories.tsx Show resolved Hide resolved
src/annotation-engine/stories.tsx Show resolved Hide resolved
src/annotation-engine/stories.tsx Outdated Show resolved Hide resolved
src/annotation-engine/use-annotation-engine.ts Outdated Show resolved Hide resolved
src/annotation-engine/use-annotation-engine.ts Outdated Show resolved Hide resolved
src/annotation-engine/stories.tsx Outdated Show resolved Hide resolved
src/annotation-engine/use-annotation-engine.ts Outdated Show resolved Hide resolved
src/annotation-engine/utils.ts Outdated Show resolved Hide resolved
- Polygons | polylines can have unlimited number of points
- Finish polygons | polylines with space keyboard
- Finish polygons by clicking on first point
default:
setIsShapeClosed(true);
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est normal que tu aies deux switch sur shapeType ? Dans le premier, il n'y a pas de default. Egalement, comment tu gères le fait de poser n points pour un polygon ou polyline ?

Copy link
Contributor Author

@dimitrilahaye dimitrilahaye Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans le premier le default est ligne 117.

Je fais deux switch car chacun a un rôle particulier:

  • Switch 1: nombres de points
  • Switch 2: forme fermée ou pas.

Question 2:
Donc ligne 154 tu as la méthode isGeometryComplete qui permet de savoir si la forme est complète. Donc c'est toujours false pour les POLY-trucs.
Les POLY-trucs se complètent avec une action manuelle, on se sert donc des méthodes isGeometryReadyToBeManuallyCompleted (POLYGON et POLYLINE -> touche espace ou autre) et isPolygonReadyToBeManuallyCompletedByClickOnFirstPoint (POLYGON only -> clic sur le premier point) pour ça.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arf ça me perturbe d'avoir un default qui n'est pas à la fin x) mais peu importe, laisse tel quel.
Et du coup, oui je comprends bien les deux switch !

case 'POLYLINE':
return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK pour les polygon et polyline, c'est juste qu'on ne prend pas en compte le numberOfPoints pour valider la forme, oui ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@dimitrilahaye dimitrilahaye merged commit ae6c7f4 into develop Nov 8, 2021
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.

3 participants