Debian Codegraph @

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

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qSRA #
4 //# #
5 //# This program is free software; you can redistribute it and/or modify #
6 //# it under the terms of the GNU General Public License as published by #
7 //# the Free Software Foundation; version 2 or later of the License. #
8 //# #
9 //# This program is distributed in the hope that it will be useful, #
10 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 //# GNU General Public License for more details. #
13 //# #
14 //# COPYRIGHT: EDF #
15 //# #
16 //##########################################################################
17
18 #ifndef QSRA_SYMBOL_CLOUD_HEADER
19 #define QSRA_SYMBOL_CLOUD_HEADER
20
21 //Qt
22 #include <QString>
23
24 //qCC_db
25 #include <ccPointCloud.h>
26
27 class ccSymbolCloud : public ccPointCloud
28 {
29 public:
30
31 //! Default constructor
32 ccSymbolCloud(QString name = QString());
33
34 //! Reserves memory for storing per-point labels
35 bool reserveLabelArray(unsigned count);
36
37 //! Adds a label
38 /** Label array should have been already 'reserved' (see reserveLabelArray).
39 There should be as many labels as points at the end... (however labels
40 can be empty)
41 **/
42 void addLabel(QString label);
43
44 //! Resizes memory for storing per-point labels
45 bool resizeLabelArray(unsigned count);
46
47 //! Sets a given label
48 /** Label array should have been already resized (or filled).
49 **/
50 void setLabel(unsigned index, QString label);
51
52 //! Returns a given label
53 QString getLabel(unsigned index) const;
54
55 //! Clears the label array
56 void clearLabelArray();
57
58 //! inherited from ccPointCloud
59 virtual bool reserve(unsigned numberOfPoints) override;
60 virtual bool resize(unsigned numberOfPoints) override;
61 virtual void clear() override;
62
63 //! Sets symbol size
64 void setSymbolSize(double size) { m_symbolSize = size; }
65
66 //! Returns symbol size
67 double getSymbolSize() const { return m_symbolSize; }
68
69 //! Sets label font size
70 void setFontSize(int size) { m_fontSize = size; }
71
72 //! Returns label font size
73 int getFontSize() const { return m_fontSize; }
74
75 //! Sets whether symbols should be displayed or not
76 void showSymbols(bool state) { m_showSymbols = state; }
77 //! Returns whether symbols are displayed or not
78 bool symbolsShown() const { return m_showSymbols; }
79
80 //! Sets whether labels should be displayed or not
81 void showLabels(bool state) { m_showLabels = state; }
82 //! Returns whether labels are displayed or not
83 bool labelsShown() const { return m_showLabels; }
84
85 //! Sets labels alignment flags
86 /** See ccGenericGLDisplay::TextAlign
87 **/
88 void setLabelAlignmentFlags(unsigned char flags) { m_labelAlignFlags = flags; }
89
90 protected:
91
92 //inherited from ccPointCloud
93 virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override;
94
95 //! Labels array
96 std::vector<QString> m_labels;
97
98 //! Symbol size (in pixels)
99 double m_symbolSize;
100
101 //! Label font size (in points)
102 int m_fontSize;
103
104 //! Whether symbols are shown or not
105 bool m_showSymbols;
106
107 //! Whether labels are shown or not
108 bool m_showLabels;
109
110 //! Default label alignment flags
111 unsigned char m_labelAlignFlags;
112
113 //! Last 3D rendering parameters
114 ccGLCameraParameters m_lastCameraParams;
115 };
116
117 #endif //QSRA_SYMBOL_CLOUD_HEADER