-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring of QgsMapToolCapture to integrate shape map tools (#46687)
* make QgsMapToolCapture capable of capturing point/line/polygons This moves part of the code from QgsMapToolDigitizeFeature to QgsMapToolCapture so the tool can actually capture point, line and polygons. It's mainly the 'cadCanvasReleaseEvent` which has been transfered. * use a current CaptureTechnique in QgsMapToolCapture QgisApp has been adapted to switch between the different techniques * add point/line/polygon specific handlers for capture map tool * convert add part map tool to use QgsMapToolCapture capabilities * fix use of deprecated methods * also create a virtual handler for QgsMapToolDigitizeFeature::featureDigitized * more dox * use const abstract geom in virtual handlers * add new class QgsMapToolCaptureLayerGeometry to handle layer specific operation in capture map tool such as avoiding intersections * allow to add linear geometries on curved geometry layers * make actions exclusive * add settings registry to app * add a registry for shape map tools * abstract class for shape map tools * adapt QgsMapToolCapture to correctly support shape map tools * clean up of QgisApp * new class QgsMapToolsDigitizingTechniqueManager to handle actions in app related to capture map tools * clean up QgisInterface * sipify * refactoring of existing shape tools * refactor add ring to fully support capture map tool * add missing folder to Doxygen * fix layout * fix erasing at iterator pos * fix unused warning * fix more dox * fix cpp check warning * fix unused warning * fix annotation map tool does not support shape + set tool name * correctly handle case when the capture is not done on a vector layer (annotation, mesh, …) * enable shapes in annotation map tool * correctly undo and clean * adapt existing shape tests the deletion test with circular vertices has been dropped since the capture map tool behaves differently * fix warning * refactor fill ring to support shape digitizing * fix win build * fix more tests * avoid detach warnings * fix app test + clean up * harmonize new settings with existing ones * fix categories * support adding multi lines as a part * fix adding curve part to multi line * also handle points * code a bit clearer * cast not always valid * allow adding curved polygon to multipolygon * add test for QgsGeometry::addPart with curved parts on non-curved geoms (lines and polygons) * fix with Python < 3.9 * better dox for deprecated interface actions methods * remove files leftover * remove leftover circular string curve point tool * add default Z/M values when calling QgsGeometry::coerceToType * Apply suggestions from code review Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com> * fixes from review * move layer specific part to specific tool * fix typo * fix leak * fix dox * fix segmentization * call map tool implementation of addCurve when adding trace curve to avoid point duplication * call sub-class implementation * fix since 3.24 -> 3.26 * fix test * add test to avoid extra curves when using tracing * fix headers Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
- Loading branch information
Showing
132 changed files
with
4,920 additions
and
4,011 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# The following has been generated automatically from src/gui/qgsmaptoolcapture.h | ||
QgsMapToolCapture.CaptureTechnique.baseClass = QgsMapToolCapture |
59 changes: 59 additions & 0 deletions
59
python/gui/auto_generated/maptools/qgsmaptoolcapturelayergeometry.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/maptools/qgsmaptoolcapturelayergeometry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsMapToolCaptureLayerGeometry : QgsMapToolCapture | ||
{ | ||
%Docstring(signature="appended") | ||
:py:class:`QgsMapToolCaptureLayerGeometry` is a base class for map tools digitizing layer geometries | ||
This map tool subclass automatically handles intersection avoidance with other layers in the active project whenever a geometry is digitized by the user. | ||
|
||
.. versionadded:: 3.26 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsmaptoolcapturelayergeometry.h" | ||
%End | ||
public: | ||
QgsMapToolCaptureLayerGeometry( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode ); | ||
%Docstring | ||
Constructor | ||
%End | ||
|
||
private: | ||
virtual void layerGeometryCaptured( const QgsGeometry &geometry ); | ||
%Docstring | ||
Called when the geometry is captured | ||
A more specific handler is also called afterwards (layerPointCaptured, layerLineCaptured or layerPolygonCaptured) | ||
%End | ||
virtual void layerPointCaptured( const QgsPoint &point ); | ||
%Docstring | ||
Called when a point is captured | ||
The generic :py:func:`~QgsMapToolCaptureLayerGeometry.geometryCaptured` signal will be emitted immediately before this point-specific signal. | ||
%End | ||
virtual void layerLineCaptured( const QgsCurve *line ); | ||
%Docstring | ||
Called when a line is captured | ||
The generic :py:func:`~QgsMapToolCaptureLayerGeometry.geometryCaptured` signal will be emitted immediately before this line-specific signal. | ||
%End | ||
virtual void layerPolygonCaptured( const QgsCurvePolygon *polygon ); | ||
%Docstring | ||
Called when a polygon is captured | ||
The generic :py:func:`~QgsMapToolCaptureLayerGeometry.geometryCaptured` signal will be emitted immediately before this polygon-specific signal. | ||
%End | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/maptools/qgsmaptoolcapturelayergeometry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.