13CAD
CAD-like software based on C++, Qt and VTK.
 All Classes Files Functions Variables Friends
model.h
Go to the documentation of this file.
1 
8 #ifndef MODEL_H
9 #define MODEL_H
10 
11 #include <string>
12 
13 #include "vector3d.h"
14 #include "cell.h"
15 #include "material.h"
16 
20 class Model
21 {
22  private:
26  std::string filename;
27 
31  bool isSTL;
32 
36  std::vector<Vector3D> vertices;
37 
41  std::vector<Material> materials;
42 
46  std::vector<Cell> cells;
47 
48  // Parsing functions
49 
53  void parseVertex(std::string line);
54 
58  void parseMaterial(std::string line);
59 
63  void parseCell(std::string line);
64 
65  // Misc functions
69  std::vector<std::string> splitString(std::string line);
70 
74  bool isExtension(const std::string &str, const std::string &suffix);
75 
76  public:
77  Model() = default;
78  ~Model() = default;
79  // Loads model from file
80  Model(std::string filename);
81 
82  // Accessors
83 
87  std::string getFilename();
88 
92  bool getIsSTL();
93 
97  std::vector<Material> getMaterials();
98 
102  std::vector<Vector3D> getVertices();
103 
107  std::vector<Cell> getCells();
108 
112  int getMaterialCount();
113 
117  int getVertexCount();
118 
122  int getCellCount();
123 
128  std::string getCellList();
129 
134 
135  // Misc functions
136 
140  void copyToFile(std::string filename);
141 
145  void saveToFile(std::string filename);
146 };
147 
148 #endif /* MODEL_H */
Vector3D getCentre()
Definition: model.cpp:252
Header file for the Material class.
int getMaterialCount()
Definition: model.cpp:228
std::vector< Vector3D > getVertices()
Definition: model.cpp:218
int getVertexCount()
Definition: model.cpp:234
Header file for the Vector3D class.
Header file for the Cell class and subclasses.
Definition: vector3d.h:17
void copyToFile(std::string filename)
Definition: model.cpp:274
std::vector< Cell > getCells()
Definition: model.cpp:223
Definition: model.h:20
std::string getCellList()
Definition: model.cpp:246
bool getIsSTL()
Definition: model.cpp:208
std::string getFilename()
Definition: model.cpp:203
void saveToFile(std::string filename)
Definition: model.cpp:282
std::vector< Material > getMaterials()
Definition: model.cpp:213
int getCellCount()
Definition: model.cpp:240