This change adds the class GraphViewStyle that holds all values for defining the style of Nodes and Edges in the Graph. The GraphViewStyleImpl interface and the QtGraphViewStyleImpl implementation are used to request Qt specific metrics, like the charwidth of used fonts. This change includes the following fixes: * aggregation number always in the middle between nodes * darker color for aggregation edge * split off QGraphicsLineItem implementations from QtGraphEdge * fixed some colors in color scheme fortune cookie message = Sorge dich nicht! Du wirst bekommen was du brauchst.
96 lines
1.8 KiB
C++
96 lines
1.8 KiB
C++
#ifndef GRAPH_NODE_H
|
|
#define GRAPH_NODE_H
|
|
|
|
#include <list>
|
|
#include <memory>
|
|
|
|
#include "utility/math/Vector2.h"
|
|
#include "utility/math/Vector4.h"
|
|
#include "utility/types.h"
|
|
|
|
#include "data/graph/Node.h"
|
|
#include "data/graph/token_component/TokenComponentAccess.h"
|
|
|
|
class GraphEdge;
|
|
|
|
class GraphNode
|
|
{
|
|
public:
|
|
GraphNode(const Node* data);
|
|
virtual ~GraphNode();
|
|
|
|
virtual std::string getName() const = 0;
|
|
Id getTokenId() const;
|
|
|
|
const Node* getData() const;
|
|
void setData(const Node* data);
|
|
|
|
virtual bool isAccessNode() const = 0;
|
|
|
|
virtual Vec2i getPosition() const = 0;
|
|
virtual bool setPosition(const Vec2i& position) = 0;
|
|
virtual void moveTo(const Vec2i& position) = 0;
|
|
|
|
virtual Vec2i getSize() const = 0;
|
|
virtual void setSize(const Vec2i& size) = 0;
|
|
|
|
virtual Vec4i getBoundingRect() const = 0;
|
|
virtual Vec4i getParentBoundingRect() const = 0;
|
|
|
|
virtual void addOutEdge(const std::shared_ptr<GraphEdge>& edge) = 0;
|
|
virtual void addInEdge(const std::weak_ptr<GraphEdge>& edge) = 0;
|
|
|
|
virtual size_t getOutEdgeCount() const = 0;
|
|
virtual size_t getInEdgeCount() const = 0;
|
|
|
|
protected:
|
|
const Node* m_data;
|
|
};
|
|
|
|
struct DummyNode
|
|
{
|
|
public:
|
|
DummyNode()
|
|
: data(nullptr)
|
|
, accessType(TokenComponentAccess::ACCESS_NONE)
|
|
, active(false)
|
|
, connected(false)
|
|
, aggregated(false)
|
|
, expanded(false)
|
|
, autoExpanded(false)
|
|
, invisibleSubNodeCount(0)
|
|
, visible(false)
|
|
, topLevelAncestorId(0)
|
|
, tokenId(0)
|
|
{
|
|
}
|
|
|
|
bool isExpanded() const
|
|
{
|
|
return expanded || autoExpanded;
|
|
}
|
|
|
|
const Node* data;
|
|
TokenComponentAccess::AccessType accessType;
|
|
|
|
Vec2i position;
|
|
Vec2i size;
|
|
|
|
bool active;
|
|
bool connected;
|
|
bool aggregated;
|
|
|
|
bool expanded;
|
|
bool autoExpanded;
|
|
size_t invisibleSubNodeCount;
|
|
|
|
bool visible;
|
|
|
|
Id topLevelAncestorId;
|
|
Id tokenId;
|
|
|
|
std::vector<DummyNode> subNodes;
|
|
};
|
|
|
|
#endif // GRAPH_NODE_H
|