ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccThicknessTool.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 <ecvColorTypes.h>
12 
13 #include "ccThickness.h"
14 #include "ccTool.h"
15 #include "ecvPlane.h"
16 
17 /*
18 Tool used to create thickness measurements in qCompass
19 */
20 class ccThicknessTool : public ccTool {
21 public:
23  virtual ~ccThicknessTool();
24 
25  // called when the tool is set to active (for initialization)
26  virtual void toolActivated() override;
27 
28  // called when the tool is set to disactive (for cleanup)
29  virtual void toolDisactivated() override;
30 
31  // called when the selection is changed while this tool is active
32  virtual void onNewSelection(
33  const ccHObject::Container& selectedEntities) override;
34 
35  // called when a point in a point cloud gets picked while this tool is
36  // active
37  virtual void pointPicked(ccHObject* insertPoint,
38  unsigned itemIdx,
39  ccHObject* pickedObject,
40  const CCVector3& P) override;
41 
42  // called when a point in a point cloud gets picked while this tool is
43  // active
44  void pointPicked(ccHObject* insertPoint,
45  unsigned itemIdx,
46  ccPointCloud* cloud,
47  const CCVector3& P) override;
48 
49  // called when "Return" or "Space" is pressed, or the "Accept Button" is
50  // clicked
51  void accept() override; // do nothing
52 
53  // called when the "Escape" is pressed, or the "Cancel" button is clicked
54  void cancel() override; // do nothing
55 protected:
56  ccPlane* m_referencePlane = nullptr; // plane used to calculate thickness
57  CCVector3* m_startPoint = nullptr; // first point used to calculate
58  // thickness in two-point mode
59  std::vector<int> m_hiddenObjects; // used to hide all point clouds (first),
60  // then all planes (second).
62  -1; // used to store partially completed lineation graphics
63 private:
64  float planeToPointDistance(
65  ccPlane* plane, CCVector3 P); // calculate point-to-plane distances
66  ccHObject* buildGraphic(CCVector3 endPoint,
67  float thickness); // build a "thickness" graphic
68 
69  // recurses children looking for point clouds & making them invisible
70  void recurseChildren(ccHObject* obj, bool hidePointClouds, bool hidePlanes);
71 
72  // gets the interior part of the currently selected GeoObject (or returns
73  // the insertPoint if it's not a GeoObject)
74  ccHObject* getInsertInterior(ccHObject* insertPoint);
75 
76 public:
78  static bool TWO_POINT_MODE; // if true, two points + planar orientation
79  // used to calculate thickness. If false, then
80  // point-to-plane distance is calculated for
81  // each point
82 };
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
Plane (primitive)
Definition: ecvPlane.h:18
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
virtual void onNewSelection(const ccHObject::Container &selectedEntities) override
virtual void toolActivated() override
std::vector< int > m_hiddenObjects
virtual void toolDisactivated() override
ccPlane * m_referencePlane
static ecvColor::Rgb ACTIVE_COLOR
static bool TWO_POINT_MODE
void cancel() override
virtual ~ccThicknessTool()
CCVector3 * m_startPoint
virtual void pointPicked(ccHObject *insertPoint, unsigned itemIdx, ccHObject *pickedObject, const CCVector3 &P) override
void accept() override
Definition: ccTool.h:18
RGB color structure.
Definition: ecvColorTypes.h:49