-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/add measure tool #124
base: main
Are you sure you want to change the base?
Conversation
- README has been added - CHANGELOG/package.json have been changed to alpha release
4304b17
to
9197c6c
Compare
Co-authored-by: Finn-Rasmus Darge <[email protected]>
9197c6c
to
17e61c2
Compare
Co-authored-by: Finn-Rasmus Darge <[email protected]>
…/add-measure-tool
By adding these two, it is now possible to measure lengths and areas and not triggering the pins plugin or the directSelect of gfi. If one wants to use more complex interactions, they may remove the measure interactions by selecting "No interaction". This still leaves room open for draw and measure to work together, but this may be a wanted situation. If not, this can be removed by simply toggling the respective plugin.
@warm-coolguy I've added the relevant parts that were missing here. Let me know if you've got any questions! |
Also, on another note, I'll tackle the TODOs in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reviewing and summing up my findings I find that an awful lot of my comments is about making this implementation more like Draw
. A lot of problems we have here have already been solved in Draw
, and all that progress is lost on this re-implementation and would have to be redone samishly. (After all, Draw
is the result of a lot of work over a long period of time, and we're on the third-or-so implementation here, learning incrementally.)
This makes me really wonder if Draw
could just add, by configuration, another radio box section like pseudo-HTML:
h3. Measurement
radio. None
radio. m, m²
radio. km, km²
radio. km, ha
When active, lines would show lengths (and maybe length sum), areas lengths and area, and circles area and maybe circumference or diameter or whatever.
What do you think about this?
new Style({ | ||
stroke: new Stroke({ color: textColor, width: lineWidth / 5 }), | ||
text: new Text({ | ||
font: 'bold 14px cursive', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose that the font (and, for that, all fields configurable in OL for Text) should be configurable, and don't consider the current defaults to work well.
I'm having issues reading this due to its fat/self-overlapping nature. While the problem can't be solved in general for all backgrounds, it can be solved better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will add and adjust those!
interactions.push(modify) | ||
styleFunc = specialStyle | ||
} else if (mode === 'delete') { | ||
interactions = await dispatch('createDeleteInteraction', drawSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an effect on the edges that makes it seem like they can be interacted with, but nothing happens on clicks. That's confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted 8b7258f
interactions.push(draw) | ||
} else if (drawSource.getFeatures().length > 0) { | ||
if (mode === 'edit') { | ||
const modify = getModify(drawSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modify
does not yield any effects on the map, making it hard to see whether clicking will be effective. I propose the same effect as used in the Draw
plugin should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add that!
if (pointAmount < minimum) { | ||
drawSource.removeFeature(feature) | ||
dispatch('setSelectedFeature', null) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deletion in Measure differs to how Deletion in Draw works. Here, only corner points are deleted, and the feature is kept intact as long as possible. In Draw, we just delete whole features that are clicked, which seems to be the more reasonable behaviour to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the implementation added was quite neat and left it as is. But I have no strong feelings and will adjust it.
packages/plugins/Measure/src/store/actions/createInteractions.ts
Outdated
Show resolved
Hide resolved
delete: { | ||
// larger lines and points | ||
lineWidth: 4, | ||
pointWidth: 5, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why lines should be fatter when starting a deletion albeit being exactly the elements the user is not supposed to interact with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #124 (comment)
I thought, so far, that that would be an effort we are not taking right now but in the near future. Maybe we should discuss this before this PR gets merged though. Edit: Before moving forward, adjusting everything to be like Draw, I agree that we should take a look on how some added things here may be added to Draw now instead of the future. Let's ☎️ about this soon! |
32b7b5c
to
e2d7079
Compare
Summary
Added a measure tool for distances and areas
Instructions for local reproduction and review
npm run snowbox