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
65  void setAxisWidth(PointCoordinateType width);
66 
67  // Returns display scale
69  return m_DisplayScale;
70  }
71  // Sets display scale
72  void setDisplayScale(PointCoordinateType 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
102  void drawMeOnly(CC_DRAW_CONTEXT& context) override;
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 };
ccCoordinateSystem::axisPlanesAreShown
bool axisPlanesAreShown() const
Definition: ecvCoordinateSystem.h:54
ccSerializableObject::LoadedIDMap
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
Definition: ecvSerializableObject.h:61
ccCoordinateSystem::axisLinesAreShown
bool axisLinesAreShown() const
Definition: ecvCoordinateSystem.h:58
LineSet.h
ccGenericPrimitive::minimumFileVersion_MeOnly
short minimumFileVersion_MeOnly() const override
Definition: ecvGenericPrimitive.cpp:154
ccGenericPrimitive::clearDrawings
virtual void clearDrawings()
Definition: ecvGenericPrimitive.cpp:215
width
int width
Definition: FileIOFactory.cpp:142
CV_CLASS_ENUM
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
ccCoordinateSystem::getTypeName
virtual QString getTypeName() const override
Returns type name (sphere, cylinder, etc.)
Definition: ecvCoordinateSystem.h:50
context
ImGuiContext * context
Definition: Window.cpp:76
ccCoordinateSystem::m_showAxisLines
bool m_showAxisLines
Definition: ecvCoordinateSystem.h:121
ccCoordinateSystem::getAxisWidth
PointCoordinateType getAxisWidth() const
Definition: ecvCoordinateSystem.h:63
ccMesh::drawMeOnly
void drawMeOnly(CC_DRAW_CONTEXT &context) override
Enables (OpenGL) stipple mask.
Definition: ecvMesh.cpp:2635
ccCoordinateSystem::getDisplayScale
PointCoordinateType getDisplayScale() const
Definition: ecvCoordinateSystem.h:68
Vector3Tpl< PointCoordinateType >
ccGenericPrimitive::clone
virtual ccGenericPrimitive * clone() const =0
Clones primitive.
ccCoordinateSystem::m_DisplayScale
PointCoordinateType m_DisplayScale
CoordinateSystem options.
Definition: ecvCoordinateSystem.h:118
ccGenericPrimitive::toFile_MeOnly
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
Definition: ecvGenericPrimitive.cpp:135
ccCoordinateSystem::m_width
PointCoordinateType m_width
Definition: ecvCoordinateSystem.h:119
ecvGenericPrimitive.h
ccGenericPrimitive::hideShowDrawings
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
Definition: ecvGenericPrimitive.cpp:219
ccGLMatrix
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
ccCoordinateSystem::getOrigin
CCVector3 getOrigin() const
Definition: ecvCoordinateSystem.h:75
CV_DB_LIB_API
#define CV_DB_LIB_API
Definition: CV_db.h:15
ccGLDrawContext
Display context.
Definition: ecvDrawContext.h:365
ccGenericPrimitive::fromFile_MeOnly
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
Definition: ecvGenericPrimitive.cpp:160
CV_TYPES::COORDINATESYSTEM
@ COORDINATESYSTEM
Definition: CVTypes.h:145
ccGenericPrimitive
Generic primitive interface.
Definition: ecvGenericPrimitive.h:16
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
ccGenericPrimitive::buildUp
virtual bool buildUp()=0
Builds primitive.
ccCoordinateSystem
Coordinate System (primitive)
Definition: ecvCoordinateSystem.h:19
ccCoordinateSystem::m_showAxisPlanes
bool m_showAxisPlanes
Definition: ecvCoordinateSystem.h:120
ccCoordinateSystem::m_axis
cloudViewer::geometry::LineSet m_axis
Definition: ecvCoordinateSystem.h:122
ccPlane
Plane (primitive)
Definition: ecvPlane.h:17
cloudViewer::geometry::LineSet
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Definition: LineSet.h:29
name
std::string name
Definition: FileIOFactory.cpp:129
ccCoordinateSystem::getClassID
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvCoordinateSystem.h:45