QGIS API Documentation
2.0.1-Dufour
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
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
{
return
-1; }
46
virtual
bool
mergeWith
( QUndoCommand * ) {
return
false
; }
47
48
protected
:
49
QgsVectorLayerEditBuffer
*
mBuffer
;
50
};
51
52
53
class
QgsVectorLayerUndoCommandAddFeature
:
public
QgsVectorLayerUndoCommand
54
{
55
public
:
56
QgsVectorLayerUndoCommandAddFeature
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeature
& f );
57
58
virtual
void
undo
();
59
virtual
void
redo
();
60
61
private
:
62
QgsFeature
mFeature
;
63
};
64
65
66
class
QgsVectorLayerUndoCommandDeleteFeature
:
public
QgsVectorLayerUndoCommand
67
{
68
public
:
69
QgsVectorLayerUndoCommandDeleteFeature
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid );
70
71
virtual
void
undo
();
72
virtual
void
redo
();
73
74
private
:
75
QgsFeatureId
mFid
;
76
QgsFeature
mOldAddedFeature
;
77
};
78
79
80
class
QgsVectorLayerUndoCommandChangeGeometry
:
public
QgsVectorLayerUndoCommand
81
{
82
public
:
83
QgsVectorLayerUndoCommandChangeGeometry
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid,
QgsGeometry
* newGeom );
84
~QgsVectorLayerUndoCommandChangeGeometry
();
85
86
virtual
void
undo
();
87
virtual
void
redo
();
88
virtual
int
id
()
const
;
89
virtual
bool
mergeWith
(
const
QUndoCommand * );
90
91
private
:
92
QgsFeatureId
mFid
;
93
QgsGeometry
*
mOldGeom
;
94
mutable
QgsGeometry
*
mNewGeom
;
95
};
96
97
98
class
QgsVectorLayerUndoCommandChangeAttribute
:
public
QgsVectorLayerUndoCommand
99
{
100
public
:
101
QgsVectorLayerUndoCommandChangeAttribute
(
QgsVectorLayerEditBuffer
* buffer,
QgsFeatureId
fid,
int
fieldIndex,
const
QVariant& newValue );
102
virtual
void
undo
();
103
virtual
void
redo
();
104
105
private
:
106
QgsFeatureId
mFid
;
107
int
mFieldIndex
;
108
QVariant
mOldValue
;
109
QVariant
mNewValue
;
110
bool
mFirstChange
;
111
};
112
113
114
class
QgsVectorLayerUndoCommandAddAttribute
:
public
QgsVectorLayerUndoCommand
115
{
116
public
:
117
QgsVectorLayerUndoCommandAddAttribute
(
QgsVectorLayerEditBuffer
* buffer,
const
QgsField
& field );
118
119
virtual
void
undo
();
120
virtual
void
redo
();
121
122
private
:
123
QgsField
mField
;
124
int
mFieldIndex
;
125
};
126
127
128
class
QgsVectorLayerUndoCommandDeleteAttribute
:
public
QgsVectorLayerUndoCommand
129
{
130
public
:
131
QgsVectorLayerUndoCommandDeleteAttribute
(
QgsVectorLayerEditBuffer
* buffer,
int
fieldIndex );
132
133
virtual
void
undo
();
134
virtual
void
redo
();
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 Tue Sep 24 2013 14:41:47 for QGIS API Documentation by
1.8.1.2