ui: graph view layouting and member rendering

Added simple layouting functions (implementations for simple grid and circle layout).
Also the graph displays class members and connections (edges) to or from them "correctly" now.

fortune cookie message = Your exotic ideas will lead you to many exciting new adventures.
This commit is contained in:
Manuel Dobusch
2014-07-15 16:40:52 +02:00
parent 61cb4afd91
commit ec42ef708d
24 changed files with 839 additions and 165 deletions
@@ -1,6 +1,7 @@
#ifndef GRAPH_NODE_H
#define GRAPH_NODE_H
#include <list>
#include <memory>
#include "utility/math/Vector2.h"
@@ -14,17 +15,21 @@ public:
GraphNode(const Id tokenId);
virtual ~GraphNode();
virtual std::string getName() = 0;
Id getTokenId();
virtual Vec2i getPosition() = 0;
virtual std::string getName() const = 0;
Id getTokenId() const;
virtual Vec2i getPosition() const = 0;
virtual void setPosition(const Vec2i& position) = 0;
virtual bool addOutEdge(const std::shared_ptr<GraphEdge>& edge) = 0;
virtual bool addInEdge(const std::weak_ptr<GraphEdge>& edge) = 0;
virtual void removeOutEdge(GraphEdge* edge) = 0;
virtual std::list<std::shared_ptr<GraphNode> > getSubNodes() const = 0;
virtual void addSubNode(const std::shared_ptr<GraphNode>& node) = 0;
virtual void notifyParentMoved() = 0;
protected:
Id m_tokenId;
};
@@ -36,13 +41,56 @@ public:
: name(n)
, tokenId(tId)
, position(p)
, subNodes()
, actualNode()
{
}
bool operator==(const DummyNode& other) const
{
if(tokenId == other.tokenId
&& name == other.name
&& position == position)
{
return true;
}
return false;
}
bool operator!=(const DummyNode& other) const
{
return !(*this == other);
}
bool operator<(const DummyNode& other) const
{
if(tokenId < other.tokenId)
{
return true;
}
return false;
}
bool operator>(const DummyNode& other) const
{
return !(*this < other);
}
void operator=(DummyNode& other)
{
name = other.name;
tokenId = other.tokenId;
position = other.position;
subNodes = other.subNodes;
actualNode = other.actualNode;
}
std::string name;
Id tokenId;
Vec2i position;
std::vector<DummyNode> subNodes;
std::weak_ptr<GraphNode> actualNode;
};