src: refactoring of GraphNode and GraphEdge classes

* common base class QtGraphNode
* derived class QtGraphNodeData for nodes representing the data model
* removed GraphNode and GraphEdge interface classes
* moved and renamed files for DummyNode and DummyEdge
* refactored includes throughout Graph UI related files
This commit is contained in:
Eberhard Graether
2015-05-22 13:54:50 +02:00
parent 1e8d8cece0
commit bd5de1d271
25 changed files with 328 additions and 373 deletions
@@ -4,8 +4,8 @@
#include "utility/logging/logging.h"
#include "component/view/graphElements/GraphEdge.h"
#include "component/view/graphElements/GraphNode.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/controller/helper/DummyNode.h"
#include "component/view/GraphView.h"
#include "component/view/GraphViewStyle.h"
#include "data/access/StorageAccess.h"
@@ -1,16 +1,14 @@
#include "component/controller/GraphLayouter.h"
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include "component/view/graphElements/GraphEdge.h"
#include "component/view/graphElements/GraphNode.h"
#include "utility/math/MatrixDynamicBase.h"
#include "component/controller/helper/DummyEdge.h"
#include "component/controller/helper/DummyNode.h"
// for prototyping, remove when done
#include "Eigen/Dense"
#include "Eigen/Eigenvalues"
@@ -151,10 +149,7 @@ void GraphLayouter::layoutSpectralPrototype(std::vector<DummyNode>& nodes, const
nodes[i].position.x = newPos.x;
nodes[i].position.y = newPos.y;
//std::cout << newPos << std::endl;
}
//std::cout << "=================" << std::endl;
}
}
@@ -0,0 +1,29 @@
#ifndef DUMMY_EDGE_H
#define DUMMY_EDGE_H
#include "utility/types.h"
class Edge;
// temporary data structure for (visual) graph creation process
struct DummyEdge
{
DummyEdge(const Id ownerId, const Id targetId, const Edge* data)
: ownerId(ownerId)
, targetId(targetId)
, data(data)
, visible(false)
, active(false)
{
}
Id ownerId;
Id targetId;
const Edge* data;
bool visible;
bool active;
};
#endif // DUMMY_EDGE_H
@@ -0,0 +1,77 @@
#ifndef DUMMY_NODE_H
#define DUMMY_NODE_H
#include "utility/math/Vector2.h"
#include "utility/types.h"
#include "data/graph/token_component/TokenComponentAccess.h"
class Node;
// temporary data structure for (visual) graph creation process
struct DummyNode
{
public:
DummyNode()
: visible(false)
, childVisible(false)
, topLevelAncestorId(0)
, tokenId(0)
, data(nullptr)
, active(false)
, connected(false)
, aggregated(false)
, expanded(false)
, autoExpanded(false)
, accessType(TokenComponentAccess::ACCESS_NONE)
, invisibleSubNodeCount(0)
{
}
bool isGraphNode() const
{
return data != nullptr;
}
bool isAccessNode() const
{
return accessType != TokenComponentAccess::ACCESS_NONE;
}
bool isExpandToggleNode() const
{
return !data && !isAccessNode();
}
bool isExpanded() const
{
return expanded || autoExpanded;
}
Vec2i position;
Vec2i size;
bool visible;
bool childVisible;
Id topLevelAncestorId;
Id tokenId;
std::vector<DummyNode> subNodes;
// GraphNode
const Node* data;
bool active;
bool connected;
bool aggregated;
bool expanded;
bool autoExpanded;
// AccessNode
TokenComponentAccess::AccessType accessType;
// ExpandToggleNode
size_t invisibleSubNodeCount;
};
#endif // DUMMY_NODE_H