Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsvectorlayerundocommand.h
Go to the documentation of this file.
1 
2 #ifndef QGSVECTORLAYERUNDOCOMMAND_H
3 #define QGSVECTORLAYERUNDOCOMMAND_H
4 
5 #include <QUndoCommand>
6 
7 #include <QVariant>
8 #include <QSet>
9 #include <QList>
10 
11 #include "qgsfield.h"
12 #include "qgsfeature.h"
13 
14 class QgsGeometry;
16 
17 
18 // TODO: copied from qgsvectorlayer.h
19 typedef QList<int> QgsAttributeList;
20 typedef QSet<int> QgsFeatureIds;
21 typedef QSet<int> QgsAttributeIds;
22 
23 
24 
28 class QgsUndoCommand : public QUndoCommand
29 {
30  public:
31 
34  {
35  public:
37  QVariant original;
38  QVariant target;
39  };
40 
41  typedef QMap<int, AttributeChangeEntry> AttributeChanges;
42 
45  {
46  public:
49 
50  void setOriginalGeometry( QgsGeometry& orig );
52 
55  };
56 
57 
58  QgsUndoCommand( QgsVectorLayer* layer, QString text );
59 
63  void undo();
64 
68  void redo();
69 
76  void storeGeometryChange( int featureId, QgsGeometry& original, QgsGeometry& target );
77 
86  void storeAttributeChange( int featureId, int field, QVariant original, QVariant target, bool isFirstChange );
87 
92  void storeFeatureDelete( int featureId );
93 
98  void storeFeatureAdd( QgsFeature& feature );
99 
105  void storeAttributeAdd( int index, const QgsField & value );
106 
112  void storeAttributeDelete( int index, const QgsField & orig );
113 
114  private:
116  bool mFirstRun;
117 
120 
122  QMap<int, GeometryChangeEntry> mGeometryChange;
123 
125  QMap<int, AttributeChanges> mAttributeChange;
126 
132 
135 
138 
143 
144  friend class QgsVectorLayer;
145 };
146 
147 #endif