All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ChangePropertyCommand.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file ChangePropertyCommand.h
22 
23  \brief Undo/Redo for changes in component properties.
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_CHANGE_PROPERTY_COMMAND_ITEM_H
29 #define __TERRALIB_LAYOUT_INTERNAL_CHANGE_PROPERTY_COMMAND_ITEM_H
30 
31 // TerraLib
32 #include "../../../../core/Config.h"
33 
34 // STL
35 #include <vector>
36 
37 // Qt
38 #include <QUndoCommand>
39 
40 class QGraphicsItem;
41 
42 namespace te
43 {
44  namespace layout
45  {
46  class Properties;
47  class PropertiesOutside;
48 
49  /*!
50  \brief Undo/Redo for changes in component properties.
51 
52  \ingroup layout
53  */
54  class TELAYOUTEXPORT ChangePropertyCommand : public QUndoCommand
55  {
56  public:
57 
58  /*!
59  \brief Constructor
60 
61  \param item
62  \param oldProperties
63  \param newProperties
64  \param outside
65  \param parent
66  */
67  ChangePropertyCommand( QGraphicsItem* item, Properties* oldProperties,
68  Properties* newProperties, PropertiesOutside* outside = 0, QUndoCommand *parent = 0 );
69 
70  /*!
71  \brief Constructor
72 
73  \param items
74  \param oldProperties
75  \param newProperties
76  \param outside
77  \param parent
78  */
79  ChangePropertyCommand( std::vector<QGraphicsItem*> items, std::vector<Properties*> allOld,
80  std::vector<Properties*> allNew, PropertiesOutside* outside = 0, QUndoCommand *parent = 0 );
81 
82  /*!
83  \brief Destructor. Delete all properties.
84  */
85  virtual ~ChangePropertyCommand();
86 
87  /*!
88  \brief Reimplemented from QUndoCommand
89  */
90  virtual void undo();
91 
92  /*!
93  \brief Reimplemented from QUndoCommand
94  */
95  virtual void redo();
96 
97  protected:
98 
99  virtual QString createCommandString(QGraphicsItem* item);
100 
101  virtual bool equals(Properties* props1, Properties* props2);
102 
103  virtual bool checkItem(QGraphicsItem* item, Properties* props);
104 
105  virtual bool checkVectors();
106 
107  QGraphicsItem* m_item;
111  std::vector<QGraphicsItem*> m_items;
112  std::vector<Properties*> m_allOldProperties;
113  std::vector<Properties*> m_allNewProperties;
114  };
115  }
116 }
117 
118 #endif
Properties tree for any item, MVC component, using Qt for presentation and editing.
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
std::vector< Properties * > m_allOldProperties
std::vector< Properties * > m_allNewProperties
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Definition: Properties.h:52
std::vector< QGraphicsItem * > m_items
Undo/Redo for changes in component properties.