project_model.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement  (BSD License)
00003  *
00004  *  Point Cloud Library  (PCL) - www.pointclouds.org
00005  *  Copyright  (c) 2012, Jeremie Papon.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Willow Garage, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  */
00037 
00038 #ifndef PROJECT_MODEL_H_
00039 #define PROJECT_MODEL_H_
00040 
00041 
00042 #include <vtkSmartPointer.h>
00043 #include <vtkCamera.h>
00044 
00045 #include <pcl/io/pcd_io.h>
00046 
00047 #include <pcl/apps/cloud_composer/commands.h>
00048 #include <pcl/apps/cloud_composer/qt.h>
00049 #include <pcl/apps/cloud_composer/point_selectors/selection_event.h> 
00050 #include <pcl/apps/cloud_composer/point_selectors/manipulation_event.h>
00051 #include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>
00052 
00053 class QItemSelectionModel;
00054 
00055 namespace pcl
00056 {
00057   namespace cloud_composer
00058   {
00059     class CloudCommand;
00060     class AbstractTool;
00061     class WorkQueue;
00062     class CloudComposerItem;
00063     class CloudView;
00064     class InteractorStyleSwitch;
00065     
00066     class ProjectModel : public QStandardItemModel
00067     {
00068         Q_OBJECT
00069 
00070       public:
00071         ProjectModel (QObject *parent = 0);
00072         ProjectModel (const ProjectModel& to_copy);
00073         virtual ~ProjectModel ();
00074         
00075         ProjectModel (QString project_name, QObject *parent = 0);
00076         
00077         inline const QString
00078         getName () { return horizontalHeaderItem (0)->text (); }
00079         
00080         inline QUndoStack*
00081         getUndoStack () { return undo_stack_; }
00082         
00084         void 
00085         setName (QString new_name);     
00086         
00088         inline QItemSelectionModel*
00089         getSelectionModel ()
00090         {
00091           return selection_model_;
00092         }
00093         
00094         
00095         
00097         void
00098         enqueueToolAction (AbstractTool* tool);
00099                
00101         void 
00102         insertNewCloudComposerItem (CloudComposerItem* new_item, QStandardItem* parent_item);
00103         
00105         void
00106         setCloudView (CloudView* view);
00107         
00109         void 
00110         setPointSelection (boost::shared_ptr<SelectionEvent> selected_event);
00111         
00113         void
00114         manipulateClouds (boost::shared_ptr<ManipulationEvent> manip_event);
00115       public slots:
00116         void 
00117         commandCompleted (CloudCommand* command);
00118         
00119         void
00120         clearSelection ();
00121         
00122         void 
00123         deleteSelectedItems ();
00124         
00126         void 
00127         insertNewCloudFromFile ();
00128         
00130         void 
00131         insertNewCloudFromRGBandDepth ();
00132         
00134         void 
00135         saveSelectedCloudToFile ();
00136         
00138         void
00139         emitAllStateSignals ();
00140         
00142         void
00143         setAxisVisibility (bool visible);
00144               
00146         void 
00147         mouseStyleChanged (QAction* new_style_action);
00148         
00150         void
00151         itemSelectionChanged ( const QItemSelection & selected, const QItemSelection & deselected );
00152         
00154         void 
00155         createNewCloudFromSelection ();
00156         
00158         void 
00159         selectAllItems (QStandardItem* item = 0 );
00160       signals:  
00161         void
00162         enqueueNewAction (AbstractTool* tool, ConstItemList data);
00163         
00165         void
00166         modelChanged ();
00167         
00168         void 
00169         axisVisible (const bool axis_visible);
00170         
00171         void
00172         deleteAvailable (bool can_delete);
00173         
00174         void
00175         newCloudFromSelectionAvailable (bool can_create);
00176         
00177         void
00178         mouseStyleState (interactor_styles::INTERACTOR_STYLES);
00179         
00180       private:
00182         bool
00183         onlyCloudItemsSelected ();
00184         
00185         QItemSelectionModel* selection_model_;
00186         QMap <QString, int> name_to_type_map_;
00187         QUndoStack* undo_stack_;
00188         WorkQueue* work_queue_; 
00189         QThread* work_thread_;
00190         CloudView* cloud_view_;
00191         
00193         QDir last_directory_;
00194                 
00195         //Variables for toggle action status
00196         bool axis_visible_;
00197         QMap <interactor_styles::INTERACTOR_STYLES, bool> selected_style_map_; 
00199         void
00200         setSelectedStyle (interactor_styles::INTERACTOR_STYLES style);
00201         
00203         boost::shared_ptr<SelectionEvent> selection_event_;
00205         QMap <CloudItem*, pcl::PointIndices::Ptr > selected_item_index_map_;
00206     };
00207   }
00208 }
00209 
00210 Q_DECLARE_METATYPE (pcl::cloud_composer::ProjectModel);
00211 Q_DECLARE_METATYPE (pcl::cloud_composer::interactor_styles::INTERACTOR_STYLES);
00212 
00213 #endif //PROJECT_MODEL_H
00214 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:31:34