@@ -49,7 +49,6 @@ void VisualizationControlPanel::setupUI()
4949 layoutTypeCombo_ = new QComboBox;
5050 layoutTypeCombo_->addItem (" Automatic" , static_cast <int >(LayoutType::Automatic));
5151 layoutTypeCombo_->addItem (" Yifan Hu" , static_cast <int >(LayoutType::YifanHu));
52- layoutTypeCombo_->addItem (" Force Atlas" , static_cast <int >(LayoutType::ForceAtlas));
5352 layoutTypeCombo_->addItem (" Spring Force" , static_cast <int >(LayoutType::SpringForce));
5453 layoutTypeCombo_->addItem (" Circular" , static_cast <int >(LayoutType::Circular));
5554 layoutTypeCombo_->addItem (" Hierarchical" , static_cast <int >(LayoutType::Hierarchical));
@@ -219,11 +218,7 @@ void VisualizationControlPanel::setupAutomaticParamsUI()
219218
220219 QLabel* infoLabel = new QLabel (
221220 " <b>Automatic Layout</b><br>"
222- " Selects the best algorithm based on graph size:<br>"
223- " • ≤12 nodes: Circular<br>"
224- " • ≤50 nodes: Yifan Hu<br>"
225- " • ≤200 nodes: Force Atlas<br>"
226- " • >200 nodes: Circular (fast)"
221+ " Automatically selects the best layout algorithm based on graph size."
227222 );
228223 infoLabel->setWordWrap (true );
229224 layout->addWidget (infoLabel);
@@ -769,16 +764,32 @@ void VisualizationControlPanel::setEnabled(bool enabled)
769764
770765void VisualizationControlPanel::onLayoutTypeChanged ()
771766{
772- int index = getSelectedLayoutAlgorithm ();
773- if (parametersStackedWidget_ && index >= 0 && index < parametersStackedWidget_->count ()) {
774- parametersStackedWidget_->setCurrentIndex (index);
767+ if (!layoutTypeCombo_) {
768+ return ;
775769 }
776-
777- if (layoutTypeCombo_) {
778- LayoutType selectedType = static_cast <LayoutType>(layoutTypeCombo_->currentData ().toInt ());
779- emit layoutAlgorithmChanged (static_cast <int >(selectedType));
770+
771+ LayoutType selectedType = static_cast <LayoutType>(layoutTypeCombo_->currentData ().toInt ());
772+
773+ int stackIndex = 0 ;
774+ switch (selectedType) {
775+ case LayoutType::Automatic: stackIndex = 0 ; break ;
776+ case LayoutType::SeedCentric: stackIndex = 1 ; break ;
777+ case LayoutType::FWTL: stackIndex = 2 ; break ;
778+ case LayoutType::YifanHu: stackIndex = 3 ; break ;
779+ case LayoutType::ForceAtlas: stackIndex = 4 ; break ;
780+ case LayoutType::SpringForce: stackIndex = 5 ; break ;
781+ case LayoutType::Circular: stackIndex = 6 ; break ;
782+ case LayoutType::Hierarchical: stackIndex = 7 ; break ;
783+ case LayoutType::Grid: stackIndex = 8 ; break ;
784+ case LayoutType::Random: stackIndex = 9 ; break ;
785+ default : stackIndex = 0 ; break ;
780786 }
781-
787+
788+ if (parametersStackedWidget_ && stackIndex >= 0 && stackIndex < parametersStackedWidget_->count ()) {
789+ parametersStackedWidget_->setCurrentIndex (stackIndex);
790+ }
791+
792+ emit layoutAlgorithmChanged (static_cast <int >(selectedType));
782793 emit layoutTypeChanged ();
783794}
784795
0 commit comments