ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvMeasurementToolsCommon.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 #ifndef CV_MEASUREMENT_TOOLS_COMMON_H
9 #define CV_MEASUREMENT_TOOLS_COMMON_H
10 
11 #include <vtkPointHandleRepresentation3D.h>
12 #include <vtkProperty.h>
13 
14 namespace cvMeasurementTools {
15 
16 // ParaView-style colors
17 constexpr double FOREGROUND_COLOR[3] = {1.0, 1.0,
18  1.0}; // White for normal state
19 constexpr double INTERACTION_COLOR[3] = {
20  0.0, 1.0, 0.0}; // Green for selected/interactive state
21 constexpr double RAY_COLOR[3] = {1.0, 0.0,
22  0.0}; // Red for angle rays (ParaView default)
23 constexpr double ARC_COLOR[3] = {
24  1.0, 0.1, 0.0}; // Orange-red for arc and text (ParaView default)
25 
30 inline void configureHandle3D(vtkPointHandleRepresentation3D* handle) {
31  if (!handle) return;
32 
33  // Set normal (foreground) color - white
34  if (auto* prop = handle->GetProperty()) {
35  prop->SetColor(FOREGROUND_COLOR[0], FOREGROUND_COLOR[1],
36  FOREGROUND_COLOR[2]);
37  }
38 
39  // Set selected (interaction) color - green
40  if (auto* selectedProp = handle->GetSelectedProperty()) {
41  selectedProp->SetColor(INTERACTION_COLOR[0], INTERACTION_COLOR[1],
43  }
44 
45  // Configure cursor appearance - show only the crosshair axes, no
46  // outline/shadows
47  handle->AllOff(); // Turn off outline and all shadows
48 
49  // Enable smooth motion and translation mode for better handle movement
50  handle->SmoothMotionOn();
51  handle->TranslationModeOn();
52 }
53 
54 } // namespace cvMeasurementTools
55 
56 #endif // CV_MEASUREMENT_TOOLS_COMMON_H
constexpr double FOREGROUND_COLOR[3]
void configureHandle3D(vtkPointHandleRepresentation3D *handle)
Configure 3D handle representation with ParaView-style properties.
constexpr double INTERACTION_COLOR[3]
constexpr double ARC_COLOR[3]
constexpr double RAY_COLOR[3]