QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
vector
qgsvectorlayerundocommand.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvectorlayerundocommand.h
3
---------------------
4
begin : June 2009
5
copyright : (C) 2009 by Martin Dobias
6
email : wonder dot sk at gmail dot com
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 QGSVECTORLAYERUNDOCOMMAND_H
17
#define QGSVECTORLAYERUNDOCOMMAND_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsfeature.h
"
22
#include "
qgsfields.h
"
23
24
#include <QList>
25
#include <QSet>
26
#include <QUndoCommand>
27
#include <QVariant>
28
29
class
QgsGeometry
;
30
31
#include "
qgsvectorlayereditbuffer.h
"
32
38
39
class
CORE_EXPORT
QgsVectorLayerUndoCommand
:
public
QUndoCommand
40
{
41
public
:
46
QgsVectorLayerUndoCommand
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
)
47
:
mBuffer
( buffer )
48
{}
49
51
inline
QgsVectorLayer
*
layer
() {
return
mBuffer
->L; }
52
53
int
id
()
const override
{
return
-1; }
54
bool
mergeWith
(
const
QUndoCommand * )
override
{
return
false
; }
55
56
protected
:
58
QgsVectorLayerEditBuffer
*
mBuffer
=
nullptr
;
59
};
60
61
67
68
class
CORE_EXPORT
QgsVectorLayerUndoCommandAddFeature
:
public
QgsVectorLayerUndoCommand
69
{
70
public
:
76
QgsVectorLayerUndoCommandAddFeature
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
QgsFeature
&f );
77
78
void
undo
()
override
;
79
void
redo
()
override
;
80
81
private
:
82
QgsFeature
mFeature;
83
};
84
85
91
92
class
CORE_EXPORT
QgsVectorLayerUndoCommandDeleteFeature
:
public
QgsVectorLayerUndoCommand
93
{
94
public
:
100
QgsVectorLayerUndoCommandDeleteFeature
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
QgsFeatureId
fid );
101
102
void
undo
()
override
;
103
void
redo
()
override
;
104
105
private
:
106
QgsFeatureId
mFid;
107
QgsFeature
mOldAddedFeature;
108
};
109
115
116
class
CORE_EXPORT
QgsVectorLayerUndoCommandChangeGeometry
:
public
QgsVectorLayerUndoCommand
117
{
118
public
:
125
QgsVectorLayerUndoCommandChangeGeometry
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
QgsFeatureId
fid,
const
QgsGeometry
&newGeom );
126
127
void
undo
()
override
;
128
void
redo
()
override
;
129
int
id
()
const override
{
return
1; }
130
bool
mergeWith(
const
QUndoCommand *other )
override
;
131
132
private
:
133
QgsFeatureId
mFid;
134
QgsGeometry
mOldGeom;
135
mutable
QgsGeometry
mNewGeom;
136
};
137
138
144
145
class
CORE_EXPORT
QgsVectorLayerUndoCommandChangeAttribute
:
public
QgsVectorLayerUndoCommand
146
{
147
public
:
156
QgsVectorLayerUndoCommandChangeAttribute
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
QgsFeatureId
fid,
int
fieldIndex,
const
QVariant &newValue,
const
QVariant &oldValue );
157
void
undo
()
override
;
158
void
redo
()
override
;
159
160
private
:
161
QgsFeatureId
mFid;
162
int
mFieldIndex;
163
QVariant mOldValue;
164
QVariant mNewValue;
165
bool
mFirstChange =
true
;
166
};
167
173
174
class
CORE_EXPORT
QgsVectorLayerUndoCommandAddAttribute
:
public
QgsVectorLayerUndoCommand
175
{
176
public
:
182
QgsVectorLayerUndoCommandAddAttribute
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
const
QgsField
&field );
183
184
void
undo
()
override
;
185
void
redo
()
override
;
186
187
private
:
188
QgsField
mField;
189
int
mFieldIndex;
190
};
191
197
198
class
CORE_EXPORT
QgsVectorLayerUndoCommandDeleteAttribute
:
public
QgsVectorLayerUndoCommand
199
{
200
public
:
206
QgsVectorLayerUndoCommandDeleteAttribute
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
int
fieldIndex );
207
208
void
undo
()
override
;
209
void
redo
()
override
;
210
211
private
:
212
int
mFieldIndex;
213
QString mFieldName;
214
bool
mProviderField;
215
int
mOriginIndex;
216
QgsField
mOldField;
217
QVariantMap mOldEditorWidgetConfig;
218
219
QMap<QgsFeatureId, QVariant> mDeletedValues;
220
QString mOldName;
221
};
222
223
229
230
class
CORE_EXPORT
QgsVectorLayerUndoCommandRenameAttribute
:
public
QgsVectorLayerUndoCommand
231
{
232
public
:
239
QgsVectorLayerUndoCommandRenameAttribute
(
QgsVectorLayerEditBuffer
*buffer
SIP_TRANSFER
,
int
fieldIndex,
const
QString &newName );
240
241
void
undo
()
override
;
242
void
redo
()
override
;
243
244
private
:
245
int
mFieldIndex;
246
bool
mProviderField;
247
int
mOriginIndex;
248
QString mOldName;
249
QString mNewName;
250
};
251
252
#endif
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsField
Encapsulate a field in an attribute table or data source.
Definition
qgsfield.h:56
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:267
QgsVectorLayerEditBuffer
Stores queued vector layer edit operations prior to committing changes to the layer's data provider.
Definition
qgsvectorlayereditbuffer.h:39
QgsVectorLayerUndoCommandAddAttribute::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:326
QgsVectorLayerUndoCommandAddAttribute::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:315
QgsVectorLayerUndoCommandAddAttribute::QgsVectorLayerUndoCommandAddAttribute
QgsVectorLayerUndoCommandAddAttribute(QgsVectorLayerEditBuffer *buffer, const QgsField &field)
Constructor for QgsVectorLayerUndoCommandAddAttribute.
Definition
qgsvectorlayerundocommand.cpp:304
QgsVectorLayerUndoCommandAddFeature::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:43
QgsVectorLayerUndoCommandAddFeature::QgsVectorLayerUndoCommandAddFeature
QgsVectorLayerUndoCommandAddFeature(QgsVectorLayerEditBuffer *buffer, QgsFeature &f)
Constructor for QgsVectorLayerUndoCommandAddFeature.
Definition
qgsvectorlayerundocommand.cpp:25
QgsVectorLayerUndoCommandAddFeature::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:54
QgsVectorLayerUndoCommandChangeAttribute::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:280
QgsVectorLayerUndoCommandChangeAttribute::QgsVectorLayerUndoCommandChangeAttribute
QgsVectorLayerUndoCommandChangeAttribute(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid, int fieldIndex, const QVariant &newValue, const QVariant &oldValue)
Constructor for QgsVectorLayerUndoCommandChangeAttribute.
Definition
qgsvectorlayerundocommand.cpp:190
QgsVectorLayerUndoCommandChangeAttribute::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:233
QgsVectorLayerUndoCommandChangeGeometry::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:140
QgsVectorLayerUndoCommandChangeGeometry::id
int id() const override
Definition
qgsvectorlayerundocommand.h:129
QgsVectorLayerUndoCommandChangeGeometry::QgsVectorLayerUndoCommandChangeGeometry
QgsVectorLayerUndoCommandChangeGeometry(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid, const QgsGeometry &newGeom)
Constructor for QgsVectorLayerUndoCommandChangeGeometry.
Definition
qgsvectorlayerundocommand.cpp:104
QgsVectorLayerUndoCommandChangeGeometry::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:173
QgsVectorLayerUndoCommandDeleteAttribute::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:373
QgsVectorLayerUndoCommandDeleteAttribute::QgsVectorLayerUndoCommandDeleteAttribute
QgsVectorLayerUndoCommandDeleteAttribute(QgsVectorLayerEditBuffer *buffer, int fieldIndex)
Constructor for QgsVectorLayerUndoCommandDeleteAttribute.
Definition
qgsvectorlayerundocommand.cpp:336
QgsVectorLayerUndoCommandDeleteAttribute::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:416
QgsVectorLayerUndoCommandDeleteFeature::QgsVectorLayerUndoCommandDeleteFeature
QgsVectorLayerUndoCommandDeleteFeature(QgsVectorLayerEditBuffer *buffer, QgsFeatureId fid)
Constructor for QgsVectorLayerUndoCommandDeleteFeature.
Definition
qgsvectorlayerundocommand.cpp:62
QgsVectorLayerUndoCommandDeleteFeature::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:89
QgsVectorLayerUndoCommandDeleteFeature::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:75
QgsVectorLayerUndoCommandRenameAttribute::redo
void redo() override
Definition
qgsvectorlayerundocommand.cpp:462
QgsVectorLayerUndoCommandRenameAttribute::QgsVectorLayerUndoCommandRenameAttribute
QgsVectorLayerUndoCommandRenameAttribute(QgsVectorLayerEditBuffer *buffer, int fieldIndex, const QString &newName)
Constructor for QgsVectorLayerUndoCommandRenameAttribute.
Definition
qgsvectorlayerundocommand.cpp:435
QgsVectorLayerUndoCommandRenameAttribute::undo
void undo() override
Definition
qgsvectorlayerundocommand.cpp:447
QgsVectorLayerUndoCommand::layer
QgsVectorLayer * layer()
Returns the layer associated with the undo command.
Definition
qgsvectorlayerundocommand.h:51
QgsVectorLayerUndoCommand::id
int id() const override
Definition
qgsvectorlayerundocommand.h:53
QgsVectorLayerUndoCommand::mergeWith
bool mergeWith(const QUndoCommand *) override
Definition
qgsvectorlayerundocommand.h:54
QgsVectorLayerUndoCommand::QgsVectorLayerUndoCommand
QgsVectorLayerUndoCommand(QgsVectorLayerEditBuffer *buffer)
Constructor for QgsVectorLayerUndoCommand.
Definition
qgsvectorlayerundocommand.h:46
QgsVectorLayerUndoCommand::mBuffer
QgsVectorLayerEditBuffer * mBuffer
Associated edit buffer.
Definition
qgsvectorlayerundocommand.h:58
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgsfeature.h
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:32
qgsfields.h
qgsvectorlayereditbuffer.h
Generated on
for QGIS API Documentation by
1.17.0