From e093dfc08a30e59c3a499f6e4cfdb91d81353ab3 Mon Sep 17 00:00:00 2001 From: Tri-Thien TRUONG Date: Fri, 20 Mar 2020 16:52:31 +0100 Subject: [PATCH] ajout commentaires --- ColorimetricSegmenter.cpp | 11 ++++++++--- HSVDialog.cpp | 32 ++++++++++++++++++++++---------- HSVDialog.h | 8 +++++++- RgbDialog.cpp | 13 ++++++++++++- RgbDialog.h | 3 +++ 5 files changed, 52 insertions(+), 15 deletions(-) diff --git a/ColorimetricSegmenter.cpp b/ColorimetricSegmenter.cpp index b2506b1..d6bb727 100644 --- a/ColorimetricSegmenter.cpp +++ b/ColorimetricSegmenter.cpp @@ -21,9 +21,14 @@ #include "ColorimetricSegmenter.h" -// Default constructor: -// - pass the Qt resource path to the info.json file (from .qrc file) -// - constructor should mainly be used to initialize actions and other members +/* + Default constructor: + - pass the Qt resource path to the info.json file (from .qrc file) + - constructor should mainly be used to initialize actions and other members +*/ +/* + Class that will apply all the algorithm of our plugin +*/ ColorimetricSegmenter::ColorimetricSegmenter( QObject *parent ) : QObject( parent ) , ccStdPluginInterface( ":/CC/plugin/ColorimetricSegmenter/info.json" ) diff --git a/HSVDialog.cpp b/HSVDialog.cpp index 6e5285c..a849fbc 100644 --- a/HSVDialog.cpp +++ b/HSVDialog.cpp @@ -38,6 +38,9 @@ #include #include +/* + Constructor +*/ HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent) : QDialog(parent) , Ui::HSVDialog() @@ -51,12 +54,12 @@ HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent) //restore semi-persistent parameters - red_first->setValue(0); - green_first->setValue(0); - blue_first->setValue(0); + red->setValue(0); + green->setValue(0); + blue->setValue(0); //Link between Ui and actions - connect(pointPickingButton_first, &QCheckBox::toggled, this, &HSVDialog::pickPoint_first); + connect(pointPickingButton_first, &QCheckBox::toggled, this, &HSVDialog::pickPoint); //auto disable picking mode on quit connect(this, &QDialog::finished, [&]() @@ -66,7 +69,10 @@ HSVDialog::HSVDialog(ccPickingHub* pickingHub, QWidget* parent) ); } -void HSVDialog::pickPoint_first(bool state) +/* + Method for the picking point functionnality +*/ +void HSVDialog::pickPoint(bool state) { if (!m_pickingHub) { @@ -89,6 +95,9 @@ void HSVDialog::pickPoint_first(bool state) pointPickingButton_first->blockSignals(false); } +/* + Method applied after a point is picked by picking point functionnality +*/ void HSVDialog::onItemPicked(const PickedItem& pi) { assert(pi.entity); @@ -96,15 +105,14 @@ void HSVDialog::onItemPicked(const PickedItem& pi) if (pi.entity->isKindOf(CC_TYPES::POINT_CLOUD)) { - //Get RGB values of the picked point ccGenericPointCloud* cloud = static_cast(pi.entity); const ccColor::Rgb& rgb = cloud->getPointColor(pi.itemIndex); if (pointPickingButton_first->isChecked()) { - ccLog::Print("Point picked from first point picker"); - red_first->setValue(rgb.r); - green_first->setValue(rgb.g); - blue_first->setValue(rgb.b); + ccLog::Print("Point picked"); + red->setValue(rgb.r); + green->setValue(rgb.g); + blue->setValue(rgb.b); hsv hsv_first = rgb2hsv(rgb); hue_first->setValue(hsv_first.h); @@ -117,6 +125,10 @@ void HSVDialog::onItemPicked(const PickedItem& pi) } +/* + Method to convert from rgb values to hsv values + return : hsv struct +*/ hsv HSVDialog::rgb2hsv(ccColor::Rgb rgb) { hsv res; float r = rgb.r / 255.0f; diff --git a/HSVDialog.h b/HSVDialog.h index 2642e4d..ef5db29 100644 --- a/HSVDialog.h +++ b/HSVDialog.h @@ -31,12 +31,18 @@ class ccPlane; class ccHObject; class ccPickingHub; +/* + Struct for HSV +*/ typedef struct { double h; double s; double v; } hsv; +/* + Get the values of the HSV interface, and interactions +*/ class HSVDialog : public QDialog, public ccPickingListener, public Ui::HSVDialog { Q_OBJECT @@ -50,7 +56,7 @@ public: hsv rgb2hsv(ccColor::Rgb rgb); public slots: - void pickPoint_first(bool); + void pickPoint(bool); protected: //members diff --git a/RgbDialog.cpp b/RgbDialog.cpp index 41f69a2..53f431e 100644 --- a/RgbDialog.cpp +++ b/RgbDialog.cpp @@ -38,6 +38,9 @@ #include #include +/* + Constructor +*/ RgbDialog::RgbDialog(ccPickingHub* pickingHub, QWidget* parent) : QDialog(parent) , Ui::RgbDialog() @@ -63,6 +66,9 @@ RgbDialog::RgbDialog(ccPickingHub* pickingHub, QWidget* parent) ); } +/* + Method for the first picking point functionnality +*/ void RgbDialog::pickPoint_first(bool state) { if (!m_pickingHub) @@ -86,6 +92,9 @@ void RgbDialog::pickPoint_first(bool state) pointPickingButton_first->blockSignals(false); } +/* + Method for the second picking point functionnality +*/ void RgbDialog::pickPoint_second(bool state) { if (!m_pickingHub) @@ -109,7 +118,9 @@ void RgbDialog::pickPoint_second(bool state) pointPickingButton_second->blockSignals(false); } - +/* + Method applied after a point is picked by picking point functionnality +*/ void RgbDialog::onItemPicked(const PickedItem& pi) { assert(pi.entity); diff --git a/RgbDialog.h b/RgbDialog.h index 7d2942e..5b6b932 100644 --- a/RgbDialog.h +++ b/RgbDialog.h @@ -31,6 +31,9 @@ class ccPlane; class ccHObject; class ccPickingHub; +/* + Get the values of the RGB interface, and interactions +*/ class RgbDialog : public QDialog, public ccPickingListener, public Ui::RgbDialog { Q_OBJECT