ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvOrderChoiceDlg.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "ecvOrderChoiceDlg.h"
9 
10 // common
11 #include <ecvQtHelpers.h>
12 
13 // ECV_PLUGINS
14 #include <ecvMainAppInterface.h>
15 
16 // CV_DB_LIB
17 #include <ecvDisplayTools.h>
18 #include <ecvHObject.h>
19 
20 // QT
21 #include <QMainWindow>
22 
23 // ui template
24 #include <ui_roleChoiceDlg.h>
25 
27  QString firstRole,
28  ccHObject* secondEntity,
29  QString secondRole,
30  ecvMainAppInterface* app /*=0*/)
31  : QDialog(app ? app->getMainWindow() : 0, Qt::Tool),
32  m_gui(new Ui_RoleChoiceDialog),
33  m_app(app),
34  m_firstEnt(firstEntity),
35  m_secondEnt(secondEntity),
36  m_useInputOrder(true) {
37  m_gui->setupUi(this);
38 
39  connect(m_gui->swapButton, &QAbstractButton::clicked, this,
41 
42  m_gui->firstlabel->setText(firstRole);
43  m_gui->secondlabel->setText(secondRole);
44 
45  ccQtHelpers::SetButtonColor(m_gui->firstColorButton, Qt::red);
46  ccQtHelpers::SetButtonColor(m_gui->secondColorButton, Qt::yellow);
47 
49 }
50 
52  if (m_firstEnt) {
54  // m_firstEnt->prepareDisplayForRefresh_recursive();
55  }
56  if (m_secondEnt) {
58  // m_secondEnt->prepareDisplayForRefresh_recursive();
59  }
60 
61  if (m_app) {
63  m_app->refreshAll();
64  }
65 
66  if (m_gui) {
67  delete m_gui;
68  m_gui = 0;
69  }
70 }
71 
74 }
75 
78 }
79 
81  ccHObject* o1 = getFirstEntity();
82  if (o1) {
83  m_gui->firstLineEdit->setText(o1->getName());
84  o1->setEnabled(true);
85  o1->setVisible(true);
87  // o1->prepareDisplayForRefresh_recursive();
88  } else {
89  m_gui->firstLineEdit->setText("No entity!");
90  }
91 
92  ccHObject* o2 = getSecondEntity();
93  if (o2) {
94  m_gui->secondLineEdit->setText(o2->getName());
95  o2->setEnabled(true);
96  o2->setVisible(true);
98  // o2->prepareDisplayForRefresh_recursive();
99  } else {
100  m_gui->secondLineEdit->setText("No entity!");
101  }
102 
103  if (m_app) {
105  m_app->refreshAll();
106  }
107 }
108 
112 }
virtual void setTempColor(const ecvColor::Rgb &col, bool autoActivate=true)
Sets current temporary (unique)
virtual void setVisible(bool state)
Sets entity visibility.
virtual void enableTempColor(bool state)
Set temporary color activation state.
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
virtual QString getName() const
Returns object name.
Definition: ecvObject.h:72
virtual void setEnabled(bool state)
Sets the "enabled" property.
Definition: ecvObject.h:102
ccHObject * getSecondEntity()
Returns the second entity (new order)
ccHObject * m_firstEnt
ecvMainAppInterface * m_app
ccOrderChoiceDlg(ccHObject *firstEntity, QString firstRole, ccHObject *secondEntity, QString secondRole, ecvMainAppInterface *app=0)
Default constructor.
void swap()
Swaps the entities.
ccHObject * getFirstEntity()
Returns the first entity (new order)
void setColorsAndLabels()
Sets the right colors to the entities and updates the dialog.
ccHObject * m_secondEnt
Ui_RoleChoiceDialog * m_gui
virtual ~ccOrderChoiceDlg()
Destructor.
static void SetButtonColor(QAbstractButton *button, const QColor &col)
Sets a button background color.
Definition: ecvQtHelpers.h:17
static void SetRedrawRecursive(bool redraw=false)
Main application interface (for plugins)
virtual void refreshAll(bool only2D=false, bool forceRedraw=true)=0
Redraws all GL windows that have the 'refresh' flag on.
constexpr Rgb red(MAX, 0, 0)
constexpr Rgb yellow(MAX, MAX, 0)