DependencyGraph: grouping & unflatten is optional

Property group "User parameter:BaseApp/Preferences/DependencyGraph" has two booleans to enable subgraphing and unflatten (by default on): "Unflatten", "GeoFeatureSubgraphs"
This commit is contained in:
Stefan Tröger
2017-01-31 07:22:14 +01:00
committed by wmayer
parent 25df3c549d
commit bbabe833e9
2 changed files with 94 additions and 53 deletions

View File

@@ -99,13 +99,20 @@ public:
}
void run() {
// Write data to unflatten process
unflattenProc.write(str);
unflattenProc.closeWriteChannel();
QByteArray preprocessed = str;
//no error handling: unflatten is optional
unflattenProc.waitForFinished();
preprocessed = unflattenProc.readAll();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/DependencyGraph");
if(hGrp->GetBool("Unflatten", true)) {
// Write data to unflatten process
unflattenProc.write(str);
unflattenProc.closeWriteChannel();
//no error handling: unflatten is optional
unflattenProc.waitForFinished();
preprocessed = unflattenProc.readAll();
} else {
unflattenProc.closeWriteChannel();
unflattenProc.waitForFinished();
}
dotProc.write(preprocessed);
dotProc.closeWriteChannel();
@@ -193,7 +200,7 @@ void GraphvizView::updateSvgItem(const App::Document &doc)
QProcess * flatProc = thread->unflattenProcess();
QStringList args, flatArgs;
args << QLatin1String("-Tsvg");
flatArgs << QLatin1String("-c2 -l3");
flatArgs << QLatin1String("-c2 -l2");
#ifdef FC_OS_LINUX
QString path = QString::fromUtf8(hGrp->GetASCII("Graphviz", "/usr/bin").c_str());
@@ -302,7 +309,7 @@ QByteArray GraphvizView::exportGraph(const QString& format)
QProcess dotProc, flatProc;
QStringList args, flatArgs;
args << QString::fromLatin1("-T%1").arg(format);
flatArgs << QLatin1String("-c2 -l3");
flatArgs << QLatin1String("-c2 -l2");
#ifdef FC_OS_LINUX
QString path = QString::fromUtf8(hGrp->GetASCII("Graphviz", "/usr/bin").c_str());
@@ -317,23 +324,30 @@ QByteArray GraphvizView::exportGraph(const QString& format)
QString exe = QString::fromLatin1("%1/dot").arg(path);
QString unflatten = QString::fromLatin1("%1/unflatten").arg(path);
#endif
flatProc.setEnvironment(QProcess::systemEnvironment());
flatProc.start(unflatten, flatArgs);
if (!flatProc.waitForStarted()) {
return QByteArray();
}
flatProc.write(graphCode.c_str(), graphCode.size());
flatProc.closeWriteChannel();
if (!flatProc.waitForFinished())
return QByteArray();
dotProc.setEnvironment(QProcess::systemEnvironment());
dotProc.start(exe, args);
if (!dotProc.waitForStarted()) {
return QByteArray();
}
dotProc.write(flatProc.readAll());
ParameterGrp::handle depGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/DependencyGraph");
if(depGrp->GetBool("Unflatten", true)) {
flatProc.setEnvironment(QProcess::systemEnvironment());
flatProc.start(unflatten, flatArgs);
if (!flatProc.waitForStarted()) {
return QByteArray();
}
flatProc.write(graphCode.c_str(), graphCode.size());
flatProc.closeWriteChannel();
if (!flatProc.waitForFinished())
return QByteArray();
dotProc.write(flatProc.readAll());
}
else
dotProc.write(graphCode.c_str(), graphCode.size());
dotProc.closeWriteChannel();
if (!dotProc.waitForFinished())
return QByteArray();