From f3f8dd9deef8d369e68575f6a9288f1f97026c6a Mon Sep 17 00:00:00 2001 From: Jannik Busse Date: Mon, 9 Jan 2023 13:20:18 +0100 Subject: [PATCH 1/4] added Template files --- {io => examples}/Templates/Template_jun_2M.xml | 0 {io => examples}/Templates/Template_jun_3A.xml | 0 {io => examples}/Templates/Template_jun_M2A.xml | 0 {io => examples}/Templates/Template_jun_MA.xml | 0 {io => examples}/Templates/Template_road.xml | 0 {io => examples}/Templates/Template_roundabout.xml | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {io => examples}/Templates/Template_jun_2M.xml (100%) rename {io => examples}/Templates/Template_jun_3A.xml (100%) rename {io => examples}/Templates/Template_jun_M2A.xml (100%) rename {io => examples}/Templates/Template_jun_MA.xml (100%) rename {io => examples}/Templates/Template_road.xml (100%) rename {io => examples}/Templates/Template_roundabout.xml (100%) diff --git a/io/Templates/Template_jun_2M.xml b/examples/Templates/Template_jun_2M.xml similarity index 100% rename from io/Templates/Template_jun_2M.xml rename to examples/Templates/Template_jun_2M.xml diff --git a/io/Templates/Template_jun_3A.xml b/examples/Templates/Template_jun_3A.xml similarity index 100% rename from io/Templates/Template_jun_3A.xml rename to examples/Templates/Template_jun_3A.xml diff --git a/io/Templates/Template_jun_M2A.xml b/examples/Templates/Template_jun_M2A.xml similarity index 100% rename from io/Templates/Template_jun_M2A.xml rename to examples/Templates/Template_jun_M2A.xml diff --git a/io/Templates/Template_jun_MA.xml b/examples/Templates/Template_jun_MA.xml similarity index 100% rename from io/Templates/Template_jun_MA.xml rename to examples/Templates/Template_jun_MA.xml diff --git a/io/Templates/Template_road.xml b/examples/Templates/Template_road.xml similarity index 100% rename from io/Templates/Template_road.xml rename to examples/Templates/Template_road.xml diff --git a/io/Templates/Template_roundabout.xml b/examples/Templates/Template_roundabout.xml similarity index 100% rename from io/Templates/Template_roundabout.xml rename to examples/Templates/Template_roundabout.xml From f4c493a13ce8f233f30cffeac38bb9a7d26a50f3 Mon Sep 17 00:00:00 2001 From: Jannik Busse Date: Mon, 9 Jan 2023 15:54:54 +0100 Subject: [PATCH 2/4] fixed a bug where false warnings were thrown and changed example files --- examples/carla_test.xml | 59 ------------ examples/complex.xml | 156 -------------------------------- examples/con_lanewiden.xml | 2 +- examples/err.xml | 111 ----------------------- examples/err_only_jun.xml | 46 ---------- examples/geomBug.xml | 111 ----------------------- examples/junction_ma.xml | 4 +- examples/rb_crash.xml | 71 --------------- examples/rb_linking_bug.xml | 93 ------------------- examples/small_test.xml | 69 -------------- src/connection/linkSegments.h | 27 +++++- src/generation/connectingRoad.h | 2 +- src/generation/roundAbout.h | 2 +- src/generation/tjunction.h | 2 +- src/generation/xjunction.h | 2 +- 15 files changed, 29 insertions(+), 728 deletions(-) delete mode 100644 examples/carla_test.xml delete mode 100644 examples/complex.xml delete mode 100644 examples/err.xml delete mode 100644 examples/err_only_jun.xml delete mode 100644 examples/geomBug.xml delete mode 100644 examples/rb_crash.xml delete mode 100644 examples/rb_linking_bug.xml delete mode 100644 examples/small_test.xml diff --git a/examples/carla_test.xml b/examples/carla_test.xml deleted file mode 100644 index 7d2d92d2..00000000 --- a/examples/carla_test.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/complex.xml b/examples/complex.xml deleted file mode 100644 index 4f5b4080..00000000 --- a/examples/complex.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/con_lanewiden.xml b/examples/con_lanewiden.xml index d5898164..86338167 100644 --- a/examples/con_lanewiden.xml +++ b/examples/con_lanewiden.xml @@ -19,7 +19,7 @@ - + diff --git a/examples/err.xml b/examples/err.xml deleted file mode 100644 index 9136f253..00000000 --- a/examples/err.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/err_only_jun.xml b/examples/err_only_jun.xml deleted file mode 100644 index edfccea9..00000000 --- a/examples/err_only_jun.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/geomBug.xml b/examples/geomBug.xml deleted file mode 100644 index 9136f253..00000000 --- a/examples/geomBug.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/junction_ma.xml b/examples/junction_ma.xml index bb5f7ede..9d1c91db 100644 --- a/examples/junction_ma.xml +++ b/examples/junction_ma.xml @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ - + diff --git a/examples/rb_crash.xml b/examples/rb_crash.xml deleted file mode 100644 index 021221f4..00000000 --- a/examples/rb_crash.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/rb_linking_bug.xml b/examples/rb_linking_bug.xml deleted file mode 100644 index 29e09d94..00000000 --- a/examples/rb_linking_bug.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/small_test.xml b/examples/small_test.xml deleted file mode 100644 index 25c4fee7..00000000 --- a/examples/small_test.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/connection/linkSegments.h b/src/connection/linkSegments.h index bfb33a27..3ca715f8 100644 --- a/src/connection/linkSegments.h +++ b/src/connection/linkSegments.h @@ -267,6 +267,10 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) DOMElement *links; if (inputxml.findNodeWithName("links", links)) { + if(!setting.silentMode) + { + cout << "\tLinks are not specified -> skip segment linking" << endl; + } throwWarning("'links' are not specified in input file.\n\t -> skip segment linking", true); return 0; } @@ -296,10 +300,23 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) } } - //generate a map to store all the outgoing links of each segment + //generate a map to store all outgoing links of each segment std::map> outgoing_connections; std::map> incoming_connections; + + int linkcount = links->getChildElementCount(); + + if(linkcount <= 0 && !setting.silentMode) + { + cout << "\tNo links were defined" << endl; + return 0; + } + else if(!setting.silentMode) + { + cout << "\t"<< linkcount << " links were defined" << endl; + } + for (DOMElement *segmentLink = links->getFirstElementChild();segmentLink != NULL; segmentLink = segmentLink->getNextElementSibling()) { int fromSegment = readIntAttrFromNode(segmentLink, "fromSegment"); @@ -335,7 +352,7 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) //process the element------------------ transformRoad(segmentLink, data); //end processessing the element-------- - break; //prevents multiple processing steps if they are defined in the xml (they shoudlnt be) + break; //prevents multiple processing steps if they are defined in the xml (they shouldn't be) } toDo.push(e); @@ -352,7 +369,7 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) if(curId != readIntAttrFromNode(segmentLink, "toSegment") || incoming_id != readIntAttrFromNode(segmentLink, "fromSegment")) continue; //process the element------------------ transformRoad(segmentLink, data, true); - break; //prevents multiple processing steps if they are defined in the xml (they shoudlnt be) + break; //prevents multiple processing steps if they are defined in the xml (they shouldn't be) } toDo.push(incoming_id); @@ -361,7 +378,7 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) //check if all roads are connected to the network vector v; - for(road r: data.roads) + for(road &r: data.roads) { if(!r.isLinkedToNetwork) { @@ -374,7 +391,7 @@ int linkSegments(xmlTree &inputxml, roadNetwork &data) for(road* p: v) { if(!setting.silentMode) - cout << "\tRoad " << p->inputSegmentId << " is not linked"<< endl; + cout << "\tRoad " << p->inputId << " in segment " << p->inputSegmentId << " is not linked"<< endl; std::cerr << "\tRoad " << p->inputSegmentId << " is not linked"<< endl; } diff --git a/src/generation/connectingRoad.h b/src/generation/connectingRoad.h index 909fc4d0..63ff3410 100644 --- a/src/generation/connectingRoad.h +++ b/src/generation/connectingRoad.h @@ -40,7 +40,7 @@ int connectingRoad(DOMElement *node, roadNetwork &data) //--- generate roads ------------------------------------------------------ if(!setting.silentMode) - cout << "\t Generating Roads" << endl; + cout << "\tGenerating Roads" << endl; road r; int id = readIntAttrFromNode(mainRoad, "id"); diff --git a/src/generation/roundAbout.h b/src/generation/roundAbout.h index 06fbecfb..90b955ce 100644 --- a/src/generation/roundAbout.h +++ b/src/generation/roundAbout.h @@ -249,7 +249,7 @@ int roundAbout(const DOMElement* node, roadNetwork &data) // --- generate roads -------------------------------------------------- if(!setting.silentMode) - cout << "\t Generating Roads for Roundabout" << endl; + cout << "\tGenerating Roads for Roundabout" << endl; /* \___ ____/ id: 1 id: helper diff --git a/src/generation/tjunction.h b/src/generation/tjunction.h index a935ae65..4413ef36 100644 --- a/src/generation/tjunction.h +++ b/src/generation/tjunction.h @@ -222,7 +222,7 @@ int tjunction(const DOMElement* node, roadNetwork &data) __________ ___________ */ if(!setting.silentMode) - cout << "\t Generating Roads" << endl; + cout << "\tGenerating Roads" << endl; laneSection lS; double t; diff --git a/src/generation/xjunction.h b/src/generation/xjunction.h index bade5ac4..ca967688 100644 --- a/src/generation/xjunction.h +++ b/src/generation/xjunction.h @@ -297,7 +297,7 @@ int xjunction(const DOMElement* domNode, roadNetwork &data) | | */ if(!setting.silentMode) - cout << "\t Generating Roads" << endl; + cout << "\tGenerating Roads" << endl; road r1; r1.id = 100 * junc.id + 1; From 90186d413edf882c7d36cadba923db62264219cf Mon Sep 17 00:00:00 2001 From: Jannik Busse Date: Mon, 9 Jan 2023 15:57:34 +0100 Subject: [PATCH 3/4] removed depricated files --- examples/jun_m2a_round.xml | 51 ------------------------------- examples/junction_templateM2A.xml | 35 --------------------- examples/simple.xml | 29 ------------------ 3 files changed, 115 deletions(-) delete mode 100644 examples/jun_m2a_round.xml delete mode 100644 examples/junction_templateM2A.xml delete mode 100644 examples/simple.xml diff --git a/examples/jun_m2a_round.xml b/examples/jun_m2a_round.xml deleted file mode 100644 index 38b0191f..00000000 --- a/examples/jun_m2a_round.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/junction_templateM2A.xml b/examples/junction_templateM2A.xml deleted file mode 100644 index 303e6bb8..00000000 --- a/examples/junction_templateM2A.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/simple.xml b/examples/simple.xml deleted file mode 100644 index 49fa39a6..00000000 --- a/examples/simple.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From c3a45695ffd5e688bc28d231a5a486d41f0a0d90 Mon Sep 17 00:00:00 2001 From: Jannik Busse Date: Wed, 11 Jan 2023 11:47:16 +0100 Subject: [PATCH 4/4] added example file --- examples/close_network.xml | 94 +++++++++++++++++++ .../{con_lanewiden.xml => close_roads.xml} | 0 2 files changed, 94 insertions(+) create mode 100644 examples/close_network.xml rename examples/{con_lanewiden.xml => close_roads.xml} (100%) diff --git a/examples/close_network.xml b/examples/close_network.xml new file mode 100644 index 00000000..19e9bf11 --- /dev/null +++ b/examples/close_network.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/con_lanewiden.xml b/examples/close_roads.xml similarity index 100% rename from examples/con_lanewiden.xml rename to examples/close_roads.xml