-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cpp
94 lines (62 loc) · 2.29 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <math.h>
#include <iostream>
#include <App/Header.h>
#include <Translators/EOS/Reader.h>
#include <Translators/EOS/Writer.h>
#include <Translators/MTT/Reader.h>
#include <Translators/MTT/Writer.h>
#include <Translators/Realizer/Reader.h>
#include <Translators/Realizer/Writer.h>
#include <Translators/SLMSOL/Reader.h>
#include <Translators/SLMSOL/Writer.h>
int main(int argc, char *argv[])
{
if(argc < 2) {
std::cerr << "Number of argument must be one ";
}
std::string path = argv[0];
std::string mode = argv[1];
std::string inputFilename = argv[2];
std::string outputFilename = argv[3];
std::cout << "Reading file " << inputFilename << std::endl;
if(mode.find("mtt") != std::string::npos) {
slm::MTT::Reader reader(inputFilename);
std::cout << "Parsing File" << std::endl;
reader.parse();
slm::MTT::Writer writer(outputFilename);
slm::Header header;
header.zUnit = reader.getZUnit();
header.vMajor = 1;
header.vMinor = 6;
header.fileName = "MTT Layerfile";
writer.write(header, reader.getModels(), reader.getLayers());
} else if(mode.find("realizer") != std::string::npos) {
slm::realizer::Reader reader(inputFilename);
std::cout << "Parsing File" << std::endl;
reader.parse();
slm::realizer::Writer writer(outputFilename);
slm::Header header;
header.zUnit = 1000;
header.vMajor = 4;
header.vMinor = 7;
header.fileName = outputFilename;
std::string headerStr = reader.getHeader();
writer.setHeaderText(headerStr);
writer.write(header, reader.getModels(), reader.getLayers());
} else if(mode.find("eos") != std::string::npos) {
slm::eos::Reader reader(inputFilename);
std::cout << "Parsing File" << std::endl;
reader.parse();
slm::eos::Writer writer(outputFilename);
slm::Header header;
header.zUnit = 1000;
header.vMajor = 4;
header.vMinor = 7;
header.fileName = outputFilename;
float sf = reader.getScaleFactor();
writer.setScaleFactor(sf);
writer.write(header, reader.getModels(), reader.getLayers());
} else {
std::cerr << "Error: Invalid option given";
}
}