QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20#include "qgsmaptool.h"
21#include "qgswkbtypes.h"
22
23class QgsRubberBand;
25class QgsVectorLayer;
26class QKeyEvent;
27
32class GUI_EXPORT QgsMapToolEdit : public QgsMapTool
33{
34 Q_OBJECT
35
36 public:
38
39 Flags flags() const override { return QgsMapTool::EditTool; }
40
45 static double defaultZValue();
46
53 static double defaultMValue();
54
62 QgsGeometryRubberBand *createGeometryRubberBand( Qgis::GeometryType geometryType = Qgis::GeometryType::Line, bool alternativeBand = false ) const SIP_FACTORY;
63
64 private slots:
66 void connectLayers( const QList<QgsMapLayer *> &layers );
67
72 void cleanCanvas();
73
74 protected:
76 static QColor digitizingStrokeColor();
78 static int digitizingStrokeWidth();
80 static QColor digitizingFillColor();
81
89 QgsRubberBand *createRubberBand( Qgis::GeometryType geometryType = Qgis::GeometryType::Line, bool alternativeBand = false ) SIP_FACTORY;
90
92 QgsVectorLayer *currentVectorLayer();
93
101
107 Q_DECL_DEPRECATED TopologicalResult addTopologicalPoints( const QVector<QgsPointXY> &vertices ) SIP_DEPRECATED;
108
114 TopologicalResult addTopologicalPoints( const QVector<QgsPoint> &vertices );
115
117 void notifyNotVectorLayer();
119 void notifyNotEditableLayer();
120
121 private:
123 QList<QgsVectorLayer *> editableVectorLayers();
124};
125
126#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:358
@ Line
Lines.
Definition qgis.h:360
A rubberband class for QgsAbstractGeometry (considering curved geometries).
Base class for all map layer types.
Definition qgsmaplayer.h:80
Flags flags() const override
Returns the flags for the map tool.
QgsMapToolEdit(QgsMapCanvas *canvas)
TopologicalResult
Result of addTopologicalPoints.
@ InvalidLayer
AddTopologicalPoints failed due to an invalid canvas.
@ InvalidCanvas
AddTopologicalPoints failed due to an invalid canvas.
@ Success
AddTopologicalPoints was successful.
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
QgsMapTool(QgsMapCanvas *canvas)
Constructor takes a map canvas as a parameter.
QFlags< Flag > Flags
Definition qgsmaptool.h:115
friend class QgsMapCanvas
Definition qgsmaptool.h:380
@ EditTool
Map tool is an edit tool, which can only be used when layer is editable.
Definition qgsmaptool.h:111
Responsible for drawing transient features (e.g.
Represents a vector layer which manages a vector based dataset.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_FACTORY
Definition qgis_sip.h:84