ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cc2sm.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 <Utils/PCLCloud.h>
12 
13 #include "qPCL.h"
14 
15 // CV_DB_LIB
16 #include <ecvMaterial.h>
17 
18 // PCL
19 #include <pcl/point_cloud.h>
20 #include <pcl/point_types.h>
21 
22 // Eigen (for texture coordinates)
23 #include <Eigen/Dense>
24 
25 // VTK
26 #include <vtkSmartPointer.h>
27 
28 // system
29 #include <list>
30 #include <string>
31 #include <vector>
32 
33 class ccPointCloud;
34 class ccGenericMesh;
35 class ccPolyline;
36 
37 class vtkPolyData;
38 class vtkDataArray;
39 class vtkMatrix4x4;
40 class vtkPolyData;
41 
44 public:
45  explicit cc2smReader(bool showMode = false);
46  explicit cc2smReader(const ccPointCloud* cc_cloud, bool showMode = false);
47 
48  PCLCloud::Ptr getGenericField(std::string field_name) const;
49 
50  unsigned getvisibilityNum() const;
51 
52  PCLCloud::Ptr getXYZ() const;
53  pcl::PointCloud<pcl::PointXYZ>::Ptr getXYZ2() const;
54 
55  PCLCloud::Ptr getNormals() const;
56  PCLCloud::Ptr getPointNormals() const;
57 
58  PCLCloud::Ptr getColors() const;
59 
60  bool getvtkScalars(vtkSmartPointer<vtkDataArray>& scalars,
61  bool sfColors) const;
62 
63  enum Fields { COORD_X, COORD_Y, COORD_Z, NORM_X, NORM_Y, NORM_Z };
64  PCLCloud::Ptr getOneOf(Fields field) const;
65 
66  PCLCloud::Ptr getFloatScalarField(const std::string& field_name) const;
67 
68  PCLCloud::Ptr getAsSM(std::list<std::string>& requested_fields) const;
69 
71 
75  PCLCloud::Ptr getAsSM(bool ignoreScalars = false) const;
76  PCLCloud::Ptr getAsSM(bool xyz,
77  bool normals,
78  bool rgbColors,
79  const QStringList& scalarFields) const;
80 
82  pcl::PointCloud<pcl::PointXYZ>::Ptr getRawXYZ() const;
83 
85  pcl::PointCloud<pcl::PointNormal>::Ptr getAsPointNormal() const;
86 
87  PCLCloud::Ptr getVtkPolyDataAsSM(vtkPolyData* const polydata) const;
88  PCLMesh::Ptr getVtkPolyDataAsPclMesh(vtkPolyData* const polydata) const;
89 
90  PCLMesh::Ptr getPclMesh(ccGenericMesh* mesh);
91  PCLTextureMesh::Ptr getPclTextureMesh(ccGenericMesh* mesh);
92 
93  PCLPolygon::Ptr getPclPolygon(ccPolyline* polyline) const;
94 
95  bool getPclCloud2(ccGenericMesh* mesh, PCLCloud& cloud) const;
96 
108  bool getVtkPolyDataFromMeshCloud(
109  ccGenericMesh* mesh, vtkSmartPointer<vtkPolyData>& polydata) const;
110 
123  bool getVtkPolyDataWithTextures(
124  ccGenericMesh* mesh,
126  vtkSmartPointer<vtkMatrix4x4>& transformation,
127  std::vector<std::vector<Eigen::Vector2f>>& tex_coordinates);
128 
129  static std::string GetSimplifiedSFName(const std::string& ccSfName);
130 
131  static void ConVertToPCLMaterial(ccMaterial::CShared inMaterial,
132  PCLMaterial& outMaterial);
133 
134 protected:
135  bool checkIfFieldExists(const std::string& field_name) const;
136 
141  unsigned m_visibilityNum;
142 };
pcl::TexMaterial PCLMaterial
Definition: PCLCloud.h:32
pcl::PCLPointCloud2 PCLCloud
Definition: PCLCloud.h:34
CC to PCL cloud converter.
Definition: cc2sm.h:43
bool m_partialVisibility
Definition: cc2sm.h:140
unsigned m_visibilityNum
Definition: cc2sm.h:141
const ccPointCloud * m_cc_cloud
Associated cloud.
Definition: cc2sm.h:138
bool m_showMode
Definition: cc2sm.h:139
@ COORD_X
Definition: cc2sm.h:63
Generic mesh interface.
QSharedPointer< const ccMaterial > CShared
Const + Shared type.
Definition: ecvMaterial.h:31
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Colored polyline.
Definition: ecvPolyline.h:24
double normals[3]
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15