Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef COMMANDS_H_
00039 #define COMMANDS_H_
00040
00041 #include <pcl/apps/cloud_composer/qt.h>
00042 #include <pcl/pcl_exports.h>
00043 #include <pcl/apps/cloud_composer/items/cloud_item.h>
00044
00045 namespace pcl
00046 {
00047 namespace cloud_composer
00048 {
00049 class AbstractTool;
00050 class ProjectModel;
00051 struct OutputPair
00052 {
00053 QList <const CloudComposerItem*> input_items_;
00054 QList <CloudComposerItem*> output_items_;
00055 };
00056
00057
00058
00059 class PCL_EXPORTS CloudCommand : public QUndoCommand
00060 {
00061 public:
00062 CloudCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00063
00064 virtual
00065 ~CloudCommand ();
00066
00067 virtual bool
00068 runCommand (AbstractTool* tool) = 0;
00069
00070 virtual void
00071 undo () = 0;
00072
00073 virtual void
00074 redo () = 0;
00075
00076
00077
00078
00079 void
00080 setProjectModel (ProjectModel* model);
00081
00082 inline void
00083 setInputData (ConstItemList input_data)
00084 {
00085 original_data_ = input_data;
00086 }
00087 protected:
00092 bool
00093 replaceOriginalWithNew (QList <const CloudComposerItem*> originals, QList <CloudComposerItem*> new_items);
00094
00096 bool
00097 restoreOriginalRemoveNew (QList <const CloudComposerItem*> originals, QList <CloudComposerItem*> new_items);
00098
00099 ConstItemList original_data_;
00100
00101 QMap <QStandardItem*, QStandardItem*> removed_to_parent_map_;
00102 QList <OutputPair> output_data_;
00103 ProjectModel* project_model_;
00104
00110 bool last_was_undo_;
00111
00115 bool
00116 canUseTemplates (ConstItemList &input_data);
00117
00118 bool can_use_templates_;
00119 int template_type_;
00120 };
00121
00122 class PCL_EXPORTS ModifyItemCommand : public CloudCommand
00123 {
00124 public:
00125 ModifyItemCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00126
00127 virtual bool
00128 runCommand (AbstractTool* tool);
00129
00130 virtual void
00131 undo ();
00132
00133 virtual void
00134 redo ();
00135 private:
00136
00137
00138
00139 };
00140
00141 class PCL_EXPORTS NewItemCloudCommand : public CloudCommand
00142 {
00143 public:
00144 NewItemCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00145
00146 virtual bool
00147 runCommand (AbstractTool* tool);
00148
00149 virtual void
00150 undo ();
00151
00152 virtual void
00153 redo ();
00154
00155 };
00156
00157
00158 class PCL_EXPORTS SplitCloudCommand : public CloudCommand
00159 {
00160 public:
00161 SplitCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00162
00163 virtual bool
00164 runCommand (AbstractTool* tool);
00165
00166 virtual void
00167 undo ();
00168
00169 virtual void
00170 redo ();
00171 private:
00172
00173 };
00174
00175 class PCL_EXPORTS DeleteItemCommand : public CloudCommand
00176 {
00177 public:
00178 DeleteItemCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00179
00180 virtual bool
00181 runCommand (AbstractTool* tool);
00182
00183 virtual void
00184 undo ();
00185
00186 virtual void
00187 redo ();
00188 private:
00189 };
00190
00191 class PCL_EXPORTS MergeCloudCommand : public CloudCommand
00192 {
00193 public:
00198 MergeCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0);
00199
00200 virtual bool
00201 runCommand (AbstractTool* tool);
00202
00203 virtual void
00204 undo ();
00205
00206 virtual void
00207 redo ();
00208
00209 inline void
00210 setSelectedIndicesMap( const QMap <CloudItem*, pcl::PointIndices::Ptr > selected_item_index_map)
00211 {
00212 selected_item_index_map_ = selected_item_index_map;
00213 }
00214
00215 private:
00216 QMap <CloudItem*, pcl::PointIndices::Ptr > selected_item_index_map_;
00217 };
00218 }
00219 }
00220
00221 Q_DECLARE_METATYPE (ConstItemList);
00222 #endif //COMMANDS_H_