ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvCoordinateSystem.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 // Local
11 #include "LineSet.h"
12 #include "ecvGenericPrimitive.h"
13 
14 class ccPlane;
15 
17 
20 public:
22 
27  PointCoordinateType axisWidth,
28  const ccGLMatrix* transMat = nullptr,
29  QString name = QString("CoordinateSystem"));
30 
32 
36  ccCoordinateSystem(const ccGLMatrix* transMat,
37  QString name = QString("CoordinateSystem"));
38 
40 
42  ccCoordinateSystem(QString name = QString("CoordinateSystem"));
43 
45  virtual CV_CLASS_ENUM getClassID() const override {
47  }
48 
49  // inherited from ccGenericPrimitive
50  virtual QString getTypeName() const override { return "CoordinateSystem"; }
51  virtual ccGenericPrimitive* clone() const override;
52 
53  // Returns whether axis planes are Shown
54  inline bool axisPlanesAreShown() const { return m_showAxisPlanes; }
55  // Sets whether axis planes are Shown
56  void ShowAxisPlanes(bool show);
57  // Returns whether axis lines are Shown
58  inline bool axisLinesAreShown() const { return m_showAxisLines; }
59  // Sets whether axis lines are Shown
60  void ShowAxisLines(bool show);
61 
62  // Returns axis width
63  inline PointCoordinateType getAxisWidth() const { return m_width; }
64  // Sets axis width
66 
67  // Returns display scale
69  return m_DisplayScale;
70  }
71  // Sets display scale
73 
74  // ccPlane get2AxisPlane(int axisNum);
75  inline CCVector3 getOrigin() const {
76  return m_transformation.getTranslationAsVec3D();
77  }
78 
79  // Returns xy plane
80  std::shared_ptr<ccPlane> getXYplane() const;
81  // Returns yz plane
82  std::shared_ptr<ccPlane> getYZplane() const;
83  // Returns zx plane
84  std::shared_ptr<ccPlane> getZXplane() const;
85 
86  virtual void clearDrawings() override;
87  virtual void hideShowDrawings(CC_DRAW_CONTEXT& context) override;
88 
90  static constexpr PointCoordinateType DEFAULT_DISPLAY_SCALE = 1.0;
92  static constexpr float MIN_DISPLAY_SCALE_F = 0.001f;
94  static constexpr PointCoordinateType AXIS_DEFAULT_WIDTH = 4.0;
96  static constexpr float MIN_AXIS_WIDTH_F = 1.0f;
98  static constexpr float MAX_AXIS_WIDTH_F = 16.0f;
99 
100 protected:
101  // inherited from ccDrawable
103 
104  // inherited from ccGenericPrimitive
105  bool toFile_MeOnly(QFile& out, short dataVersion) const override;
106  short minimumFileVersion_MeOnly() const override;
107  bool fromFile_MeOnly(QFile& in,
108  short dataVersion,
109  int flags,
110  LoadedIDMap& oldToNewIDMap) override;
111  virtual bool buildUp() override;
112 
113  ccPlane createXYplane(const ccGLMatrix* transMat = nullptr) const;
114  ccPlane createYZplane(const ccGLMatrix* transMat = nullptr) const;
115  ccPlane createZXplane(const ccGLMatrix* transMat = nullptr) const;
116 
123 };
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
#define CV_DB_LIB_API
Definition: CV_db.h:15
int width
std::string name
Coordinate System (primitive)
PointCoordinateType m_DisplayScale
CoordinateSystem options.
cloudViewer::geometry::LineSet m_axis
bool axisPlanesAreShown() const
PointCoordinateType m_width
CCVector3 getOrigin() const
std::shared_ptr< ccPlane > getZXplane() const
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
virtual bool buildUp() override
Builds primitive.
ccCoordinateSystem(const ccGLMatrix *transMat, QString name=QString("CoordinateSystem"))
Default constructor.
std::shared_ptr< ccPlane > getXYplane() const
ccPlane createZXplane(const ccGLMatrix *transMat=nullptr) const
void ShowAxisLines(bool show)
short minimumFileVersion_MeOnly() const override
virtual ccGenericPrimitive * clone() const override
Clones primitive.
void ShowAxisPlanes(bool show)
ccPlane createYZplane(const ccGLMatrix *transMat=nullptr) const
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context) override
void setDisplayScale(PointCoordinateType scale)
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
ccPlane createXYplane(const ccGLMatrix *transMat=nullptr) const
std::shared_ptr< ccPlane > getYZplane() const
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
virtual QString getTypeName() const override
Returns type name (sphere, cylinder, etc.)
ccCoordinateSystem(PointCoordinateType displayScale, PointCoordinateType axisWidth, const ccGLMatrix *transMat=nullptr, QString name=QString("CoordinateSystem"))
Default constructor.
PointCoordinateType getDisplayScale() const
bool axisLinesAreShown() const
void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
ccCoordinateSystem(QString name=QString("CoordinateSystem"))
Simplified constructor.
PointCoordinateType getAxisWidth() const
void setAxisWidth(PointCoordinateType width)
virtual void clearDrawings() override
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
Generic primitive interface.
Plane (primitive)
Definition: ecvPlane.h:18
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Definition: LineSet.h:29
ImGuiContext * context
Definition: Window.cpp:76
@ COORDINATESYSTEM
Definition: CVTypes.h:145
Display context.