MDAL
mdal_ply.hpp
1 /*
2  MDAL - Mesh Data Abstraction Library (MIT License)
3  Copyright (C) 2020 Runette Software Ltd
4 */
5 
6 #ifndef MDAL_PLY_HPP
7 #define MDAL_PLY_HPP
8 
9 #include <string>
10 #include <memory>
11 
12 #include "mdal_data_model.hpp"
13 #include "mdal_memory_data_model.hpp"
14 #include "mdal.h"
15 #include "mdal_driver.hpp"
16 
17 
18 namespace MDAL
19 {
23  class DriverPly : public Driver
24  {
25  public:
26  DriverPly();
27  ~DriverPly() override;
28  DriverPly *create() override;
29 
30  bool canReadMesh( const std::string &uri ) override;
31  int faceVerticesMaximumCount() const override {return 100;}
32 
33  std::unique_ptr< Mesh > load( const std::string &meshFile, const std::string &meshName = "" ) override;
34  void save( const std::string &fileName, const std::string &meshName, Mesh *mesh ) override;
35  bool persist( DatasetGroup *group ) override;
36 
37  std::string saveMeshOnFileSuffix() const override;
38 
39  private:
40  std::shared_ptr<DatasetGroup> addDatasetGroup( MDAL::Mesh *mesh, const std::string &name, const MDAL_DataLocation location, bool isScalar );
41  void addDataset2D( MDAL::DatasetGroup *group, const std::vector<double> &values );
42  void addDataset3D( MDAL::DatasetGroup *group,
43  const std::vector<double> &values,
44  const std::vector<int> &valueIndexes,
45  const std::vector<double> &levels,
46  const std::vector<int> &levelIndexes );
47 
48  };
49 
50 } // namespace MDAL
51 #endif //MDAL_PLY_HPP
Definition: mdal_data_model.hpp:137
PLY format specification : http://gamma.cs.unc.edu/POWERPLANT/papers/ply.pdf.
Definition: mdal_ply.hpp:24
int faceVerticesMaximumCount() const override
returns the maximum vertices per face
Definition: mdal_ply.hpp:31
Definition: mdal_driver.hpp:28
Definition: mdal_data_model.hpp:238