Connector shared_ptr keeps one owner and i don't know where it is!
This commit is contained in:
+2
-1
@@ -3,9 +3,10 @@
|
||||
#include "draggable.h"
|
||||
#include "vmath.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace VISEQ::BASE {
|
||||
class Connectable : public Draggable{
|
||||
class Connectable : public Draggable {
|
||||
public:
|
||||
Connectable() {}
|
||||
Connectable(Vec2Df position) : Draggable(position) {}
|
||||
|
||||
+3
-3
@@ -64,9 +64,9 @@ namespace VISEQ::GRAPH {
|
||||
BASE::Connectable::draw();
|
||||
float opacity = 150.0f - Clamp(position.dist(SCREEN_MOUSE), 0.0f, 150.0f);
|
||||
|
||||
/*if(partner){*/
|
||||
/* DrawLineV(position, partner->position, VS_COLOR_RED);*/
|
||||
/*}*/
|
||||
if(partner){
|
||||
DrawLineV(position, partner->position, VS_COLOR_RED);
|
||||
}
|
||||
|
||||
if(hovering()){
|
||||
DrawCircle(position.x, position.y, 8.0f, (Color){108, 203, 237, 255});
|
||||
|
||||
+7
-2
@@ -71,10 +71,10 @@ namespace VISEQ::GRAPH {
|
||||
edges.emplace_back(std::make_shared<Edge>());
|
||||
edges.back()->start = from;
|
||||
edges.back()->end = to;
|
||||
from->connections.push_back(edges.back());
|
||||
to->connections.push_back(edges.back());
|
||||
edges.back()->start_conn = from->connectors.back();
|
||||
edges.back()->end_conn = to->connectors.back();
|
||||
from->connections.push_back(edges.back());
|
||||
to->connections.push_back(edges.back());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +222,14 @@ namespace VISEQ::GRAPH {
|
||||
}
|
||||
|
||||
void removeEdges(){
|
||||
|
||||
for(auto edge : remove_edges){
|
||||
std::cout << "connectors size: " << edge->start->connectors.size() << std::endl;
|
||||
std::cout << "use count: " << edge->start_conn.use_count() << std::endl;
|
||||
std::erase(edge->start->connectors, edge->start_conn);
|
||||
std::erase(edge->end->connectors, edge->end_conn);
|
||||
std::cout << "connectors size: " << edge->start->connectors.size() << std::endl;
|
||||
std::cout << "use count: " << edge->start_conn.use_count() << std::endl;
|
||||
std::erase(edge->start->connections, edge);
|
||||
std::erase(edge->end->connections, edge);
|
||||
std::erase(edges, edge);
|
||||
|
||||
@@ -41,8 +41,6 @@ namespace VISEQ::GRAPH::NODES {
|
||||
std::vector<std::shared_ptr<Node>> neighbors;
|
||||
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;
|
||||
|
||||
Distribution distributionMode = Distribution::GEOMETRIC;
|
||||
|
||||
Reference in New Issue
Block a user