7
7
#include < array>
8
8
#include < chrono>
9
9
#include < ctime>
10
+ #include < boost/algorithm/string.hpp>
11
+ #include < boost/format.hpp>
10
12
11
13
using namespace EuroScopePlugIn ;
12
14
@@ -671,7 +673,6 @@ string AT3Tags::GetRouteCodeLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTa
671
673
string spadCurrent = FlightPlan.GetControllerAssignedData ().GetScratchPadString ();
672
674
string flightStrip = FlightPlan.GetControllerAssignedData ().GetFlightStripAnnotation (3 );
673
675
string runway = FlightPlan.GetFlightPlanData ().GetArrivalRwy ();
674
- string fpRoute = FlightPlan.GetFlightPlanData ().GetRoute ();
675
676
string lineStr;
676
677
677
678
size_t startContainer = flightStrip.find (" /R/" );
@@ -685,6 +686,18 @@ string AT3Tags::GetRouteCodeLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTa
685
686
}
686
687
}
687
688
else if (arptSet.find (FlightPlan.GetFlightPlanData ().GetDestination ()) != arptSet.end () && strlen (FlightPlan.GetFlightPlanData ().GetArrivalRwy ()) != 0 ) {
689
+
690
+ // resolve flightplan route and remove stepclimb info to avoid the interference
691
+ vector<string> route = split (FlightPlan.GetFlightPlanData ().GetRoute (), ' ' );
692
+ string fpRoute = " " ;
693
+ for (std::size_t i = 0 ; i < route.size (); i++) {
694
+ if (i != 0 && i != route.size ()) {
695
+ route[i] = route[i].substr (0 , route[i].find_first_of (' /' ));
696
+ }
697
+ boost::to_upper (route[i]);
698
+ fpRoute = fpRoute + route[i] + " " ;
699
+ }
700
+
688
701
for (auto & rte : rteJson[FlightPlan.GetFlightPlanData ().GetDestination ()][runway.substr (0 , 2 )][" routes" ].items ()) { // matches exact route only for auto assigning route code
689
702
if (fpRoute.find (rte.value ()[" route" ]) != string::npos) {
690
703
lineStr = rte.key ();
@@ -734,11 +747,14 @@ string AT3Tags::GetAPPDEPLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTarge
734
747
}
735
748
}
736
749
else if (arptSet.find (FlightPlan.GetFlightPlanData ().GetDestination ()) != arptSet.end () && strlen (FlightPlan.GetFlightPlanData ().GetArrivalRwy ()) != 0 ) {
737
- string app = GetAvailableApps (FlightPlan.GetFlightPlanData ().GetDestination (), FlightPlan.GetFlightPlanData ().GetArrivalRwy ())[0 ]; // selects default app if no assignment, which is [0]
738
- if (app.find (" _" ) != string::npos) {
739
- lineStr = app.substr (0 , app.find (" _" ));
740
- string spadItem = " /A/" + app + " /A//" ;
741
- FlightPlan.GetControllerAssignedData ().SetFlightStripAnnotation (2 , spadItem.c_str ());
750
+ vector<string> appsVec = GetAvailableApps (FlightPlan.GetFlightPlanData ().GetDestination (), FlightPlan.GetFlightPlanData ().GetArrivalRwy ());
751
+ if (appsVec.size () > 0 ) {
752
+ string app = appsVec[0 ]; // selects default app if no assignment, which is [0]
753
+ if (app.find (" _" ) != string::npos) {
754
+ lineStr = app.substr (0 , app.find (" _" ));
755
+ string spadItem = " /A/" + app + " /A//" ;
756
+ FlightPlan.GetControllerAssignedData ().SetFlightStripAnnotation (2 , spadItem.c_str ());
757
+ }
742
758
}
743
759
}
744
760
@@ -769,11 +785,14 @@ string AT3Tags::GetAMCLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget)
769
785
}
770
786
}
771
787
else if (arptSet.find (FlightPlan.GetFlightPlanData ().GetDestination ()) != arptSet.end () && strlen (FlightPlan.GetFlightPlanData ().GetArrivalRwy ()) != 0 ) {
772
- string app = GetAvailableApps (FlightPlan.GetFlightPlanData ().GetDestination (), FlightPlan.GetFlightPlanData ().GetArrivalRwy ())[0 ]; // selects default app if no assignment, which is [0]
773
- if (app.find (" _" ) != string::npos) {
774
- lineStr = app.substr (0 , app.find (" _" ));
775
- string spadItem = " /A/" + app + " /A//" ;
776
- FlightPlan.GetControllerAssignedData ().SetFlightStripAnnotation (2 , spadItem.c_str ());
788
+ vector<string> appsVec = GetAvailableApps (FlightPlan.GetFlightPlanData ().GetDestination (), FlightPlan.GetFlightPlanData ().GetArrivalRwy ());
789
+ if (appsVec.size () > 0 ) {
790
+ string app = appsVec[0 ]; // selects default app if no assignment, which is [0]
791
+ if (app.find (" _" ) != string::npos) {
792
+ lineStr = app.substr (0 , app.find (" _" ));
793
+ string spadItem = " /A/" + app + " /A//" ;
794
+ FlightPlan.GetControllerAssignedData ().SetFlightStripAnnotation (2 , spadItem.c_str ());
795
+ }
777
796
}
778
797
}
779
798
0 commit comments