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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user