preparing for node->connector->edge->connector->node
This commit is contained in:
+10
-1
@@ -11,12 +11,21 @@ namespace VISEQ::GRAPH {
|
|||||||
using GraphItem::state;
|
using GraphItem::state;
|
||||||
|
|
||||||
Connector() {}
|
Connector() {}
|
||||||
Connector(Vec2Df center_position, float orbit) : orbit(orbit) {setPosition(center_position);}
|
Connector(std::shared_ptr<GraphItem> parent, Vec2Df center_position, float orbit) : orbit(orbit) {
|
||||||
|
setPosition(center_position);
|
||||||
|
setParent(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<GraphItem> parent;
|
||||||
|
|
||||||
float radius = 5.0f;
|
float radius = 5.0f;
|
||||||
float orbit = 14.0f;
|
float orbit = 14.0f;
|
||||||
Vec2Df center_position;
|
Vec2Df center_position;
|
||||||
|
|
||||||
|
void setParent(std::shared_ptr<GraphItem> _parent){
|
||||||
|
parent = _parent;
|
||||||
|
}
|
||||||
|
|
||||||
void setPosition(Vec2Df pos) override {
|
void setPosition(Vec2Df pos) override {
|
||||||
center_position = pos;
|
center_position = pos;
|
||||||
if(!partner) position = center_position - ((center_position - state->screen_mouse)).norm() * (radius + orbit);
|
if(!partner) position = center_position - ((center_position - state->screen_mouse)).norm() * (radius + orbit);
|
||||||
|
|||||||
+3
-1
@@ -25,7 +25,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
Node(Vec2Df p) : Draggable(p) {}
|
Node(Vec2Df p) : Draggable(p) {}
|
||||||
|
|
||||||
void addConnector() {
|
void addConnector() {
|
||||||
connectors.emplace_back(std::make_shared<Connector>(position, radius + 5.0f));
|
connectors.emplace_back(std::make_shared<Connector>(std::make_shared<GraphItem>(this), position, radius + 5.0f));
|
||||||
connectors.back()->init();
|
connectors.back()->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +38,8 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
std::vector<std::shared_ptr<Node>> neighbors;
|
std::vector<std::shared_ptr<Node>> neighbors;
|
||||||
std::vector<std::shared_ptr<VISEQ::GRAPH::EDGES::Edge>> connections;
|
std::vector<std::shared_ptr<VISEQ::GRAPH::EDGES::Edge>> connections;
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<Node>> connected_nodes; //TODO: change from node->edge->node to node->node with edge being edge[node->node]
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Connector>> connectors;
|
std::vector<std::shared_ptr<Connector>> connectors;
|
||||||
|
|
||||||
Distribution distributionMode = Distribution::GEOMETRIC;
|
Distribution distributionMode = Distribution::GEOMETRIC;
|
||||||
|
|||||||
Reference in New Issue
Block a user