Debian Codegraph @

plugins/core/Standard/qSRA/include/ccMapWindow.h

raw
1 #pragma once
2
3 //##########################################################################
4 //# #
5 //# CLOUDCOMPARE PLUGIN: qSRA #
6 //# #
7 //# This program is free software; you can redistribute it and/or modify #
8 //# it under the terms of the GNU General Public License as published by #
9 //# the Free Software Foundation; version 2 or later of the License. #
10 //# #
11 //# This program is distributed in the hope that it will be useful, #
12 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 //# GNU General Public License for more details. #
15 //# #
16 //# COPYRIGHT: EDF #
17 //# #
18 //##########################################################################
19
20 //qCC
21 #include <ccGLWindow.h>
22
23 //qCC_db
24 #include <ccScalarField.h>
25
26 //! 2D map display window
27 class ccMapWindow : public ccGLWindow
28 {
29 public:
30
31 //! Default constructor
32 explicit ccMapWindow(QOpenGLWidget* parent = nullptr)
33 : ccGLWindow(nullptr, parent, true)
34 , m_sfForRampDisplay(nullptr)
35 , m_showSF(true)
36 {}
37
38 //! Destructor
39 virtual ~ccMapWindow()
40 {
41 setAssociatedScalarField(nullptr);
42 }
43
44 //! Sets associated scalar-field
45 /** This scalar field will be used for color ramp display.
46 **/
47 void setAssociatedScalarField(ccScalarField* sf)
48 {
49 if (m_sfForRampDisplay != sf)
50 {
51 if (m_sfForRampDisplay)
52 m_sfForRampDisplay->release();
53
54 m_sfForRampDisplay = sf;
55
56 if (m_sfForRampDisplay)
57 m_sfForRampDisplay->link();
58 }
59 }
60
61 //! Whether to show associated SF or not
62 void showSF(bool state) { m_showSF = state; }
63
64 //! Returns whether associated SF should be shown or not
65 bool sfShown() const { return m_showSF; }
66
67 //! Returns associated scalar field
68 ccScalarField* getAssociatedScalarField() const { return m_sfForRampDisplay; }
69
70 //inherited from ccGLWindow
71 void getContext(CC_DRAW_CONTEXT& context) override
72 {
73 ccGLWindow::getContext(context);
74
75 if (m_showSF)
76 {
77 //override sf that will be used for color ramp display
78 context.sfColorScaleToDisplay = m_sfForRampDisplay;
79 }
80 }
81
82 protected:
83
84 //! Associated scalar field
85 ccScalarField* m_sfForRampDisplay;
86
87 //! Whether to show or not the associated SF
88 bool m_showSF;
89 };