// ________________________________________________________________________________________________ bool writeObjectFileVector(const std::vector<std::vector<FaceObject> > &vfo, const std::string &sFolder, bool append) { std::ofstream ofObjFile; for (size_t j = 0; j < vfo.size(); j++) { if (vfo[j].size() > 0) { std::string fullPath = sFolder + "/" + vfo[j][0].fileName + ".txt"; writeObjectFile(vfo[j], fullPath, append); } } return true; }
inline bool doWrite(const osg::Object & obj, WriteType type, const std::string& fileName, const Options * options) { switch(type) { case WRITE_TYPE_IMAGE: return writeImageFile (static_cast<const osg::Image &>(obj), fileName, options); case WRITE_TYPE_HEIGHT_FIELD: return writeHeightFieldFile(static_cast<const osg::HeightField &>(obj), fileName, options); case WRITE_TYPE_NODE: return writeNodeFile (static_cast<const osg::Node &>(obj), fileName, options); case WRITE_TYPE_SHADER: return writeShaderFile (static_cast<const osg::Shader &>(obj), fileName, options); // WRITE_TYPE_OBJECT default: return writeObjectFile(obj, fileName, options); } }
void Manager::saveFacesToDisk() { // save vector to disk std::string file = selectedDirectory.toStdString() + "/.metaface/" + selectedFile.toStdString() + ".txt"; QDir dir(selectedDirectory + "/.metaface/"); if (!dir.exists()) { dir.mkpath("."); } bool res = writeObjectFile(this->TagedElements, file, false); if(!res) { qDebug() << "!!!!!faild to save to file!!!!!!"; //ToDo: Maybe handle a save error } else { std::cerr << "saved to file: " << file << " \n" << endl; } }