Files
viseq/src/edge.h
T

53 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include "connector.h"
#include "graph-item.h"
2024-11-03 03:48:49 +01:00
#include <memory>
#include "node.h"
2024-11-03 03:48:49 +01:00
using namespace VISEQ::GRAPH;
2024-11-03 03:48:49 +01:00
namespace VISEQ::GRAPH::EDGES {
class Edge : public GraphItem{
2024-11-03 03:48:49 +01:00
public:
Edge() {}
2024-12-03 01:25:49 +01:00
Edge(std::weak_ptr<NODES::Node> start, std::weak_ptr<NODES::Node> end) : start(start), end(end) {}
2024-12-03 01:25:49 +01:00
std::weak_ptr<NODES::Node> start;
std::weak_ptr<NODES::Node> end;
std::weak_ptr<Connector> start_conn;
std::weak_ptr<Connector> end_conn;
2024-11-30 12:47:33 +01:00
2024-11-07 00:56:33 +01:00
EdgeType edgeType;
2024-11-03 03:48:49 +01:00
bool pass_forward = true;
bool pass_backward = true;
bool active = false;
bool config = false;
bool split = false;
2024-11-07 00:56:33 +01:00
float speed = 0;
float bpm = 120.0f;
2024-11-03 03:48:49 +01:00
float connector_offset = 8.0f;
float switches_offset = 25.0f;
2026-01-12 00:16:36 +01:00
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);
2024-11-03 03:48:49 +01:00
};
typedef std::shared_ptr<Edge> SPTR_Edge;
2024-12-03 01:25:49 +01:00
typedef std::weak_ptr<Edge> WPTR_Edge;
2024-11-03 03:48:49 +01:00
typedef std::vector<SPTR_Edge> VEC_SPTR_Edge;
2024-12-03 01:25:49 +01:00
typedef std::vector<WPTR_Edge> VEC_WPTR_Edge;
2024-11-03 03:48:49 +01:00
}