ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvProtractorTool.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 
11 #include "ui_cvProtractorToolDlg.h"
12 
13 // Forward declarations for VTK classes
15 
16 // Include the custom constrained widgets and representations
19 
21  Q_OBJECT
22 
23 public:
24  explicit cvProtractorTool(QWidget* parent = nullptr);
25  ~cvProtractorTool() override;
26 
27  virtual void start() override;
28  virtual void reset() override;
29  virtual void showWidget(bool state) override;
30  virtual ccHObject* getOutput() override;
31 
32  virtual double getMeasurementValue() const override;
33  virtual void getPoint1(double pos[3]) const override;
34  virtual void getPoint2(double pos[3]) const override;
35  virtual void getCenter(double pos[3]) const override;
36  virtual void setPoint1(double pos[3]) override;
37  virtual void setPoint2(double pos[3]) override;
38  virtual void setCenter(double pos[3]) override;
39  virtual void setColor(double r, double g, double b) override;
40  virtual bool getColor(double& r, double& g, double& b) const override;
41  virtual void lockInteraction() override;
42  virtual void unlockInteraction() override;
43  virtual void setInstanceLabel(const QString& label) override;
44  // Font property setters are now implemented in base class
45  // Only applyFontProperties() needs to be overridden
46 
47 protected:
48  virtual void initTool() override;
49  virtual void createUi() override;
50  virtual void setupPointPickingShortcuts(QWidget* vtkWidget) override;
51 
52 private slots:
54  void pickKeyboardPoint1(double x, double y, double z);
55  void pickKeyboardCenter(double x, double y, double z);
56  void pickKeyboardPoint2(double x, double y, double z);
57 
58  void on_point1XSpinBox_valueChanged(double arg1);
59  void on_point1YSpinBox_valueChanged(double arg1);
60  void on_point1ZSpinBox_valueChanged(double arg1);
61  void on_centerXSpinBox_valueChanged(double arg1);
62  void on_centerYSpinBox_valueChanged(double arg1);
63  void on_centerZSpinBox_valueChanged(double arg1);
64  void on_point2XSpinBox_valueChanged(double arg1);
65  void on_point2YSpinBox_valueChanged(double arg1);
66  void on_point2ZSpinBox_valueChanged(double arg1);
67  void onAngleChanged(double angle);
68  void onWorldPoint1Changed(double* pos);
69  void onWorldPoint2Changed(double* pos);
70  void onWorldCenterChanged(double* pos);
71  void on_pickPoint1_toggled(bool checked);
72  void on_pickCenter_toggled(bool checked);
73  void on_pickPoint2_toggled(bool checked);
74  void on_widgetVisibilityCheckBox_toggled(bool checked);
75  void on_arcVisibilityCheckBox_toggled(bool checked);
76 
77 private:
78  void hookWidget(const vtkSmartPointer<cvConstrainedPolyLineWidget>& widget);
79  void updateAngleDisplay();
80 
82  void applyTextPropertiesToLabel();
83 
84  Ui::ProtractorToolDlg* m_configUi = nullptr;
86  m_widget; // Using PolyLineWidget (100% ParaView consistency)
88  m_rep; // PolyLine with 3 handles for angle measurement
89 
91  double m_currentColor[3] = {0.0, 1.0, 0.0}; // Default green
92 
94  QString m_instanceLabel;
95 
98  void applyFontProperties() override;
99 };
#define slots
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
Extended PolyLineRepresentation adding angle display functionality.
virtual void getPoint1(double pos[3]) const override
Get point 1 coordinates.
virtual void setupPointPickingShortcuts(QWidget *vtkWidget) override
virtual double getMeasurementValue() const override
Get measurement value (distance or angle)
virtual void lockInteraction() override
Lock tool interaction (disable VTK widget interaction and UI controls)
virtual void getCenter(double pos[3]) const override
Get center point coordinates (for angle/protractor)
cvProtractorTool(QWidget *parent=nullptr)
~cvProtractorTool() override
virtual void setPoint2(double pos[3]) override
Set point 2 coordinates.
virtual void initTool() override
virtual void start() override
virtual void setPoint1(double pos[3]) override
Set point 1 coordinates.
virtual void setInstanceLabel(const QString &label) override
Set instance label suffix (e.g., "#1", "#2") for display in 3D view.
virtual void setColor(double r, double g, double b) override
Set measurement color (RGB values in range [0.0, 1.0])
virtual void reset() override
virtual void createUi() override
virtual void unlockInteraction() override
Unlock tool interaction (enable VTK widget interaction and UI controls)
virtual void getPoint2(double pos[3]) const override
Get point 2 coordinates.
virtual bool getColor(double &r, double &g, double &b) const override
virtual ccHObject * getOutput() override
virtual void setCenter(double pos[3]) override
Set center point coordinates (for angle/protractor)
virtual void showWidget(bool state) override
normal_z y
normal_z x
normal_z z