allow more tag entries to customize the views
This commit is contained in:
@@ -61,7 +61,10 @@ PlugIn::PlugIn() :
|
|||||||
m_playbackValid(false) {
|
m_playbackValid(false) {
|
||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
|
this->RegisterTagItemType("ETA", static_cast<int>(PlugIn::TagItemElement::EstimatedTimeOfArrival));
|
||||||
|
this->RegisterTagItemType("PTA", static_cast<int>(PlugIn::TagItemElement::PlannedTimeOfArrival));
|
||||||
this->RegisterTagItemType("Delta time", static_cast<int>(PlugIn::TagItemElement::DeltaTime));
|
this->RegisterTagItemType("Delta time", static_cast<int>(PlugIn::TagItemElement::DeltaTime));
|
||||||
|
this->RegisterTagItemType("Fixed plan indicator", static_cast<int>(PlugIn::TagItemElement::FixedPlanIndicator));
|
||||||
this->RegisterTagItemFunction("Force planning", static_cast<int>(PlugIn::TagItemFunction::ForceToBackendMenu));
|
this->RegisterTagItemFunction("Force planning", static_cast<int>(PlugIn::TagItemFunction::ForceToBackendMenu));
|
||||||
|
|
||||||
this->DisplayUserMessage(PLUGIN_NAME, "INFO", (std::string("Loaded ") + PLUGIN_NAME + " " + PLUGIN_VERSION).c_str(), true, true, false, false, false);
|
this->DisplayUserMessage(PLUGIN_NAME, "INFO", (std::string("Loaded ") + PLUGIN_NAME + " " + PLUGIN_VERSION).c_str(), true, true, false, false, false);
|
||||||
@@ -444,45 +447,65 @@ void PlugIn::OnGetTagItem(EuroScopePlugIn::CFlightPlan flightPlan, EuroScopePlug
|
|||||||
this->m_updateQueueLock.lock();
|
this->m_updateQueueLock.lock();
|
||||||
|
|
||||||
/* check if the inbound is forced */
|
/* check if the inbound is forced */
|
||||||
|
if (0 != this->m_forcedToBackendCallsigns.size()) {
|
||||||
const auto cIt = std::find(this->m_forcedToBackendCallsigns.cbegin(), this->m_forcedToBackendCallsigns.cend(), callsign);
|
const auto cIt = std::find(this->m_forcedToBackendCallsigns.cbegin(), this->m_forcedToBackendCallsigns.cend(), callsign);
|
||||||
forced = this->m_forcedToBackendCallsigns.cend() != cIt;
|
forced = this->m_forcedToBackendCallsigns.cend() != cIt;
|
||||||
|
}
|
||||||
|
|
||||||
/* check if the inbound is expected to be planned */
|
/* check if the inbound is expected to be planned */
|
||||||
planExpected = this->m_updateQueue.cend() != this->m_updateQueue.find(destination);
|
planExpected = this->m_updateQueue.cend() != this->m_updateQueue.find(destination);
|
||||||
|
|
||||||
this->m_updateQueueLock.unlock();
|
this->m_updateQueueLock.unlock();
|
||||||
|
|
||||||
if (TagItemElement::DeltaTime == static_cast<TagItemElement>(itemCode)) {
|
|
||||||
if (true == this->m_compatible) {
|
|
||||||
std::lock_guard guard(this->m_inboundsQueueLock);
|
std::lock_guard guard(this->m_inboundsQueueLock);
|
||||||
auto it = this->m_inbounds.find(callsign);
|
auto it = this->m_inbounds.find(callsign);
|
||||||
|
|
||||||
/* inbound expected, but not available */
|
std::string message;
|
||||||
if (this->m_inbounds.cend() == it && (true == forced || true == planExpected)) {
|
switch (static_cast<TagItemElement>(itemCode)) {
|
||||||
std::strcpy(itemString, "* ??:??");
|
case TagItemElement::EstimatedTimeOfArrival:
|
||||||
|
{
|
||||||
|
if (this->m_inbounds.cend() != it)
|
||||||
|
message = UtcTime::timeToString(it->second.eta(), "%H:%M");
|
||||||
|
else if (true == forced || true == planExpected)
|
||||||
|
message = "??:??";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* inbound is available */
|
case TagItemElement::PlannedTimeOfArrival:
|
||||||
else if (this->m_inbounds.cend() != it) {
|
{
|
||||||
|
if (this->m_inbounds.cend() != it)
|
||||||
|
message = UtcTime::timeToString(it->second.pta(), "%H:%M");
|
||||||
|
else if (true == forced || true == planExpected)
|
||||||
|
message = "??:??";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TagItemElement::DeltaTime:
|
||||||
|
{
|
||||||
|
if (this->m_inbounds.cend() != it) {
|
||||||
const auto ttl = static_cast<int>(std::roundf(it->second.timeToLose().convert(second)));
|
const auto ttl = static_cast<int>(std::roundf(it->second.timeToLose().convert(second)));
|
||||||
const auto minutes = ttl / 60;
|
|
||||||
const auto seconds = std::abs(ttl) % 60;
|
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << (true == it->second.fixedPlan() ? "" : "* ") << std::setw(2) << std::setfill('0') << minutes << ":"
|
stream << ttl;
|
||||||
<< std::setw(2) << std::setfill('0') << seconds;
|
message = stream.str();
|
||||||
std::strcpy(itemString, stream.str().c_str());
|
|
||||||
}
|
}
|
||||||
else {
|
else if (true == forced || true == planExpected) {
|
||||||
gsl::at(tagString, 0) = '\0';
|
message = "??";
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
case TagItemElement::FixedPlanIndicator:
|
||||||
std::strcpy(itemString, "N/A");
|
if (this->m_inbounds.cend() != it && false == it->second.fixedPlan())
|
||||||
}
|
message = "*";
|
||||||
|
else if (this->m_inbounds.cend() == it && (true == forced || true == planExpected))
|
||||||
|
message = "*";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 != message.length()) {
|
||||||
|
std::strcpy(itemString, message.c_str());
|
||||||
*colorCode = EuroScopePlugIn::TAG_COLOR_DEFAULT;
|
*colorCode = EuroScopePlugIn::TAG_COLOR_DEFAULT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlugIn::OnFunctionCall(int functionId, const char* itemString, POINT pt, RECT area) {
|
void PlugIn::OnFunctionCall(int functionId, const char* itemString, POINT pt, RECT area) {
|
||||||
std::ignore = itemString;
|
std::ignore = itemString;
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ namespace aman {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
enum class TagItemElement {
|
enum class TagItemElement {
|
||||||
DeltaTime = 0
|
EstimatedTimeOfArrival = 0,
|
||||||
|
PlannedTimeOfArrival = 1,
|
||||||
|
DeltaTime = 2,
|
||||||
|
FixedPlanIndicator = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
void validateBackendData();
|
void validateBackendData();
|
||||||
|
|||||||
Reference in New Issue
Block a user