-
Notifications
You must be signed in to change notification settings - Fork 79
Allow adding a new part to multipart geometries #4496
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -814,17 +814,22 @@ Item { | |||
| return "invisible" | ||||
|
|
||||
| if (internal.splitGeometryButtonVisible) { | ||||
| if (!internal.redrawGeometryButtonVisible && !internal.streamingModeButtonVisible) | ||||
| if (!internal.redrawGeometryButtonVisible && !internal.streamingModeButtonVisible && !internal.addPartButtonVisible) | ||||
| return "split" | ||||
| } | ||||
|
|
||||
| if (internal.addPartButtonVisible) { | ||||
| if (!internal.splitGeometryButtonVisible && !internal.streamingModeButtonVisible && !internal.redrawGeometryButtonVisible) | ||||
| return "addPart" | ||||
| } | ||||
|
|
||||
| if (internal.redrawGeometryButtonVisible) { | ||||
| if (!internal.splitGeometryButtonVisible && !internal.streamingModeButtonVisible) | ||||
| if (!internal.splitGeometryButtonVisible && !internal.streamingModeButtonVisible && !internal.addPartButtonVisible) | ||||
| return "redraw" | ||||
| } | ||||
|
|
||||
| if (internal.streamingModeButtonVisible) { | ||||
| if (!internal.redrawGeometryButtonVisible && !internal.splitGeometryButtonVisible) | ||||
| if (!internal.redrawGeometryButtonVisible && !internal.splitGeometryButtonVisible && !internal.addPartButtonVisible) | ||||
|
Withalion marked this conversation as resolved.
|
||||
| return "stream" | ||||
| } | ||||
| return "menu" | ||||
|
|
@@ -834,6 +839,9 @@ Item { | |||
| if (actionState === "split") | ||||
| return __style.splitGeometryIcon | ||||
|
|
||||
| if (actionState === "addPart") | ||||
| return __style.plusIcon | ||||
|
|
||||
| if (actionState === "redraw") | ||||
| return __style.redrawGeometryIcon | ||||
|
|
||||
|
|
@@ -847,6 +855,9 @@ Item { | |||
| if (actionState === "split") | ||||
| return root.toggleSplitting() | ||||
|
|
||||
| if (actionState === "addPart") | ||||
| return root.toggleAddPart() | ||||
|
|
||||
| if (actionState === "redraw") | ||||
| return root.toggleRedraw() | ||||
|
|
||||
|
|
@@ -977,6 +988,18 @@ Item { | |||
| } | ||||
| } | ||||
|
|
||||
| MMListDelegate { | ||||
| text: qsTr( "Add part" ) | ||||
| leftContent: MMIcon { source: __style.plusIcon } | ||||
|
|
||||
| visible: internal.addPartButtonVisible | ||||
|
|
||||
| onClicked: { | ||||
| root.toggleAddPart() | ||||
| moreToolsMenu.close() | ||||
| } | ||||
| } | ||||
|
|
||||
| MMListDelegate { | ||||
| text: qsTr( "Redraw geometry" ) | ||||
| leftContent: MMIcon { source: __style.redrawGeometryIcon } | ||||
|
|
@@ -1262,6 +1285,7 @@ Item { | |||
|
|
||||
| // visibility of buttons in "more" menu | ||||
| property bool splitGeometryButtonVisible: !internal.isPointLayer && !root.isStreaming && root.state === "edit" | ||||
| property bool addPartButtonVisible: internal.isMultiPartLayer && !root.isStreaming && root.state === "edit" | ||||
| property bool redrawGeometryButtonVisible: root.state === "edit" | ||||
| property bool streamingModeButtonVisible: !internal.isPointLayer || internal.isMultiPartLayer | ||||
|
|
||||
|
|
@@ -1323,6 +1347,24 @@ Item { | |||
| } | ||||
| } | ||||
|
|
||||
| function toggleAddPart() { | ||||
| addPart( internal.featurePairToEdit ) | ||||
| } | ||||
|
|
||||
|
Withalion marked this conversation as resolved.
|
||||
| function addPart( featurepair) { | ||||
| __activeProject.setActiveLayer( featurepair.layer ) | ||||
| root.centerToPair( featurepair ) | ||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think this is a bad idea and would like to remove it (also from |
||||
| root.showInfoTextMessage( qsTr( "Add new part to the geometry" ) ) | ||||
|
|
||||
| internal.featurePairToEdit = featurepair | ||||
|
Withalion marked this conversation as resolved.
|
||||
|
|
||||
| // You should be already in state == "edit" | ||||
| if ( recordingToolsLoader.active ) { | ||||
| recordingToolsLoader.item.recordingMapTool.state = MM.RecordingMapTool.Record | ||||
| recordingToolsLoader.item.recordingMapTool.startDigitizingNewPart() | ||||
| } | ||||
| } | ||||
|
|
||||
| function toggleSplitting() { | ||||
| split(internal.featurePairToEdit) | ||||
| } | ||||
|
|
||||
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.
@uclaros why not? :)
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'm thinking
Viewis a great state to add a new partThere 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 state is set to
Recordin qml before invoking this method. This is kind of a safeguard that the method doesn't get called properly.Should I set the state in cpp and just call
startDigitizingNewPart()from qml?