-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Map guides #55883
[FEATURE] Map guides #55883
Conversation
allows map renderer jobs to be nulls
I would have like to get this in for 3.36, but couldn't make it soon enough. Let's see if this raises discussions :) Tests for the snapping are coming. |
/** | ||
* \ingroup gui | ||
* \brief The QgsDigitizingGuideMapTool is a base class for map tools drawing map guides | ||
* \since QGIS 3.34 |
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.
3.36 or 3.38. Several similar instances below
@@ -0,0 +1,561 @@ | |||
/*************************************************************************** | |||
qgsdigitizingguidemaptool.h |
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.
qgsdigitizingguidemaptool.h | |
qgsdigitizingguidemaptool.cpp |
{ | ||
mCenterRubberBand.reset( new QgsRubberBand( mCanvas, Qgis::GeometryType::Point ) ); | ||
mCenterRubberBand->setIcon( QgsRubberBand::ICON_CROSS ); | ||
//mCenterRubberBand->setWidth( QgsGuiUtils::scaleIconSize( 8 ) ); |
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.
//mCenterRubberBand->setWidth( QgsGuiUtils::scaleIconSize( 8 ) ); |
if ( mDistances.count() < 2 ) | ||
{ | ||
QInputDialog *d = new QInputDialog; | ||
//d->setDialogTitle( tr( "Distance to point" ) ); |
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.
//d->setDialogTitle( tr( "Distance to point" ) ); |
const QgsPointXY &s1 = mSegment->first; | ||
const QgsPointXY &s2 = mSegment->second; | ||
|
||
const double nx = s2.y() - s1.y(); |
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.
Some high level comment about what all the below maths is trying to accomplish would be welcome :-)
I'd note that there's a division by zero if s1 == s2
Wondering if there wouldn't be value to move the computation part to some non-GUI method in case it might be helpful (but no strong opinion)
QList< QgsAnnotationItemNode > nodes() const override; | ||
Qgis::AnnotationItemEditOperationResult applyEdit( QgsAbstractAnnotationItemEditOperation *operation ) override; | ||
QgsAnnotationItemEditOperationTransientResults *transientEditResults( QgsAbstractAnnotationItemEditOperation *operation ) override SIP_FACTORY; | ||
virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override; |
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.
why adding virtual here ? override already indicates this (not sure about QGIS habits though)
@@ -649,7 +649,7 @@ std::vector<LayerRenderJob> QgsMapRendererJob::prepareJobs( QPainter *painter, Q | |||
job.context()->setElevationMap( job.elevationMap ); | |||
} | |||
|
|||
if ( ( job.renderer->flags() & Qgis::MapLayerRendererFlag::RenderPartialOutputs ) && ( mSettings.flags() & Qgis::MapSettingsFlag::RenderPartialOutput ) ) | |||
if ( job.renderer && ( job.renderer->flags() & Qgis::MapLayerRendererFlag::RenderPartialOutputs ) && ( mSettings.flags() & Qgis::MapSettingsFlag::RenderPartialOutput ) ) |
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.
are this additional check and the one in qgsmaprenderedparalleljob.cpp specific to the new dev, or bug fixes ? If the later, they should probably be in a separate commit (apologies if it is already the case, but wasn't obvious from looking at commit titles)
Hmm -- I have reservations. The approach here of storing the guides in an annotation layer makes me uneasy. Why go for this approach? As far as I can see, we'd never want guides to be rendered outside of the mapcanvas so my gut instinct is that rubber bands / canvas items would be a better fit for rendering the guides. And then there's other things which look odd to me, eg why are we needing a creation datetime value for the guide model? The UI also looks very rough to me. A collapsed group doesn't seem at all appropriate here. I'd prefer a panel stack there. And a proper toolbar instead of the row of custom buttons. How does this feature relate to the other guides option in the CAD panel? Does it ultimately supersede that? Or will we have two approaches to this? |
👍 A plugin to assist drawing such guides in an annotation layer would be more appropriate imho, instead of adding another hidden entity in the project (I'm looking at you default annotation layer!) |
Thank you for the valuable feedback. Canvas Item sounds indeed like a wiser choice, I'll come back later with a refactored implementation. Regarding the coexistence with current helpers/guides in the Advanced Digitizing tools, the idea here is that you take time to build the guides and keep them around for a while, rather than having them placed during the digitizing process. There are a few reasons to this:
The only overlap I see is with the line extension (but again, having a clear construction process of the guides makes sense). I will try to improve UX following the comments. |
One can achieve the same goal by adding a point and a line layer to his project and store features as snapping guides. This will have all the proposed pros but also have lots of extra benefits, off the top of my head:
Actually, IMO the only non-ovelap is the two circle intersection, which now requires two actual circles to be added as guides. I would suggest we come up with an elegant way to add the two distances tool to the existing advanced digitizing tools/locks (so far such attempts had a very intrusive ui and terrible ux) and let user manage their guides on their layers of choice. |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 21 days. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the QGIS project can do to help push this PR forward please let us know how we can assist. |
superseded by #57584 |
This introduces map guides in advanced digitizing.
Map guides are saved in an annotation layer (i.e. in the project) and can be either points or lines/curves.
For now, this introduces 4 map tools to create guides:
There is no spatial index of the guides. We assume for now that the number of guides will not be large enough to justify this.
Once the CRS is set (as soon as the first guide is added), it is kept even if the project CRS changes. This means that a transform will take place in the snapping.
Introducing a process to transform the guides sounds like an overkill.
cad.mov