ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccTraceTool.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 "ccTool.h"
11 #include "ccTrace.h"
12 
13 /*
14 Tool used to digitise traces
15 */
16 class ccTraceTool : public ccTool {
17 public:
18  ccTraceTool();
19  virtual ~ccTraceTool();
20 
21  // called when the tool is set to active (for initialization)
22  void toolActivated() override;
23 
24  // called when the tool is disactivated by a tool change or similar
25  void toolDisactivated() override;
26 
27  // called when a point in a point cloud gets picked while this tool is
28  // active
29  void pointPicked(ccHObject* insertPoint,
30  unsigned itemIdx,
31  ccPointCloud* cloud,
32  const CCVector3& P) override;
33 
34  // called when a new selection is made
35  void onNewSelection(const ccHObject::Container& selectedEntities) override;
36 
37  // called when "Return" or "Space" is pressed, or the "Accept Button" is
38  // clicked
39  void accept() override;
40 
41  // called when the "Escape" is pressed, or the "Cancel" button is clicked
42  void cancel() override;
43 
44  // if this returns true, the undo button is enabled in the gui
45  bool canUndo() override;
46 
47  // called when the undo button is clicked
48  void undo() override;
49 
50 protected:
51  // finishes and finalises the trace currently being digitised to
52  void finishCurrentTrace();
53  bool pickupTrace(
54  ccHObject* obj); // if obj is a ccTrace, it becomes the active
55  // trace. Returns true if succesfull
56 
57  // properties of the active trace
58  int m_trace_id =
59  -1; // active trace id (stored rather than a pointer to avoid dead
60  // pointers after users delete objects in the DB_Tree)
61  bool m_preExisting = false; // set to true when a trace is picked up from a
62  // selection (so we don't delete it on cancel).
63  bool m_changed = false; // becomes true if changes have been made. Used to
64  // update fit planes
65 
66  bool m_parentPlaneDeleted = false; // true if parent plane was deleted
67  bool m_childPlaneDeleted = false; // true if child plane was deleted
68 
70  true; // do we want to precompute gradient for cost function?
72  true; // do we want to precompute curvature for cost functions?
73 };
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
Definition: ecvHObject.h:337
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ccTool.h:18
bool m_precompute_gradient
Definition: ccTraceTool.h:69
void onNewSelection(const ccHObject::Container &selectedEntities) override
bool m_precompute_curvature
Definition: ccTraceTool.h:71
bool m_parentPlaneDeleted
Definition: ccTraceTool.h:66
void undo() override
void accept() override
bool m_changed
Definition: ccTraceTool.h:63
void toolDisactivated() override
Definition: ccTraceTool.cpp:26
bool pickupTrace(ccHObject *obj)
bool m_childPlaneDeleted
Definition: ccTraceTool.h:67
bool canUndo() override
virtual ~ccTraceTool()
Definition: ccTraceTool.cpp:18
void finishCurrentTrace()
bool m_preExisting
Definition: ccTraceTool.h:61
int m_trace_id
Definition: ccTraceTool.h:58
void toolActivated() override
Definition: ccTraceTool.cpp:21
void pointPicked(ccHObject *insertPoint, unsigned itemIdx, ccPointCloud *cloud, const CCVector3 &P) override
Definition: ccTraceTool.cpp:31
void cancel() override