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
Support defining size of features in GMF draw tool #5345
Conversation
7c539dd
to
68ffa5f
Compare
68ffa5f
to
b6eb1fe
Compare
Thanks. Was there anything more to review? |
Just tow remarks on testing the example:
|
I highly suspect that's an OpenLayers issue. I don't think this should be addressed as part of this PR.
It was not specified. I'll ask the question on JIRA. |
Enforcing only one side at a time is not required, but we need to let the user know about it. I'll add a message to the panel. |
f21c7ba
to
609a528
Compare
This patch introduces a new component in GMF to specify sizes (length, width, height, radius) while drawing features in the draw tool.
gmf-drawfeatureoptions
A new component is born: gmf-drawfeatureoptions
The parameters it must have are:
The behaves according to the type of interaction it was given. The possible ones are:
Use of the Snap interaction
The Snap interaction of OpenLayers is used as main way to force the drawing tool to "snap" to an invisible grid while drawing and while sizes are set.
A single feature is created and its geometry is set in a way that the mouse always snaps to it while drawing. This is done using an enormous pixel tolerance of 10,000 pixels.
Hack to allow draw end on double-click
Double-clicking ends the drawing of a LineString or Polygon. While snapping with a 10,000 pixel tolerance, the event is eaten up by the Snap interaction, and messes with the Draw interaction.
To fix this, we manually end the drawing on double clicking, when necessary.
All Draw interactions are required
In order for the feature used by the Snap interaction to have its geometry created, we need to have access to the feature being drawn. A feature being drawn is only accessible from its Draw interaction.
There was currently no way to have access to those, which are created and nested in the NGEO drawfeature directive.
To obtain them, they were given unique ids, and then obtained through the map itself, in the GMF drawfeature directive, by using their given unique ids as a way to find them.