From c696c0d1d26fb8ff891fe5bf0587ce25e6f86abe Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Sun, 13 Oct 2024 16:54:16 +0800 Subject: [PATCH] 1 --- StoryPresent/dag_layout.cpp | 20 ++++++++++---------- StoryPresent/dag_layout.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/StoryPresent/dag_layout.cpp b/StoryPresent/dag_layout.cpp index 5e03a29..5a43798 100644 --- a/StoryPresent/dag_layout.cpp +++ b/StoryPresent/dag_layout.cpp @@ -464,15 +464,15 @@ void dags::DAGGraph::nodes_sort_with_belows(int curr_layer, const QList>& total_nodes) { -// int layer_index = 0; -// QList> nodes; -// while ((nodes = this->nodes_revise_forward_within_layer(layer_index, total_nodes)).size()) { -// current_nodelist_filling_springs(nodes); -// nodes_sort_with_above(layer_index, total_nodes); -// layer_index++; -// } -//} +void dags::DAGGraph::graph_springs_layout_forward(const QList>& total_nodes) { + int layer_index = 0; + QList> nodes; + while ((nodes = this->nodes_revise_forward_within_layer(layer_index, total_nodes)).size()) { + current_nodelist_filling_springs(nodes); + nodes_sort_with_above(layer_index, total_nodes); + layer_index++; + } +} //QList> dags::DAGGraph::nodes_revise_forward_within_layer(int layer_index, const QList>& nodes) { // @@ -561,7 +561,7 @@ void dags::DAGGraph::backwardsLayoutImpls() { } void dags::DAGGraph::adjustLayoutImpls() { - //this->graph_springs_layout_forward(this->node_with_layout); + this->graph_springs_layout_forward(this->node_with_layout); } diff --git a/StoryPresent/dag_layout.h b/StoryPresent/dag_layout.h index c4345ef..5e3974c 100644 --- a/StoryPresent/dag_layout.h +++ b/StoryPresent/dag_layout.h @@ -102,10 +102,10 @@ namespace dags { void nodes_sort_with_above(int curr_layer, const QList>& total_nodes); void nodes_sort_with_belows(int curr_layer, const QList>& total_nodes); - //void graph_springs_layout_forward(const QList>& total_nodes); - //QList> nodes_revise_forward_within_layer(int layer_index, const QList>& nodes); - //double node_revise_via_upstream(const QList, double>>& prev_nodes, std::shared_ptr node); - //bool current_nodelist_filling_springs(const QList>& ordered_nodes); + void graph_springs_layout_forward(const QList>& total_nodes); + QList> nodes_revise_forward_within_layer(int layer_index, const QList>& nodes); + double node_revise_via_upstream(const QList, double>>& prev_nodes, std::shared_ptr node); + bool current_nodelist_filling_springs(const QList>& ordered_nodes); //bool node_adjust_inlayer_forward(int curr_layer, const QList>& total_nodes);