29 nodes_.append(std::unique_ptr<Node>(
node));
30 top_level_nodes_.add_new(
node);
38 clusters_.append(std::unique_ptr<Cluster>(cluster));
39 top_level_clusters_.add_new(cluster);
47 edges_.append(std::unique_ptr<UndirectedEdge>(edge));
54 edges_.append(std::unique_ptr<DirectedEdge>(edge));
60 if (parent_ == new_parent) {
63 if (parent_ ==
nullptr) {
64 graph_.top_level_clusters_.remove(
this);
65 new_parent->children_.add_new(
this);
67 else if (new_parent ==
nullptr) {
68 parent_->children_.remove(
this);
69 graph_.top_level_clusters_.add_new(
this);
72 parent_->children_.remove(
this);
73 new_parent->children_.add_new(
this);
80 if (cluster_ == cluster) {
83 if (cluster_ ==
nullptr) {
84 graph_.top_level_nodes_.remove(
this);
85 cluster->nodes_.add_new(
this);
87 else if (cluster ==
nullptr) {
88 cluster_->nodes_.remove(
this);
89 graph_.top_level_nodes_.add_new(
this);
92 cluster_->nodes_.remove(
this);
93 cluster->nodes_.add_new(
this);
103 for (
Cluster *cluster : top_level_clusters_) {
104 cluster->set_random_cluster_bgcolors();
110 float hue = rand() / (
float)RAND_MAX;
111 float staturation = 0.3f;
115 for (
Cluster *cluster : children_) {
116 cluster->set_random_cluster_bgcolors();
123 while (current !=
nullptr) {
124 if (current ==
this) {
127 current = current->parent_;
137 std::stringstream ss;
142 for (
const std::unique_ptr<DirectedEdge> &edge : edges_) {
143 edge->export__as_edge_statement(ss);
153 std::stringstream ss;
158 for (
const std::unique_ptr<UndirectedEdge> &edge : edges_) {
159 edge->export__as_edge_statement(ss);
173 for (
Node *
node : top_level_nodes_) {
174 node->export__as_declaration(ss);
177 for (
Cluster *cluster : top_level_clusters_) {
178 cluster->export__declare_nodes_and_clusters(ss);
184 ss <<
"subgraph " << this->
name() <<
" {\n";
191 node->export__as_declaration(ss);
194 for (
Cluster *cluster : children_) {
195 cluster->export__declare_nodes_and_clusters(ss);
225 ss << key <<
"=" << value <<
", ";
229 for (
char c : value) {
258 if (port_name_.has_value()) {
259 ss <<
":" << *port_name_;
265 std::stringstream ss;
266 ss << std::setprecision(4) << h <<
' ' << s <<
' ' <<
v;
276 std::stringstream ss;
278 ss << R
"(<<table border="0" cellspacing="3">)";
281 ss << R
"(<tr><td colspan="3" align="center"><b>)";
282 ss << ((name.size() == 0) ? "No Name" : name);
283 ss <<
"</b></td></tr>";
287 for (
int i = 0; i < socket_max_amount; i++) {
289 if (i < input_names.
size()) {
291 if (name.
size() == 0) {
294 ss << R
"(<td align="left" port="in)" << i << "\">";
302 if (i < output_names.
size()) {
304 if (name.
size() == 0) {
307 ss << R
"(<td align="right" port="out)" << i << "\">";
typedef float(TangentPoint)[2]
ATTR_WARN_UNUSED_RESULT const BMVert * v
void foreach_item(const FuncT &func) const
constexpr int64_t size() const
constexpr int64_t size() const
void export__as_bracket_list(std::stringstream &ss) const
void set(StringRef key, StringRef value)
void set_parent_cluster(Cluster *new_parent)
bool contains(Node &node) const
void export__declare_nodes_and_clusters(std::stringstream &ss) const
void set_random_cluster_bgcolors()
void export__as_edge_statement(std::stringstream &ss) const
DirectedEdge & new_edge(NodePort from, NodePort to)
std::string to_dot_string() const
Cluster & new_cluster(StringRef label="")
void set_random_cluster_bgcolors()
Node & new_node(StringRef label)
void export__declare_nodes_and_clusters(std::stringstream &ss) const
void to_dot_string(std::stringstream &ss) const
NodeWithSocketsRef(Node &node, StringRef name, Span< std::string > input_names, Span< std::string > output_names)
void set_shape(Attr_shape shape)
void export__as_declaration(std::stringstream &ss) const
void export__as_id(std::stringstream &ss) const
void set_parent_cluster(Cluster *cluster)
void export__as_edge_statement(std::stringstream &ss) const
UndirectedEdge & new_edge(NodePort a, NodePort b)
std::string to_dot_string() const
std::string color_attr_from_hsv(float h, float s, float v)
_W64 unsigned int uintptr_t