Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Line 4 tag elements #24

Merged
merged 36 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9cd07ae
Update compiler config
arthuwu Jun 29, 2024
654e649
Adjust target icon shape
arthuwu Jun 29, 2024
e96e98e
Revert "Adjust target icon shape"
arthuwu Jun 29, 2024
770a0ca
Merge branch 'dev' of https://github.com/arthuwu/HKCP into dev
arthuwu Jun 29, 2024
f65ce96
Reapply "Adjust target icon shape"
arthuwu Jun 29, 2024
6e4b881
Update AT3RadarTargetDisplay.cpp
arthuwu Jun 29, 2024
de2ad83
Added custom tag items for lines 2/3
arthuwu Jun 30, 2024
4e33e18
Misc fixes
arthuwu Jun 30, 2024
c4a2dec
Update AT3Tags.cpp
arthuwu Jul 1, 2024
e987ecc
Merge remote-tracking branch 'upstream/dev' into dev
arthuwu Jul 1, 2024
8940cb4
Merge remote-tracking branch 'upstream/dev' into dev
arthuwu Jul 2, 2024
21d86fb
Update AT3Tags.cpp
arthuwu Jul 2, 2024
729049b
Update AT3Tags.cpp
arthuwu Jul 2, 2024
3a30458
Added TopSky high speed and +, - conditions
arthuwu Jul 3, 2024
d583f42
formatting fixes
arthuwu Jul 3, 2024
f498fd8
start implementation of app selection
arthuwu Jul 4, 2024
32a3356
Implement APP/DEP and AMC Line 4
arthuwu Jul 6, 2024
004d1e2
Merge remote-tracking branch 'upstream/dev' into dev
arthuwu Jul 7, 2024
275f230
Implement Route Codes
arthuwu Jul 10, 2024
081a867
Merge remote-tracking branch 'upstream/dev' into dev
arthuwu Jul 10, 2024
6b06575
Implement AMAN delay
arthuwu Jul 10, 2024
c6452eb
Add MAESTRO.lib
arthuwu Jul 10, 2024
f8145f5
Update .gitignore
arthuwu Jul 10, 2024
f5b6810
Implement gate ETA
arthuwu Jul 10, 2024
9f89cc1
Get GMT instead of local time
arthuwu Jul 11, 2024
1ec7834
Implement APP selection logic when no runway is selected
arthuwu Jul 11, 2024
420f4bc
Add support for empty gates and STARs
arthuwu Jul 11, 2024
9a09a19
Formatting fixes
arthuwu Jul 11, 2024
c234c03
Update AT3Tags.cpp
arthuwu Jul 11, 2024
145ba25
Update AT3Tags.cpp
arthuwu Jul 11, 2024
a87fbbc
Bug fixes
arthuwu Jul 11, 2024
70da27f
Abstract tag menu functions
arthuwu Jul 12, 2024
9aae1f9
Fix bug where two letter route codes would crash HKCP
arthuwu Jul 12, 2024
425ce08
Rename function
arthuwu Jul 12, 2024
dc2ab81
oops
arthuwu Jul 12, 2024
04ab81f
Update AT3Tags.cpp
arthuwu Jul 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
569 changes: 550 additions & 19 deletions AT3/AT3Tags.cpp

Large diffs are not rendered by default.

40 changes: 37 additions & 3 deletions AT3/AT3Tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <fstream>
#include <nlohmann/json.hpp>
#include "MAESTROapi.h"
#include <chrono>
#include <ctime>

using namespace std;
using namespace EuroScopePlugIn;
using json = nlohmann::json;

class AT3Tags :
public EuroScopePlugIn::CPlugIn
Expand All @@ -30,6 +37,21 @@ class AT3Tags :
POINT Pt,
RECT Area);

virtual void OnFlightPlanControllerAssignedDataUpdate(CFlightPlan FlightPlan,
int DataType);

virtual void OnTimer(int Counter);

void SetApp(int index, CFlightPlan FlightPlan, vector<string> appsVec);

void SetRte(int index, CFlightPlan FlightPlan, vector<string> rteVec, string dest, string destRunway);

string GetActiveArrRwy(string airport);

vector<string> GetAvailableApps(string airport, string runway);

vector<string> GetAvailableRtes(string airport, string runway);

string GetFormattedAltitude(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetFormattedAltitudedAssigned(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);
Expand All @@ -42,19 +64,31 @@ class AT3Tags :

string GetFormattedSpeedAssigned(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetRouteCode(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);
void GetRouteCode(CFlightPlan& FlightPlan);

string GetRouteCodeLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

void GetAssignedAPP(CFlightPlan& FlightPlan);

string GetAPPDEPLine4(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetAMCLine4 (CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetFormattedSlot(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);
string GetFormattedETA(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget, int minutes);

string GetAMANDelay(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetCallsign(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetATYPWTC(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetVSIndicator(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

string GetArrivalRwy(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);
string GetFormattedArrivalRwy(CFlightPlan& FlightPlan, CRadarTarget& RadarTarget);

protected:
int minu;
json appsJson;
json rteJson;
set<string> arptSet;
};
17 changes: 15 additions & 2 deletions Constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const int TAG_ITEM_AT3_SPEED_ASSIGNED = 15;
const int TAG_ITEM_AT3_ROUTE_CODE = 16;
const int TAG_ITEM_AT3_APPDEP_LINE4 = 17;
const int TAG_ITEM_AT3_AMC_LINE4 = 18;
const int TAG_ITEM_AT3_SLOT = 19;
const int TAG_ITEM_AT3_ETA = 19;
const int TAG_ITEM_AT3_CALLSIGN = 20;
const int TAG_ITEM_AT3_ATYPWTC = 21;
const int TAG_ITEM_AT3_ATYPWTC = 21;
const int TAG_ITEM_AT3_VS_INDICATOR = 22;
const int TAG_ITEM_AT3_ARRIVAL_RWY = 23;
const int TAG_ITEM_AT3_DELAY = 24;

const int TAG_FUNC_APP_SEL_MENU = 200;
const int TAG_FUNC_APP_SEL_ITEM_1 = 201;
Expand All @@ -38,6 +39,18 @@ const int TAG_FUNC_APP_SEL_ITEM_5 = 205;
const int TAG_FUNC_APP_SEL_ITEM_6 = 206;
const int TAG_FUNC_APP_SEL_ITEM_7 = 207;
const int TAG_FUNC_APP_SEL_ITEM_8 = 208;
const int TAG_FUNC_APP_SEL_DUMMY = 209;

const int TAG_FUNC_RTE_SEL_MENU = 300;
const int TAG_FUNC_RTE_SEL_ITEM_1 = 301;
const int TAG_FUNC_RTE_SEL_ITEM_2 = 302;
const int TAG_FUNC_RTE_SEL_ITEM_3 = 303;
const int TAG_FUNC_RTE_SEL_ITEM_4 = 304;
const int TAG_FUNC_RTE_SEL_ITEM_5 = 305;
const int TAG_FUNC_RTE_SEL_ITEM_6 = 306;
const int TAG_FUNC_RTE_SEL_ITEM_7 = 307;
const int TAG_FUNC_RTE_SEL_ITEM_8 = 308;
const int TAG_FUNC_RTE_SEL_DUMMY = 309;

const int TAG_FUNC_CHECKFP_MENU = 100;
const int TAG_FUNC_CHECKFP_CHECK = 101;
Expand Down
6 changes: 6 additions & 0 deletions HKCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,22 @@ CRadarScreen* HKCPPlugin::OnRadarScreenCreated(const char* sDisplayName, bool Ne

void HKCPPlugin::OnFunctionCall(int FunctionId, const char* ItemString, POINT Pt, RECT Area) {
VFPC->OnFunctionCall(FunctionId, ItemString, Pt, Area);
tags->OnFunctionCall(FunctionId, ItemString, Pt, Area);
}

void HKCPPlugin::OnGetTagItem(CFlightPlan FlightPlan, CRadarTarget RadarTarget, int ItemCode, int TagData, char sItemString[16], int* pColorCode, COLORREF* pRGB, double* pFontSize) {
VFPC->OnGetTagItem(FlightPlan, RadarTarget, ItemCode, TagData, sItemString, pColorCode, pRGB, pFontSize);
tags->OnGetTagItem(FlightPlan, RadarTarget, ItemCode, TagData, sItemString, pColorCode, pRGB, pFontSize);
}

void HKCPPlugin::OnFlightPlanControllerAssignedDataUpdate(CFlightPlan FlightPlan, int DataType) {
tags->OnFlightPlanControllerAssignedDataUpdate(FlightPlan, DataType);
}

void HKCPPlugin::OnTimer(int Count) {
VFPC->OnTimer(Count);
Atis->OnTimer(Count);
tags->OnTimer(Count);
}

void HKCPPlugin::OnFlightPlanDisconnect(CFlightPlan FlightPlan) {
Expand Down
2 changes: 2 additions & 0 deletions HKCP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class HKCPPlugin :
COLORREF* pRGB,
double* pFontSize);

virtual void OnFlightPlanControllerAssignedDataUpdate(CFlightPlan FlightPlan, int DataType);

virtual void OnFlightPlanDisconnect(CFlightPlan FlightPlan);

virtual bool OnCompileCommand(const char* sCommandLine);
Expand Down
4 changes: 2 additions & 2 deletions HKCP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;EDFFCHECKFP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions); CURL_STATICLIB</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;EDFFCHECKFP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions);CURL_STATICLIB;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(ProjectDir)Libs;$(ProjectDir)Libs\include;$(ProjectDir)</AdditionalIncludeDirectories>
Expand All @@ -177,7 +177,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>$(ProjectDir)Libs\EuroScopePlugInDll.lib; winmm.lib; $(ProjectDir)Libs\libcurl_a.lib; Ws2_32.lib;Crypt32.lib; Wldap32.lib; Normaliz.lib </AdditionalDependencies>
<AdditionalDependencies>$(ProjectDir)Libs\EuroScopePlugInDll.lib;$(ProjectDir)Libs\MAESTRO.lib;winmm.lib;$(ProjectDir)Libs\libcurl_a.lib;Ws2_32.lib;Crypt32.lib;Wldap32.lib;Normaliz.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down
Binary file added Libs/MAESTRO.lib
Binary file not shown.
17 changes: 17 additions & 0 deletions Libs/MAESTROapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#ifndef MAESTROapi
#define MAESTROapi __declspec ( dllimport )
#endif

extern "C" MAESTROapi bool IsInSequence( const char * callsign ) ;
// return value: true if the callsign (case sensitive!) is found in the sequence
// false otherwise

extern "C" MAESTROapi double GetCurrentDelay( const char * callsign ) ;
// return value: current (remaining) delay in minutes if the callsign (case sensitive!) is found in the sequence
// 0 otherwise

extern "C" MAESTROapi double GetTotalDelay( const char * callsign ) ;
// return value: total delay in minutes if the callsign (case sensitive!) is found in the sequence
// 0 otherwise
55 changes: 55 additions & 0 deletions Libs/include/nlohmann/adl_serializer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++
// | | |__ | | | | | | version 3.11.3
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT

#pragma once

#include <utility>

#include <nlohmann/detail/abi_macros.hpp>
#include <nlohmann/detail/conversions/from_json.hpp>
#include <nlohmann/detail/conversions/to_json.hpp>
#include <nlohmann/detail/meta/identity_tag.hpp>

NLOHMANN_JSON_NAMESPACE_BEGIN

/// @sa https://json.nlohmann.me/api/adl_serializer/
template<typename ValueType, typename>
struct adl_serializer
{
/// @brief convert a JSON value to any value type
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
template<typename BasicJsonType, typename TargetType = ValueType>
static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
{
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
}

/// @brief convert a JSON value to any value type
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/
template<typename BasicJsonType, typename TargetType = ValueType>
static auto from_json(BasicJsonType && j) noexcept(
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})))
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
{
return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {});
}

/// @brief convert any value type to a JSON value
/// @sa https://json.nlohmann.me/api/adl_serializer/to_json/
template<typename BasicJsonType, typename TargetType = ValueType>
static auto to_json(BasicJsonType& j, TargetType && val) noexcept(
noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val))))
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void())
{
::nlohmann::to_json(j, std::forward<TargetType>(val));
}
};

NLOHMANN_JSON_NAMESPACE_END
103 changes: 103 additions & 0 deletions Libs/include/nlohmann/byte_container_with_subtype.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++
// | | |__ | | | | | | version 3.11.3
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT

#pragma once

#include <cstdint> // uint8_t, uint64_t
#include <tuple> // tie
#include <utility> // move

#include <nlohmann/detail/abi_macros.hpp>

NLOHMANN_JSON_NAMESPACE_BEGIN

/// @brief an internal type for a backed binary type
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/
template<typename BinaryType>
class byte_container_with_subtype : public BinaryType
{
public:
using container_type = BinaryType;
using subtype_type = std::uint64_t;

/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
byte_container_with_subtype() noexcept(noexcept(container_type()))
: container_type()
{}

/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))
: container_type(b)
{}

/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))
: container_type(std::move(b))
{}

/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b)))
: container_type(b)
, m_subtype(subtype_)
, m_has_subtype(true)
{}

/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/
byte_container_with_subtype(container_type&& b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b))))
: container_type(std::move(b))
, m_subtype(subtype_)
, m_has_subtype(true)
{}

bool operator==(const byte_container_with_subtype& rhs) const
{
return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
}

bool operator!=(const byte_container_with_subtype& rhs) const
{
return !(rhs == *this);
}

/// @brief sets the binary subtype
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/
void set_subtype(subtype_type subtype_) noexcept
{
m_subtype = subtype_;
m_has_subtype = true;
}

/// @brief return the binary subtype
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/
constexpr subtype_type subtype() const noexcept
{
return m_has_subtype ? m_subtype : static_cast<subtype_type>(-1);
}

/// @brief return whether the value has a subtype
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/
constexpr bool has_subtype() const noexcept
{
return m_has_subtype;
}

/// @brief clears the binary subtype
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/
void clear_subtype() noexcept
{
m_subtype = 0;
m_has_subtype = false;
}

private:
subtype_type m_subtype = 0;
bool m_has_subtype = false;
};

NLOHMANN_JSON_NAMESPACE_END
Loading
Loading