QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsmaptooledit.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaptooledit.h - base class for editing map tools
3  ---------------------
4  begin : Juli 2007
5  copyright : (C) 2007 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMAPTOOLEDIT_H
17 #define QGSMAPTOOLEDIT_H
18 
19 #include "qgswkbtypes.h"
20 #include "qgsmaptool.h"
21 #include "qgis_gui.h"
22 
23 class QgsRubberBand;
25 class QgsVectorLayer;
26 class QKeyEvent;
27 
32 class GUI_EXPORT QgsMapToolEdit: public QgsMapTool
33 {
34  Q_OBJECT
35 
36  public:
37  QgsMapToolEdit( QgsMapCanvas *canvas );
38 
39  Flags flags() const override { return QgsMapTool::EditTool; }
40 
45  double defaultZValue() const;
46 
47  private slots:
49  void connectLayers( const QList<QgsMapLayer *> &layers );
50 
55  void cleanCanvas();
56 
57  protected:
58 
60  static QColor digitizingStrokeColor();
62  static int digitizingStrokeWidth();
64  static QColor digitizingFillColor();
65 
73  QgsRubberBand *createRubberBand( QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry, bool alternativeBand = false ) SIP_FACTORY;
74 
75  QgsGeometryRubberBand *createGeometryRubberBand( QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry, bool alternativeBand = false ) const SIP_FACTORY;
76 
78  QgsVectorLayer *currentVectorLayer();
79 
82  {
83  Success = 0,
84  InvalidCanvas = 1,
85  InvalidLayer = 2,
86  };
87 
93  Q_DECL_DEPRECATED TopologicalResult addTopologicalPoints( const QVector<QgsPointXY> &vertices ) SIP_DEPRECATED;
94 
100  TopologicalResult addTopologicalPoints( const QVector<QgsPoint> &vertices );
101 
103  void notifyNotVectorLayer();
105  void notifyNotEditableLayer();
106 
107  private:
109  QList<QgsVectorLayer *> editableVectorLayers();
110 };
111 
112 #endif
QgsRubberBand
A class for drawing transient features (e.g.
Definition: qgsrubberband.h:50
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMapTool
Abstract base class for all map tools.
Definition: qgsmaptool.h:64
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsMapToolEdit::flags
Flags flags() const override
Returns the flags for the map tool.
Definition: qgsmaptooledit.h:39
qgsmaptool.h
QgsGeometryRubberBand
A rubberband class for QgsAbstractGeometry (considering curved geometries).
Definition: qgsgeometryrubberband.h:49
QgsMapToolEdit::TopologicalResult
TopologicalResult
Result of addTopologicalPoints.
Definition: qgsmaptooledit.h:82
QgsWkbTypes::LineGeometry
@ LineGeometry
Definition: qgswkbtypes.h:143
QgsWkbTypes::GeometryType
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:141
QgsMapToolEdit
Base class for map tools that edit vector geometry.
Definition: qgsmaptooledit.h:33
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsWkbTypes
Handles storage of information regarding WKB types and their properties.
Definition: qgswkbtypes.h:42
QgsMapTool::EditTool
@ EditTool
Map tool is an edit tool, which can only be used when layer is editable.
Definition: qgsmaptool.h:94
qgswkbtypes.h