00001 #include <pcl/apps/cloud_composer/qt.h> 00002 #include <pcl/apps/cloud_composer/items/cloud_composer_item.h> 00003 00004 00005 00006 00007 pcl::cloud_composer::CloudComposerItem::CloudComposerItem (QString name) 00008 : QStandardItem(name) 00009 { 00010 //Set up the properties, store pointer locally for convenience 00011 properties_ = new PropertiesModel (this); 00012 00013 QString item_id = name + QString ("%1").arg ((long)this); 00014 00015 00016 this->setData (QVariant::fromValue (properties_), ItemDataRole::PROPERTIES); 00017 this->setData (QVariant (item_id), ItemDataRole::ITEM_ID); 00018 00019 this->setForeground (QBrush (Qt::black)); 00020 00021 } 00022 00023 00024 pcl::cloud_composer::CloudComposerItem::~CloudComposerItem () 00025 { 00026 properties_->deleteLater (); 00027 qDebug () << "Cloud Composer Item Destructor"; 00028 } 00029 00030 pcl::cloud_composer::CloudComposerItem* 00031 pcl::cloud_composer::CloudComposerItem::clone () const 00032 { 00033 CloudComposerItem* new_item = new CloudComposerItem (this->text ()); 00034 00035 PropertiesModel* new_item_properties = new_item->getPropertiesModel (); 00036 new_item_properties->copyProperties (properties_); 00037 00038 return new_item; 00039 } 00040 00041 QList <pcl::cloud_composer::CloudComposerItem*> 00042 pcl::cloud_composer::CloudComposerItem::getChildren (CloudComposerItem::ItemType type) const 00043 { 00044 QList <CloudComposerItem*> items; 00045 for (int i = 0; i < this->rowCount (); ++i) 00046 { 00047 if ( this->child (i)->type () == type ) 00048 { 00049 items.append (dynamic_cast <CloudComposerItem*> (this->child (i))); 00050 } 00051 } 00052 00053 return items; 00054 } 00055 00056 void 00057 pcl::cloud_composer::CloudComposerItem::addChild (CloudComposerItem *item_arg) 00058 { 00059 this->appendRow (item_arg); 00060 } 00061 00062 void 00063 pcl::cloud_composer::CloudComposerItem::paintView (boost::shared_ptr<pcl::visualization::PCLVisualizer> vis) const 00064 { 00065 qDebug () << "Paint View in Cloud Composer Item - doing nothing"; 00066 } 00067 00068 void 00069 pcl::cloud_composer::CloudComposerItem::removeFromView (boost::shared_ptr<pcl::visualization::PCLVisualizer> vis) const 00070 { 00071 qDebug () << "Remove from View in Cloud Composer Item - doing nothing"; 00072 } 00073 00074 QMap <QString, QWidget*> 00075 pcl::cloud_composer::CloudComposerItem::getInspectorTabs () 00076 { 00077 return QMap <QString, QWidget*> (); 00078 } 00079 00080 /* 00081 template <typename CloudPtrT> 00082 CloudPtrT 00083 pcl::cloud_composer::CloudComposerItem::getCloudPtr () const 00084 { 00085 QVariant cloud_variant = this->data (CLOUD); 00086 // Get Extract the pointer from the cloud contained in this item, if the type can't be converted, default-constructed value is returned 00087 CloudPtrT ptr; 00088 if (cloud_variant.canConvert <CloudPtrT> ()) 00089 ptr = cloud_variant.value <CloudPtrT> (); 00090 else 00091 qCritical () << "Requested Cloud of incorrect type from "<<this->text ()<<" correct type is "<<cloud_variant.typeName(); 00092 00093 return ptr; 00094 } 00095 */ 00096 00097