Skip to content

Commit

Permalink
Fixed predicted track line still showing although set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed Oct 28, 2020
1 parent 69adf60 commit f5eac31
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
22 changes: 12 additions & 10 deletions vSMR/InsetWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,19 +344,21 @@ void CInsetWindow::render(HDC hDC, CSMRRadar * radar_screen, Graphics* gdi, POIN

// Predicted Track Line
// It starts 10 seconds away from the ac
double d = double(rt.GetPosition().GetReportedGS()*0.514444)*10;
CPosition AwayBase = BetterHarversine(rt.GetPosition().GetPosition(), rt.GetTrackHeading(), d);
if (radar_screen->PredictedLength > 0) {
double d = double(rt.GetPosition().GetReportedGS() * 0.514444) * 10;
CPosition AwayBase = BetterHarversine(rt.GetPosition().GetPosition(), rt.GetTrackHeading(), d);

d = double(rt.GetPosition().GetReportedGS()*0.514444) * (radar_screen->PredictedLenght * 60)-10;
CPosition PredictedEnd = BetterHarversine(AwayBase, rt.GetTrackHeading(), d);
d = double(rt.GetPosition().GetReportedGS() * 0.514444) * (radar_screen->PredictedLength * 60) - 10;
CPosition PredictedEnd = BetterHarversine(AwayBase, rt.GetTrackHeading(), d);

POINT liangOne, liangTwo;
POINT liangOne, liangTwo;

if (LiangBarsky(m_Area, projectPoint(AwayBase), projectPoint(PredictedEnd), liangOne, liangTwo))
{
dc.SelectObject(&WhitePen);
dc.MoveTo(liangOne);
dc.LineTo(liangTwo);
if (LiangBarsky(m_Area, projectPoint(AwayBase), projectPoint(PredictedEnd), liangOne, liangTwo))
{
dc.SelectObject(&WhitePen);
dc.MoveTo(liangOne);
dc.LineTo(liangTwo);
}
}

if (mouseWithin(mouseLocation, { RtPoint.x - 4, RtPoint.y - 4, RtPoint.x + 4, RtPoint.y + 4 })) {
Expand Down
22 changes: 11 additions & 11 deletions vSMR/SMRRadar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void CSMRRadar::OnAsrContentLoaded(bool Loaded)
Trail_Gnd = atoi(p_value);

if ((p_value = GetDataFromAsr("PredictedLine")) != NULL)
PredictedLenght = atoi(p_value);
PredictedLength = atoi(p_value);

string temp;

Expand Down Expand Up @@ -314,7 +314,7 @@ void CSMRRadar::OnAsrContentToBeSaved()

SaveDataToAsr("GndTrailsDots", "vSMR GRND Trail Dots", std::to_string(Trail_Gnd).c_str());

SaveDataToAsr("PredictedLine", "vSMR Predicted Track Lines", std::to_string(PredictedLenght).c_str());
SaveDataToAsr("PredictedLine", "vSMR Predicted Track Lines", std::to_string(PredictedLength).c_str());

string temp = "";

Expand Down Expand Up @@ -1006,7 +1006,7 @@ void CSMRRadar::OnFunctionCall(int FunctionId, const char * sItemString, POINT P

if (FunctionId == RIMCAS_UPDATE_PTL)
{
PredictedLenght = atoi(sItemString);
PredictedLength = atoi(sItemString);

ShowLists["Predicted Track Line"] = true;
}
Expand Down Expand Up @@ -1966,12 +1966,12 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)

// Predicted Track Line
// It starts 20 seconds away from the ac
if (reportedGs > 50)
if (reportedGs > 50 && PredictedLength > 0)
{
double d = double(rt.GetPosition().GetReportedGS()*0.514444) * 10;
CPosition AwayBase = BetterHarversine(rt.GetPosition().GetPosition(), rt.GetTrackHeading(), d);

d = double(rt.GetPosition().GetReportedGS()*0.514444) * (PredictedLenght * 60) - 10;
d = double(rt.GetPosition().GetReportedGS()*0.514444) * (PredictedLength * 60) - 10;
CPosition PredictedEnd = BetterHarversine(AwayBase, rt.GetTrackHeading(), d);

dc.MoveTo(ConvertCoordFromPositionToPixel(AwayBase));
Expand Down Expand Up @@ -2489,12 +2489,12 @@ void CSMRRadar::OnRefresh(HDC hDC, int Phase)

if (ShowLists["Predicted Track Line"]) {
GetPlugIn()->OpenPopupList(ListAreas["Predicted Track Line"], "Predicted Track Line", 1);
GetPlugIn()->AddPopupListElement("0", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 0)));
GetPlugIn()->AddPopupListElement("1", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 1)));
GetPlugIn()->AddPopupListElement("2", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 2)));
GetPlugIn()->AddPopupListElement("3", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 3)));
GetPlugIn()->AddPopupListElement("4", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 4)));
GetPlugIn()->AddPopupListElement("5", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLenght == 5)));
GetPlugIn()->AddPopupListElement("0", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 0)));
GetPlugIn()->AddPopupListElement("1", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 1)));
GetPlugIn()->AddPopupListElement("2", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 2)));
GetPlugIn()->AddPopupListElement("3", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 3)));
GetPlugIn()->AddPopupListElement("4", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 4)));
GetPlugIn()->AddPopupListElement("5", "", RIMCAS_UPDATE_PTL, false, int(bool(PredictedLength == 5)));
GetPlugIn()->AddPopupListElement("Close", "", RIMCAS_CLOSE, false, 2, false, true);
ShowLists["Predicted Track Line"] = false;
}
Expand Down
2 changes: 1 addition & 1 deletion vSMR/SMRRadar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class CSMRRadar :

int Trail_Gnd = 4;
int Trail_App = 4;
int PredictedLenght = 0;
int PredictedLength = 0;

bool NeedCorrelateCursor = false;
bool ReleaseInProgress = false;
Expand Down

0 comments on commit f5eac31

Please sign in to comment.