本文整理汇总了C++中UnlockTaskData函数的典型用法代码示例。如果您正苦于以下问题:C++ UnlockTaskData函数的具体用法?C++ UnlockTaskData怎么用?C++ UnlockTaskData使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UnlockTaskData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OverviewRefreshTask
static void OverviewRefreshTask(void) {
LockTaskData();
RefreshTask();
int i;
// Only need to refresh info where the removal happened
// as the order of other taskpoints hasn't changed
UpLimit = 0;
lengthtotal = 0;
for (i=0; i<MAXTASKPOINTS; i++) {
if (Task[i].Index != -1) {
lengthtotal += Task[i].Leg;
UpLimit = i+1;
}
}
// Simple FAI 2004 triangle rules
fai_ok = true;
if (lengthtotal>0) {
for (i=0; i<MAXTASKPOINTS; i++) {
if (Task[i].Index != -1) {
double lrat = Task[i].Leg/lengthtotal;
if ((lrat>0.45)||(lrat<0.10)) {
fai_ok = false;
}
}
}
} else {
fai_ok = false;
}
RefreshTaskStatistics();
WndProperty* wp;
wp = (WndProperty*)wf->FindByName(TEXT("prpAATEst"));
if (wp) {
double dd = CALCULATED_INFO.TaskTimeToGo;
// if ((CALCULATED_INFO.TaskStartTime>0.0)&&(CALCULATED_INFO.Flying)) { patchout 091126
if ( (CALCULATED_INFO.TaskStartTime>0.0)&&(CALCULATED_INFO.Flying) &&(ActiveTaskPoint>0)) { // patch 091126
dd += GPS_INFO.Time-CALCULATED_INFO.TaskStartTime;
}
dd= min(24.0*60.0,dd/60.0);
wp->GetDataField()->SetAsFloat(dd);
wp->RefreshDisplay();
}
LowLimit =0;
wTaskList->ResetList();
wTaskList->Redraw();
UpdateCaption();
UnlockTaskData();
}
示例2: LockTaskData
bool MapWindow::WaypointInTask(int ind) {
bool retval = false;
LockTaskData();
if ((ind<0)||(ind>=(int)WayPointList.size())) {
retval = WayPointList[ind].InTask;
}
UnlockTaskData();
return retval;
}
示例3: SaveDefaultTask
void SaveDefaultTask(void) {
LockTaskData();
TCHAR buffer[MAX_PATH];
LocalPath(buffer,TEXT(LKD_TASKS));
_tcscat(buffer,TEXT("\\"));
_tcscat(buffer,_T(LKF_DEFAULTASK)); // 091101
SaveTask(buffer);
UnlockTaskData();
}
示例4: ValidNotResWayPoint
// A waypoint is valid here only if a list exists, it is within range and it is not reserved
bool ValidNotResWayPoint(int i) { // 091213
bool retval = true;
LockTaskData();
if ((i<=RESWP_END)||(i>=(int)WayPointList.size())) {
retval = false;
}
UnlockTaskData();
return retval;
}
示例5: ValidStartPoint
bool ValidStartPoint(size_t i) {
bool retVal=false;
LockTaskData();
if(i<MAXSTARTPOINTS) {
retVal = ValidWayPointFast(StartPoints[i].Index);
}
UnlockTaskData();
return retVal;
}
示例6: DoOptimise
static void DoOptimise(void) {
double myrange= Range;
double RangeLast= Range;
double deltaTlast = 0;
int steps = 0;
if (!AATEnabled) return;
LockFlightData();
LockTaskData();
TargetDialogOpen = true;
do {
myrange = Range;
AdjustAATTargets(Range);
RefreshTask();
RefreshTaskStatistics();
double deltaT = CALCULATED_INFO.TaskTimeToGo;
if ((CALCULATED_INFO.TaskStartTime>0.0)&&(CALCULATED_INFO.Flying)) {
deltaT += GPS_INFO.Time-CALCULATED_INFO.TaskStartTime;
}
deltaT= min(24.0*60.0,deltaT/60.0)-AATTaskLength-5;
double dRdT = 0.001;
if (steps>0) {
if (fabs(deltaT-deltaTlast)>0.01) {
dRdT = min(0.5,(Range-RangeLast)/(deltaT-deltaTlast));
if (dRdT<=0.0) {
// error, time decreases with increasing range!
// or, no effect on time possible
break;
}
} else {
// minimal change for whatever reason
// or, no effect on time possible, e.g. targets locked
break;
}
}
RangeLast = Range;
deltaTlast = deltaT;
if (fabs(deltaT)>0.25) {
// more than 15 seconds error
Range -= dRdT*deltaT;
Range = max(-1.0, min(Range,1.0));
} else {
break;
}
} while (steps++<25);
Range = myrange;
AdjustAATTargets(Range);
RefreshCalculator();
TargetDialogOpen = false;
UnlockTaskData();
UnlockFlightData();
}
示例7: AdjustAATTargets
double AdjustAATTargets(double desired) {
int i, istart, inum;
double av=0;
istart = max(1,ActiveTaskPoint);
inum=0;
LockTaskData();
for(i=istart;i<MAXTASKPOINTS-1;i++)
{
if(ValidTaskPoint(i)&&ValidTaskPoint(i+1) && !Task[i].AATTargetLocked)
{
Task[i].AATTargetOffsetRadius = max(-1.0,min(1.0,
Task[i].AATTargetOffsetRadius));
av += Task[i].AATTargetOffsetRadius;
inum++;
}
}
if (inum>0) {
av/= inum;
}
if (fabs(desired)>1.0) {
// don't adjust, just retrieve.
goto OnExit;
}
// TODO accuracy: Check here for true minimum distance between
// successive points (especially second last to final point)
// Do this with intersection tests
desired = (desired+1.0)/2.0; // scale to 0,1
av = (av+1.0)/2.0; // scale to 0,1
for(i=istart;i<MAXTASKPOINTS-1;i++)
{
if((Task[i].Index >=0)&&(Task[i+1].Index >=0) && !Task[i].AATTargetLocked)
{
double d = (Task[i].AATTargetOffsetRadius+1.0)/2.0;
// scale to 0,1
if (av>0.01) {
d = desired;
// 20080615 JMW
// was (desired/av)*d;
// now, we don't want it to be proportional
} else {
d = desired;
}
d = min(1.0, max(d, 0.0))*2.0-1.0;
Task[i].AATTargetOffsetRadius = d;
}
}
OnExit:
UnlockTaskData();
return av;
}
示例8: AltitudeRequired
// Current Waypoint calculations for task (no safety?) called only once at beginning
// of DoCalculations, using MACCREADY
void AltitudeRequired(NMEA_INFO *Basic, DERIVED_INFO *Calculated,
const double this_maccready)
{
// LockFlightData();
(void)Basic;
LockTaskData();
if(ValidTaskPoint(ActiveWayPoint))
{
int index;
double wp_alt = FAIFinishHeight(Basic, Calculated, ActiveWayPoint);
double height_above_wp = Calculated->NavAltitude + Calculated->EnergyHeight - wp_alt;
Calculated->NextAltitudeRequired = GlidePolar::MacCreadyAltitude(this_maccready,
Calculated->WaypointDistance,
Calculated->WaypointBearing,
Calculated->WindSpeed, Calculated->WindBearing,
0, 0,
true,
NULL, height_above_wp, CRUISE_EFFICIENCY
);
if (this_maccready==0 ) Calculated->NextAltitudeRequired0=Calculated->NextAltitudeRequired;
else
Calculated->NextAltitudeRequired0 = GlidePolar::MacCreadyAltitude(0,
Calculated->WaypointDistance,
Calculated->WaypointBearing,
Calculated->WindSpeed, Calculated->WindBearing,
0, 0,
true,
NULL, height_above_wp, CRUISE_EFFICIENCY
);
Calculated->NextAltitudeRequired += wp_alt;
Calculated->NextAltitudeRequired0 += wp_alt; // VENTA6
Calculated->NextAltitudeDifference = Calculated->NavAltitude + Calculated->EnergyHeight - Calculated->NextAltitudeRequired;
Calculated->NextAltitudeDifference0 = Calculated->NavAltitude + Calculated->EnergyHeight - Calculated->NextAltitudeRequired0;
// We set values only for current destination active waypoint.
index=TASKINDEX;
WayPointCalc[index].AltArriv[ALTA_MC]=1111.0;
WayPointCalc[index].AltArriv[ALTA_SMC]=2222.0; // FIX 091012
WayPointCalc[index].AltArriv[ALTA_MC0]=3333.0;
WayPointCalc[index].AltArriv[ALTA_AVEFF]=1234.0;
}
else
{
Calculated->NextAltitudeRequired = 0;
Calculated->NextAltitudeDifference = 0;
Calculated->NextAltitudeDifference0 = 0; // VENTA6
}
UnlockTaskData();
// UnlockFlightData();
}
示例9: OnSetAlt2Clicked
static void OnSetAlt2Clicked(WndButton* pWnd){
LockTaskData();
Alternate2 = SelectedWaypoint;
RefreshTask();
UnlockTaskData();
if (ValidWayPoint(Alternate2))
DoStatusMessage(_T("Altern.2="),WayPointList[Alternate2].Name);
retStatus=4;
wf->SetModalResult(mrOK);
}
示例10: LockTaskData
double AATDistance::DistanceCovered(double longitude,
double latitude,
int taskwaypoint) {
(void)taskwaypoint; // unused
double retval;
LockTaskData();
retval= DistanceCovered_internal(longitude, latitude, false);
UnlockTaskData();
return retval;
}
示例11: ValidResWayPoint
// 100929 A waypoint is valid here only if it is virtual, and with a valid content
bool ValidResWayPoint(int i) { // 091213
bool retval = true;
LockTaskData();
if ( (i<0) || (i>RESWP_END) )
retval = false;
else {
if (WayPointList[i].Latitude == RESWP_INVALIDNUMBER) retval=false;
}
UnlockTaskData();
return retval;
}
示例12: GetWaypointValues
static void GetWaypointValues(void) {
WndProperty* wp;
bool changed = false;
if (!AATEnabled) {
return;
}
if ((twItemIndex<MAXTASKPOINTS)&&(twItemIndex>=0)) {
LockTaskData();
wp = (WndProperty*)wf->FindByName(TEXT("prpAATType"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].AATType,
wp->GetDataField()->GetAsInteger());
}
wp = (WndProperty*)wf->FindByName(TEXT("prpAATCircleRadius"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].AATCircleRadius,
iround(wp->GetDataField()->GetAsFloat()/DISTANCEMODIFY));
}
wp = (WndProperty*)wf->FindByName(TEXT("prpAATSectorRadius"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].AATSectorRadius,
iround(wp->GetDataField()->GetAsFloat()/DISTANCEMODIFY));
}
wp = (WndProperty*)wf->FindByName(TEXT("prpAATStartRadial"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].AATStartRadial,
wp->GetDataField()->GetAsInteger());
}
wp = (WndProperty*)wf->FindByName(TEXT("prpAATFinishRadial"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].AATFinishRadial,
wp->GetDataField()->GetAsInteger());
}
wp = (WndProperty*)wf->FindByName(TEXT("prpOutCircle"));
if (wp) {
CHECK_CHANGED(Task[twItemIndex].OutCircle,
wp->GetDataField()->GetAsInteger());
}
if (changed) {
TaskModified = true;
}
UnlockTaskData();
}
}
示例13: OnReplaceClicked
static void OnReplaceClicked(WindowControl * Sender){
(void)Sender;
LockTaskData();
ReplaceWaypoint(SelectedWaypoint);
RealActiveWaypoint = SelectedWaypoint;
RefreshTask();
UnlockTaskData();
MapWindow::RefreshMap();
wf->SetModalResult(mrOK);
}
示例14: OnMoveBeforeClicked
static void OnMoveBeforeClicked(WndButton* pWnd){
LockTaskData();
SwapWaypoint(twItemIndex-1);
SetWaypointValues();
UnlockTaskData();
if(pWnd) {
WndForm * pForm = pWnd->GetParentWndForm();
if(pForm) {
pForm->SetModalResult(mrOK);
}
}
}
示例15: OnClearClicked
static void OnClearClicked(WndButton* pWnd) {
LockTaskData();
for (int i=0; i<MAXSTARTPOINTS; i++) {
StartPoints[i].Index = -1;
StartPoints[i].Active = false;
}
StartPoints[0].Index = Task[0].Index;
StartPoints[0].Active = true;
changed = true;
UnlockTaskData();
UpdateList();
}