コード例 #1
0
LRESULT CDlgDepartureSlotSpec::OnEndDbClickNoEditListItem( WPARAM wparam, LPARAM lparam)
{
	if(!m_pDepSlotSpec)return (0);	
	DepartureSlotItem* pItem = m_pDepSlotSpec->GetItem(m_nRowSel);
	if(!pItem)return (0);

	if(m_nColumnSel == 0)//Flight Type
	{
		if (m_pSelectFlightType == NULL)
			return (0);
		FlightConstraint fltType = (*m_pSelectFlightType)(NULL);
		char szBuffer[1024]={0};
		int xCount = m_wndListCtrl.GetItemCount();
		for(int n = 0;n<xCount;n++)
		{
			if(!m_wndListCtrl.GetItemText(n,0).Compare(szBuffer))
			{
				MessageBox(_T("This Flight Type had existed."));
				return (0);
			}
		}

		pItem->SetFltType(fltType);
		CString strFltType;
		pItem->GetFlightConstraint().screenPrint(strFltType);
		CString strString;		
		strString.Format("%s \t ", strFltType);
		m_wndListCtrl.SetItemText(m_nRowSel,m_nColumnSel,strString);
	}
	else if(m_nColumnSel == 2)//Time Range
	{
		CDlgTimeRange dlg(pItem->GetFromTime(), pItem->GetToTime());
		if(IDOK == dlg.DoModal())
		{
			pItem->SetFromTime(dlg.GetStartTime());
			pItem->SetToTime(dlg.GetEndTime());
			
			ElapsedTime estFromTime;
			estFromTime = pItem->GetFromTime();
			ElapsedTime estToTime;
			estToTime = pItem->GetToTime();
			CString strFromTime;
			strFromTime.Format("Day%d %02d:%02d:%02d", estFromTime.GetDay(), 
				estFromTime.GetHour(),
				estFromTime.GetMinute(),
				estFromTime.GetSecond());
			CString strToTime;
			strToTime.Format("Day%d %02d:%02d:%02d", estToTime.GetDay(), 
				estToTime.GetHour(),
				estToTime.GetMinute(),
				estToTime.GetSecond());
			CString strfromToTime;
			strfromToTime.Format("%s - %s", strFromTime, strToTime);
			m_wndListCtrl.SetItemText(m_nRowSel,m_nColumnSel,strfromToTime);
		}
	}

	return (0);
}
コード例 #2
0
void CDlgDepartureSlotSpec::SetListContent()
{
	m_wndListCtrl.DeleteAllItems();
	//get values
	size_t nDepSlotCount = m_pDepSlotSpec->GetElementCount();
	for (size_t i = 0; i< nDepSlotCount; i++)
	{
		DepartureSlotItem* pItem = m_pDepSlotSpec->GetItem(i);

		//flight type
		FlightConstraint fltType = pItem->GetFlightConstraint();
		CString strFltType;
		fltType.screenPrint(strFltType);
		CString strString;		
		strString.Format("%s \t ", strFltType);
		m_wndListCtrl.InsertItem(i, strString);

		//SID
		m_wndListCtrl.SetItemText(i,1,pItem->GetSIDName());

		//Time Range
		ElapsedTime estFromTime;
		estFromTime = pItem->GetFromTime();
		ElapsedTime estToTime;
		estToTime = pItem->GetToTime();
		CString strFromTime;
		strFromTime.Format("Day%d %02d:%02d:%02d", estFromTime.GetDay(), 
			estFromTime.GetHour(),
			estFromTime.GetMinute(),
			estFromTime.GetSecond());
		CString strToTime;
		strToTime.Format("Day%d %02d:%02d:%02d", estToTime.GetDay(), 
			estToTime.GetHour(),
			estToTime.GetMinute(),
			estToTime.GetSecond());
		CString strfromToTime;
		strfromToTime.Format("%s - %s", strFromTime, strToTime);
		m_wndListCtrl.SetItemText(i, 2,strfromToTime);

		//first slot delay distribution
		m_wndListCtrl.SetItemText(i, 3,pItem->GetFirstSlotDelayProDisName());

		//inter slot delay distribution
		m_wndListCtrl.SetItemText(i, 4,pItem->GetInterSlotDelayProDisName());

		m_wndListCtrl.SetItemData(i, (DWORD_PTR)pItem);
	}
	m_wndListCtrl.SetItemState(nDepSlotCount - 1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
}
コード例 #3
0
void CDetailDelayResult::GenerateResult(vector<CAirsideFlightDelayReport::FltTypeDelayItem>& fltTypeDelayData,CParameters *pParameter)
{
	ASSERT(pParameter != NULL);

	ClearAllData();

	ElapsedTime estMinDelayTime = pParameter->getStartTime();
	ElapsedTime estMaxDelayTime = pParameter->getEndTime();

	long lMinDelayTime = estMinDelayTime.asSeconds();
	long lMaxDelayTime = estMaxDelayTime.asSeconds();

	//delay time error
	if (lMaxDelayTime < lMinDelayTime)
	{
		return;
	}

	m_estStartTime = estMinDelayTime;
	m_estEndTime   = estMaxDelayTime;

	long lUserIntervalTime = pParameter->getInterval();
	ElapsedTime estUserIntervalTime = ElapsedTime(lUserIntervalTime);

	long lDelayTimeSegmentCount = 0;             //the count of the delayTime segment
	if (0 < lUserIntervalTime)
	{
        estMinDelayTime = ElapsedTime(lMinDelayTime);
        lDelayTimeSegmentCount = (lMaxDelayTime - lMinDelayTime) / (lUserIntervalTime);

        if((lMaxDelayTime - lMinDelayTime) % (lUserIntervalTime) != 0)
            lDelayTimeSegmentCount += 1;
	}
	else
	{
		lDelayTimeSegmentCount= ClacTimeRange(estMaxDelayTime, estMinDelayTime, estUserIntervalTime);
	}

	bool bSetTimeRange = false;
	for (int j=0; j<(int)pParameter->getFlightConstraintCount(); j++)
	{
		FlightConstraint flightConstraint = pParameter->getFlightConstraint(j);

		CDetailFlightDelayData *pDetailFlightDelayData = new CDetailFlightDelayData;
		pDetailFlightDelayData->m_fltCons = flightConstraint;

		for (long i=0; i<lDelayTimeSegmentCount; i++)
		{
			ElapsedTime estTempMinDelayTime = estMinDelayTime + ElapsedTime(estUserIntervalTime.asSeconds()*i);
			ElapsedTime estTempMaxDelayTime = estMinDelayTime + ElapsedTime(estUserIntervalTime.asSeconds()*(i + 1));

            if(estTempMaxDelayTime > estMaxDelayTime)
                estTempMaxDelayTime = estMaxDelayTime;

			if (!bSetTimeRange)
			{
				CString strTimeRange = _T("");
				//strTimeRange.Format(_T("%s-%s"), estTempMinDelayTime.printTime(), estTempMaxDelayTime.printTime());
				strTimeRange.Format(_T("%02d:%02d-%02d:%02d"), estTempMinDelayTime.asHours(), estTempMinDelayTime.GetMinute(), estTempMaxDelayTime.asHours(), estTempMaxDelayTime.GetMinute());
				m_vTimeRange.push_back(strTimeRange);
			}			

			pDetailFlightDelayData->m_vData.push_back(GetFlightCountInIntervalTime(flightConstraint, estTempMinDelayTime, estTempMaxDelayTime, fltTypeDelayData)/100);  //second
		}

		bSetTimeRange = true;

		m_vFlightData.push_back(pDetailFlightDelayData);
	}
}