QGIS API Documentation
2.8.2-Wien
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
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 <QUndoCommand>
20
21
#include <QVariant>
22
#include <QSet>
23
#include <QList>
24
25
#include "
qgsfield.h
"
26
#include "
qgsfeature.h
"
27
28
class
QgsGeometry
;
29
class
QgsGeometryCache
;
30
31
#include "
qgsvectorlayer.h
"
32
#include "
qgsvectorlayereditbuffer.h
"
33
34
35
class
CORE_EXPORT
QgsVectorLayerUndoCommand
:
public
QUndoCommand
36
{
37
public
:
38
QgsVectorLayerUndoCommand
(
QgsVectorLayerEditBuffer
*buffer )
39
: QUndoCommand()
40
, mBuffer( buffer )
41
{}
42
inline
QgsVectorLayer
*
layer
() {
return
mBuffer->L; }
43
inline
QgsGeometryCache
*
cache
() {
return
mBuffer->L->cache(); }
44
45
virtual
int
id
()
const override
{
return
-1; }
46
virtual
bool
mergeWith
(
const
QUndoCommand * )
override
{
return
false
; }
47
48
protected
:
49
QgsVectorLayerEditBuffer
*
mBuffer
;
50
};
51
52
53
class
CORE_EXPORT
QgsVectorLayerUndoCommandAddFeature
:
public
QgsVectorLayerUndoCommand
54
{
55
public
:
56
QgsVectorLayerUndoCommandAddFeature
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeature
& f );
57
58
virtual
void
undo()
override
;
59
virtual
void
redo()
override
;
60
61
private
:
62
QgsFeature
mFeature;
63
};
64
65
66
class
CORE_EXPORT
QgsVectorLayerUndoCommandDeleteFeature
:
public
QgsVectorLayerUndoCommand
67
{
68
public
:
69
QgsVectorLayerUndoCommandDeleteFeature
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid );
70
71
virtual
void
undo()
override
;
72
virtual
void
redo()
override
;
73
74
private
:
75
QgsFeatureId
mFid;
76
QgsFeature
mOldAddedFeature;
77
};
78
79
80
class
CORE_EXPORT
QgsVectorLayerUndoCommandChangeGeometry
:
public
QgsVectorLayerUndoCommand
81
{
82
public
:
83
QgsVectorLayerUndoCommandChangeGeometry
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid,
QgsGeometry
* newGeom );
84
~
QgsVectorLayerUndoCommandChangeGeometry
();
85
86
virtual
void
undo()
override
;
87
virtual
void
redo()
override
;
88
virtual
int
id
()
const override
;
89
virtual
bool
mergeWith
(
const
QUndoCommand * )
override
;
90
91
private
:
92
QgsFeatureId
mFid;
93
QgsGeometry
* mOldGeom;
94
mutable
QgsGeometry
* mNewGeom;
95
};
96
97
98
class
CORE_EXPORT
QgsVectorLayerUndoCommandChangeAttribute
:
public
QgsVectorLayerUndoCommand
99
{
100
public
:
101
QgsVectorLayerUndoCommandChangeAttribute
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid,
int
fieldIndex,
const
QVariant &newValue,
const
QVariant &oldValue );
102
virtual
void
undo()
override
;
103
virtual
void
redo()
override
;
104
105
private
:
106
QgsFeatureId
mFid;
107
int
mFieldIndex;
108
QVariant mOldValue;
109
QVariant mNewValue;
110
bool
mFirstChange;
111
};
112
113
114
class
CORE_EXPORT
QgsVectorLayerUndoCommandAddAttribute
:
public
QgsVectorLayerUndoCommand
115
{
116
public
:
117
QgsVectorLayerUndoCommandAddAttribute
(
QgsVectorLayerEditBuffer
* buffer,
const
QgsField
& field );
118
119
virtual
void
undo()
override
;
120
virtual
void
redo()
override
;
121
122
private
:
123
QgsField
mField;
124
int
mFieldIndex;
125
};
126
127
128
class
CORE_EXPORT
QgsVectorLayerUndoCommandDeleteAttribute
:
public
QgsVectorLayerUndoCommand
129
{
130
public
:
131
QgsVectorLayerUndoCommandDeleteAttribute
(
QgsVectorLayerEditBuffer
* buffer,
int
fieldIndex );
132
133
virtual
void
undo()
override
;
134
virtual
void
redo()
override
;
135
136
private
:
137
int
mFieldIndex;
138
bool
mProviderField;
139
int
mOriginIndex;
140
QgsField
mOldField;
141
142
QMap<QgsFeatureId, QVariant> mDeletedValues;
143
};
144
145
146
#endif
Generated on Sun May 10 2015 16:33:25 for QGIS API Documentation by
1.8.1.2