Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
373 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "AircraftFlowMeasuresDialog.h" | ||
#include "dialog/DialogCallArgument.h" | ||
|
||
namespace UKControllerPlugin::ECFMP { | ||
/* | ||
Public facing window procedure | ||
*/ | ||
LRESULT AircraftFlowMeasuresDialog::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
if (msg == WM_INITDIALOG) { | ||
LogInfo("Aircraft flow measures dialog opened"); | ||
SetWindowLongPtr( | ||
hwnd, GWLP_USERDATA, reinterpret_cast<Dialog::DialogCallArgument*>(lParam)->dialogArgument); | ||
} else if (msg == WM_DESTROY) { | ||
SetWindowLongPtr(hwnd, GWLP_USERDATA, NULL); | ||
LogInfo("Aircraft flow measures dialog closed"); | ||
} | ||
|
||
AircraftFlowMeasuresDialog* dialog = | ||
reinterpret_cast<AircraftFlowMeasuresDialog*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); | ||
return dialog ? dialog->_WndProc(hwnd, msg, wParam, lParam) : FALSE; | ||
} | ||
|
||
/* | ||
Private window procedure bound to the objects | ||
*/ | ||
LRESULT AircraftFlowMeasuresDialog::_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
switch (msg) { | ||
// Initialise | ||
case WM_INITDIALOG: { | ||
this->InitDialog(hwnd, lParam); | ||
return TRUE; | ||
} | ||
// Dialog Closed | ||
case WM_CLOSE: { | ||
EndDialog(hwnd, wParam); | ||
return TRUE; | ||
} | ||
// Buttons pressed | ||
case WM_COMMAND: { | ||
switch (LOWORD(wParam)) { | ||
case IDOK: { | ||
EndDialog(hwnd, wParam); | ||
return TRUE; | ||
} | ||
default: | ||
return FALSE; | ||
} | ||
} | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
void AircraftFlowMeasuresDialog::InitDialog(HWND hwnd, LPARAM lParam) | ||
{ | ||
auto* data = reinterpret_cast<AircraftFlowMeasuresDialogData*>( | ||
reinterpret_cast<Dialog::DialogCallArgument*>(lParam)->contextArgument); | ||
|
||
// Set the the dialog box title | ||
std::wstring title = L"ECFMP flow Measures for " + data->callsign; | ||
SetWindowText(hwnd, title.c_str()); | ||
|
||
// Set the flow measures text | ||
std::wstring description = data->flowMeasures; | ||
SetDlgItemText(hwnd, IDC_FLOW_MEASURES_INFO, description.c_str()); | ||
} | ||
} // namespace UKControllerPlugin::ECFMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin::ECFMP { | ||
|
||
struct AircraftFlowMeasuresDialogData | ||
{ | ||
// The aircraft callsign | ||
std::wstring callsign; | ||
|
||
// The description of the flow measures | ||
std::wstring flowMeasures; | ||
}; | ||
|
||
class AircraftFlowMeasuresDialog | ||
{ | ||
public: | ||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
|
||
private: | ||
LRESULT _WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
void InitDialog(HWND hwnd, LPARAM lParam); | ||
}; | ||
} // namespace UKControllerPlugin::ECFMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "AircraftFlowMeasuresDialog.h" | ||
#include "AircraftFlowMeasureMapInterface.h" | ||
#include "ListAircraftFlowMeasures.h" | ||
#include "dialog/DialogManager.h" | ||
#include "euroscope/EuroScopeCFlightPlanInterface.h" | ||
#include "helper/HelperFunctions.h" | ||
|
||
namespace UKControllerPlugin::ECFMP { | ||
ListAircraftFlowMeasures::ListAircraftFlowMeasures( | ||
std::shared_ptr<const AircraftFlowMeasureMapInterface> flowMeasureMap, | ||
const Dialog::DialogManager& dialogManager) | ||
: flowMeasureMap(std::move(flowMeasureMap)), dialogManager(dialogManager) | ||
{ | ||
assert(this->flowMeasureMap != nullptr && "Flow measure map cannot be null"); | ||
} | ||
|
||
void ListAircraftFlowMeasures::ListForAircraft(const Euroscope::EuroScopeCFlightPlanInterface& flightplan) | ||
{ | ||
const auto flowMeasuresForCallsign = flowMeasureMap->GetFlowMeasuresForCallsign(flightplan.GetCallsign()); | ||
if (flowMeasuresForCallsign.empty()) { | ||
return; | ||
} | ||
|
||
// Write the flow measures to a string | ||
std::string flowMeasureString; | ||
for (const auto& flowMeasure : flowMeasuresForCallsign) { | ||
flowMeasureString += "Measure: " + flowMeasure->Identifier() + "\r\n\r\n"; | ||
flowMeasureString += flowMeasure->Measure().MeasureDescription() + "\r\n\r\n"; | ||
|
||
flowMeasureString += "Applicable To:\r\n\r\n"; | ||
|
||
for (const auto& description : flowMeasure->Filters().FilterDescriptions()) { | ||
flowMeasureString += description + "\r\n"; | ||
} | ||
|
||
flowMeasureString += "\r\n"; | ||
flowMeasureString += "End of measure " + flowMeasure->Identifier() + "\r\n\r\n"; | ||
} | ||
|
||
// Open dialog | ||
AircraftFlowMeasuresDialogData dialogData{ | ||
.callsign = HelperFunctions::ConvertToWideString(flightplan.GetCallsign()), | ||
.flowMeasures = | ||
HelperFunctions::ConvertToWideString(flowMeasureString.substr(0, flowMeasureString.size() - 4))}; | ||
|
||
dialogManager.OpenDialog(IDD_FLOW_MEASURE_LIST, reinterpret_cast<LPARAM>(&dialogData)); | ||
} | ||
} // namespace UKControllerPlugin::ECFMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin { | ||
namespace Dialog { | ||
class DialogManager; | ||
} // namespace Dialog | ||
namespace Euroscope { | ||
class EuroScopeCFlightPlanInterface; | ||
} // namespace Euroscope | ||
} // namespace UKControllerPlugin | ||
|
||
namespace UKControllerPlugin::ECFMP { | ||
class AircraftFlowMeasureMapInterface; | ||
|
||
class ListAircraftFlowMeasures | ||
{ | ||
public: | ||
ListAircraftFlowMeasures( | ||
std::shared_ptr<const AircraftFlowMeasureMapInterface> flowMeasureMap, | ||
const Dialog::DialogManager& dialogManager); | ||
void ListForAircraft(const Euroscope::EuroScopeCFlightPlanInterface& flightplan); | ||
|
||
private: | ||
// The flow measure map | ||
std::shared_ptr<const AircraftFlowMeasureMapInterface> flowMeasureMap; | ||
|
||
// Dialog manager | ||
const Dialog::DialogManager& dialogManager; | ||
}; | ||
|
||
} // namespace UKControllerPlugin::ECFMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.