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 };
ccSymbolCloud::m_showSymbols
bool m_showSymbols
Whether symbols are shown or not.
Definition: ccSymbolCloud.h:93
ccSymbolCloud::addLabel
void addLabel(QString label)
Adds a label.
Definition: ccSymbolCloud.cpp:48
ccSymbolCloud::m_labelAlignFlags
unsigned char m_labelAlignFlags
Default label alignment flags.
Definition: ccSymbolCloud.h:99
ccSymbolCloud::setSymbolSize
void setSymbolSize(double size)
Sets symbol size.
Definition: ccSymbolCloud.h:51
ccSymbolCloud::reserveLabelArray
bool reserveLabelArray(unsigned count)
Reserves memory for storing per-point labels.
Definition: ccSymbolCloud.cpp:38
ccSymbolCloud::ccSymbolCloud
ccSymbolCloud(QString name=QString())
Default constructor.
Definition: ccSymbolCloud.cpp:13
ccSymbolCloud::m_labels
std::vector< QString > m_labels
Labels array.
Definition: ccSymbolCloud.h:84
ccSymbolCloud::symbolsShown
bool symbolsShown() const
Returns whether symbols are displayed or not.
Definition: ccSymbolCloud.h:65
ccSymbolCloud::m_lastCameraParams
ccGLCameraParameters m_lastCameraParams
Last 3D rendering parameters.
Definition: ccSymbolCloud.h:102
ccSymbolCloud::labelsShown
bool labelsShown() const
Returns whether labels are displayed or not.
Definition: ccSymbolCloud.h:70
ccSymbolCloud::getLabel
QString getLabel(unsigned index) const
Returns a given label.
Definition: ccSymbolCloud.cpp:73
ccSymbolCloud::clear
virtual void clear() override
Clears the entity from all its points and features.
Definition: ccSymbolCloud.cpp:83
cloudViewer::PointCloudTpl< ccGenericPointCloud >::size
unsigned size() const override
Definition: PointCloudTpl.h:38
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
ccSymbolCloud::getSymbolSize
double getSymbolSize() const
Returns symbol size.
Definition: ccSymbolCloud.h:54
ccGLCameraParameters
OpenGL camera parameters.
Definition: ecvGenericDisplayTools.h:554
ccSymbolCloud::setFontSize
void setFontSize(int size)
Sets label font size.
Definition: ccSymbolCloud.h:57
context
ImGuiContext * context
Definition: Window.cpp:76
ccSymbolCloud::m_showLabels
bool m_showLabels
Whether labels are shown or not.
Definition: ccSymbolCloud.h:96
ccSymbolCloud::reserve
virtual bool reserve(unsigned numberOfPoints) override
inherited from ccPointCloud
Definition: ccSymbolCloud.cpp:22
ccSymbolCloud::setLabelAlignmentFlags
void setLabelAlignmentFlags(unsigned char flags)
Sets labels alignment flags.
Definition: ccSymbolCloud.h:75
ccSymbolCloud::m_fontSize
int m_fontSize
Label font size (in points)
Definition: ccSymbolCloud.h:90
ccSymbolCloud::showLabels
void showLabels(bool state)
Sets whether labels should be displayed or not.
Definition: ccSymbolCloud.h:68
ccSymbolCloud::m_symbolSize
double m_symbolSize
Symbol size (in pixels)
Definition: ccSymbolCloud.h:87
ccSymbolCloud::setLabel
void setLabel(unsigned index, QString label)
Sets a given label.
Definition: ccSymbolCloud.cpp:67
ccSymbolCloud
Definition: ccSymbolCloud.h:16
ccSymbolCloud::clearLabelArray
void clearLabelArray()
Clears the label array.
Definition: ccSymbolCloud.cpp:81
count
int count
Definition: FileIOFactory.cpp:132
ccSymbolCloud::showSymbols
void showSymbols(bool state)
Sets whether symbols should be displayed or not.
Definition: ccSymbolCloud.h:63
ccGLDrawContext
Display context.
Definition: ecvDrawContext.h:365
ccSymbolCloud::resizeLabelArray
bool resizeLabelArray(unsigned count)
Resizes memory for storing per-point labels.
Definition: ccSymbolCloud.cpp:57
ccSymbolCloud::getFontSize
int getFontSize() const
Returns label font size.
Definition: ccSymbolCloud.h:60
ccSymbolCloud::drawMeOnly
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
Definition: ccSymbolCloud.cpp:105
ecvPointCloud.h
name
std::string name
Definition: FileIOFactory.cpp:129
ccSymbolCloud::resize
virtual bool resize(unsigned numberOfPoints) override
Resizes all the active features arrays.
Definition: ccSymbolCloud.cpp:30