Files
viseq/src/edge.h
T
2026-01-12 00:16:36 +01:00

53 lines
1.4 KiB
C++

#pragma once
#include "connector.h"
#include "graph-item.h"
#include <memory>
#include "node.h"
using namespace VISEQ::GRAPH;
namespace VISEQ::GRAPH::EDGES {
class Edge : public GraphItem{
public:
Edge() {}
Edge(std::weak_ptr<NODES::Node> start, std::weak_ptr<NODES::Node> end) : start(start), end(end) {}
std::weak_ptr<NODES::Node> start;
std::weak_ptr<NODES::Node> end;
std::weak_ptr<Connector> start_conn;
std::weak_ptr<Connector> end_conn;
EdgeType edgeType;
bool pass_forward = true;
bool pass_backward = true;
bool active = false;
bool config = false;
bool split = false;
float speed = 0;
float bpm = 120.0f;
float connector_offset = 8.0f;
float switches_offset = 25.0f;
virtual bool GActive();
virtual EdgeType getEdgeType() const;
std::weak_ptr<NODES::Node> getNextNode(std::weak_ptr<NODES::Node> origin);
void draw(Vec2Df mouse_pos, Camera2D cam);
friend void to_json(json& j, const Edge& E);
friend void from_json(const json& j, Edge& E);
friend void to_json(json& j, const std::shared_ptr<Edge>& E);
friend void from_json(const json& j, std::shared_ptr<Edge>& E);
};
typedef std::shared_ptr<Edge> SPTR_Edge;
typedef std::weak_ptr<Edge> WPTR_Edge;
typedef std::vector<SPTR_Edge> VEC_SPTR_Edge;
typedef std::vector<WPTR_Edge> VEC_WPTR_Edge;
}