コード例 #1
0
void CBase_SampleChart::ClearPeak(const CBase_AnalysisSample* pSample, DWORD dwFlag)
{
	EnableRefresh(false);
	if(dwFlag & FLAG_DATA_SOURCE)
	{
		CChartSerie* pSerie = GetMainSerie();
		if(pSerie) pSerie->ClearSerie();
	}
// 	if(dwFlag & FLAG_POINTS_BEGIN)
// 	{
// 		if(m_pBeginPoints) m_pBeginPoints->ClearSerie();
// 	}
// 	if(dwFlag & FLAG_POINTS_PEAK)
// 	{
// 		if(m_pPeakPoints) m_pPeakPoints->ClearSerie();
// 	}
// 	if(dwFlag & FLAG_POINTS_END)
// 	{
// 		if(m_pEndPoints) m_pEndPoints->ClearSerie();
// 	}
	if(dwFlag & FLAG_LINES_BASE)
	{
		CChartLineSerie* pLine = NULL;
		for(int i=0; i<=m_arrBaseLines.GetUpperBound(); i++)
		{
			pLine = m_arrBaseLines.GetAt(i);
			if(pLine) RemoveSerie(pLine->GetSerieId());
		}
		m_arrBaseLines.RemoveAll();
	}
	if(dwFlag & FLAG_LINES_DIVIDEBASE)
	{
		CChartLineSerie* pLine = NULL;
		for(int i=0; i<=m_arrDivideBaseLines.GetUpperBound(); i++)
		{
			pLine = m_arrDivideBaseLines.GetAt(i);
			if(pLine) RemoveSerie(pLine->GetSerieId());
		}
		m_arrDivideBaseLines.RemoveAll();
	}
	DWORD dwFMask = dwFlag & FLAGMASK_STRINGS_ASSISTANT;
	if(dwFMask == FLAGMASK_STRINGS_ASSISTANT)
	{
		//同时都删除,才清空		
		CSuperChartString* pSerie = NULL;
		for(int i=0; i<=m_arrAssistants.GetUpperBound(); i++)
		{
			pSerie = m_arrAssistants.GetAt(i);
			if(pSerie) RemoveChartString(pSerie);
		}
		m_arrAssistants.RemoveAll();
	}
	else if(dwFMask)
	{
		//否则,重画
		RedrawPeak(pSample, FLAGMASK_STRINGS_ASSISTANT & ~dwFMask);
	}
	EnableRefresh(true);
	RefreshCtrl();
}
コード例 #2
0
void CBase_SampleChart::RedrawPeakOnRealTime(const CBase_AnalysisSample* pSample, DWORD dwFlag, CBase_SampleChart::enumMode eMode, bool bRefresh)
{
	if(!pSample) return;
	EnableRefresh(false);

	if(dwFlag & FLAG_DATA_SOURCE)
	{
		CChartSerie* pSerie = GetMainSerie();
		if(pSerie)
		{
			pSerie->ClearSerie();
			const CArray<CCurveDataSingle>& m_srcData = pSample->m_dataMainCurve.m_arrayData;
			if(m_srcData.GetUpperBound() > -1)
			{
				pSerie->m_vPoints.InitPoints(m_srcData.GetUpperBound()+1);
				structMinMaxInfo mmi;
				GetBottomAxis()->GetMinMax(mmi.minx, mmi.maxx);
				GetLeftAxis()->GetMinMax(mmi.miny, mmi.maxy);
				bool bNeed = mmi.minx==0 && mmi.miny == 0 && mmi.maxx == 0 && mmi.maxy == 0;
				for (int i=0; i<=m_srcData.GetUpperBound(); ++i)
				{
					double x = m_srcData[i].dX;
					double y = m_srcData[i].dY;
					pSerie->m_vPoints.AddPoint(x, y);					
					if(mmi.minx > x) mmi.minx = x;
					if(mmi.maxx < x) mmi.maxx = x;
					if(mmi.miny > y) mmi.miny = y;
					if(mmi.maxy < y) mmi.maxy = y;
				}
				if(bNeed)
				{
					GetBottomAxis()->SetCoordinate(mmi.minx, mmi.maxx, COORDINATE_SET);
					GetLeftAxis()->SetCoordinate(mmi.miny, mmi.maxy, COORDINATE_SET);
				}
			}
		}
	}
	//const CPeakList* pPS = &pSample->m_cResultList;
	const CPeakList* pPS = &pSample->m_cPeakList;
	const CPeakList* pRT = &pSample->m_cAllRealTimePeakList; 
	
	if(dwFlag & FLAG_LINES_BASE)
	{
		//首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAG_LINES_BASE);

		CChartLineSerie* pLine = NULL;
		for (int i=0; i<=pRT->m_cArrayData.GetUpperBound(); ++i)
		{
			pLine = CreateLineSerie();
			pLine->SetColor(m_crBaseLines);
			pLine->m_vPoints.AddPoint(pRT->m_cArrayData[i].m_dataBegin.dX, pRT->m_cArrayData[i].m_dataBegin.dY);
			pLine->m_vPoints.AddPoint(pRT->m_cArrayData[i].m_dataEnd.dX, pRT->m_cArrayData[i].m_dataEnd.dY);
			pLine->m_dwDPFlag = NULL;//不能在数据处理的曲线选择列表框中出现
			m_arrBaseLines.Add(pLine);
		}
	}
	if(dwFlag & FLAG_LINES_DIVIDEBASE)
	{
		CChartLineSerie* pLine = NULL;
		//首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAG_LINES_DIVIDEBASE);

		for (int i=0; i<=pSample->m_arrayVLines.GetUpperBound(); ++i)
		{
			const CBase_AnalysisSample::structLine& line = pSample->m_arrayVLines.GetAt(i);
			pLine = CreateLineSerie();
			pLine->SetColor(m_crBaseLines);
			pLine->m_vPoints.AddPoint(line.begin.x, line.begin.y);
			pLine->m_vPoints.AddPoint(line.end.x, line.end.y);
			pLine->m_dwDPFlag = NULL;//不能在数据处理的曲线选择列表框中出现
			m_arrDivideBaseLines.Add(pLine);
		}
	}


	if((dwFlag & FLAG_STRINGS_RESERVEDTIME) || (dwFlag & FLAG_STRINGS_CONCENTRATION) || (dwFlag & FLAG_STRINGS_COMPONENTNAME) || (dwFlag & FLAG_STRINGS_FMJ) || (dwFlag & FLAG_STRINGS_FG))
	{
		
		//不管。首先删除全部,再重新绘画
		if(eMode == MODE_SETALL) ClearPeak(pSample, FLAGMASK_STRINGS_ASSISTANT);

		CString t;
		int i_upper_bound = pRT->m_cArrayData.GetUpperBound();
		for (int i=0; i<=i_upper_bound; ++i)
		{
			CString ass;
			const CPeakStandard& ps = pRT->m_cArrayData[i];
			if(dwFlag & FLAG_STRINGS_RESERVEDTIME) ass += CParamCommon::TimeString(ps.m_dReserveTime) + _T("/");
			if(dwFlag & FLAG_STRINGS_FMJ)
			{
				t.Format(_T("%.3f/"), ps.m_dArea);
				ass += t;
			}
			if(dwFlag & FLAG_STRINGS_FG)
			{
				t.Format(_T("%.3f/"), ps.m_dHeight);
				ass += t;
			}

			const CPeakStandard* pPSResult = GetPSByTime(pSample->m_cResultList, ps.m_dReserveTime);
			if(pPSResult)
			{
				if(dwFlag & FLAG_STRINGS_CONCENTRATION)
				{
					t.Format(_T("%.1f/"), pPSResult->m_dResultConcentration);
					ass += t;
				}
				if(dwFlag & FLAG_STRINGS_COMPONENTNAME)
				{
					ass += pPSResult->m_cStrComponentName;
					ass += _T('/');
				}
			}

			while(ass.Right(1) == _T("/")) ass.Delete(ass.GetLength()-1);
			//ass = _T("-->") + ass;
			CSuperChartString* pSerie = AddChartString(ps.m_dataTop.dX, ps.m_dataTop.dY, ass);
			pSerie->SetMustInPlottingRect(true);
			pSerie->Font.Color = m_crAssistants;
			pSerie->Font.SetSize(100);
			pSerie->Font.SetBold(550);
			pSerie->Font.SetAngle(600);
			pSerie->SetScreenOffset(-6, -8);
			pSerie->m_dwChartObjectFlag = CTWenChartObject::CHARTOBJECT_NOTINBZMANAGE;
			m_arrAssistants.Add(pSerie);
		}
	}
	EnableRefresh(true);
	if(bRefresh) RefreshCtrl();
}
コード例 #3
0
void CBase_SampleChart::RefreshSample_Curve2DSeries(CBase_AnalysisSample* pSample ,const CString& dataFolder, bool bRefreshAxisRange)
{
	if(pSample)
	{
		CIADataCurve2D c2d;
		if(!PASUCCESS(pSample->GetIADataCurve2D(c2d))) return;
		structMinMaxInfo mmi;
		mmi.minx=0,mmi.miny=0,mmi.maxx=0,mmi.maxy=0;
		CString type;
		CIADataCurve2DSingle single;
		CString strMainGroup,strMainSerie;
		pSample->GetIADataCurve2D_MainInfo(&strMainGroup, &strMainSerie);
		long pos;
		c2d.BeginEnum(pos);
		while(c2d.GetNext(pos, type, single))
		{
			CString name,filename;
			single.BeginEnum();
			while(single.GetNext(name, filename))
			{
				void* pv = NULL;
				m_mapCurve2DVisibilites.Lookup(name, pv);
				void* pLine = NULL;
				bool bIsMain = strMainGroup == type && strMainSerie == name;
				if(bIsMain) continue;//主曲线由积分结果负责
				if(bIsMain) pLine = m_pcCurveMain;
				else m_mapCurve2DSeries.Lookup(name, pLine);
				if(pv)//需要绘画
				{
					if(bIsMain)
					{
						if(m_pcCurveMain)
						{
							m_pcCurveMain->ClearSerie();
							LoadSerieFromFile(mmi, m_pcCurveMain, dataFolder + filename);
							m_pcCurveMain->SetVisible(true);
						}
					}
					else
					{
						if(pLine == NULL)
						{
							CChartSerie* line = CreateCurve2DSerie(type, name);
							line->ClearSerie();
							LoadSerieFromFile(mmi, line, dataFolder + filename);
						}
						else ((CChartSerie*)pLine)->SetVisible(true);
					}
				}
				else
				{
					if(pLine) ((CChartSerie*)pLine)->SetVisible(false);
				}
			}
		}
		if(bRefreshAxisRange)
		{
			GetBottomAxis()->SetCoordinate(mmi.minx, mmi.maxx, COORDINATE_SET);
			GetLeftAxis()->SetCoordinate(mmi.miny, mmi.maxy, COORDINATE_SET);
		}
	}
}