資源簡介
曲線繪制類
不實用鏈表,可隨時添加新數據,內存占用率極低
自動根據輸入數據值修改Y坐標和以前繪制的點的位置
可添加1條至多條曲線,最大9條曲線同時顯示

代碼片段和文件信息
//?OScopeCtrl.cpp?:?implementation?file//
#include?“stdafx.h“
#include?“math.h“
#include?“OScopeCtrl.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__?;
#endif
/////////////////////////////////////////////////////////////////////////////
//?COScopeCtrl
COScopeCtrl::COScopeCtrl()
{
??//?since?plotting?is?based?on?a?LineTo?for?each?new?point
??//?we?need?a?starting?point?(i.e.?a?“previous“?point)
??//?use?0.0?as?the?default?first?point.
??//?these?are?public?member?variables?and?can?be?changed?outside
??//?(after?construction).??Therefore?m_perviousPosition?could?be?set?to
??//?a?more?appropriate?value?prior?to?the?first?call?to?SetPosition.
for?(int?i=0;i<10;i++)
{
m_dPreviousPosition[i]=?0.0?;
m_dCurrentPosition[i]=0.0;
m_strLegend[i]=““;
}
??//?public?variable?for?the?number?of?decimal?places?on?the?y?axis
??m_nYDecimals?=?3?;
??//?set?some?initial?values?for?the?scaling?until?“SetRange“?is?called.
??//?these?are?protected?varaibles?and?must?be?set?with?SetRange
??//?in?order?to?ensure?that?m_dRange?is?updated?accordingly
??m_dLowerLimit?=?-10.0?;
??m_dUpperLimit?=??10.0?;
??m_dRange??????=??m_dUpperLimit?-?m_dLowerLimit?;???//?protected?member?variable
??//?m_nShiftPixels?determines?how?much?the?plot?shifts?(in?terms?of?pixels)?
??//?with?the?addition?of?a?new?data?point
??m_nShiftPixels?????=?4?;
??m_nHalfShiftPixels?=?m_nShiftPixels/2?;?????????????????????//?protected
??m_nPlotShiftPixels?=?m_nShiftPixels?+?m_nHalfShiftPixels?;??//?protected
??//?background?grid?and?data?colors
??//?these?are?public?variables?and?can?be?set?directly
??m_crBackColor??=?RGB(??0???0???0)?;??//?see?also?SetBackgroundColor
??m_crGridColor??=?RGB(??0?255?255)?;??//?see?also?SetGridColor
??m_crPlotColor[0]??=?RGB(255?255?255)?;??
??m_crPlotColor[1]??=?RGB(255?0?0)?;??
??m_crPlotColor[2]??=?RGB(0?255?0)?;??
??m_crPlotColor[3]??=?RGB(128?255?128)?;??
??m_crPlotColor[4]??=?RGB(0?0?255)?;??
??m_crPlotColor[5]??=?RGB(0?255?255)?;??
??m_crPlotColor[6]??=?RGB(255?0?255)?;??
??m_crPlotColor[7]??=?RGB(255?255?0)?;??
??m_crPlotColor[8]??=?RGB(128?255?255)?;??
??m_crPlotColor[9]??=?RGB(255?128?255)?;??
??//?protected?variables
??for(i=0;i<10;i++)
??m_penPlot[i].CreatePen(PS_SOLID?0?m_crPlotColor[i])?;
??m_brushBack.CreateSolidBrush(m_crBackColor)?;
??//?public?member?variables?can?be?set?directly?
??m_strXUnitsString.Format(“Samples“)?;??//?can?also?be?set?with?SetXUnits
??m_strYUnitsString.Format(“Y?units“)?;??//?can?also?be?set?with?SetYUnits
??//?protected?bitmaps?to?restore?the?memory?DC‘s
??m_pbitmapOldGrid?=?NULL?;
??m_pbitmapOldPlot?=?NULL?;
??m_fTempMax=UD_ZERO;
??m_dPreVFactor=-1.0;
??m_nLineNum=1;//曲線默認只有一條
}??//?COScopeCtrl
/////////////////////////////////////////////////////////////////////////////
COScopeCtrl::~COScopeCtrl()
{
??//?just?to?be?picky?restore?the?bitmaps?for?the?tw
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2010-12-15?10:16??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)
?????目錄??????????0??2010-12-15?11:26??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject
?????目錄??????????0??2010-12-15?11:26??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\Debug
?????文件?????118915??2010-12-15?11:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\Debug\TestOScope.exe
?????文件??????20277??2010-12-15?11:25??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\OScopeCtrl.cpp
?????文件???????2599??2010-12-15?11:22??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\OScopeCtrl.h
?????文件???????3421??1998-12-07?21:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\ReadMe.txt
?????目錄??????????0??2010-12-08?21:59??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\res
?????文件???????1078??1998-12-08?08:31??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\res\TestOScope.ico
?????文件????????402??1998-12-07?21:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\res\TestOScope.rc2
?????文件????????731??2010-12-08?22:20??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\resource.h
?????文件????????210??1998-12-08?13:19??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\StdAfx.cpp
?????文件????????987??1998-12-07?21:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\StdAfx.h
?????文件???????4438??1998-12-07?22:32??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.001
?????文件??????36124??2010-12-15?10:16??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.aps
?????文件???????2159??1998-12-08?13:19??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.cpp
?????文件???????4374??2010-12-15?10:33??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.dsp
?????文件????????545??2010-12-08?22:00??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.dsw
?????文件???????1392??1998-12-08?13:19??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.h
?????文件??????50176??2010-12-15?11:25??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.ncb
?????文件??????48640??2010-12-15?11:25??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.opt
?????文件???????1421??2010-12-15?11:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.plg
?????文件???????5448??2010-12-15?10:16??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScope.rc
?????文件???????6390??2010-12-15?11:23??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScopeDlg.cpp
?????文件???????1624??1998-12-08?13:19??曲線繪制1.3版本(繼承1.2,可同時繪制最多10條曲線)\DemoProject\TestOScopeDlg.h
-----------?---------??----------?-----??----
???????????????311351????????????????????25
- 上一篇:基于MATLAB的溫度場模擬
- 下一篇:裝載問題 裝載問題裝載問題
評論
共有 條評論