OpenLexocad  27.0
IvWriter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Inventor/SbVec3f.h>
5 #include <Topo/Shape.h>
6 
7 #include <string>
8 
9 class SoMaterial;
10 
11 namespace App
12 {
13 class Element;
14 }
15 
16 namespace OpenLxApp
17 {
18 class myFace
19 {
20 public:
21  std::vector<SbVec3f> vertices;
22  std::vector<SbVec3f> verticesNormals;
23  std::vector<long> coordinateIndices;
24  bool useNormals;
25 };
26 
27 class myEdge
28 {
29 public:
30  std::vector<SbVec3f> vertices;
31  std::vector<long> coordinateIndices;
32 };
33 
34 
35 
36 class IvWriter
37 {
38 public:
39  IvWriter::IvWriter(const std::vector<App::Element*>& elems);
40 
42  bool saveIV(const std::string& filename);
43 
44 private:
45  const std::vector<App::Element*>& _elems;
46 
47  bool _createFaces(pConstShape shape, std::vector<myFace>& myFaces, std::map<int, int>& face_2_material_index, int colorIndex);
48  bool _createEdges(pConstShape shape,
49  std::vector<myEdge>& myEdges,
50  std::map<int, int>& edge_2_material_index,
51  int colorIndex,
52  double abscissa = 0);
53 
54  void _createMaterial(App::Element* e, SoMaterial* oiv_mat, int& materialIndex, bool& useMaterial);
55 };
56 
57 
58 } // namespace OpenLxApp
Definition: IvWriter.h:27
std::vector< SbVec3f > vertices
Definition: IvWriter.h:21
std::vector< SbVec3f > vertices
Definition: IvWriter.h:30
Definition: IvWriter.h:18
bool useNormals
Definition: IvWriter.h:24
Definition: ActiveScript.h:9
std::vector< long > coordinateIndices
Definition: IvWriter.h:31
Core::PropertyText filename
Definition: CoreDocument.h:151
Definition: IvWriter.h:36
std::vector< long > coordinateIndices
Definition: IvWriter.h:23
IvWriter::IvWriter(const std::vector< App::Element * > &elems)
std::vector< SbVec3f > verticesNormals
Definition: IvWriter.h:22
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:81
bool saveIV(const std::string &filename)
Saves the document to 'filename'.