ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccSymbolCloud.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 // Qt
11 #include <QString>
12 
13 // CV_DB_LIB
14 #include <ecvPointCloud.h>
15 
16 class ccSymbolCloud : public ccPointCloud {
17 public:
19  ccSymbolCloud(QString name = QString());
20 
22  bool reserveLabelArray(unsigned count);
23 
25 
29  void addLabel(QString label);
30 
32  bool resizeLabelArray(unsigned count);
33 
35 
37  void setLabel(unsigned index, QString label);
38 
40  QString getLabel(unsigned index) const;
41 
43  void clearLabelArray();
44 
46  virtual bool reserve(unsigned numberOfPoints) override;
47  virtual bool resize(unsigned numberOfPoints) override;
48  virtual void clear() override;
49 
51  void setSymbolSize(double size) { m_symbolSize = size; }
52 
54  double getSymbolSize() const { return m_symbolSize; }
55 
57  void setFontSize(int size) { m_fontSize = size; }
58 
60  int getFontSize() const { return m_fontSize; }
61 
63  void showSymbols(bool state) { m_showSymbols = state; }
65  bool symbolsShown() const { return m_showSymbols; }
66 
68  void showLabels(bool state) { m_showLabels = state; }
70  bool labelsShown() const { return m_showLabels; }
71 
73 
75  void setLabelAlignmentFlags(unsigned char flags) {
76  m_labelAlignFlags = flags;
77  }
78 
79 protected:
80  // inherited from ccPointCloud
81  virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override;
82 
84  std::vector<QString> m_labels;
85 
87  double m_symbolSize;
88 
91 
94 
97 
99  unsigned char m_labelAlignFlags;
100 
103 };
std::string name
int count
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
void setLabelAlignmentFlags(unsigned char flags)
Sets labels alignment flags.
Definition: ccSymbolCloud.h:75
bool resizeLabelArray(unsigned count)
Resizes memory for storing per-point labels.
int getFontSize() const
Returns label font size.
Definition: ccSymbolCloud.h:60
bool m_showSymbols
Whether symbols are shown or not.
Definition: ccSymbolCloud.h:93
QString getLabel(unsigned index) const
Returns a given label.
void addLabel(QString label)
Adds a label.
virtual void clear() override
Clears the entity from all its points and features.
virtual bool reserve(unsigned numberOfPoints) override
inherited from ccPointCloud
virtual bool resize(unsigned numberOfPoints) override
Resizes all the active features arrays.
void setLabel(unsigned index, QString label)
Sets a given label.
unsigned char m_labelAlignFlags
Default label alignment flags.
Definition: ccSymbolCloud.h:99
void showLabels(bool state)
Sets whether labels should be displayed or not.
Definition: ccSymbolCloud.h:68
void showSymbols(bool state)
Sets whether symbols should be displayed or not.
Definition: ccSymbolCloud.h:63
void setSymbolSize(double size)
Sets symbol size.
Definition: ccSymbolCloud.h:51
bool m_showLabels
Whether labels are shown or not.
Definition: ccSymbolCloud.h:96
double m_symbolSize
Symbol size (in pixels)
Definition: ccSymbolCloud.h:87
ccGLCameraParameters m_lastCameraParams
Last 3D rendering parameters.
int m_fontSize
Label font size (in points)
Definition: ccSymbolCloud.h:90
bool reserveLabelArray(unsigned count)
Reserves memory for storing per-point labels.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
void clearLabelArray()
Clears the label array.
std::vector< QString > m_labels
Labels array.
Definition: ccSymbolCloud.h:84
bool labelsShown() const
Returns whether labels are displayed or not.
Definition: ccSymbolCloud.h:70
void setFontSize(int size)
Sets label font size.
Definition: ccSymbolCloud.h:57
double getSymbolSize() const
Returns symbol size.
Definition: ccSymbolCloud.h:54
bool symbolsShown() const
Returns whether symbols are displayed or not.
Definition: ccSymbolCloud.h:65
ccSymbolCloud(QString name=QString())
Default constructor.
unsigned size() const override
Returns the number of points.
Definition: PointCloudTpl.h:38
ImGuiContext * context
Definition: Window.cpp:76
OpenGL camera parameters.
Display context.