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

[advanced digitizing] Implement visual construction guides #57584

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

nirvn
Copy link
Contributor

@nirvn nirvn commented May 28, 2024

Description

This PR adds visual construction guides to the advanced digitizing dock widget which builds on top of our preexisting CAD construction mode.

UI wise, the functionality is exposed through a set of actions within a new drop-down menu attached to the construction activation toolbar button:

image

When recording construction guides, QGIS will render all construction steps taken as dashed lines. Those lines will remain visible as long as advanced digitizing is enabled. The guides are snap-able, allowing for construction steps to begin mid-way into a previous set of steps too.

In action:

vokoscreenNG-2024-05-28_11-26-37.mp4

The construction guides are stored in a vector layer, which is exposed through the advanced digitizing dock widget, allowing for further customization of those guides via e.g. python plugins.

@nirvn nirvn added Feature Frozen Feature freeze - Do not merge! Digitizing Related to feature digitizing map tools or functionality labels May 28, 2024
@github-actions github-actions bot added this to the 3.38.0 milestone May 28, 2024
Copy link

github-actions bot commented May 28, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 35784b2)

@lbartoletti
Copy link
Member

Very interesting feature!

Some questions:

  • Is the layer available in the layertree ? (Personnaly, I don't want to see it in)
  • Is it possible to save the construction layer ?
  • What is the projection of the layer ? Same as the project one ?
  • What are the snapping options for this layer ?

Thanks!

@3nids 3nids mentioned this pull request May 28, 2024
@nirvn
Copy link
Contributor Author

nirvn commented May 28, 2024

@lbartoletti , glad this functionality is peaking your interest :)

Here are As to your Qs:

  • The layer is not available in the layer tree; it is however publicly exposed through the QgsAdvancedDigitizingDockerWidget, which means it can be accessed via python (console, plugins, etc.) via iface.cadDockWidget().constructionGuidesLayer(). This makes it possible to prototype further enhancements through python (either as proof of concept prior to implementation in src/gui, or simply as a cool plugin :).
  • The initial implementation here does not expose a 'save guides to file', but it can easily be implemented in the future (or right away in python scripting via QgsVectorFileWriter). The PR aims at laying a foundation upon which we can build on.
  • That is correct, the layer that holds the guide adopts the project CRS. If that is changed during the course of a project session, the guides will be reprojected to match the changed project CRS.
  • The layer will adopt the poject's snapping configuration set in the snapping toolbar.

@nirvn
Copy link
Contributor Author

nirvn commented Jun 1, 2024

@nyalldawson , thanks for the review, your comments were addressed. A couple of tests were also added to test guide recording and snapping.

Copy link
Collaborator

@nyalldawson nyalldawson left a comment

Choose a reason for hiding this comment

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

Just one small tweak

{
if ( QgsVectorLayer *constructionGuidesLayer = mAdvancedDigitizingDockWidget->constructionGuidesLayer() )
{
QgsFeatureIterator it = constructionGuidesLayer->getFeatures( mMapCanvas->mapSettings().visibleExtent() );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
QgsFeatureIterator it = constructionGuidesLayer->getFeatures( mMapCanvas->mapSettings().visibleExtent() );
QgsFeatureIterator it = constructionGuidesLayer->getFeatures( QgsFeatureRequest().setNoAttributes().setFilterRect( mMapCanvas->mapSettings().visibleExtent() ) );

@nyalldawson nyalldawson added the Merge After Thaw For approved PRs which are ready to be merged as soon as master is thawed label Jun 4, 2024
@uclaros
Copy link
Contributor

uclaros commented Jun 21, 2024

In the video, at 0:34 it appears like you need to click on Show construction guides twice for the option to get unchecked. Is that the case?

@nyalldawson nyalldawson removed the Frozen Feature freeze - Do not merge! label Jun 21, 2024
@nirvn nirvn merged commit 2fb1de2 into qgis:master Jun 25, 2024
29 checks passed
nyalldawson added a commit to nyalldawson/QGIS that referenced this pull request Jul 16, 2024
nyalldawson added a commit that referenced this pull request Jul 18, 2024
@zacharlie zacharlie added the Changelog Items that are queued to appear in the visual changelog - remove after harvesting label Sep 24, 2024
@qgis-bot
Copy link
Collaborator

@nirvn

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@agiudiceandrea agiudiceandrea added the Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. label Sep 24, 2024
@qgis-bot
Copy link
Collaborator

@nirvn
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@qgis-bot
Copy link
Collaborator

@nirvn
A documentation ticket has been opened at qgis/QGIS-Documentation#9274
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Digitizing Related to feature digitizing map tools or functionality Feature Merge After Thaw For approved PRs which are ready to be merged as soon as master is thawed Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants