From c6c273eddfb56165bd18612d7a0daa66e4dadf05 Mon Sep 17 00:00:00 2001 From: Uwe Date: Tue, 6 Dec 2022 19:04:38 +0100 Subject: [PATCH] [Raytracing] attempt to fix compilation on Arch linux by adding all used STL headers - also uniform std handling (either using namespace and then omit or use it always and no namespace --- src/Mod/Raytracing/App/LuxProject.cpp | 14 +++++++------ src/Mod/Raytracing/App/LuxTools.cpp | 30 +++++++++++++-------------- src/Mod/Raytracing/App/PreCompiled.h | 1 + 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Mod/Raytracing/App/LuxProject.cpp b/src/Mod/Raytracing/App/LuxProject.cpp index aec6c9cd95..7cbaa85440 100644 --- a/src/Mod/Raytracing/App/LuxProject.cpp +++ b/src/Mod/Raytracing/App/LuxProject.cpp @@ -24,7 +24,9 @@ #ifndef _PreComp_ # include +# include # include +# include #endif #include @@ -58,7 +60,7 @@ void LuxProject::onDocumentRestored() Base::FileInfo fi(Template.getValue()); if (fi.fileName().empty()) fi.setFile(PageResult.getValue()); - std::string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName(); + string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName(); // try to find the template in user dir/Templates first Base::FileInfo tempfi(App::Application::getUserAppDataDir() + "data/Mod/Raytracing/Templates/" + fi.fileName()); if (tempfi.exists()) @@ -69,18 +71,18 @@ void LuxProject::onDocumentRestored() App::DocumentObjectExecReturn *LuxProject::execute(void) { - if (std::string(PageResult.getValue()).empty()) + if (string(PageResult.getValue()).empty()) PageResult.setValue(Template.getValue()); Base::FileInfo fi(Template.getValue()); if (!fi.isReadable()) { Base::Console().Log("LuxProject::execute() not able to open %s!\n",Template.getValue()); - std::string error = std::string("Cannot open file ") + Template.getValue(); + string error = string("Cannot open file ") + Template.getValue(); return new App::DocumentObjectExecReturn(error); } // open Template file string line; - ifstream file ( fi.filePath().c_str() ); + ifstream file (fi.filePath().c_str()); // make a temp file for FileIncluded Property string tempName = PageResult.getExchangeTempFile(); @@ -101,8 +103,8 @@ App::DocumentObjectExecReturn *LuxProject::execute(void) // get through the children and collect all the views ofile << "# declares FreeCAD objects" << endl << "# Generated by FreeCAD (http://www.freecadweb.org/)" << endl << endl; - const std::vector &Grp = Group.getValues(); - for (std::vector::const_iterator It= Grp.begin();It!=Grp.end();++It) { + const vector &Grp = Group.getValues(); + for (vector::const_iterator It= Grp.begin();It!=Grp.end();++It) { if ((*It)->getTypeId().isDerivedFrom(Raytracing::RaySegment::getClassTypeId())) { Raytracing::RaySegment *View = static_cast(*It); ofile << View->Result.getValue(); diff --git a/src/Mod/Raytracing/App/LuxTools.cpp b/src/Mod/Raytracing/App/LuxTools.cpp index 7e280965b9..f51df9ced1 100644 --- a/src/Mod/Raytracing/App/LuxTools.cpp +++ b/src/Mod/Raytracing/App/LuxTools.cpp @@ -29,7 +29,6 @@ # include # include # include - #endif #include @@ -41,22 +40,21 @@ using Base::Console; - using namespace Raytracing; -using namespace std; std::string LuxTools::getCamera(const CamDef& Cam) { std::stringstream out; - out << "# declares position and view direction" << endl - << "# Generated by FreeCAD (http://www.freecadweb.org/)" << endl + out << "# declares position and view direction" << std::endl + << "# Generated by FreeCAD (http://www.freecadweb.org/)" + << std::endl // writing Camera positions << "LookAt " << Cam.CamPos.X() << " " << Cam.CamPos.Y() << " " << Cam.CamPos.Z() << " " // writing lookat << Cam.LookAt.X() << " " << Cam.LookAt.Y() << " " << Cam.LookAt.Z() << " " // writing the Up Vector - << Cam.Up.X() << " " << Cam.Up.Y() << " " << Cam.Up.Z() << endl; + << Cam.Up.X() << " " << Cam.Up.Y() << " " << Cam.Up.Z() << std::endl; return out.str(); } @@ -74,10 +72,10 @@ void LuxTools::writeShape(std::ostream &out, const char *PartName, const TopoDS_ Base::SequencerLauncher seq("Writing file", l); // write object - out << "AttributeBegin # \"" << PartName << "\"" << endl; - out << "Transform [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]" << endl; - out << "NamedMaterial \"FreeCADMaterial_" << PartName << "\"" << endl; - out << "Shape \"mesh\"" << endl; + out << "AttributeBegin # \"" << PartName << "\"" << std::endl; + out << "Transform [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]" << std::endl; + out << "NamedMaterial \"FreeCADMaterial_" << PartName << "\"" << std::endl; + out << "Shape \"mesh\"" << std::endl; // gather vertices, normals and face indices std::stringstream triindices; @@ -124,10 +122,10 @@ void LuxTools::writeShape(std::ostream &out, const char *PartName, const TopoDS_ } // end of face loop // write mesh data - out << " \"integer triindices\" [" << triindices.str() << "]" << endl; - out << " \"point P\" [" << P.str() << "]" << endl; - out << " \"normal N\" [" << N.str() << "]" << endl; - out << " \"bool generatetangents\" [\"false\"]" << endl; - out << " \"string name\" [\"" << PartName << "\"]" << endl; - out << "AttributeEnd # \"\"" << endl; + out << " \"integer triindices\" [" << triindices.str() << "]" << std::endl; + out << " \"point P\" [" << P.str() << "]" << std::endl; + out << " \"normal N\" [" << N.str() << "]" << std::endl; + out << " \"bool generatetangents\" [\"false\"]" << std::endl; + out << " \"string name\" [\"" << PartName << "\"]" << std::endl; + out << "AttributeEnd # \"\"" << std::endl; } diff --git a/src/Mod/Raytracing/App/PreCompiled.h b/src/Mod/Raytracing/App/PreCompiled.h index 565baa6948..db9a8d0e17 100644 --- a/src/Mod/Raytracing/App/PreCompiled.h +++ b/src/Mod/Raytracing/App/PreCompiled.h @@ -28,6 +28,7 @@ #ifdef _PreComp_ // STL +#include #include #include