Commit 6508e859 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

supports both ascii and binary export (question asked to user)

parent 00b254b7
...@@ -237,7 +237,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -237,7 +237,7 @@ void Viewer::importMesh(std::string& filename)
updateGLMatrices() ; updateGLMatrices() ;
} }
void Viewer::exportMesh(std::string& filename) void Viewer::exportMesh(std::string& filename, bool askExportMode)
{ {
size_t pos = filename.rfind(".") ; // position of "." in filename size_t pos = filename.rfind(".") ; // position of "." in filename
std::string extension = filename.substr(pos) ; std::string extension = filename.substr(pos) ;
...@@ -247,7 +247,9 @@ void Viewer::exportMesh(std::string& filename) ...@@ -247,7 +247,9 @@ void Viewer::exportMesh(std::string& filename)
else if (extension.compare(0, 4, std::string(".ply")) == 0) else if (extension.compare(0, 4, std::string(".ply")) == 0)
{ {
int ascii = 0 ; int ascii = 0 ;
Utils::QT::inputValues(Utils::QT::VarCombo("binary mode;ascii mode",ascii,"Save in")) ; if (askExportMode)
Utils::QT::inputValues(Utils::QT::VarCombo("binary mode;ascii mode",ascii,"Save in")) ;
std::vector<PFP::TVEC3*> attributes ; std::vector<PFP::TVEC3*> attributes ;
attributes.push_back(&position) ; attributes.push_back(&position) ;
Algo::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), !ascii, allDarts) ; Algo::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), !ascii, allDarts) ;
...@@ -327,7 +329,7 @@ int main(int argc, char **argv) ...@@ -327,7 +329,7 @@ int main(int argc, char **argv)
{ {
std::string filenameExp(argv[2]) ; std::string filenameExp(argv[2]) ;
std::cout << "Exporting " << filename << " as " << filenameExp << " ... "<< std::flush ; std::cout << "Exporting " << filename << " as " << filenameExp << " ... "<< std::flush ;
sqt.exportMesh(filenameExp) ; sqt.exportMesh(filenameExp, false) ;
std::cout << "done!" << std::endl ; std::cout << "done!" << std::endl ;
return (0) ; return (0) ;
......
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
void cb_Save() ; void cb_Save() ;
void importMesh(std::string& filename) ; void importMesh(std::string& filename) ;
void exportMesh(std::string& filename); void exportMesh(std::string& filename, bool askExportMode = true);
public slots: public slots:
void slot_drawVertices(bool b) ; void slot_drawVertices(bool b) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment