From 55957ede2dfcd70a03cd1204355695505b3e5d54 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Mon, 5 Oct 2020 13:08:02 +0200
Subject: [PATCH] Avoid expanding the juntions info when creating connection
 roads.

---
 OpenRoadEd/Qt/SettingsWidgets/SettingsJunction.cpp |  1 +
 OpenRoadEd/Qt/SettingsWidgets/SettingsLane.cpp     |  2 +-
 OpenRoadEd/Qt/Tree/RoadTree.cpp                    | 10 ++++++++++
 OpenRoadEd/Qt/Tree/RoadTree.h                      |  2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/OpenRoadEd/Qt/SettingsWidgets/SettingsJunction.cpp b/OpenRoadEd/Qt/SettingsWidgets/SettingsJunction.cpp
index 48efd19..f8c21b9 100644
--- a/OpenRoadEd/Qt/SettingsWidgets/SettingsJunction.cpp
+++ b/OpenRoadEd/Qt/SettingsWidgets/SettingsJunction.cpp
@@ -110,6 +110,7 @@ void SettingsJunction::CreateRoadsPressed(void)
     }
   }
   mRoadTree->SelectJunction(junction_index);
+  mRoadTree->CollapseSelection();
   if(errors!=0)
   {
     QMessageBox messageBox;
diff --git a/OpenRoadEd/Qt/SettingsWidgets/SettingsLane.cpp b/OpenRoadEd/Qt/SettingsWidgets/SettingsLane.cpp
index b70e8e8..205f073 100644
--- a/OpenRoadEd/Qt/SettingsWidgets/SettingsLane.cpp
+++ b/OpenRoadEd/Qt/SettingsWidgets/SettingsLane.cpp
@@ -228,4 +228,4 @@ void SettingsLane::SuccessorIdChanged(int value)
 {
 	// Sets the new value
 	mLane->SetSuccessor(value);
-}
\ No newline at end of file
+}
diff --git a/OpenRoadEd/Qt/Tree/RoadTree.cpp b/OpenRoadEd/Qt/Tree/RoadTree.cpp
index f9a335b..cdb6661 100644
--- a/OpenRoadEd/Qt/Tree/RoadTree.cpp
+++ b/OpenRoadEd/Qt/Tree/RoadTree.cpp
@@ -2075,6 +2075,16 @@ void RoadTree::LoadStructure(OpenDrive *openDrive)
 	connect(mTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(OnItemSelected())); 
 }
 
+void RoadTree::ExpandSelection(void)
+{
+  this->OnExpandPressed();
+}
+
+void RoadTree::CollapseSelection(void)
+{
+  this->OnCollapsePressed();
+}
+
 /**
  * Method called when an item in the road tree is clicked
  */
diff --git a/OpenRoadEd/Qt/Tree/RoadTree.h b/OpenRoadEd/Qt/Tree/RoadTree.h
index e5b7ad0..444e872 100644
--- a/OpenRoadEd/Qt/Tree/RoadTree.h
+++ b/OpenRoadEd/Qt/Tree/RoadTree.h
@@ -366,6 +366,8 @@ public:
 	JunctionPriorityRoad* GetRealJunctionPriority(int indexJunction, int indexPriority);
 	JunctionController* GetRealJunctionController(int indexJunction, int indexController);
 
+  void ExpandSelection(void);
+  void CollapseSelection(void);
 
 private:
 	/**
-- 
GitLab