本文整理汇总了C++中LockTaskData函数的典型用法代码示例。如果您正苦于以下问题:C++ LockTaskData函数的具体用法?C++ LockTaskData怎么用?C++ LockTaskData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LockTaskData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearTask
void ClearTask(void) {
LockTaskData();
TaskModified = true;
TargetModified = true;
if (ISPARAGLIDER) PGOptimizeRoute = PGOptimizeRoute_Config;
LastTaskFileName[0] = _T('\0');
ActiveWayPoint = -1;
EnableMultipleStartPoints = false;
std::for_each(std::begin(Task), std::end(Task), ResetTaskWpt);
std::for_each(std::begin(TaskStats), std::end(TaskStats), ResetTaskStat);
std::for_each(std::begin(StartPoints), std::end(StartPoints), ResetStartPoint);
UnlockTaskData();
}
示例2: LKASSERT
/**
* @brief Sets requested zoom scale for AUTO_ZOOM mode
*/
void MapWindow::Zoom::CalculateAutoZoom()
{
static int autoMapScaleWaypointIndex = -1;
static int wait_for_new_wpt_distance = 0;
double wpd = DerivedDrawInfo.ZoomDistance;
if (wait_for_new_wpt_distance>0) wait_for_new_wpt_distance--; //This counter is needed to get new valid waypoint distance after wp changes
if ( (wpd > 0) && (wait_for_new_wpt_distance==0) ) {
double AutoZoomFactor;
if( (DisplayOrientation == NORTHTRACK && !mode.Is(Mode::MODE_CIRCLING)) ||
DisplayOrientation == NORTHUP ||
DisplayOrientation == NORTHSMART ||
((DisplayOrientation == NORTHCIRCLE || DisplayOrientation == TRACKCIRCLE) && mode.Is(Mode::MODE_CIRCLING)) )
AutoZoomFactor = 2.5;
else
AutoZoomFactor = 4;
if ( ( !ISPARAGLIDER && (wpd < AutoZoomFactor * _scaleOverDistanceModify) ) ||
( ISPARAGLIDER && (wpd < PGAutoZoomThreshold)) ) {
// waypoint is too close, so zoom in
LKASSERT(AutoZoomFactor!=0);
_modeScale[SCALE_CRUISE] = LimitMapScale(wpd * DISTANCEMODIFY / AutoZoomFactor);
}
}
LockTaskData(); // protect from external task changes
// if we aren't looking at a waypoint, see if we are now
if(autoMapScaleWaypointIndex == -1) {
if(ValidTaskPoint(ActiveWayPoint))
autoMapScaleWaypointIndex = Task[ActiveWayPoint].Index;
}
if(ValidTaskPoint(ActiveWayPoint)) {
// if the current zoom focused waypoint has changed...
if(autoMapScaleWaypointIndex != Task[ActiveWayPoint].Index) {
autoMapScaleWaypointIndex = Task[ActiveWayPoint].Index;
wait_for_new_wpt_distance = 3;
// zoom back out to where we were before
_modeScale[SCALE_CRUISE] = _modeScale[SCALE_AUTO_ZOOM];
}
}
{
UnlockTaskData();
}
}
示例3: OnRemoveClicked
static void OnRemoveClicked(WndButton* pWnd) {
LockTaskData();
RemoveTaskPoint(twItemIndex);
SetWaypointValues();
if (ActiveTaskPoint>=twItemIndex) {
ActiveTaskPoint--;
}
if (ActiveTaskPoint<0) {
ActiveTaskPoint= -1;
}
UnlockTaskData();
if(pWnd) {
WndForm * pForm = pWnd->GetParentWndForm();
if(pForm) {
pForm->SetModalResult(mrOK);
}
}
}
示例4: OnSelectClicked
static void OnSelectClicked(WindowControl * Sender){
(void)Sender;
int res;
res = dlgWayPointSelect();
if (res != -1){
SelectedWaypoint = res;
if (Task[twItemIndex].Index != res) {
if (CheckDeclaration()) {
LockTaskData();
ResetTaskWaypoint(twItemIndex);
Task[twItemIndex].Index = res;
TaskModified = true;
UnlockTaskData();
}
}
UpdateCaption();
};
}
示例5: dlgStartPointShowModal
void dlgStartPointShowModal(void) {
ItemIndex = -1;
wf = dlgLoadFromXML(CallBackTable,
ScreenLandscape ? TEXT("dlgStartPoint_L.xml") : TEXT("dlgStartPoint_P.xml"),
ScreenLandscape ? IDR_XML_STARTPOINT_L : IDR_XML_STARTPOINT_P);
if (!wf) return;
//ASSERT(wf!=NULL);
CheckStartPointInTask();
wStartPointList = (WndListFrame*)wf->FindByName(TEXT("frmStartPointList"));
//ASSERT(wStartPointList!=NULL);
wStartPointList->SetBorderKind(BORDERLEFT);
wStartPointList->SetEnterCallback(OnStartPointListEnter);
wStartPointListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmStartPointListEntry"));
//ASSERT(wStartPointListEntry!=NULL);
wStartPointListEntry->SetCanFocus(true);
UpdateList();
changed = false;
wf->ShowModal();
// now retrieve back the properties...
if (changed) {
LockTaskData();
TaskModified = true;
RefreshTask();
UnlockTaskData();
};
delete wf;
wf = NULL;
}
示例6: OnSelectClicked
static void OnSelectClicked(WndButton* pWnd){
int res;
res = dlgWayPointSelect();
if (res != -1){
SelectedWaypoint = res;
LKASSERT(twItemIndex>=0);
if (Task[twItemIndex].Index != res) {
if (CheckDeclaration()) {
LockTaskData();
ResetTaskWaypoint(twItemIndex);
Task[twItemIndex].Index = res;
Task[twItemIndex].PGConeBase = WayPointList[res].Altitude;
TaskModified = true;
UnlockTaskData();
}
}
UpdateCaption();
};
}
示例7: LockTaskData
double AATDistance::DistanceCovered_internal(double longitude,
double latitude,
bool insector) {
double achieved;
if (!ValidTaskPoint(ActiveTaskPoint) || (ActiveTaskPoint==0)) {
// max_achieved_distance = 0;
return 0.0;
}
LockTaskData();
if (insector) {
achieved = DistanceCovered_inside(longitude, latitude);
} else {
achieved = DistanceCovered_outside(longitude, latitude);
}
UnlockTaskData();
// max_achieved_distance = max(achieved, max_achieved_distance);
return achieved;
}
示例8: ResetScale
void Statistics::RenderBarograph(HDC hdc, RECT rc)
{
ResetScale();
ScaleXFromData(rc, &flightstats.Altitude);
ScaleYFromData(rc, &flightstats.Altitude);
ScaleXFromData(rc, &flightstats.Altitude_Base);
ScaleYFromData(rc, &flightstats.Altitude_Base);
ScaleXFromData(rc, &flightstats.Altitude_Ceiling);
ScaleYFromData(rc, &flightstats.Altitude_Ceiling);
DrawXGrid(hdc, rc,
0.25, flightstats.Altitude.x_min,
STYLE_THINDASHPAPER);
DrawYGrid(hdc, rc, 1000/ALTITUDEMODIFY, 0, STYLE_THINDASHPAPER);
DrawLineGraph(hdc, rc, &flightstats.Altitude,
STYLE_MEDIUMBLACK);
LockTaskData();
for(int j=0;j<MAXTASKPOINTS;j++) {
if (ValidTaskPoint(j) && (LegStartTime[j]>=0)) {
double xx = (LegStartTime[j]-Calculated->TakeOffTime)/3600;
if (xx>=0) {
DrawLine(hdc, rc,
xx, flightstats.Altitude.y_min,
xx, flightstats.Altitude.y_max,
STYLE_THINDASHPAPER);
}
}
}
UnlockTaskData();
DrawTrend(hdc, rc, &flightstats.Altitude_Base, STYLE_BLUETHIN);
DrawTrend(hdc, rc, &flightstats.Altitude_Ceiling, STYLE_BLUETHIN);
DrawXLabel(hdc, rc, TEXT("t"));
DrawYLabel(hdc, rc, TEXT("h"));
}
示例9: LockTaskData
/*
* Currently even if set for FIVV, colors are not used.
*/
TCHAR *FormatterAlternate::Render(int *color) {
//int active=ActiveAlternate; REMOVE
LockTaskData();
if(Valid && ValidWayPoint(ActiveAlternate)) {
switch (WayPointCalc[ActiveAlternate].VGR ) {
case 0:
// impossible, give a magenta debug color;
*color = 5;
break;
case 1:
#ifdef FIVV
*color = 0; // green
#else
*color = 0; // blue
#endif
break;
case 2:
#ifdef FIVV
*color = 0; // yellow 4
#else
*color = 0; // normale white
#endif
break;
case 3:
*color = 1; // red
break;
default:
// even more impossible, give debug color magenta
*color = 5;
break;
}
// Value=WayPointCalc[ActiveAlternate].GR; BUGFIX 090918
_stprintf(Text,Format,Value);
} else {
Valid = false;
RenderInvalid(color);
}
UnlockTaskData();
return(Text);
}
示例10: FlyDirectTo
void FlyDirectTo(int index) {
if (!CheckDeclaration())
return;
LockTaskData();
TaskModified = true;
TargetModified = true;
ActiveWayPoint = -1;
AATEnabled = FALSE;
InsertRecentList(index);
Task[0].Index = index;
for (int i=1; i<=MAXTASKPOINTS; i++) {
Task[i].Index = -1;
}
ActiveWayPoint = 0;
RefreshTask();
UnlockTaskData();
}
示例11: OnStartPointListEnter
static void OnStartPointListEnter(WindowControl * Sender,
WndListFrame::ListInfo_t *ListInfo) {
(void)Sender;
ItemIndex = ListInfo->ItemIndex + ListInfo->ScrollIndex;
if (ItemIndex>=MAXSTARTPOINTS) {
ItemIndex = -1;
while(ValidStartPoint(ItemIndex++)) { }
}
if (ItemIndex>=0) {
int res;
res = dlgWayPointSelect();
if (res>=0) {
// TODO bug: don't add it if it's already present!
LockTaskData();
StartPoints[ItemIndex].Index = res;
StartPoints[ItemIndex].Active = true;
UnlockTaskData();
changed = true;
UpdateList();
}
}
}
示例12: CorrectSide
// Are we on the correct side of start cylinder?
bool CorrectSide() {
// Remember that IsInSector works reversed...
#if DEBUGTGATES
StartupStore(_T("CorrectSide: PGstartout=%d InSector=%d\n"),PGStartOut,CALCULATED_INFO.IsInSector);
#endif
if (ActiveWayPoint==0 && PGStartOut && CALCULATED_INFO.IsInSector)
return false;
if (ActiveWayPoint==0 && !PGStartOut && !CALCULATED_INFO.IsInSector)
return false;
LockTaskData();
bool ExitWpt = Task[ActiveWayPoint].OutCircle;
UnlockTaskData();
if (ExitWpt==0 && PGStartOut && CALCULATED_INFO.IsInSector)
return false;
if (ExitWpt==0 && !PGStartOut && !CALCULATED_INFO.IsInSector)
return false;
return true;
}
示例13: OnSelectClicked
static void OnSelectClicked(WindowControl * Sender){
(void)Sender;
int res;
res = dlgWayPointSelect();
if (res != -1){
SelectedWaypoint = res;
if (Task[twItemIndex].Index != res) {
if (CheckDeclaration()) {
LockTaskData();
Task[twItemIndex].Index = res;
Task[twItemIndex].AATTargetOffsetRadius = 0.0;
Task[twItemIndex].AATTargetOffsetRadial = 0.0;
Task[twItemIndex].AATSectorRadius = SectorRadius;
Task[twItemIndex].AATCircleRadius = SectorRadius;
Task[twItemIndex].AATTargetLocked = false;
TaskModified = true;
UnlockTaskData();
}
}
UpdateCaption();
};
}
示例14: CalculateOptimizedTargetPos
void CalculateOptimizedTargetPos(NMEA_INFO *Basic, DERIVED_INFO *Calculated) {
if (!DoOptimizeRoute())
return;
LockTaskData();
gPGTask.Optimize(Basic, Calculated);
for(size_t i=0; i<gPGTask.Count(); ++i) {
gPGTask.UpdateTaskPoint(i, Task[i]);
}
int stdwp=Task[ActiveTaskPoint].Index;
WayPointList[RESWP_OPTIMIZED].Latitude = Task[ActiveTaskPoint].AATTargetLat;
WayPointList[RESWP_OPTIMIZED].Longitude = Task[ActiveTaskPoint].AATTargetLon;
WayPointList[RESWP_OPTIMIZED].Altitude = Task[ActiveTaskPoint].AATTargetAltitude;
_stprintf(WayPointList[RESWP_OPTIMIZED].Name, _T("!%s"),WayPointList[stdwp].Name);
UnlockTaskData();
}
示例15: ClearOptimizedTargetPos
// Clear PG
void ClearOptimizedTargetPos() {
if (!DoOptimizeRoute())
return;
LockTaskData();
WayPointList[RESWP_OPTIMIZED].Latitude=RESWP_INVALIDNUMBER;
WayPointList[RESWP_OPTIMIZED].Longitude=RESWP_INVALIDNUMBER;
WayPointList[RESWP_OPTIMIZED].Altitude=RESWP_INVALIDNUMBER;
// name will be assigned by function dynamically
_tcscpy(WayPointList[RESWP_OPTIMIZED].Name, _T("OPTIMIZED") );
for(int i = 0; ValidWayPoint(Task[i].Index); ++i) {
Task[i].AATTargetLat = WayPointList[Task[i].Index].Latitude;
Task[i].AATTargetLon = WayPointList[Task[i].Index].Longitude;
Task[i].AATTargetAltitude = WayPointList[Task[i].Index].Altitude;
Task[i].AATTargetLocked = false;
}
gPGTask.Initialize();
UnlockTaskData();
}