QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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"
33 
34 
35 class QgsVectorLayerUndoCommand : public QUndoCommand
36 {
37  public:
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:
50 };
51 
52 
54 {
55  public:
57 
58  virtual void undo();
59  virtual void redo();
60 
61  private:
63 };
64 
65 
67 {
68  public:
70 
71  virtual void undo();
72  virtual void redo();
73 
74  private:
77 };
78 
79 
81 {
82  public:
85 
86  virtual void undo();
87  virtual void redo();
88  virtual int id() const;
89  virtual bool mergeWith( const QUndoCommand * );
90 
91  private:
95 };
96 
97 
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:
108  QVariant mOldValue;
109  QVariant mNewValue;
111 };
112 
113 
115 {
116  public:
118 
119  virtual void undo();
120  virtual void redo();
121 
122  private:
125 };
126 
127 
129 {
130  public:
132 
133  virtual void undo();
134  virtual void redo();
135 
136  private:
141 
142  QMap<QgsFeatureId, QVariant> mDeletedValues;
143 };
144 
145 
146 #endif