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