ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvScalarFieldArithmeticsDlg.h
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 #pragma once
9 
10 #include <ui_sfArithmeticsDlg.h>
11 
12 class ccPointCloud;
13 
16 class ccScalarFieldArithmeticsDlg : public QDialog,
17  public Ui::SFArithmeticsDlg {
18  Q_OBJECT
19 
20 public:
22  ccScalarFieldArithmeticsDlg(ccPointCloud* cloud, QWidget* parent = 0);
23 
25  enum Operation { /* Operations requiring two SFs */
26  PLUS = 0,
27  MINUS = 1,
28  MULTIPLY = 2,
29  DIVIDE = 3,
30  /* Operations requiring only one SF */
31  SQRT = 4,
32  POW2 = 5,
33  POW3 = 6,
34  EXP = 7,
35  LOG = 8,
36  LOG10 = 9,
37  COS = 10,
38  SIN = 11,
39  TAN = 12,
40  ACOS = 13,
41  ASIN = 14,
42  ATAN = 15,
43  INT = 16,
44  INVERSE = 17,
45  /* Invalid enum. (always last) */
46  INVALID = 255
47  };
48 
50  Operation getOperation() const;
51 
53  static Operation GetOperationByName(QString name);
54 
56  static QString GetOperationName(Operation op,
57  QString sf1,
58  QString sf2 = QString());
59 
61 
66  bool apply(ccPointCloud* cloud);
67 
69  struct SF2 {
70  SF2() : isConstantValue(true), constantValue(0), sfIndex(-1) {}
71 
73  double constantValue;
74  int sfIndex;
75  };
76 
78 
86  static bool Apply(ccPointCloud* cloud,
87  Operation op,
88  int sf1Idx,
89  bool inplace,
90  SF2* sf2 = 0,
91  QWidget* parent = 0);
92 
93 protected slots:
94 
96  void onOperationIndexChanged(int index);
97 
99  void onSF2IndexChanged(int index);
100 
101 protected:
103  int getSF1Index();
105  int getSF2Index();
106 
108  QString getOperationName(QString sf1, QString sf2 = QString()) const;
109 };
std::string name
#define slots
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
int getSF1Index()
Returns first selected SF index.
static Operation GetOperationByName(QString name)
Returns the operation enumerator based on its name.
Operation getOperation() const
Returns selected operation.
QString getOperationName(QString sf1, QString sf2=QString()) const
Returns selected operation name.
void onOperationIndexChanged(int index)
Called when the operation combo-box is modified.
int getSF2Index()
Returns second selected SF index.
static bool Apply(ccPointCloud *cloud, Operation op, int sf1Idx, bool inplace, SF2 *sf2=0, QWidget *parent=0)
Applies operation on a given cloud.
ccScalarFieldArithmeticsDlg(ccPointCloud *cloud, QWidget *parent=0)
Default constructor.
void onSF2IndexChanged(int index)
Called when the SF2 combo-box is modified.
bool apply(ccPointCloud *cloud)
Applies operation on a given cloud.
static QString GetOperationName(Operation op, QString sf1, QString sf2=QString())
Returns operation name.