void GenGraphForm::doExport() { if (!tasks.empty()) { killAllTasks(); return; } if (filename->text()==QString("")) return; QString dotfile = filename->text(); QString basefile = removeFileExt(dotfile); if (basefile==dotfile) // no extension specified dotfile += ".dot"; std::ofstream fdot; fdot.open(dotfile, std::ofstream::out | std::ofstream::trunc); if (!fdot.is_open()) { qFatal("Output to %s failed.\n",(const char*)dotfile); return; } { sofa::simulation::tree::ExportDotVisitor act(sofa::core::ExecParams::defaultInstance() /* PARAMS FIRST */, &fdot); act.showNode = this->showNodes->isOn(); act.showObject = this->showObjects->isOn(); act.showBehaviorModel = this->showBehaviorModels->isOn(); act.showCollisionModel = this->showCollisionModels->isOn(); act.showVisualModel = this->showVisualModels->isOn(); act.showMapping = this->showMappings->isOn(); act.showContext = this->showContext->isOn(); act.showCollisionPipeline = this->showCollisionPipeline->isOn(); act.showSolver = this->showSolvers->isOn(); act.showMechanicalState = this->showMechanicalStates->isOn(); act.showForceField = this->showForceFields->isOn(); act.showInteractionForceField = this->showInteractionForceFields->isOn(); act.showConstraint = this->showConstraints->isOn(); act.showMass = this->showMass->isOn(); act.showTopology = this->showTopology->isOn(); act.showMechanicalMapping = this->showMechanicalMappings->isOn(); act.labelNodeName = this->labelNodeName->isOn(); act.labelNodeClass = this->labelNodeClass->isOn(); act.labelObjectName = this->labelObjectName->isOn(); act.labelObjectClass = this->labelObjectClass->isOn(); graph->executeVisitor(&act); } fdot.close(); QStringList argv0; if (layoutDirV->isOn()) argv0 << "dot" << "-Grankdir=TB"; else if (layoutDirH->isOn()) argv0 << "dot" << "-Grankdir=LR"; else if (layoutSpring->isOn()) argv0 << "neato"; else if (layoutRadial->isOn()) argv0 << "twopi"; bool exp = false; exportedFile = dotfile; if (genPNG->isOn()) { QStringList argv = argv0; argv << "-Tpng" << "-o" << basefile+".png"; argv << dotfile; addTask(argv); if (!exp) { exp = true; exportedFile = basefile+".png"; } } if (genPS->isOn()) { QStringList argv = argv0; argv << "-Tps" << "-o" << basefile+".ps"; argv << dotfile; addTask(argv); if (!exp) { exp = true; exportedFile = basefile+".ps"; } } if (genFIG->isOn()) { QStringList argv = argv0; argv << "-Tfig" << "-o" << basefile+".fig"; argv << dotfile; addTask(argv); if (!exp) { exp = true; exportedFile = basefile+".fig"; } } if (genSVG->isOn()) { QStringList argv = argv0; argv << "-Tsvg" << "-o" << basefile+".svg"; argv << dotfile; addTask(argv); if (!exp) { exp = true; exportedFile = basefile+".svg"; } } //exported = true; //displayButton->setEnabled(true); }
void GenGraphForm::doClose() { killAllTasks(); this->close(); }
TaskManager::~TaskManager() { killAllTasks(); }