deleteCommand.cpp
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 
00040 
00041 #include <pcl/apps/point_cloud_editor/deleteCommand.h>
00042 #include <pcl/apps/point_cloud_editor/copyBuffer.h>
00043 #include <pcl/apps/point_cloud_editor/selection.h>
00044 
00045 DeleteCommand::DeleteCommand (SelectionPtr selection_ptr,
00046                               CloudPtr cloud_ptr)
00047   : cloud_ptr_(cloud_ptr), selection_ptr_(selection_ptr), deleted_selection_(cloud_ptr) {}
00048 
00049 void
00050 DeleteCommand::execute ()
00051 {
00052   if (!cloud_ptr_)
00053     return;
00054   if (selection_ptr_->empty())
00055     return;
00056 
00057   // back up the points to be deleted
00058   deleted_selection_ = *selection_ptr_;
00059   deleted_cloud_buffer_.set(cloud_ptr_, deleted_selection_);
00060 
00061   // delete the points
00062   cloud_ptr_->remove(deleted_selection_);
00063 
00064   // The selection points to the incorrect points or may have indices out of
00065   // bounds, so we must clear it.
00066   selection_ptr_->clear();
00067 
00068   // notify the cloud that the selection has changed
00069   cloud_ptr_ -> setSelection(selection_ptr_);
00070 }
00071 
00072 void
00073 DeleteCommand::undo ()
00074 {
00075   if (!cloud_ptr_)
00076     return;
00077   cloud_ptr_->restore(deleted_cloud_buffer_, deleted_selection_);
00078 }
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:23:21