void UpdateFixedLine() { if ((mIdx == 0) || (mIdx == (size_t) getFinalWaypoint())) { UpdateSymLine(); } else { StartupStore(_T("..Cup Task : LINE Turnpoint is only supported for Start or Finish%s"), NEWLINE); mA1 = 90.0; UpdateFixedSector(); } }
void UpdateToStartSector() { if (mIdx > 0) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *StartPt = TaskWayPoint(0); // bearing to prev DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, StartPt->Latitude, StartPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
void UpdateToPrevSector() { if (ValidTaskPoint(mIdx - 1)) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *PrevPt = TaskWayPoint(mIdx - 1); // bearing to prev DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, PrevPt->Latitude, PrevPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
void UpdateToNextSector() { if (ValidTaskPoint(mIdx + 1)) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *NextPt = TaskWayPoint(mIdx + 1); // bearing to next DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, NextPt->Latitude, NextPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
void UpdateSymSector() { if (mIdx == 0) { UpdateToNextSector(); } else if (mIdx == ((size_t) getFinalWaypoint())) { UpdateToPrevSector(); } else { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *PrevPt = TaskWayPoint(mIdx - 1); const WAYPOINT *NextPt = TaskWayPoint(mIdx + 1); double InB = 0; double OutB = 0; // bearing to prev DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, PrevPt->Latitude, PrevPt->Longitude, NULL, &InB); // bearing to next DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, NextPt->Latitude, NextPt->Longitude, NULL, &OutB); mA12 = BiSector(InB, OutB); UpdateFixedSector(); } }
void UpdateTask() { if (mA1 == 180.0) { if (mIdx == 0) { StartLine = 0; StartRadius = mR1; } else if (mIdx == (size_t) getFinalWaypoint()) { FinishLine = 0; FinishRadius = mR1; } else { Task[mIdx].AATType = CIRCLE; Task[mIdx].AATCircleRadius = mR1; } } else { switch (mType) { case 0: // - Fixed value, if (mLine) { StartupStore(_T("..Cup Task : \"Fixed\" LINE Turnpoint is not supported%s"), NEWLINE); UpdateFixedLine(); } else { UpdateFixedSector(); } break; case 1: // - Symmetrical, if (mLine) { StartupStore(_T("..Cup Task : \"Symmetrical\" LINE Turnpoint is not supported%s"), NEWLINE); UpdateSymLine(); } else { UpdateSymSector(); } break; case 2: // - To next point, if (mLine) { if (mIdx > 0) { StartupStore(_T("..Cup Task : \"To next point\" LINE Turnpoint is not supported%s"), NEWLINE); } UpdateToNextLine(); } else { UpdateToNextSector(); } break; case 3: // - To previous point, if (mLine) { if (mIdx < (size_t) getFinalWaypoint()) { StartupStore(_T("..Cup Task : \"To previous point\" LINE Turnpoint is not supported%s"), NEWLINE); } UpdateToPrevLine(); } else { UpdateToPrevSector(); } break; case 4: // - To start point if (mLine) { StartupStore(_T("..Cup Task : \"To start point\" LINE Turnpoint is not supported%s"), NEWLINE); UpdateToStartLine(); } else { UpdateToStartSector(); } break; } } }