Skip to content

Commit bd83a70

Browse files
authored
Add stepclimb support for AT3 RTE menu (#33)
added route resolve code and moved it to the end of judging auto assigning route code is needed
1 parent 14bc81a commit bd83a70

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

AT3/AT3Tags.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <array>
88
#include <chrono>
99
#include <ctime>
10+
#include <boost/algorithm/string.hpp>
11+
#include <boost/format.hpp>
1012

1113
using namespace EuroScopePlugIn;
1214

@@ -671,7 +673,6 @@ string AT3Tags::GetRouteCodeLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTa
671673
string spadCurrent = FlightPlan.GetControllerAssignedData().GetScratchPadString();
672674
string flightStrip = FlightPlan.GetControllerAssignedData().GetFlightStripAnnotation(3);
673675
string runway = FlightPlan.GetFlightPlanData().GetArrivalRwy();
674-
string fpRoute = FlightPlan.GetFlightPlanData().GetRoute();
675676
string lineStr;
676677

677678
size_t startContainer = flightStrip.find("/R/");
@@ -685,6 +686,18 @@ string AT3Tags::GetRouteCodeLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTa
685686
}
686687
}
687688
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+
688701
for (auto& rte : rteJson[FlightPlan.GetFlightPlanData().GetDestination()][runway.substr(0, 2)]["routes"].items()) { //matches exact route only for auto assigning route code
689702
if (fpRoute.find(rte.value()["route"]) != string::npos) {
690703
lineStr = rte.key();

AT3/AT3Tags.hpp

+18
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "MAESTROapi.h"
1212
#include <chrono>
1313
#include <ctime>
14+
#include <boost/algorithm/string.hpp>
15+
#include <boost/format.hpp>
1416

1517
using namespace std;
1618
using namespace EuroScopePlugIn;
@@ -95,4 +97,20 @@ class AT3Tags :
9597
COLORREF colorAssumed;
9698
COLORREF colorNotAssumed;
9799
COLORREF colorRedundant;
100+
101+
private:
102+
template <typename Out>
103+
void split(const string& s, char delim, Out result) {
104+
istringstream iss(s);
105+
string item;
106+
while (getline(iss, item, delim)) {
107+
*result++ = item;
108+
}
109+
}
110+
111+
vector<string> split(const string& s, char delim) {
112+
vector<string> elems;
113+
split(s, delim, back_inserter(elems));
114+
return elems;
115+
}
98116
};

0 commit comments

Comments
 (0)