void displayEuclideanClusters (const pcl::PointCloud<PointT>::CloudVectorType &clusters, boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer) { char name[1024]; unsigned char red [6] = {255, 0, 0, 255, 255, 0}; unsigned char grn [6] = { 0, 255, 0, 255, 0, 255}; unsigned char blu [6] = { 0, 0, 255, 0, 255, 255}; for (size_t i = 0; i < clusters.size (); i++) { sprintf (name, "cluster_%d" , int (i)); pcl::visualization::PointCloudColorHandlerCustom<PointT> color0(boost::make_shared<pcl::PointCloud<PointT> >(clusters[i]),red[i%6],grn[i%6],blu[i%6]); if (!viewer->updatePointCloud (boost::make_shared<pcl::PointCloud<PointT> >(clusters[i]),color0,name)) viewer->addPointCloud (boost::make_shared<pcl::PointCloud<PointT> >(clusters[i]),color0,name); viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, name); viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_OPACITY, 0.3, name); } }
void MainWindow::createActions() { openAct = new QAction("&Open", this); connect(openAct, SIGNAL(triggered()), this, SLOT(openAndReadFile())); exitAct = new QAction("E&xit", this); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction("&About", this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); statAct = new QAction("&Stat", this); connect(statAct, SIGNAL(triggered()), this, SLOT(showStat())); resetAct = new QAction("&Reset position", this); resetAct->setStatusTip("Reset the position"); connect(resetAct, SIGNAL(triggered()), this, SLOT(reset())); reseteffectAct = new QAction("&Reset", this); reseteffectAct->setStatusTip("Reset all material"); connect(reseteffectAct, SIGNAL(triggered()), this, SLOT(reseteffect())); //ANIMATION----------------------------------------------------- animationShownAct = new QAction("&Shown", this); animationShownAct->setStatusTip("Show animation"); animationShownAct->setCheckable(true); connect(animationShownAct, SIGNAL(triggered()), this, SLOT(showAnimation())); animationHiddenAct = new QAction("&Hidden", this); animationHiddenAct->setStatusTip("Hide animation"); animationHiddenAct->setCheckable(true); connect(animationHiddenAct, SIGNAL(triggered()), this, SLOT(hideAnimation())); animationGroup = new QActionGroup(this); animationGroup->addAction(animationShownAct); animationGroup->addAction(animationHiddenAct); animationHiddenAct->setChecked(true); //COLOR----------------------------------------------------- color0Act = new QAction("&No light",this); color0Act->setStatusTip("No light"); color0Act->setCheckable(true); connect(color0Act, SIGNAL(triggered()), this, SLOT(color0())); color1Act = new QAction("&Red",this); color1Act->setStatusTip("Red"); color1Act->setCheckable(true); connect(color1Act, SIGNAL(triggered()), this, SLOT(color1())); color2Act = new QAction("&Green",this); color2Act->setStatusTip("Green"); color2Act->setCheckable(true); connect(color2Act, SIGNAL(triggered()), this, SLOT(color2())); color3Act = new QAction("&Blue",this); color3Act->setStatusTip("Blue"); color3Act->setCheckable(true); connect(color3Act, SIGNAL(triggered()), this, SLOT(color3())); color10Act = new QAction("&White",this); color10Act->setStatusTip("White"); color10Act->setCheckable(true); connect(color10Act, SIGNAL(triggered()), this, SLOT(color10())); colorGroup = new QActionGroup(this); colorGroup->addAction(color0Act); colorGroup->addAction(color1Act); colorGroup->addAction(color2Act); colorGroup->addAction(color3Act); colorGroup->addAction(color10Act); color10Act->setChecked(true); //EFFECT----------------------------------------------------- effect0Act = new QAction("&No effect",this); effect0Act->setStatusTip("No effect"); effect0Act->setCheckable(true); connect(effect0Act, SIGNAL(triggered()), this, SLOT(effect0())); effect1Act = new QAction("&Ambient",this); effect1Act->setStatusTip("Ambient"); effect1Act->setCheckable(true); connect(effect1Act, SIGNAL(triggered()), this, SLOT(effect1())); effect2Act = new QAction("&Diffuse",this); effect2Act->setStatusTip("Diffuse"); effect2Act->setCheckable(true); connect(effect2Act, SIGNAL(triggered()), this, SLOT(effect2())); effect10Act = new QAction("&All",this); effect10Act->setStatusTip("All effect"); effect10Act->setCheckable(true); connect(effect10Act, SIGNAL(triggered()), this, SLOT(effect10())); effectGroup = new QActionGroup(this); effectGroup->addAction(effect0Act); effectGroup->addAction(effect1Act); effectGroup->addAction(effect2Act); effectGroup->addAction(effect10Act); effect10Act->setChecked(true); //AMBIENT----------------------------------------------------- ambient0Act = new QAction("&No Ambient",this); ambient0Act->setStatusTip("No Ambient"); ambient0Act->setCheckable(true); connect(ambient0Act, SIGNAL(triggered()), this, SLOT(ambient0())); ambient1Act = new QAction("&Ambient",this); ambient1Act->setStatusTip("Ambient"); ambient1Act->setCheckable(true); connect(ambient1Act, SIGNAL(triggered()), this, SLOT(ambient1())); ambient2Act = new QAction("&Ambient Color",this); ambient2Act->setStatusTip("Ambient Color"); ambient2Act->setCheckable(true); connect(ambient2Act, SIGNAL(triggered()), this, SLOT(ambient2())); ambientGroup = new QActionGroup(this); ambientGroup->addAction(ambient0Act); ambientGroup->addAction(ambient1Act); ambientGroup->addAction(ambient2Act); ambient0Act->setChecked(true); //DIFFUSE----------------------------------------------------- diffuse0Act = new QAction("&No Diffuse",this); diffuse0Act->setStatusTip("No Diffuse"); diffuse0Act->setCheckable(true); connect(diffuse0Act, SIGNAL(triggered()), this, SLOT(diffuse0())); diffuse1Act = new QAction("&Diffuse",this); diffuse1Act->setStatusTip("Diffuse"); diffuse1Act->setCheckable(true); connect(diffuse1Act, SIGNAL(triggered()), this, SLOT(diffuse1())); diffuseGroup = new QActionGroup(this); diffuseGroup->addAction(diffuse0Act); diffuseGroup->addAction(diffuse1Act); diffuse0Act->setChecked(true); //SPECULAR----------------------------------------------------- specular0Act = new QAction("&No Specular",this); specular0Act->setStatusTip("No Specular"); specular0Act->setCheckable(true); connect(specular0Act, SIGNAL(triggered()), this, SLOT(specular0())); specular1Act = new QAction("&Specular",this); specular1Act->setStatusTip("Specular"); specular1Act->setCheckable(true); connect(specular1Act, SIGNAL(triggered()), this, SLOT(specular1())); specularGroup = new QActionGroup(this); specularGroup->addAction(specular0Act); specularGroup->addAction(specular1Act); specular0Act->setChecked(true); //SPECULAR----------------------------------------------------- shininess0Act = new QAction("&No Shininess",this); shininess0Act->setStatusTip("No Shininess"); shininess0Act->setCheckable(true); connect(shininess0Act, SIGNAL(triggered()), this, SLOT(shininess0())); shininess1Act = new QAction("&Low Shininess",this); shininess1Act->setStatusTip("Low Shininess"); shininess1Act->setCheckable(true); connect(shininess1Act, SIGNAL(triggered()), this, SLOT(shininess1())); shininess2Act = new QAction("&High Shininess",this); shininess2Act->setStatusTip("High Shininess"); shininess2Act->setCheckable(true); connect(shininess2Act, SIGNAL(triggered()), this, SLOT(shininess2())); shininessGroup = new QActionGroup(this); shininessGroup->addAction(shininess0Act); shininessGroup->addAction(shininess1Act); shininessGroup->addAction(shininess2Act); shininess0Act->setChecked(true); //EMISSION----------------------------------------------------- emission0Act = new QAction("&No Emission",this); emission0Act->setStatusTip("No Emission"); emission0Act->setCheckable(true); connect(emission0Act, SIGNAL(triggered()), this, SLOT(emission0())); emission1Act = new QAction("&Emission",this); emission1Act->setStatusTip("eEmission"); emission1Act->setCheckable(true); connect(emission1Act, SIGNAL(triggered()), this, SLOT(emission1())); emissionGroup = new QActionGroup(this); emissionGroup->addAction(emission0Act); emissionGroup->addAction(emission1Act); emission0Act->setChecked(true); //SHADING------------------------------------------------- shading0Act = new QAction("&No shading", this); shading0Act->setStatusTip("No shading"); shading0Act->setCheckable(true); connect(shading0Act, SIGNAL(triggered()), this, SLOT(shading0())); shading1Act = new QAction("&Flat shading", this); shading1Act->setStatusTip("Flat shading"); shading1Act->setCheckable(true); connect(shading1Act, SIGNAL(triggered()), this, SLOT(shading1())); shading2Act = new QAction("&Smooth shading", this); shading2Act->setStatusTip("Smooth shading"); shading2Act->setCheckable(true); connect(shading2Act, SIGNAL(triggered()), this, SLOT(shading2())); shadingGroup = new QActionGroup(this); shadingGroup->addAction(shading0Act); shadingGroup->addAction(shading1Act); shadingGroup->addAction(shading2Act); shading0Act->setChecked(true); //NORMAL---------------------------------------------------- normal0Act = new QAction("&No normal",this); normal0Act->setStatusTip("No normal"); normal0Act->setCheckable(true); connect(normal0Act, SIGNAL(triggered()), this, SLOT(normal0())); normal1Act = new QAction("&normal",this); normal1Act->setStatusTip("Has normal"); normal1Act->setCheckable(true); connect(normal1Act, SIGNAL(triggered()), this, SLOT(normal1())); normalGroup = new QActionGroup(this); normalGroup->addAction(normal0Act); normalGroup->addAction(normal1Act); normal0Act->setChecked(true); }