Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wake): Departure wake interval calculator (#417)
* Add command to assign holds * Docs * Add callsign selection helpers * Callsign provider for add to hold * Make factory an object * Forward declarations in holds * Update display to handle right clicks * Display title bar a11y * Hook everything up * Forward declarations * Include order * Docs * Style * Forward declarations * Style * Add wake category and scheme models * Load categories from json * Load schemes from json * Scheme collection * Add aircraft types via dependency * Map flightplan to aircraft type * Add wake mapper * Implement new mapper * Remove old code * Style * Get departure intervals from wake categories * Make graphics easier to work with * Graphics font manager * Styles * Basic calculator layout * Start implementing finer details of calculator * List abstraction * Move callsign selection list to new list * Tinkering * Tests * Allow ground and delivery to use * Put wake list in place * Intermediate clickspot * Tests * Display intervals * Load position from ASR * Position * Generic toggle * Menu toggle * Store visibility on ASR * Style
- Loading branch information
Showing
84 changed files
with
2,794 additions
and
405 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,36 @@ | ||
#include "CallsignSelectionList.h" | ||
#include "CallsignSelectionProviderInterface.h" | ||
#include "euroscope/EuroscopePluginLoopbackInterface.h" | ||
#include "plugin/PopupMenuItem.h" | ||
#include "list/ListItem.h" | ||
|
||
namespace UKControllerPlugin::Aircraft { | ||
|
||
CallsignSelectionList::CallsignSelectionList( | ||
std::shared_ptr<CallsignSelectionProviderInterface> callsignProvider, | ||
Euroscope::EuroscopePluginLoopbackInterface& plugin, | ||
int callbackFunctionId) | ||
: callsignProvider(std::move(callsignProvider)), plugin(plugin), callbackFunctionId(callbackFunctionId) | ||
CallsignSelectionList::CallsignSelectionList(std::shared_ptr<CallsignSelectionProviderInterface> callsignProvider) | ||
: callsignProvider(std::move(callsignProvider)) | ||
{ | ||
} | ||
|
||
void CallsignSelectionList::TriggerList(const POINT& location) | ||
int CallsignSelectionList::ListColumns() | ||
{ | ||
const auto callsigns = this->callsignProvider->GetCallsigns(); | ||
if (callsigns.empty()) { | ||
return; | ||
} | ||
|
||
plugin.TriggerPopupList(RECT{location.x, location.y, location.x + 50, location.y + 100}, "Select Aircraft", 1); | ||
return 1; | ||
} | ||
|
||
Plugin::PopupMenuItem menuItem; | ||
menuItem.secondValue = ""; | ||
menuItem.callbackFunctionId = callbackFunctionId; | ||
menuItem.fixedPosition = false; | ||
menuItem.disabled = false; | ||
menuItem.checked = EuroScopePlugIn::POPUP_ELEMENT_NO_CHECKBOX; | ||
std::string CallsignSelectionList::ListName() | ||
{ | ||
return "Select Aircraft"; | ||
} | ||
|
||
for (const auto& callsign : callsigns) { | ||
menuItem.firstValue = callsign; | ||
plugin.AddItemToPopupList(menuItem); | ||
std::list<std::shared_ptr<List::ListItem>> CallsignSelectionList::ListItems() | ||
{ | ||
std::list<std::shared_ptr<List::ListItem>> items; | ||
for (const auto& callsign : this->callsignProvider->GetCallsigns()) { | ||
items.push_back( | ||
std::make_shared<List::ListItem>(callsign, "", false, false, List::ListItemCheckedStatus::NoCheckbox)); | ||
} | ||
return items; | ||
} | ||
|
||
void CallsignSelectionList::CallsignSelected(const std::string& callsign) | ||
void CallsignSelectionList::ItemSelected(const std::string& item) | ||
{ | ||
callsignProvider->CallsignSelected(callsign); | ||
this->callsignProvider->CallsignSelected(item); | ||
} | ||
} // namespace UKControllerPlugin::Aircraft |
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 |
---|---|---|
@@ -1,33 +1,19 @@ | ||
#include "CallsignSelectionList.h" | ||
#include "CallsignSelectionListFactory.h" | ||
#include "CallsignSelectionProviderInterface.h" | ||
#include "euroscope/CallbackFunction.h" | ||
#include "euroscope/EuroscopePluginLoopbackInterface.h" | ||
#include "plugin/FunctionCallEventHandler.h" | ||
#include "list/PopupListFactory.h" | ||
|
||
namespace UKControllerPlugin::Aircraft { | ||
|
||
CallsignSelectionListFactory::CallsignSelectionListFactory( | ||
Plugin::FunctionCallEventHandler& functionHandler, Euroscope::EuroscopePluginLoopbackInterface& plugin) | ||
: functionHandler(functionHandler), plugin(plugin) | ||
CallsignSelectionListFactory::CallsignSelectionListFactory(List::PopupListFactory& listFactory) | ||
: listFactory(listFactory) | ||
{ | ||
} | ||
|
||
auto CallsignSelectionListFactory::Create( | ||
std::shared_ptr<CallsignSelectionProviderInterface> provider, const std::string& description) const | ||
-> std::shared_ptr<CallsignSelectionList> | ||
-> std::shared_ptr<List::PopupListInterface> | ||
{ | ||
int callbackId = functionHandler.ReserveNextDynamicFunctionId(); | ||
auto selectionList = std::make_shared<CallsignSelectionList>(std::move(provider), plugin, callbackId); | ||
|
||
Euroscope::CallbackFunction callback( | ||
callbackId, | ||
description, | ||
[selectionList](int functionId, const std::string& subject, RECT screenObjectArea) { | ||
selectionList->CallsignSelected(subject); | ||
}); | ||
functionHandler.RegisterFunctionCall(callback); | ||
|
||
return selectionList; | ||
return listFactory.Create(std::make_shared<CallsignSelectionList>(provider), description); | ||
} | ||
} // namespace UKControllerPlugin::Aircraft |
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 was deleted.
Oops, something went wrong.
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,33 @@ | ||
#include "FontManager.h" | ||
|
||
namespace UKControllerPlugin::Graphics { | ||
|
||
auto FontManager::Instance() -> FontManager& | ||
{ | ||
static std::unique_ptr<FontManager> instance; | ||
if (instance == nullptr) { | ||
instance = | ||
std::unique_ptr<FontManager>(new FontManager(std::make_unique<Gdiplus::FontFamily>(L"EuroScope"))); | ||
} | ||
|
||
return *instance; | ||
} | ||
|
||
auto FontManager::GetDefault() -> const Gdiplus::Font& | ||
{ | ||
return this->Get(9); | ||
} | ||
|
||
auto FontManager::Get(int size) -> const Gdiplus::Font& | ||
{ | ||
if (this->fonts.count(size) == 0) { | ||
this->fonts[size] = std::make_shared<Gdiplus::Font>(family.get(), size); | ||
} | ||
|
||
return *this->fonts.at(size); | ||
} | ||
|
||
FontManager::FontManager(std::unique_ptr<Gdiplus::FontFamily> family) : family(std::move(family)) | ||
{ | ||
} | ||
} // namespace UKControllerPlugin::Graphics |
Oops, something went wrong.