summaryrefslogtreecommitdiff
path: root/src/data/graphelementdata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/graphelementdata.cpp')
-rw-r--r--src/data/graphelementdata.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/data/graphelementdata.cpp b/src/data/graphelementdata.cpp
index cd09a6d..e1e89b1 100644
--- a/src/data/graphelementdata.cpp
+++ b/src/data/graphelementdata.cpp
@@ -110,6 +110,14 @@ int GraphElementData::indexOfKey(QString key)
return -1;
}
+void GraphElementData::mergeData(GraphElementData *d)
+{
+ GraphElementProperty p;
+ foreach (p, d->properties()) {
+ if (!hasProperty(p.key())) add(p);
+ }
+}
+
bool GraphElementData::removeRows(int row, int /*count*/, const QModelIndex &parent)
{
if (row >= 0 && row < _properties.length()) {
@@ -257,3 +265,30 @@ QVector<GraphElementProperty> GraphElementData::properties() const
{
return _properties;
}
+
+GraphElementData *GraphElementData::pathData() const
+{
+ GraphElementData *d = new GraphElementData();
+ foreach(GraphElementProperty p, _properties) {
+ if (isPathProperty(p.key())) d->add(p);
+ }
+ return d;
+}
+
+GraphElementData *GraphElementData::nonPathData() const
+{
+ GraphElementData *d = new GraphElementData();
+ foreach(GraphElementProperty p, _properties) {
+ if (!isPathProperty(p.key())) d->add(p);
+ }
+ return d;
+}
+
+bool GraphElementData::isPathProperty(QString key)
+{
+ return (key == "bend left" ||
+ key == "bend right" ||
+ key == "in" ||
+ key == "out" ||
+ key == "looseness");
+}