First commit
This commit is contained in:
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
|
||||
#Ext
|
||||
*.bmp
|
||||
*.txt
|
||||
*.sdf
|
||||
*.suo
|
||||
*.db
|
||||
*.opensdf
|
||||
|
20
TestSimulator.sln
Normal file
20
TestSimulator.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSimulator", "TestSimulator\TestSimulator.vcxproj", "{C1F3E95D-9580-4550-A748-674E1D31DF84}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C1F3E95D-9580-4550-A748-674E1D31DF84}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C1F3E95D-9580-4550-A748-674E1D31DF84}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C1F3E95D-9580-4550-A748-674E1D31DF84}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C1F3E95D-9580-4550-A748-674E1D31DF84}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
226
TestSimulator/BlockAnd.cpp
Normal file
226
TestSimulator/BlockAnd.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockAnd.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
#define BLACK RGB (0, 0, 0) //<2F>s<EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
#define COMPUTE_ERROR -13 //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD>B<EFBFBD><42>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define TOLERANCE 0.001 //<2F>e<EFBFBD>Ի~<7E>t<EFBFBD><74>
|
||||
|
||||
#define DIGITAL_VALUE 4 //<2F>Ʀ<EFBFBD><C6A6>T<EFBFBD><54>flag
|
||||
#define ANALOG_VALUE 5 //<2F><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>flag
|
||||
|
||||
#define BLK_AND 3 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockAnd::CBlockAnd ()
|
||||
{
|
||||
m_rcPinIn1 = CRect ();
|
||||
m_rcPinIn2 = CRect ();
|
||||
m_rcPinOut = CRect ();
|
||||
|
||||
m_pBlkHead1 = NULL;
|
||||
m_pBlkHead2 = NULL;
|
||||
|
||||
m_iBlkHead1Num = NO_BLOCK_HEAD;
|
||||
m_iBlkHead2Num = NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
CBlockAnd::~CBlockAnd ()
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockAnd::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockAnd::GetPinIn1Rect () const
|
||||
{
|
||||
return m_rcPinIn1;
|
||||
}
|
||||
|
||||
CRect CBlockAnd::GetPinIn2Rect () const
|
||||
{
|
||||
return m_rcPinIn2;
|
||||
}
|
||||
|
||||
CRect CBlockAnd::GetPinOutRect () const
|
||||
{
|
||||
return m_rcPinOut;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockAnd::GetBlkHead1Ptr () const
|
||||
{
|
||||
return m_pBlkHead1;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockAnd::GetBlkHead2Ptr () const
|
||||
{
|
||||
return m_pBlkHead2;
|
||||
}
|
||||
|
||||
void CBlockAnd::SetBlkHead1Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_pBlkHead1 = pBlkHead;
|
||||
}
|
||||
|
||||
void CBlockAnd::SetBlkHead2Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_pBlkHead2 = pBlkHead;
|
||||
}
|
||||
|
||||
int CBlockAnd::GetBlkHead1Num () const
|
||||
{
|
||||
return m_iBlkHead1Num;
|
||||
}
|
||||
|
||||
int CBlockAnd::GetBlkHead2Num () const
|
||||
{
|
||||
return m_iBlkHead2Num;
|
||||
}
|
||||
|
||||
void CBlockAnd::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead1Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
void CBlockAnd::SetBlkHead2Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead2Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
double CBlockAnd::GetBlkValue () const
|
||||
{
|
||||
//And<6E><EFBFBD> (<28>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ҭ<EFBFBD>1<EFBFBD>A<EFBFBD>h<EFBFBD>^<5E><>1<EFBFBD>A<EFBFBD>_<EFBFBD>h<EFBFBD>^<5E><>0)
|
||||
if (abs (m_pBlkHead1->GetBlkValue () - 1) < TOLERANCE && abs (m_pBlkHead2->GetBlkValue () - 1) < TOLERANCE)
|
||||
return 1.;
|
||||
else
|
||||
return 0.;
|
||||
}
|
||||
|
||||
int CBlockAnd::GetValueFlag () const
|
||||
{
|
||||
if (m_pBlkHead1 == NULL || m_pBlkHead2 == NULL) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>I<EFBFBD><49><EFBFBD>s<EFBFBD><73><EFBFBD>A<EFBFBD>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_VALUE || m_pBlkHead2->GetValueFlag () == NO_VALUE) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>L<EFBFBD>ȡA<C8A1>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == COMPUTE_ERROR || m_pBlkHead2->GetValueFlag () == COMPUTE_ERROR) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~<7E>A<EFBFBD>^<5E><>"<22>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~"
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead1->GetValueFlag () == ANALOG_VALUE || m_pBlkHead2->GetValueFlag () == ANALOG_VALUE) //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_OPER_FLAG || m_pBlkHead2->GetValueFlag () == NO_OPER_FLAG) //<2F><><EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸
|
||||
return NO_OPER_FLAG;
|
||||
else if (m_pBlkHead1->GetValueFlag () == DIGITAL_VALUE && m_pBlkHead2->GetValueFlag () == DIGITAL_VALUE) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD>Ҭ<EFBFBD><D2AC>Ʀ<EFBFBD><C6A6>T<EFBFBD><54><EFBFBD>A<EFBFBD>h<EFBFBD>^<5E>ǼƦ<C7BC><C6A6>T<EFBFBD><54>
|
||||
return DIGITAL_VALUE;
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
void CBlockAnd::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
void CBlockAnd::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pbrushOld;
|
||||
pbrushOld = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinIn1);
|
||||
pDC->Ellipse (m_rcPinIn2);
|
||||
pDC->Ellipse (m_rcPinOut);
|
||||
pDC->SelectObject (pbrushOld);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("AND"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
void CBlockAnd::DrawLine (CDC* pDC)
|
||||
{
|
||||
if (m_pBlkHead1 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead1->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn1.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
|
||||
if (m_pBlkHead2 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead2->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn2.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockAnd::BlkTypeIs () const
|
||||
{
|
||||
return BLK_AND;
|
||||
}
|
55
TestSimulator/BlockAnd.h
Normal file
55
TestSimulator/BlockAnd.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock And
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
class CBlockAnd : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӿ<EFBFBD><D3BF>JPin<69>A<EFBFBD>@<40>ӿ<EFBFBD><D3BF>XPin)
|
||||
CRect m_rcPinIn1;
|
||||
CRect m_rcPinIn2;
|
||||
CRect m_rcPinOut;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӳs<D3B3><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
CBlockBasis* m_pBlkHead1;
|
||||
CBlockBasis* m_pBlkHead2;
|
||||
|
||||
//<2F>s<EFBFBD><73>Block<63>s<EFBFBD><73>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӽs<D3BD><73>)
|
||||
int m_iBlkHead1Num;
|
||||
int m_iBlkHead2Num;
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockAnd ();
|
||||
virtual ~CBlockAnd ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
virtual CRect GetPinIn2Rect () const;
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr () const;
|
||||
virtual CBlockBasis* GetBlkHead2Ptr () const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
virtual void SetBlkHead2Ptr (CBlockBasis*);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num () const;
|
||||
virtual int GetBlkHead2Num () const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
virtual void SetBlkHead2Num (int) ;
|
||||
|
||||
virtual double GetBlkValue () const; //<2F><><EFBFBD>oBlock<63><6B>
|
||||
virtual int GetValueFlag () const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
191
TestSimulator/BlockBasis.cpp
Normal file
191
TestSimulator/BlockBasis.cpp
Normal file
@ -0,0 +1,191 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
|
||||
#define LIGHTGRAY RGB (211, 211, 211) //Block<63>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_OPER_FLAG -11 //Block Fun<75><6E><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
#define NO_INPUT_FLAG -12 //Block In<49><6E><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>i<EFBFBD><69>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define NO_BLK_TYPE 0
|
||||
|
||||
CBlockBasis::CBlockBasis ()
|
||||
{
|
||||
m_rcBlk = CRect ();
|
||||
m_iBlkNum = 0;
|
||||
}
|
||||
|
||||
CBlockBasis::~CBlockBasis ()
|
||||
{
|
||||
}
|
||||
|
||||
CRect CBlockBasis::GetBlkRect () const
|
||||
{
|
||||
return m_rcBlk;
|
||||
}
|
||||
|
||||
//<2F>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>BBlock<63>e<EFBFBD>סBBlock<63><6B><EFBFBD>׳]<5D>wBlock rect
|
||||
void CBlockBasis::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
m_rcBlk.SetRect (CPoint (ptCenter.x - int (iWidth / 2), ptCenter.y - int (iHeight / 2)),
|
||||
CPoint (ptCenter.x + int (iWidth / 2), ptCenter.y + int (iHeight / 2)));
|
||||
}
|
||||
|
||||
CRect CBlockBasis::GetPinIn1Rect () const
|
||||
{
|
||||
return CRect ();
|
||||
}
|
||||
|
||||
CRect CBlockBasis::GetPinIn2Rect () const
|
||||
{
|
||||
return CRect ();
|
||||
}
|
||||
|
||||
CRect CBlockBasis::GetPinOutRect () const
|
||||
{
|
||||
return CRect ();
|
||||
}
|
||||
|
||||
int CBlockBasis::GetBlkNum () const
|
||||
{
|
||||
return m_iBlkNum;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkNum (int iNum)
|
||||
{
|
||||
m_iBlkNum = iNum;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockBasis::GetBlkHead1Ptr () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockBasis::GetBlkHead1Ptr (int iIndex) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockBasis::GetBlkHead2Ptr () const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkHead1Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkHead2Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockBasis::DeleteBlkHead1Ptr (int iIndex)
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::GetBlkHead1Num () const
|
||||
{
|
||||
return NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
int CBlockBasis::GetBlkHead1Num (int iIndex) const
|
||||
{
|
||||
return NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
int CBlockBasis::GetBlkHead2Num () const
|
||||
{
|
||||
return NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkHead2Num (int iHeadBlkNum)
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockBasis::ClearBlkHead1Num ()
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::GetBlkHeadSize () const
|
||||
{
|
||||
return NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkHeadSize (int)
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::GetInputFlag () const
|
||||
{
|
||||
return NO_INPUT_FLAG;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetInputFlag (int iInputFlag)
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::GetOperFlag () const
|
||||
{
|
||||
return NO_OPER_FLAG;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetOperFlag (int iInputFlag)
|
||||
{
|
||||
}
|
||||
|
||||
double CBlockBasis::GetBlkValue () const
|
||||
{
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
double CBlockBasis::GetBlkValue (int iIndex) const
|
||||
{
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkValue (double dBlkValue)
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockBasis::SetBlkValue ()
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::GetValueFlag () const
|
||||
{
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
int CBlockBasis::GetValueFlag (int iIndex) const
|
||||
{
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Block<63>ɨ̹<C9A8><CCB9>Ц<EFBFBD><D0A6>m<EFBFBD>]<5D>wBlock rect
|
||||
void CBlockBasis::Move (CPoint ptCursor)
|
||||
{
|
||||
m_rcBlk.SetRect (CPoint (ptCursor.x - int (m_rcBlk.Width () / 2.), ptCursor.y - int (m_rcBlk.Height () / 2.)),
|
||||
CPoint (ptCursor.x + int (m_rcBlk.Width () / 2.), ptCursor.y + int (m_rcBlk.Height () / 2.)));
|
||||
}
|
||||
|
||||
void CBlockBasis::Draw (CDC* pDC)
|
||||
{
|
||||
pDC->FillSolidRect (m_rcBlk, LIGHTGRAY);
|
||||
pDC->DrawEdge (m_rcBlk, EDGE_RAISED, BF_RECT);
|
||||
}
|
||||
|
||||
void CBlockBasis::DrawLine (CDC* pDC)
|
||||
{
|
||||
}
|
||||
|
||||
int CBlockBasis::BlkTypeIs () const
|
||||
{
|
||||
return NO_BLK_TYPE;
|
||||
}
|
68
TestSimulator/BlockBasis.h
Normal file
68
TestSimulator/BlockBasis.h
Normal file
@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63><6B>¦<EFBFBD><C2A6><EFBFBD>O
|
||||
|
||||
class CBlockBasis
|
||||
{
|
||||
protected:
|
||||
CRect m_rcBlk; //Block rect
|
||||
|
||||
int m_iBlkNum; //Block<63><6B>vector<6F><72><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockBasis ();
|
||||
virtual ~CBlockBasis ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
CRect GetBlkRect () const;
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
virtual CRect GetPinIn2Rect () const;
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wBlock<63>s<EFBFBD><73>
|
||||
int GetBlkNum () const;
|
||||
void SetBlkNum (int);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr () const;
|
||||
virtual CBlockBasis* GetBlkHead1Ptr (int) const;
|
||||
virtual CBlockBasis* GetBlkHead2Ptr () const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
virtual void SetBlkHead2Ptr (CBlockBasis*);
|
||||
virtual void DeleteBlkHead1Ptr (int); //<2F><>Block Out<75>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector<6F><72><EFBFBD>M<EFBFBD><4D><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num () const;
|
||||
virtual int GetBlkHead1Num (int) const;
|
||||
virtual int GetBlkHead2Num () const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
virtual void SetBlkHead2Num (int) ;
|
||||
virtual void ClearBlkHead1Num (); //<2F>M<EFBFBD><4D>Block Out<75>s<EFBFBD><73><EFBFBD>s<EFBFBD><73>vector
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73>Block Out<75><74><EFBFBD>ƥ<EFBFBD>
|
||||
virtual int GetBlkHeadSize () const;
|
||||
virtual void SetBlkHeadSize (int);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wBlock In, Fun<75><6E>flag
|
||||
virtual int GetInputFlag () const;
|
||||
virtual void SetInputFlag (int);
|
||||
virtual int GetOperFlag () const;
|
||||
virtual void SetOperFlag (int);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wBlock<63><6B>
|
||||
virtual double GetBlkValue () const;
|
||||
virtual double GetBlkValue (int) const; //<2F><><EFBFBD>oBlock Out<75><74><EFBFBD>wchannel<65><6C><EFBFBD><EFBFBD>
|
||||
virtual void SetBlkValue (double);
|
||||
virtual void SetBlkValue ();
|
||||
virtual int GetValueFlag () const;
|
||||
virtual int GetValueFlag (int) const;
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
257
TestSimulator/BlockFun.cpp
Normal file
257
TestSimulator/BlockFun.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockFun.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
#define BLACK RGB (0, 0, 0) //<2F>s<EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define FALSE_VALUE 10 //FALSE<53>^<5E>ǭ<EFBFBD>
|
||||
#define TRUE_VALUE 11 //TRUE<55>^<5E>ǭ<EFBFBD>
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
#define NO_INPUT_FLAG -12 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>i<EFBFBD><69>
|
||||
#define COMPUTE_ERROR -13 //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD>B<EFBFBD><42>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define PLUS 1 // + flag
|
||||
#define MINUS 2 // - flag
|
||||
#define MULTI 3 // * flag
|
||||
#define DIV 4 // / flag
|
||||
|
||||
#define DIGITAL_VALUE 4 //<2F>Ʀ<EFBFBD><C6A6>T<EFBFBD><54>flag
|
||||
#define ANALOG_VALUE 5 //<2F><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>flag
|
||||
|
||||
#define BLK_FUN 6 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockFun::CBlockFun ()
|
||||
{
|
||||
m_rcPinIn1 = CRect ();
|
||||
m_rcPinIn2 = CRect ();
|
||||
m_rcPinOut = CRect ();
|
||||
|
||||
m_pBlkHead1 = NULL;
|
||||
m_pBlkHead2 = NULL;
|
||||
|
||||
m_iBlkHead1Num = NO_BLOCK_HEAD;
|
||||
m_iBlkHead2Num = NO_BLOCK_HEAD;
|
||||
|
||||
m_iOperFlag = NO_OPER_FLAG;
|
||||
}
|
||||
|
||||
CBlockFun::~CBlockFun ()
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockFun::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockFun::GetPinIn1Rect () const
|
||||
{
|
||||
return m_rcPinIn1;
|
||||
}
|
||||
|
||||
CRect CBlockFun::GetPinIn2Rect () const
|
||||
{
|
||||
return m_rcPinIn2;
|
||||
}
|
||||
|
||||
CRect CBlockFun::GetPinOutRect () const
|
||||
{
|
||||
return m_rcPinOut;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockFun::GetBlkHead1Ptr () const
|
||||
{
|
||||
return m_pBlkHead1;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockFun::GetBlkHead2Ptr () const
|
||||
{
|
||||
return m_pBlkHead2;
|
||||
}
|
||||
|
||||
void CBlockFun::SetBlkHead1Ptr (CBlockBasis* pBlkHead1)
|
||||
{
|
||||
m_pBlkHead1 = pBlkHead1;
|
||||
}
|
||||
|
||||
void CBlockFun::SetBlkHead2Ptr (CBlockBasis* pBlkHead2)
|
||||
{
|
||||
m_pBlkHead2 = pBlkHead2;
|
||||
}
|
||||
|
||||
int CBlockFun::GetBlkHead1Num () const
|
||||
{
|
||||
return m_iBlkHead1Num;
|
||||
}
|
||||
|
||||
int CBlockFun::GetBlkHead2Num () const
|
||||
{
|
||||
return m_iBlkHead2Num;
|
||||
}
|
||||
|
||||
void CBlockFun::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead1Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
void CBlockFun::SetBlkHead2Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead2Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
double CBlockFun::GetBlkValue () const
|
||||
{
|
||||
switch (m_iOperFlag)
|
||||
{
|
||||
case PLUS: //<2F>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ȭۥ[
|
||||
return m_pBlkHead1->GetBlkValue () + m_pBlkHead2->GetBlkValue ();
|
||||
break;
|
||||
case MINUS: //<2F>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ȭ۴<C8AC>
|
||||
return m_pBlkHead1->GetBlkValue () - m_pBlkHead2->GetBlkValue ();
|
||||
break;
|
||||
case MULTI: //<2F>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ȭۭ<C8AC>
|
||||
return m_pBlkHead1->GetBlkValue () * m_pBlkHead2->GetBlkValue ();
|
||||
break;
|
||||
case DIV: //<2F>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ȭ۰<C8AC>
|
||||
return m_pBlkHead1->GetBlkValue () / m_pBlkHead2->GetBlkValue ();
|
||||
break;
|
||||
default:
|
||||
return NO_VALUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockFun::GetValueFlag () const
|
||||
{
|
||||
if (m_pBlkHead1 == NULL || m_pBlkHead2 == NULL) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>I<EFBFBD><49><EFBFBD>s<EFBFBD><73><EFBFBD>A<EFBFBD>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_VALUE || m_pBlkHead2->GetValueFlag () == NO_VALUE) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>L<EFBFBD>ȡA<C8A1>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == COMPUTE_ERROR || m_pBlkHead2->GetValueFlag () == COMPUTE_ERROR) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~<7E>A<EFBFBD>^<5E><>"<22>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~"
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead1->GetValueFlag () == DIGITAL_VALUE || m_pBlkHead2->GetValueFlag () == DIGITAL_VALUE) //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C>Ʀ<EFBFBD><C6A6><EFBFBD><EFBFBD>J
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_iOperFlag == NO_OPER_FLAG) //<2F><><EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸
|
||||
return NO_OPER_FLAG;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_OPER_FLAG || m_pBlkHead2->GetValueFlag () == NO_OPER_FLAG) //<2F><><EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸
|
||||
return NO_OPER_FLAG;
|
||||
else if (m_pBlkHead1->GetValueFlag () == ANALOG_VALUE && m_pBlkHead2->GetValueFlag () == ANALOG_VALUE) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD>Ҭ<EFBFBD><D2AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54><EFBFBD>A<EFBFBD>h<EFBFBD>^<5E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>
|
||||
return ANALOG_VALUE;
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
int CBlockFun::GetOperFlag () const
|
||||
{
|
||||
return m_iOperFlag;
|
||||
}
|
||||
|
||||
void CBlockFun::SetOperFlag (int iOperFlag)
|
||||
{
|
||||
m_iOperFlag = iOperFlag;
|
||||
}
|
||||
|
||||
void CBlockFun::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
void CBlockFun::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pOldBrush;
|
||||
pOldBrush = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinIn1);
|
||||
pDC->Ellipse (m_rcPinIn2);
|
||||
pDC->Ellipse (m_rcPinOut);
|
||||
pDC->SelectObject (pOldBrush);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("FUN"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
void CBlockFun::DrawLine (CDC* pDC)
|
||||
{
|
||||
if (m_pBlkHead1 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead1->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn1.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
|
||||
if (m_pBlkHead2 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead2->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn2.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockFun::BlkTypeIs () const
|
||||
{
|
||||
return BLK_FUN;
|
||||
}
|
62
TestSimulator/BlockFun.h
Normal file
62
TestSimulator/BlockFun.h
Normal file
@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock Fun
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
class CBlockFun : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӿ<EFBFBD><D3BF>JPin<69>A<EFBFBD>@<40>ӿ<EFBFBD><D3BF>XPin)
|
||||
CRect m_rcPinIn1;
|
||||
CRect m_rcPinIn2;
|
||||
CRect m_rcPinOut;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӳs<D3B3><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
CBlockBasis* m_pBlkHead1;
|
||||
CBlockBasis* m_pBlkHead2;
|
||||
|
||||
//<2F>s<EFBFBD><73>Block<63>s<EFBFBD><73>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӽs<D3BD><73>)
|
||||
int m_iBlkHead1Num;
|
||||
int m_iBlkHead2Num;
|
||||
|
||||
//<2F>B<EFBFBD>⤸flag
|
||||
int m_iOperFlag;
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockFun ();
|
||||
virtual ~CBlockFun ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
virtual CRect GetPinIn2Rect () const;
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr () const;
|
||||
virtual CBlockBasis* GetBlkHead2Ptr () const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
virtual void SetBlkHead2Ptr (CBlockBasis*);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num () const;
|
||||
virtual int GetBlkHead2Num () const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
virtual void SetBlkHead2Num (int) ;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸flag
|
||||
virtual int GetOperFlag () const;
|
||||
virtual void SetOperFlag (int);
|
||||
|
||||
virtual double GetBlkValue () const; //<2F><><EFBFBD>oBlock<63><6B>
|
||||
virtual int GetValueFlag () const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
152
TestSimulator/BlockIn.cpp
Normal file
152
TestSimulator/BlockIn.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockIn.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_INPUT_FLAG -12 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>i<EFBFBD><69>
|
||||
|
||||
#define ZERO 0 //FALSE flag
|
||||
#define ONE 1 //TRUE flag
|
||||
#define SIN 2 //Sin flag
|
||||
#define COS 3 //Cos flag
|
||||
|
||||
#define DIGITAL_VALUE 4 //<2F>Ʀ<EFBFBD><C6A6>T<EFBFBD><54>flag
|
||||
#define ANALOG_VALUE 5 //<2F><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>flag
|
||||
|
||||
#define BLK_IN 1 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockIn::CBlockIn ()
|
||||
{
|
||||
m_rcPinOut = CRect ();
|
||||
m_iInputFlag = NO_INPUT_FLAG;
|
||||
m_dBlkValue = NO_VALUE;
|
||||
}
|
||||
|
||||
CBlockIn::~CBlockIn ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CBlockIn::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockIn::GetPinOutRect () const
|
||||
{
|
||||
return m_rcPinOut;
|
||||
}
|
||||
|
||||
int CBlockIn::GetInputFlag() const
|
||||
{
|
||||
return m_iInputFlag;
|
||||
}
|
||||
|
||||
void CBlockIn::SetInputFlag(int iInputFlag)
|
||||
{
|
||||
m_iInputFlag = iInputFlag;
|
||||
}
|
||||
|
||||
double CBlockIn::GetBlkValue () const
|
||||
{
|
||||
return m_dBlkValue;
|
||||
}
|
||||
|
||||
//<2F>ΥH<CEA5>]<5D>w<EFBFBD><77><EFBFBD>w<EFBFBD>ɶ<EFBFBD><C9B6>I<EFBFBD>UBlock<63><6B> (Sin, Cos)
|
||||
void CBlockIn::SetBlkValue (double dTime)
|
||||
{
|
||||
switch (m_iInputFlag)
|
||||
{
|
||||
case ZERO:
|
||||
m_dBlkValue = 0.;
|
||||
break;
|
||||
case ONE:
|
||||
m_dBlkValue = 1.;
|
||||
break;
|
||||
case SIN:
|
||||
m_dBlkValue = sin (dTime);
|
||||
break;
|
||||
case COS:
|
||||
m_dBlkValue = cos (dTime);
|
||||
break;
|
||||
default:
|
||||
m_dBlkValue = NO_VALUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//<2F>]<5D>wBlock<63><6B> (TRUE, FALSE)
|
||||
void CBlockIn::SetBlkValue ()
|
||||
{
|
||||
switch (m_iInputFlag)
|
||||
{
|
||||
case ZERO:
|
||||
m_dBlkValue = 0.;
|
||||
break;
|
||||
case ONE:
|
||||
m_dBlkValue = 1.;
|
||||
break;
|
||||
default:
|
||||
m_dBlkValue = NO_VALUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockIn::GetValueFlag () const
|
||||
{
|
||||
switch (m_iInputFlag)
|
||||
{
|
||||
case ZERO: //<2F><><EFBFBD>J<EFBFBD>i<EFBFBD>ά<EFBFBD>TRUE<55>ɡA<C9A1>^<5E>ǼƦ<C7BC><C6A6>T<EFBFBD><54>
|
||||
return DIGITAL_VALUE;
|
||||
break;
|
||||
case ONE: //<2F><><EFBFBD>J<EFBFBD>i<EFBFBD>ά<EFBFBD>FALSE<53>ɡA<C9A1>^<5E>ǼƦ<C7BC><C6A6>T<EFBFBD><54>
|
||||
return DIGITAL_VALUE;
|
||||
break;
|
||||
case SIN: //<2F><><EFBFBD>J<EFBFBD>i<EFBFBD>ά<EFBFBD>SIN<49>ɡA<C9A1>^<5E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>
|
||||
return ANALOG_VALUE;
|
||||
break;
|
||||
case COS: //<2F><><EFBFBD>J<EFBFBD>i<EFBFBD>ά<EFBFBD>COS<4F>ɡA<C9A1>^<5E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>
|
||||
return ANALOG_VALUE;
|
||||
break;
|
||||
default:
|
||||
return NO_VALUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CBlockIn::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.bottom - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.bottom + PIN_RADIUS;
|
||||
}
|
||||
|
||||
void CBlockIn::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pbrushOld;
|
||||
pbrushOld = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinOut);
|
||||
pDC->SelectObject (pbrushOld);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("IN"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
int CBlockIn::BlkTypeIs () const
|
||||
{
|
||||
return BLK_IN;
|
||||
}
|
43
TestSimulator/BlockIn.h
Normal file
43
TestSimulator/BlockIn.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock In
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
class CBlockIn : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD>@<40>ӿ<EFBFBD><D3BF>XPin)
|
||||
CRect m_rcPinOut;
|
||||
|
||||
//<2F><><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag
|
||||
int m_iInputFlag;
|
||||
|
||||
//Block<63><6B>
|
||||
double m_dBlkValue;
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockIn ();
|
||||
virtual ~CBlockIn ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag
|
||||
virtual int GetInputFlag () const;
|
||||
virtual void SetInputFlag (int);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wBlock<63><6B>
|
||||
virtual double GetBlkValue () const;
|
||||
virtual void SetBlkValue (double);
|
||||
virtual void SetBlkValue ();
|
||||
virtual int GetValueFlag () const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
164
TestSimulator/BlockNot.cpp
Normal file
164
TestSimulator/BlockNot.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockNot.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
#define BLACK RGB (0, 0, 0) //<2F>s<EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
#define COMPUTE_ERROR -13 //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD>B<EFBFBD><42>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define TOLERANCE 0.001 //<2F>e<EFBFBD>Ի~<7E>t<EFBFBD><74>
|
||||
|
||||
#define DIGITAL_VALUE 4 //<2F>Ʀ<EFBFBD><C6A6>T<EFBFBD><54>flag
|
||||
#define ANALOG_VALUE 5 //<2F><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>flag
|
||||
|
||||
#define BLK_NOT 5 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockNot::CBlockNot ()
|
||||
{
|
||||
m_rcPinIn = CRect ();
|
||||
m_rcPinOut = CRect ();
|
||||
|
||||
m_pBlkHead = NULL;
|
||||
|
||||
m_iBlkHeadNum = NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
CBlockNot::~CBlockNot ()
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockNot::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinIn.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinIn.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinIn.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockNot::GetPinIn1Rect () const
|
||||
{
|
||||
return m_rcPinIn;
|
||||
}
|
||||
|
||||
CRect CBlockNot::GetPinOutRect () const
|
||||
{
|
||||
return m_rcPinOut;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockNot::GetBlkHead1Ptr () const
|
||||
{
|
||||
return m_pBlkHead;
|
||||
}
|
||||
|
||||
void CBlockNot::SetBlkHead1Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_pBlkHead = pBlkHead;
|
||||
}
|
||||
|
||||
int CBlockNot::GetBlkHead1Num () const
|
||||
{
|
||||
return m_iBlkHeadNum;
|
||||
}
|
||||
|
||||
void CBlockNot::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHeadNum = iHeadBlkNum;
|
||||
}
|
||||
|
||||
double CBlockNot::GetBlkValue () const
|
||||
{
|
||||
//Not<6F><EFBFBD> (<28>Y<EFBFBD><59><EFBFBD>J<EFBFBD><4A>0<EFBFBD>A<EFBFBD>h<EFBFBD>^<5E><>1<EFBFBD>A<EFBFBD>Ϥ<EFBFBD><CFA4>^<5E><>0)
|
||||
if (m_pBlkHead->GetBlkValue () < TOLERANCE)
|
||||
return 1.;
|
||||
else
|
||||
return 0.;
|
||||
}
|
||||
|
||||
int CBlockNot::GetValueFlag () const
|
||||
{
|
||||
if (m_pBlkHead == NULL) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD><4A><EFBFBD>I<EFBFBD><49><EFBFBD>s<EFBFBD><73><EFBFBD>A<EFBFBD>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead->GetValueFlag () == NO_VALUE) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD><4A><EFBFBD>L<EFBFBD>ȡA<C8A1>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead->GetValueFlag () == COMPUTE_ERROR) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD><4A><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~<7E>A<EFBFBD>^<5E><>"<22>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~"
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead->GetValueFlag () == ANALOG_VALUE) //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead->GetValueFlag () == NO_OPER_FLAG) //<2F><><EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸
|
||||
return NO_OPER_FLAG;
|
||||
else if (m_pBlkHead->GetValueFlag () == DIGITAL_VALUE) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD><4A><EFBFBD>Ʀ<EFBFBD><C6A6>T<EFBFBD><54><EFBFBD>A<EFBFBD>h<EFBFBD>^<5E>ǼƦ<C7BC><C6A6>T<EFBFBD><54>
|
||||
return DIGITAL_VALUE;
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
void CBlockNot::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinIn.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinIn.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinIn.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
|
||||
void CBlockNot::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pbrushOld;
|
||||
pbrushOld = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinIn);
|
||||
pDC->Ellipse (m_rcPinOut);
|
||||
pDC->SelectObject (pbrushOld);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("NOT"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
void CBlockNot::DrawLine (CDC* pDC)
|
||||
{
|
||||
if (m_pBlkHead != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockNot::BlkTypeIs () const
|
||||
{
|
||||
return BLK_NOT;
|
||||
}
|
47
TestSimulator/BlockNot.h
Normal file
47
TestSimulator/BlockNot.h
Normal file
@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock Not
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
class CBlockNot : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD>@<40>ӿ<EFBFBD><D3BF>JPin<69>A<EFBFBD>@<40>ӿ<EFBFBD><D3BF>XPin)
|
||||
CRect m_rcPinIn;
|
||||
CRect m_rcPinOut;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CBlockBasis* m_pBlkHead;
|
||||
|
||||
//<2F>s<EFBFBD><73>Block<63>s<EFBFBD><73>
|
||||
int m_iBlkHeadNum;
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockNot ();
|
||||
virtual ~CBlockNot ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr () const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num () const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
|
||||
virtual double GetBlkValue () const; //<2F><><EFBFBD>oBlock<63><6B>
|
||||
virtual int GetValueFlag () const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
226
TestSimulator/BlockOr.cpp
Normal file
226
TestSimulator/BlockOr.cpp
Normal file
@ -0,0 +1,226 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockOr.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
#define BLACK RGB (0, 0, 0) //<2F>s<EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
#define COMPUTE_ERROR -13 //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD>B<EFBFBD><42>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define TOLERANCE 0.001 //<2F>e<EFBFBD>Ի~<7E>t<EFBFBD><74>
|
||||
|
||||
#define DIGITAL_VALUE 4 //<2F>Ʀ<EFBFBD><C6A6>T<EFBFBD><54>flag
|
||||
#define ANALOG_VALUE 5 //<2F><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54>flag
|
||||
|
||||
#define BLK_OR 4 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockOr::CBlockOr ()
|
||||
{
|
||||
m_rcPinIn1 = CRect ();
|
||||
m_rcPinIn2 = CRect ();
|
||||
m_rcPinOut = CRect ();
|
||||
|
||||
m_pBlkHead1 = NULL;
|
||||
m_pBlkHead2 = NULL;
|
||||
|
||||
m_iBlkHead1Num = NO_BLOCK_HEAD;
|
||||
m_iBlkHead2Num = NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
CBlockOr::~CBlockOr ()
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockOr::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockOr::GetPinIn1Rect () const
|
||||
{
|
||||
return m_rcPinIn1;
|
||||
}
|
||||
|
||||
CRect CBlockOr::GetPinIn2Rect () const
|
||||
{
|
||||
return m_rcPinIn2;
|
||||
}
|
||||
|
||||
CRect CBlockOr::GetPinOutRect () const
|
||||
{
|
||||
return m_rcPinOut;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockOr::GetBlkHead1Ptr () const
|
||||
{
|
||||
return m_pBlkHead1;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockOr::GetBlkHead2Ptr () const
|
||||
{
|
||||
return m_pBlkHead2;
|
||||
}
|
||||
|
||||
void CBlockOr::SetBlkHead1Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_pBlkHead1 = pBlkHead;
|
||||
}
|
||||
|
||||
void CBlockOr::SetBlkHead2Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_pBlkHead2 = pBlkHead;
|
||||
}
|
||||
|
||||
int CBlockOr::GetBlkHead1Num () const
|
||||
{
|
||||
return m_iBlkHead1Num;
|
||||
}
|
||||
|
||||
int CBlockOr::GetBlkHead2Num () const
|
||||
{
|
||||
return m_iBlkHead2Num;
|
||||
}
|
||||
|
||||
void CBlockOr::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead1Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
void CBlockOr::SetBlkHead2Num (int iHeadBlkNum)
|
||||
{
|
||||
m_iBlkHead2Num = iHeadBlkNum;
|
||||
}
|
||||
|
||||
double CBlockOr::GetBlkValue () const
|
||||
{
|
||||
//Or<4F><EFBFBD> (<28>Y<EFBFBD>䤤<EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A>1<EFBFBD>A<EFBFBD>h<EFBFBD>^<5E><>1<EFBFBD>A<EFBFBD>_<EFBFBD>h<EFBFBD>^<5E><>0)
|
||||
if (abs (m_pBlkHead1->GetBlkValue () - 1) < TOLERANCE || abs (m_pBlkHead2->GetBlkValue () - 1) < TOLERANCE)
|
||||
return 1.;
|
||||
else
|
||||
return 0.;
|
||||
}
|
||||
|
||||
int CBlockOr::GetValueFlag () const
|
||||
{
|
||||
if (m_pBlkHead1 == NULL || m_pBlkHead2 == NULL) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>I<EFBFBD><49><EFBFBD>s<EFBFBD><73><EFBFBD>A<EFBFBD>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_VALUE || m_pBlkHead2->GetValueFlag () == NO_VALUE) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>L<EFBFBD>ȡA<C8A1>^<5E><>"<22>L<EFBFBD><4C>"
|
||||
return NO_VALUE;
|
||||
else if (m_pBlkHead1->GetValueFlag () == COMPUTE_ERROR || m_pBlkHead2->GetValueFlag () == COMPUTE_ERROR) //<2F>Y<EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>@<40><><EFBFBD>J<EFBFBD><4A><EFBFBD>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~<7E>A<EFBFBD>^<5E><>"<22>p<EFBFBD><70><EFBFBD><EFBFBD><EFBFBD>~"
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead1->GetValueFlag () == ANALOG_VALUE || m_pBlkHead2->GetValueFlag () == ANALOG_VALUE) //<2F><><EFBFBD><EFBFBD><EFBFBD>\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J
|
||||
return COMPUTE_ERROR;
|
||||
else if (m_pBlkHead1->GetValueFlag () == NO_OPER_FLAG || m_pBlkHead2->GetValueFlag () == NO_OPER_FLAG) //<2F><><EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸
|
||||
return NO_OPER_FLAG;
|
||||
else if (m_pBlkHead1->GetValueFlag () == DIGITAL_VALUE && m_pBlkHead2->GetValueFlag () == DIGITAL_VALUE) //<2F>Y<EFBFBD><59><EFBFBD>J<EFBFBD>Ҭ<EFBFBD><D2AC>Ʀ<EFBFBD><C6A6>T<EFBFBD><54><EFBFBD>A<EFBFBD>h<EFBFBD>^<5E>ǼƦ<C7BC><C6A6>T<EFBFBD><54>
|
||||
return DIGITAL_VALUE;
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
void CBlockOr::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinIn1.left = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn1.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn1.right = m_rcBlk.CenterPoint ().x - int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn1.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinIn2.left = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) - PIN_RADIUS;
|
||||
m_rcPinIn2.top = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinIn2.right = m_rcBlk.CenterPoint ().x + int (m_rcBlk.Width () / 4) + PIN_RADIUS;
|
||||
m_rcPinIn2.bottom = m_rcBlk.CenterPoint ().y - int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
|
||||
m_rcPinOut.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinOut.top = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) - PIN_RADIUS;
|
||||
m_rcPinOut.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinOut.bottom = m_rcBlk.CenterPoint ().y + int (m_rcBlk.Height () / 2) + PIN_RADIUS;
|
||||
}
|
||||
|
||||
void CBlockOr::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pbrushOld;
|
||||
pbrushOld = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinIn1);
|
||||
pDC->Ellipse (m_rcPinIn2);
|
||||
pDC->Ellipse (m_rcPinOut);
|
||||
pDC->SelectObject (pbrushOld);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("OR"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
void CBlockOr::DrawLine (CDC* pDC)
|
||||
{
|
||||
if (m_pBlkHead1 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead1->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn1.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
|
||||
if (m_pBlkHead2 != NULL)
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
CPoint ptStart = m_pBlkHead2->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn2.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockOr::BlkTypeIs () const
|
||||
{
|
||||
return BLK_OR;
|
||||
}
|
55
TestSimulator/BlockOr.h
Normal file
55
TestSimulator/BlockOr.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock Or
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
class CBlockOr : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӿ<EFBFBD><D3BF>JPin<69>A<EFBFBD>@<40>ӿ<EFBFBD><D3BF>XPin)
|
||||
CRect m_rcPinIn1;
|
||||
CRect m_rcPinIn2;
|
||||
CRect m_rcPinOut;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӳs<D3B3><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
CBlockBasis* m_pBlkHead1;
|
||||
CBlockBasis* m_pBlkHead2;
|
||||
|
||||
//<2F>s<EFBFBD><73>Block<63>s<EFBFBD><73>(<28>s<EFBFBD>b<EFBFBD><62><EFBFBD>ӽs<D3BD><73>)
|
||||
int m_iBlkHead1Num;
|
||||
int m_iBlkHead2Num;
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockOr ();
|
||||
virtual ~CBlockOr ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
virtual CRect GetPinIn2Rect () const;
|
||||
virtual CRect GetPinOutRect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr () const;
|
||||
virtual CBlockBasis* GetBlkHead2Ptr () const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
virtual void SetBlkHead2Ptr (CBlockBasis*);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num () const;
|
||||
virtual int GetBlkHead2Num () const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
virtual void SetBlkHead2Num (int) ;
|
||||
|
||||
virtual double GetBlkValue () const; //<2F><><EFBFBD>oBlock<63><6B>
|
||||
virtual int GetValueFlag () const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
163
TestSimulator/BlockOut.cpp
Normal file
163
TestSimulator/BlockOut.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BlockOut.h"
|
||||
|
||||
#define PIN_RADIUS 8 //Pin<69>b<EFBFBD>|
|
||||
|
||||
#define GOLD RGB (255, 215, 0) //Pin<69>}<7D>C<EFBFBD><43>
|
||||
#define BLACK RGB (0, 0, 0) //<2F>s<EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define NO_VALUE -10 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>T<EFBFBD><54>
|
||||
#define NO_BLOCK_HEAD -14 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>s<EFBFBD><73>Block
|
||||
|
||||
#define BLK_OUT 2 //Block<63><6B><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD><73>
|
||||
|
||||
CBlockOut::CBlockOut ()
|
||||
{
|
||||
m_rcPinIn = CRect ();
|
||||
|
||||
m_iBlkHeadSize = (int) m_vcBlkHeadPtr.size ();
|
||||
}
|
||||
|
||||
CBlockOut::~CBlockOut ()
|
||||
{
|
||||
}
|
||||
|
||||
void CBlockOut::SetBlkRect (CPoint ptCenter, int iWidth, int iHeight)
|
||||
{
|
||||
CBlockBasis::SetBlkRect (ptCenter, iWidth, iHeight);
|
||||
|
||||
m_rcPinIn.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinIn.top = m_rcBlk.top - PIN_RADIUS;
|
||||
m_rcPinIn.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinIn.bottom = m_rcBlk.top + PIN_RADIUS;
|
||||
}
|
||||
|
||||
CRect CBlockOut::GetPinIn1Rect () const
|
||||
{
|
||||
return m_rcPinIn;
|
||||
}
|
||||
|
||||
CBlockBasis* CBlockOut::GetBlkHead1Ptr (int iIndex) const
|
||||
{
|
||||
//<2F>^<5E>ǫ<EFBFBD><C7AB>windex<65><78><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (iIndex < m_iBlkHeadSize)
|
||||
return m_vcBlkHeadPtr[iIndex];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CBlockOut::SetBlkHead1Ptr (CBlockBasis* pBlkHead)
|
||||
{
|
||||
m_vcBlkHeadPtr.push_back (pBlkHead); //<2F>s<EFBFBD>W<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
void CBlockOut::DeleteBlkHead1Ptr (int iIndex)
|
||||
{
|
||||
m_vcBlkHeadPtr.erase (m_vcBlkHeadPtr.begin () + iIndex); //<2F>M<EFBFBD><4D><EFBFBD><EFBFBD><EFBFBD>windex<65><78><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
int CBlockOut::GetBlkHead1Num (int iIndex) const
|
||||
{
|
||||
//<2F>^<5E>ǫ<EFBFBD><C7AB>windex<65><78><EFBFBD>s<EFBFBD><73>Block<63>s<EFBFBD><73>
|
||||
if (iIndex < m_iBlkHeadSize)
|
||||
return m_vcBlkHeadNum[iIndex];
|
||||
else
|
||||
return NO_BLOCK_HEAD;
|
||||
}
|
||||
|
||||
void CBlockOut::SetBlkHead1Num (int iHeadBlkNum)
|
||||
{
|
||||
m_vcBlkHeadNum.push_back (iHeadBlkNum); //<2F>s<EFBFBD>W<EFBFBD>s<EFBFBD><73>Block<63>s<EFBFBD><73>
|
||||
}
|
||||
|
||||
void CBlockOut::ClearBlkHead1Num ()
|
||||
{
|
||||
std::vector <int> ().swap (m_vcBlkHeadNum); //<2F>M<EFBFBD>ųs<C5B3><73><EFBFBD>s<EFBFBD><73>vector
|
||||
}
|
||||
|
||||
int CBlockOut::GetBlkHeadSize () const
|
||||
{
|
||||
return m_iBlkHeadSize; //<2F>^<5E>ǿ<EFBFBD><C7BF>Jchannel<65>ƥ<EFBFBD>
|
||||
}
|
||||
|
||||
void CBlockOut::SetBlkHeadSize (int iFlag)
|
||||
{
|
||||
//<2F>]<5D>w<EFBFBD><77><EFBFBD>Jchannel<65>ƥ<EFBFBD>
|
||||
if (iFlag == FALSE) //<2F><>flag<61><67>FALSE<53>ɡA<C9A1>̳s<CCB3><73><EFBFBD>s<EFBFBD><73>vector<6F>j<EFBFBD>p<EFBFBD>]<5D>w
|
||||
m_iBlkHeadSize = (int) m_vcBlkHeadNum.size ();
|
||||
else if (iFlag == TRUE) //<2F><>flag<61><67>TRUE<55>ɡA<C9A1>̳s<CCB3><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector<6F>j<EFBFBD>p<EFBFBD>]<5D>w
|
||||
m_iBlkHeadSize = (int) m_vcBlkHeadPtr.size ();
|
||||
}
|
||||
|
||||
double CBlockOut::GetBlkValue (int iIndex) const
|
||||
{
|
||||
//<2F><><EFBFBD>o<EFBFBD><6F><EFBFBD>wchannel<65><6C>Block<63><6B>
|
||||
if (!m_vcBlkHeadPtr.empty () && iIndex < m_iBlkHeadSize)
|
||||
return m_vcBlkHeadPtr[iIndex]->GetBlkValue ();
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
int CBlockOut::GetValueFlag (int iIndex) const
|
||||
{
|
||||
//<2F><><EFBFBD>o<EFBFBD><6F><EFBFBD>wchannel<65><6C>Value<75>X<EFBFBD><58>
|
||||
if (!m_vcBlkHeadPtr.empty () && iIndex < m_iBlkHeadSize)
|
||||
return m_vcBlkHeadPtr[iIndex]->GetValueFlag ();
|
||||
else
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
void CBlockOut::Move (CPoint ptCursor)
|
||||
{
|
||||
CBlockBasis::Move (ptCursor);
|
||||
|
||||
m_rcPinIn.left = m_rcBlk.CenterPoint ().x - PIN_RADIUS;
|
||||
m_rcPinIn.top = m_rcBlk.top - PIN_RADIUS;
|
||||
m_rcPinIn.right = m_rcBlk.CenterPoint ().x + PIN_RADIUS;
|
||||
m_rcPinIn.bottom = m_rcBlk.top + PIN_RADIUS;
|
||||
}
|
||||
|
||||
void CBlockOut::Draw (CDC* pDC)
|
||||
{
|
||||
CBrush brushPin (GOLD), * pbrushOld;
|
||||
pbrushOld = pDC->SelectObject (&brushPin);
|
||||
pDC->Ellipse (m_rcPinIn);
|
||||
pDC->SelectObject (pbrushOld);
|
||||
|
||||
CBlockBasis::Draw (pDC);
|
||||
pDC->DrawTextA (_T ("OUT"), -1, &m_rcBlk, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
void CBlockOut::DrawLine (CDC* pDC)
|
||||
{
|
||||
if (!m_vcBlkHeadPtr.empty ())
|
||||
{
|
||||
CPen penLine (PS_SOLID, 5, BLACK);
|
||||
CPen* pOldPen;
|
||||
|
||||
pOldPen = pDC->SelectObject (&penLine);
|
||||
|
||||
for (int i = 0; i < m_iBlkHeadSize; i++)
|
||||
{
|
||||
CPoint ptStart = m_vcBlkHeadPtr[i]->GetPinOutRect ().CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD>_<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD>JBlock<63><6B><EFBFBD><EFBFBD><EFBFBD>XPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
CPoint ptEnd = m_rcPinIn.CenterPoint (); //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD>JPin<69>}<7D><><EFBFBD><EFBFBD><EFBFBD>I
|
||||
int iGrid = (int) (m_rcBlk.Height () / 2. + 0.5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int iCornerGridY = (int) (((ptStart.y + ptEnd.y) / 2. - ptStart.y) / iGrid + 0.5); //<2F>p<EFBFBD><70><EFBFBD>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>JBlock<63>X<EFBFBD>ӹj<D3B9>I
|
||||
int iCornerY = iCornerGridY * iGrid + ptStart.y; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD>BY<42>y<EFBFBD>Ц<EFBFBD><D0A6>m
|
||||
pDC->MoveTo (ptStart);
|
||||
pDC->LineTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptStart.x, iCornerY));
|
||||
pDC->LineTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->MoveTo (CPoint (ptEnd.x, iCornerY));
|
||||
pDC->LineTo (ptEnd);
|
||||
}
|
||||
|
||||
pDC->SelectObject (pOldPen);
|
||||
}
|
||||
}
|
||||
|
||||
int CBlockOut::BlkTypeIs () const
|
||||
{
|
||||
return BLK_OUT;
|
||||
}
|
57
TestSimulator/BlockOut.h
Normal file
57
TestSimulator/BlockOut.h
Normal file
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
//Block<63>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>GBlock Out
|
||||
|
||||
#include "BlockBasis.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class CBlockOut : public CBlockBasis
|
||||
{
|
||||
private:
|
||||
//Block rect(<28>s<EFBFBD>b<EFBFBD>@<40>ӿ<EFBFBD><D3BF>JPin)
|
||||
CRect m_rcPinIn;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector(<28>s<EFBFBD>b<EFBFBD>h<EFBFBD>ӿ<EFBFBD><D3BF>Jchannel)
|
||||
std::vector <CBlockBasis*> m_vcBlkHeadPtr;
|
||||
|
||||
//<2F>s<EFBFBD><73><EFBFBD>s<EFBFBD><73>vector(<28>s<EFBFBD>b<EFBFBD>h<EFBFBD>ӿ<EFBFBD><D3BF>Jchannel)
|
||||
std::vector <int> m_vcBlkHeadNum;
|
||||
|
||||
//<2F><><EFBFBD>Jchannel<65>ƥ<EFBFBD>
|
||||
int m_iBlkHeadSize;
|
||||
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CBlockOut ();
|
||||
virtual ~CBlockOut ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>wrect
|
||||
virtual void SetBlkRect (CPoint, int, int);
|
||||
virtual CRect GetPinIn1Rect () const;
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual CBlockBasis* GetBlkHead1Ptr (int) const;
|
||||
virtual void SetBlkHead1Ptr (CBlockBasis*);
|
||||
virtual void DeleteBlkHead1Ptr (int);
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD>Block<63><6B><EFBFBD>s<EFBFBD><73>
|
||||
virtual int GetBlkHead1Num (int) const;
|
||||
virtual void SetBlkHead1Num (int) ;
|
||||
virtual void ClearBlkHead1Num ();
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>Jchannel<65>ƥ<EFBFBD>
|
||||
virtual int GetBlkHeadSize () const;
|
||||
virtual void SetBlkHeadSize (int);
|
||||
|
||||
virtual double GetBlkValue (int) const; //<2F><><EFBFBD>oBlock<63><6B>
|
||||
virtual int GetValueFlag (int) const; //<2F><><EFBFBD>oValue<75>X<EFBFBD><58>
|
||||
|
||||
virtual void Move (CPoint); //<2F><><EFBFBD><EFBFBD>Block
|
||||
virtual void Draw (CDC*); //ø<>sBlock
|
||||
virtual void DrawLine (CDC*); //ø<>sBlock<63>s<EFBFBD><73><EFBFBD>u
|
||||
|
||||
//<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
virtual int BlkTypeIs () const;
|
||||
};
|
51
TestSimulator/Complex.cpp
Normal file
51
TestSimulator/Complex.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Complex.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
|
||||
CComplex::CComplex ()
|
||||
{
|
||||
m_dReal = 0.;
|
||||
m_dImag = 0.;
|
||||
}
|
||||
|
||||
CComplex::CComplex (double dReal, double dImag)
|
||||
{
|
||||
m_dReal = dReal;
|
||||
m_dImag = dImag;
|
||||
}
|
||||
|
||||
CComplex::~CComplex ()
|
||||
{
|
||||
}
|
||||
|
||||
CComplex CComplex::operator+ (const CComplex & complexNumber)
|
||||
{
|
||||
double dTempReal = m_dReal + complexNumber.m_dReal;
|
||||
double dTempImag = m_dImag + complexNumber.m_dImag;
|
||||
|
||||
return CComplex (dTempReal, dTempImag);
|
||||
}
|
||||
|
||||
CComplex CComplex::operator- (const CComplex & complexNumber)
|
||||
{
|
||||
double dTempReal = m_dReal - complexNumber.m_dReal;
|
||||
double dTempImag = m_dImag - complexNumber.m_dImag;
|
||||
|
||||
return CComplex (dTempReal, dTempImag);
|
||||
}
|
||||
|
||||
CComplex CComplex::operator* (const CComplex & complexNumber)
|
||||
{
|
||||
double dTempReal = m_dReal * complexNumber.m_dReal - m_dImag * complexNumber.m_dImag;
|
||||
double dTempImag = m_dReal * complexNumber.m_dImag + m_dImag * complexNumber.m_dReal;
|
||||
|
||||
return CComplex (dTempReal, dTempImag);
|
||||
}
|
||||
|
||||
double CComplex::ComputeAmplitude () const
|
||||
{
|
||||
return sqrt (m_dReal * m_dReal + m_dImag * m_dImag);
|
||||
}
|
22
TestSimulator/Complex.h
Normal file
22
TestSimulator/Complex.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
class CComplex
|
||||
{
|
||||
public:
|
||||
double m_dReal; //<2F>Ƽƹ곡
|
||||
double m_dImag; //<2F>ƼƵ곡
|
||||
|
||||
public:
|
||||
//<2F>غc<D8BA>B<EFBFBD>Ѻc<D1BA>l
|
||||
CComplex ();
|
||||
CComplex (double, double);
|
||||
~CComplex ();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD>⤸
|
||||
CComplex operator+ (const CComplex &);
|
||||
CComplex operator- (const CComplex &);
|
||||
CComplex operator* (const CComplex &);
|
||||
|
||||
//<2F>p<EFBFBD><70><EFBFBD>ƼƮ<C6BC><C6AE>T<EFBFBD>j<EFBFBD>p
|
||||
double ComputeAmplitude () const;
|
||||
};
|
113
TestSimulator/FunDlg.cpp
Normal file
113
TestSimulator/FunDlg.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
// FunDlg.cpp : <20><><EFBFBD>@<40><>
|
||||
//
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TestSimulator.h"
|
||||
#include "FunDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
||||
|
||||
#define PLUS 1 // + flag
|
||||
#define MINUS 2 // - flag
|
||||
#define MULTI 3 // * flag
|
||||
#define DIV 4 // / flag
|
||||
|
||||
|
||||
CFunDlg::CFunDlg (CWnd* pParent)
|
||||
: CDialogEx (CFunDlg::IDD, pParent)
|
||||
{
|
||||
m_hIcon = AfxGetApp ()->LoadIcon (IDR_MAINFRAME);
|
||||
m_iOperFlag = NO_OPER_FLAG;
|
||||
}
|
||||
|
||||
CFunDlg::~CFunDlg ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP (CFunDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_PLUS, &CFunDlg::OnBnClickedButtonPlus)
|
||||
ON_BN_CLICKED(IDC_BUTTON_MINUS, &CFunDlg::OnBnClickedButtonMinus)
|
||||
ON_BN_CLICKED(IDC_BUTTON_MULTI, &CFunDlg::OnBnClickedButtonMulti)
|
||||
ON_BN_CLICKED(IDC_BUTTON_DIV, &CFunDlg::OnBnClickedButtonDiv)
|
||||
END_MESSAGE_MAP ()
|
||||
|
||||
|
||||
void CFunDlg::DoDataExchange (CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange (pDX);
|
||||
}
|
||||
|
||||
BOOL CFunDlg::OnInitDialog ()
|
||||
{
|
||||
CDialogEx::OnInitDialog ();
|
||||
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetReadOnly ();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>Ʈ<EFBFBD>Ū<EFBFBD><C5AA><EFBFBD>B<EFBFBD>⤸flag<61>A<EFBFBD>ñN<C3B1><4E><EFBFBD><EFBFBD><EFBFBD>ܩ<EFBFBD>Edit<69><74>
|
||||
switch (m_iOperFlag)
|
||||
{
|
||||
case PLUS:
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("+"));
|
||||
break;
|
||||
case MINUS:
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("-"));
|
||||
break;
|
||||
case MULTI:
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("*"));
|
||||
break;
|
||||
case DIV:
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("/"));
|
||||
break;
|
||||
default:
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("Please select operator"));
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CFunDlg::GetOperFlag () const
|
||||
{
|
||||
return m_iOperFlag;
|
||||
}
|
||||
|
||||
void CFunDlg::SetOperFlag (int iOperFlag)
|
||||
{
|
||||
m_iOperFlag = iOperFlag;
|
||||
}
|
||||
|
||||
void CFunDlg::OnBnClickedButtonPlus ()
|
||||
{
|
||||
m_iOperFlag = PLUS; //<2F><><EFBFBD>U+<2B><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>PLUS
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("+"));
|
||||
}
|
||||
|
||||
|
||||
void CFunDlg::OnBnClickedButtonMinus ()
|
||||
{
|
||||
m_iOperFlag = MINUS; //<2F><><EFBFBD>U-<2D><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>MINUS
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("-"));
|
||||
}
|
||||
|
||||
|
||||
void CFunDlg::OnBnClickedButtonMulti ()
|
||||
{
|
||||
m_iOperFlag = MULTI; //<2F><><EFBFBD>U*<2A><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>MULTI
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("*"));
|
||||
}
|
||||
|
||||
|
||||
void CFunDlg::OnBnClickedButtonDiv ()
|
||||
{
|
||||
m_iOperFlag = DIV; //<2F><><EFBFBD>U/<2F><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>DIV
|
||||
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("/"));
|
||||
}
|
41
TestSimulator/FunDlg.h
Normal file
41
TestSimulator/FunDlg.h
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
// FunDlg.h : <20><><EFBFBD>Y<EFBFBD><59>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
// InputDlg <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD>
|
||||
class CFunDlg: public CDialogEx
|
||||
{
|
||||
// <20>غc
|
||||
public:
|
||||
CFunDlg (CWnd* pParent = NULL); // <20>зǫغc<D8BA>禡
|
||||
~CFunDlg ();
|
||||
|
||||
// <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_FUN };
|
||||
|
||||
private:
|
||||
int m_iOperFlag;
|
||||
protected:
|
||||
virtual void DoDataExchange (CDataExchange* pDX); // DDX/DDV <20>䴩
|
||||
|
||||
// <20>{<7B><><EFBFBD>X<EFBFBD><58><EFBFBD>@
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// <20><><EFBFBD>ͪ<EFBFBD><CDAA>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>禡
|
||||
virtual BOOL OnInitDialog ();
|
||||
DECLARE_MESSAGE_MAP ()
|
||||
|
||||
public:
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD>B<EFBFBD>⤸flag
|
||||
int GetOperFlag () const;
|
||||
void SetOperFlag (int);
|
||||
|
||||
afx_msg void OnBnClickedButtonPlus ();
|
||||
afx_msg void OnBnClickedButtonMinus ();
|
||||
afx_msg void OnBnClickedButtonMulti ();
|
||||
afx_msg void OnBnClickedButtonDiv ();
|
||||
};
|
6
TestSimulator/Initial.ini
Normal file
6
TestSimulator/Initial.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[BgParameter]
|
||||
BgPicBOOL=FALSE
|
||||
BgPicPath=None
|
||||
BgColor=65535
|
||||
GridBOOL=TRUE
|
||||
LockBOOL=TRUE
|
107
TestSimulator/InputDlg.cpp
Normal file
107
TestSimulator/InputDlg.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
// InputDlg.cpp : <20><><EFBFBD>@<40><>
|
||||
//
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TestSimulator.h"
|
||||
#include "InputDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
#define NO_INPUT_FLAG -12 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD><62><EFBFBD>J<EFBFBD>i<EFBFBD><69>
|
||||
|
||||
#define ZERO 0 //FALSE flag
|
||||
#define ONE 1 //TRUE flag
|
||||
#define SIN 2 //Sin flag
|
||||
#define COS 3 //Cos flag
|
||||
|
||||
|
||||
CInputDlg::CInputDlg (CWnd* pParent)
|
||||
: CDialogEx (CInputDlg::IDD, pParent)
|
||||
{
|
||||
m_hIcon = AfxGetApp ()->LoadIcon (IDR_MAINFRAME);
|
||||
m_iInputFlag = NO_INPUT_FLAG; //<2F><><EFBFBD>l<EFBFBD>ƿ<EFBFBD><C6BF>J<EFBFBD>i<EFBFBD><69>flag
|
||||
}
|
||||
|
||||
CInputDlg::~CInputDlg ()
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP (CInputDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_TRUE, &CInputDlg::OnBnClickedButtonTrue)
|
||||
ON_BN_CLICKED(IDC_BUTTON_FALSE, &CInputDlg::OnBnClickedButtonFalse)
|
||||
ON_BN_CLICKED(IDC_BUTTON_SIN, &CInputDlg::OnBnClickedButtonSin)
|
||||
ON_BN_CLICKED(IDC_BUTTON_COS, &CInputDlg::OnBnClickedButtonCos)
|
||||
END_MESSAGE_MAP ()
|
||||
|
||||
void CInputDlg::DoDataExchange (CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange (pDX);
|
||||
}
|
||||
|
||||
BOOL CInputDlg::OnInitDialog ()
|
||||
{
|
||||
CDialogEx::OnInitDialog ();
|
||||
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetReadOnly ();
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>Ʈ<EFBFBD>Ū<EFBFBD><C5AA><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61>A<EFBFBD>ñN<C3B1><4E><EFBFBD><EFBFBD><EFBFBD>ܩ<EFBFBD>Edit<69><74>
|
||||
switch (m_iInputFlag)
|
||||
{
|
||||
case ZERO:
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("False"));
|
||||
break;
|
||||
case ONE:
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("True"));
|
||||
break;
|
||||
case SIN:
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("Sin (t)"));
|
||||
break;
|
||||
case COS:
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("Cos (t)"));
|
||||
break;
|
||||
default:
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("Please select input"));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CInputDlg::GetInputFlag () const
|
||||
{
|
||||
return m_iInputFlag;
|
||||
}
|
||||
|
||||
void CInputDlg::SetInputFlag (int iInputFlag)
|
||||
{
|
||||
m_iInputFlag = iInputFlag;
|
||||
}
|
||||
|
||||
void CInputDlg::OnBnClickedButtonTrue ()
|
||||
{
|
||||
m_iInputFlag = ONE; //<2F><><EFBFBD>UTrue<75><65><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>ONE
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("True"));
|
||||
}
|
||||
|
||||
void CInputDlg::OnBnClickedButtonFalse ()
|
||||
{
|
||||
m_iInputFlag = ZERO; //<2F><><EFBFBD>UFalse<73><65><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>ZERO
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("False"));
|
||||
}
|
||||
|
||||
void CInputDlg::OnBnClickedButtonSin ()
|
||||
{
|
||||
m_iInputFlag = SIN; //<2F><><EFBFBD>USin<69><6E><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>SIN
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("Sin (t)"));
|
||||
}
|
||||
|
||||
void CInputDlg::OnBnClickedButtonCos ()
|
||||
{
|
||||
m_iInputFlag = COS; //<2F><><EFBFBD>UCos<6F><73><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>COS
|
||||
( (CEdit*) GetDlgItem (IDC_EDIT_INPUT_VALUE))->SetWindowTextA (_T ("Cos (t)"));
|
||||
}
|
42
TestSimulator/InputDlg.h
Normal file
42
TestSimulator/InputDlg.h
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
// InputDlg.h : <20><><EFBFBD>Y<EFBFBD><59>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
// InputDlg <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD>
|
||||
class CInputDlg : public CDialogEx
|
||||
{
|
||||
// <20>غc
|
||||
public:
|
||||
CInputDlg (CWnd* pParent = NULL); // <20>зǫغc<D8BA>禡
|
||||
virtual ~CInputDlg ();
|
||||
|
||||
// <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_INPUT };
|
||||
|
||||
private:
|
||||
int m_iInputFlag;
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange (CDataExchange* pDX); // DDX/DDV <20>䴩
|
||||
|
||||
// <20>{<7B><><EFBFBD>X<EFBFBD><58><EFBFBD>@
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// <20><><EFBFBD>ͪ<EFBFBD><CDAA>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>禡
|
||||
virtual BOOL OnInitDialog ();
|
||||
DECLARE_MESSAGE_MAP ()
|
||||
|
||||
public:
|
||||
//<2F><><EFBFBD>o<EFBFBD>B<EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag
|
||||
int GetInputFlag () const;
|
||||
void SetInputFlag (int);
|
||||
|
||||
afx_msg void OnBnClickedButtonTrue();
|
||||
afx_msg void OnBnClickedButtonFalse();
|
||||
afx_msg void OnBnClickedButtonSin();
|
||||
afx_msg void OnBnClickedButtonCos();
|
||||
};
|
434
TestSimulator/OscDlg.cpp
Normal file
434
TestSimulator/OscDlg.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
|
||||
// OscDlg.cpp : <20><><EFBFBD>@<40><>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TestSimulator.h"
|
||||
#include "OscDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
#include "TestSimulatorDlg.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
//#include <iostream>
|
||||
//using namespace std;
|
||||
|
||||
//<2F>u<EFBFBD>@<40>ϰ<EFBFBD><CFB0>Ѽ<EFBFBD>
|
||||
#define WORK_LEFT 0
|
||||
#define WORK_TOP 0
|
||||
#define WORK_RIGHT 500
|
||||
#define WORK_BOTTOM 500
|
||||
|
||||
#define BLACK RGB (0, 0, 0) //<2F>I<EFBFBD><49><EFBFBD>C<EFBFBD><43>
|
||||
#define BLUE RGB (0, 0, 255) //<2F><><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43>
|
||||
#define WHITE RGB (255, 255, 255) //y = 0<><30><EFBFBD>u<EFBFBD>C<EFBFBD><43>
|
||||
#define YELLOW RGB (255, 255, 0) //<2F>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>u<EFBFBD>@<40>ӳ<EFBFBD><D3B3>쪺<EFBFBD>u<EFBFBD><75><EFBFBD>C<EFBFBD><43>
|
||||
#define RED RGB (255, 0, 0) //<2F>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>u<EFBFBD><75><EFBFBD>ӳ<EFBFBD><D3B3>쪺<EFBFBD>u<EFBFBD><75><EFBFBD>C<EFBFBD><43>
|
||||
#define GOLD RGB (255, 215, 0) //<2F><><EFBFBD><EFBFBD>output<75>i<EFBFBD><69><EFBFBD>C<EFBFBD><43>
|
||||
|
||||
#define GRID 10
|
||||
#define UNITY 100
|
||||
|
||||
#define MAX_PLOT_NUM 501 //<2F>̤jø<6A>sdata<74><61>
|
||||
#define OFFSET_Y 250 //<2F><><EFBFBD>ܲ<EFBFBD><DCB2>y<EFBFBD>Х<EFBFBD><D0A5>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>A<EFBFBD><41><EFBFBD>F<EFBFBD><46>ø<EFBFBD><C3B8>ø<EFBFBD>s<EFBFBD><73><EFBFBD>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>Gø<47>ϮɻݼW<DDBC>[<5B>@<40>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>q<EFBFBD><71>(0, 0)<29><><EFBFBD><EFBFBD><EFBFBD>ܪi<DCAA>ϥ<EFBFBD><CFA5><EFBFBD><EFBFBD>I
|
||||
|
||||
|
||||
// COscDlg <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD>
|
||||
|
||||
COscDlg::COscDlg (CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(COscDlg::IDD, pParent)
|
||||
{
|
||||
m_hIcon = AfxGetApp ()->LoadIcon (IDR_MAINFRAME);
|
||||
|
||||
m_pSimulatorDlg = (CTestSimulatorDlg*) pParent;
|
||||
|
||||
m_rcWork.SetRect (WORK_LEFT, WORK_TOP, WORK_RIGHT, WORK_BOTTOM);
|
||||
|
||||
m_dTime = 0.;
|
||||
m_dSlctOutputValue = 0.;
|
||||
m_dMaxDataValue = 0.;
|
||||
m_dFreq = 0.;
|
||||
|
||||
m_iOutputSize = 0;
|
||||
m_iSlctOutputNum = 0;
|
||||
m_dYInterval = 0;
|
||||
m_iXInterval = 0;
|
||||
m_iYPos = 0;
|
||||
m_iXPos = 0;
|
||||
|
||||
m_bSim = FALSE;
|
||||
m_bModify = TRUE;
|
||||
m_bFFT = TRUE;
|
||||
}
|
||||
|
||||
COscDlg::~COscDlg ()
|
||||
{
|
||||
if (!m_deqPenPtr.empty ())
|
||||
{
|
||||
int iSize = (int) m_deqPenPtr.size ();
|
||||
for (int i = 0; i < iSize; i++)
|
||||
delete m_deqPenPtr[i];
|
||||
}
|
||||
}
|
||||
|
||||
void COscDlg::DoDataExchange (CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange (pDX);
|
||||
DDX_Text (pDX, IDC_EDIT_TIME, m_dTime);
|
||||
DDX_Text (pDX, IDC_EDIT_VALUE, m_dSlctOutputValue);
|
||||
DDX_Control (pDX, IDC_COMBO_OUTPUT, m_ctrlComboOutput);
|
||||
DDX_Control (pDX, IDC_COMBO_VALUE_INTERVAL, m_ctrlComboYInterval);
|
||||
DDX_Control (pDX, IDC_COMBO_TIME_INTERVAL, m_ctrlComboXInterval);
|
||||
DDX_Text (pDX, IDC_EDIT_FREQUENCY, m_dFreq);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP (COscDlg, CDialogEx)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_PAINT()
|
||||
ON_BN_CLICKED(IDC_BUTTON_START, &COscDlg::OnBnClickedButtonStart)
|
||||
ON_BN_CLICKED(IDC_BUTTON_STOP, &COscDlg::OnBnClickedButtonStop)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_OUTPUT, &COscDlg::OnCbnSelchangeComboOutput)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_VALUE_INTERVAL, &COscDlg::OnCbnSelchangeComboValueInterval)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_TIME_INTERVAL, &COscDlg::OnCbnSelchangeComboTimeInterval)
|
||||
END_MESSAGE_MAP ()
|
||||
|
||||
|
||||
// COscDlg <20>T<EFBFBD><54><EFBFBD>B<EFBFBD>z<EFBFBD>`<60><>
|
||||
|
||||
BOOL COscDlg::OnInitDialog ()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
//<2F>]<5D>w<EFBFBD>üƺؤl
|
||||
srand ((unsigned int) time (NULL));
|
||||
|
||||
//<2F>]<5D>wY<77>b<EFBFBD><62><EFBFBD>jCombo box<6F><78><EFBFBD>e
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
CString strYInterval;
|
||||
double dInterval = 0.5;
|
||||
for (int j = 0 ; j < i; j++)
|
||||
dInterval *= 2;
|
||||
strYInterval.Format (_T ("%g"), dInterval);
|
||||
m_ctrlComboYInterval.AddString (strYInterval);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>l<EFBFBD><6C>Y<EFBFBD>b<EFBFBD><62><EFBFBD>j
|
||||
m_ctrlComboYInterval.SetCurSel (0);
|
||||
m_dYInterval = 0.5;
|
||||
m_iYPos = 0;
|
||||
m_dMaxDataValue = m_dYInterval * 2.5;
|
||||
|
||||
|
||||
//<2F>]<5D>wX<77>b<EFBFBD><62><EFBFBD>jCombo box<6F><78><EFBFBD>e
|
||||
m_ctrlComboXInterval.AddString (_T ("5"));
|
||||
m_ctrlComboXInterval.AddString (_T ("10"));
|
||||
m_ctrlComboXInterval.AddString (_T ("50"));
|
||||
m_ctrlComboXInterval.AddString (_T ("100"));
|
||||
m_ctrlComboXInterval.AddString (_T ("500"));
|
||||
|
||||
//<2F><><EFBFBD>l<EFBFBD><6C>X<EFBFBD>b<EFBFBD><62><EFBFBD>j
|
||||
m_ctrlComboXInterval.SetCurSel (0);
|
||||
m_iXInterval = 5;
|
||||
m_iXPos = 0;
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX <20>ݩʭ<DDA9><CAAD><EFBFBD><EFBFBD>Ǧ^ FALSE
|
||||
}
|
||||
|
||||
|
||||
void COscDlg::OnPaint ()
|
||||
{
|
||||
//<2F><><EFBFBD>w<EFBFBD>īإ<C4AB>
|
||||
CPaintDC dcOsc (this); //<2F>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>dc
|
||||
CDC dcMem; //<2F><><EFBFBD>sdc
|
||||
CBitmap bitmapMem;
|
||||
CBitmap* pOldBitmap;
|
||||
|
||||
dcMem.CreateCompatibleDC (&dcOsc); //<2F>إP<DFBB>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2>ۮe<DBAE><65>dc
|
||||
bitmapMem.CreateCompatibleBitmap (&dcOsc, WORK_RIGHT, WORK_BOTTOM);
|
||||
pOldBitmap = dcMem.SelectObject (&bitmapMem);
|
||||
|
||||
//ø<>s<EFBFBD>I<EFBFBD><49>
|
||||
dcMem.SetBkMode (TRANSPARENT);
|
||||
dcMem.FillSolidRect (m_rcWork, BLACK);
|
||||
|
||||
//<2F>Ŧ<EFBFBD><C5A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 pixels
|
||||
CPen penBlue (PS_SOLID, 1, BLUE);
|
||||
CPen* pOldPen = dcMem.SelectObject (&penBlue);
|
||||
|
||||
for (int i = 0; i < m_rcWork.Width (); i += GRID)
|
||||
{
|
||||
dcMem.MoveTo (i, 0); //<2F><><EFBFBD><EFBFBD><EFBFBD>u
|
||||
dcMem.LineTo (i, m_rcWork.Height ());
|
||||
dcMem.MoveTo (0, i); //<2F><><EFBFBD><EFBFBD><EFBFBD>u
|
||||
dcMem.LineTo (m_rcWork.Width (), i);
|
||||
}
|
||||
|
||||
//ø<>s<EFBFBD>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>u(X<>b)
|
||||
CPen penWhite (PS_SOLID, 2, WHITE);
|
||||
CString strValueZero ("Value = 0");
|
||||
dcMem.SelectObject (&penWhite);
|
||||
SetTextColor (dcMem, WHITE);
|
||||
|
||||
dcMem.MoveTo (0, m_rcWork.Height () / 2);
|
||||
dcMem.LineTo (m_rcWork.Width (), m_rcWork.Height () / 2); //<2F>e<EFBFBD>u
|
||||
dcMem.TextOutA (0, m_rcWork.Height () / 2, strValueZero, strValueZero.GetLength ()); //<2F>аO<D0B0><4F><EFBFBD>r
|
||||
|
||||
|
||||
//<2F>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>u<EFBFBD>@<40><>UNITY (<28>@<40><>UNITY<54><59> 100 piexls)
|
||||
CPen penYellow (PS_SOLID, 1, YELLOW);
|
||||
CString strValueNOne;
|
||||
strValueNOne.Format (_T ("Value = %g"), -m_dYInterval);
|
||||
CString strValuePOne;
|
||||
strValuePOne.Format (_T ("Value = %g"), m_dYInterval);
|
||||
dcMem.SelectObject (&penYellow);
|
||||
SetTextColor (dcMem, YELLOW);
|
||||
|
||||
dcMem.MoveTo (0, m_rcWork.Height () / 2 + UNITY);
|
||||
dcMem.LineTo (m_rcWork.Width (), m_rcWork.Height () / 2 + UNITY);
|
||||
dcMem.TextOutA (0, m_rcWork.Height () / 2 + UNITY, strValueNOne, strValueNOne.GetLength ());
|
||||
|
||||
dcMem.MoveTo (0, m_rcWork.Height () / 2 - UNITY);
|
||||
dcMem.LineTo (m_rcWork.Width (), m_rcWork.Height () / 2 - UNITY);
|
||||
dcMem.TextOutA (0, m_rcWork.Height () / 2 - UNITY, strValuePOne, strValuePOne.GetLength ());
|
||||
|
||||
|
||||
//<2F>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD>UNITY (<28>@<40><>UNITY<54><59> 100 piexls)
|
||||
CPen penRed (PS_SOLID, 2, RED);
|
||||
CString strValueNTwo;
|
||||
strValueNTwo.Format (_T ("Value = %g"), -2 * m_dYInterval);
|
||||
CString strValuePTwo;
|
||||
strValuePTwo.Format (_T ("Value = %g"), 2 * m_dYInterval);
|
||||
dcMem.SelectObject (&penRed);
|
||||
SetTextColor (dcMem, RED);
|
||||
|
||||
dcMem.MoveTo (0, m_rcWork.Height () / 2 + (2 * UNITY));
|
||||
dcMem.LineTo (m_rcWork.Width (), m_rcWork.Height () / 2 + (2 * UNITY));
|
||||
dcMem.TextOutA (0, m_rcWork.Height () / 2 + (2 * UNITY), strValueNTwo, strValueNTwo.GetLength ());
|
||||
|
||||
dcMem.MoveTo (0, m_rcWork.Height () / 2 - (2 * UNITY));
|
||||
dcMem.LineTo (m_rcWork.Width (), m_rcWork.Height () / 2 - (2 * UNITY));
|
||||
dcMem.TextOutA (0, m_rcWork.Height () / 2 - (2 * UNITY), strValuePTwo, strValuePTwo.GetLength ());
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>}<7D>l
|
||||
if (m_bSim)
|
||||
{
|
||||
CPen penGold (PS_SOLID, 6, GOLD);
|
||||
|
||||
int iDataSize = (int) m_pSimulatorDlg->m_deq2DOutputValue.size (); //<2F><><EFBFBD>odata<74>ƥ<EFBFBD>
|
||||
|
||||
//<2F><>data<74>Ƥj<C6A4><6A>1<EFBFBD>A<EFBFBD>}<7D>lø<6C>soutput<75>i<EFBFBD><69>
|
||||
if (iDataSize > 1)
|
||||
{
|
||||
int iPlotStart = 0; //ø<>sdata<74>_<EFBFBD>I
|
||||
if (iDataSize > MAX_PLOT_NUM)
|
||||
iPlotStart = iDataSize - MAX_PLOT_NUM;
|
||||
|
||||
for (int i = 0; i < m_iOutputSize; i++)
|
||||
{
|
||||
//<2F>]<5D>w<EFBFBD><77><EFBFBD><EFBFBD>output<75><74><EFBFBD>e<EFBFBD><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʪ<EFBFBD><CAAA>e<EFBFBD><65>
|
||||
if (m_iSlctOutputNum >= 0 && i == m_iSlctOutputNum)
|
||||
dcMem.SelectObject (&penGold);
|
||||
else
|
||||
dcMem.SelectObject (m_deqPenPtr[i]);
|
||||
|
||||
for (int j = 1; j < iDataSize; j++)
|
||||
{
|
||||
//<2F>W<EFBFBD>X<EFBFBD>iø<69>sdata<74>ơA<C6A1>h<EFBFBD>ߧY<DFA7><59><EFBFBD>X<EFBFBD>j<EFBFBD><6A>
|
||||
if (j >= MAX_PLOT_NUM)
|
||||
break;
|
||||
|
||||
double dForwardValue = m_pSimulatorDlg->m_deq2DOutputValue[j - 1 + iPlotStart][i];
|
||||
double dPostValue = m_pSimulatorDlg->m_deq2DOutputValue[j + iPlotStart][i];
|
||||
|
||||
//<2F>P<EFBFBD>_data<74>ȬO<C8AC>_<EFBFBD>W<EFBFBD>X<EFBFBD>ܪi<DCAA><69><EFBFBD>i<EFBFBD><69><EFBFBD>ܤ<EFBFBD><DCA4>̤j<CCA4><6A>
|
||||
if (dForwardValue > m_dMaxDataValue)
|
||||
dForwardValue = m_dMaxDataValue;
|
||||
else if (dForwardValue < -m_dMaxDataValue)
|
||||
dForwardValue = -m_dMaxDataValue;
|
||||
|
||||
if (dPostValue > m_dMaxDataValue)
|
||||
dPostValue = m_dMaxDataValue;
|
||||
else if (dPostValue < -m_dMaxDataValue)
|
||||
dPostValue = -m_dMaxDataValue;
|
||||
|
||||
dcMem.MoveTo (j - 1, -(int) (dForwardValue / m_dYInterval * UNITY) + OFFSET_Y);
|
||||
dcMem.LineTo (j, -(int) (dPostValue / m_dYInterval * UNITY) + OFFSET_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//<2F>Ѥ<EFBFBD><D1A4>sdc<64><63><EFBFBD><EFBFBD><EFBFBD>ܥܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>dc
|
||||
dcOsc.BitBlt (WORK_LEFT, WORK_TOP, m_rcWork.Width (), m_rcWork.Height (), &dcMem, WORK_LEFT, WORK_TOP, SRCCOPY);
|
||||
|
||||
//<2F>M<EFBFBD>z
|
||||
dcMem.SelectObject (pOldPen);
|
||||
dcMem.SelectObject (pOldBitmap);
|
||||
bitmapMem.DeleteObject ();
|
||||
dcMem.DeleteDC ();
|
||||
}
|
||||
|
||||
//<2F>ѥD<D1A5><44><EFBFBD>ܲ<EFBFBD><DCB2>ǭ<EFBFBD>(<28><><EFBFBD>e<EFBFBD>ɶ<EFBFBD>, <20><><EFBFBD><EFBFBD>output value, <20>W<EFBFBD>v)
|
||||
void COscDlg::SetData (double dTime, double dValue, double dFreq)
|
||||
{
|
||||
m_dTime = dTime;
|
||||
m_dSlctOutputValue = dValue;
|
||||
m_dFreq = dFreq;
|
||||
}
|
||||
|
||||
// <20>ѥD<D1A5><44><EFBFBD>ܲ<EFBFBD><DCB2>ǭ<EFBFBD>(<28><><EFBFBD>e<EFBFBD>ɶ<EFBFBD>, <20><><EFBFBD><EFBFBD>output value)
|
||||
void COscDlg::SetData (double dTime, double dValue)
|
||||
{
|
||||
m_dTime = dTime;
|
||||
m_dSlctOutputValue = dValue;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>UStart<72><74>
|
||||
void COscDlg::OnBnClickedButtonStart ()
|
||||
{
|
||||
if (!m_bSim)
|
||||
{
|
||||
m_bModify = FALSE; //<2F>}<7D>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD>X<EFBFBD>b<EFBFBD><62><EFBFBD>jCombo box
|
||||
m_bSim = TRUE;
|
||||
m_pSimulatorDlg->SetTimer (0, 10, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>UStop<6F><70>
|
||||
void COscDlg::OnBnClickedButtonStop ()
|
||||
{
|
||||
if (m_bSim)
|
||||
{
|
||||
m_bSim = FALSE;
|
||||
m_pSimulatorDlg->KillTimer (0);
|
||||
}
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>output combo box
|
||||
void COscDlg::OnCbnSelchangeComboOutput ()
|
||||
{
|
||||
m_iSlctOutputNum = m_ctrlComboOutput.GetCurSel ();
|
||||
m_bFFT = TRUE;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Y<EFBFBD>b<EFBFBD><62><EFBFBD>j combo box
|
||||
void COscDlg::OnCbnSelchangeComboValueInterval ()
|
||||
{
|
||||
m_iYPos = m_ctrlComboYInterval.GetCurSel ();
|
||||
double dIni = 0.5;
|
||||
for (int i = 0; i < m_iYPos; i++)
|
||||
dIni *= 2;
|
||||
m_dYInterval = dIni;
|
||||
m_dMaxDataValue = 2.5 * m_dYInterval;
|
||||
|
||||
InvalidateRect (m_rcWork, FALSE);
|
||||
UpdateWindow ();
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>X<EFBFBD>b<EFBFBD><62><EFBFBD>j combo box
|
||||
void COscDlg::OnCbnSelchangeComboTimeInterval ()
|
||||
{
|
||||
if (m_bModify && (!m_bSim))
|
||||
{
|
||||
m_iXPos = m_ctrlComboXInterval.GetCurSel ();
|
||||
switch (m_iXPos)
|
||||
{
|
||||
case 0:
|
||||
m_iXInterval = 5;
|
||||
break;
|
||||
case 1:
|
||||
m_iXInterval = 10;
|
||||
break;
|
||||
case 2:
|
||||
m_iXInterval = 50;
|
||||
break;
|
||||
case 3:
|
||||
m_iXInterval = 100;
|
||||
break;
|
||||
case 4:
|
||||
m_iXInterval = 500;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_ctrlComboXInterval.SetCurSel (m_iXPos);
|
||||
}
|
||||
|
||||
BOOL COscDlg::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN)
|
||||
{
|
||||
if (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return CDialogEx::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void COscDlg::OnClose ()
|
||||
{
|
||||
//<2F>M<EFBFBD><4D><EFBFBD>H<EFBFBD><48><EFBFBD>e<EFBFBD><65>deque
|
||||
if (!m_deqPenPtr.empty ())
|
||||
{
|
||||
for (int i = 0; i < m_iOutputSize; i++)
|
||||
delete m_deqPenPtr[i];
|
||||
}
|
||||
|
||||
m_pSimulatorDlg->m_bSimulate = FALSE; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_deqPenPtr.clear ();
|
||||
m_ctrlComboOutput.ResetContent (); //<2F>M<EFBFBD><4D>output combo box<6F><78><EFBFBD>e
|
||||
m_bSim = FALSE; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_bModify = TRUE; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD>combo box
|
||||
m_bFFT = TRUE;
|
||||
m_iSlctOutputNum = 0;
|
||||
m_dTime = 0.;
|
||||
m_dSlctOutputValue = 0.;
|
||||
m_dFreq = 0.;
|
||||
m_pSimulatorDlg->m_iStep = 0;
|
||||
m_pSimulatorDlg->KillTimer (0);
|
||||
|
||||
CDialogEx::OnClose ();
|
||||
}
|
||||
|
||||
//<2F>]<5D>wchannel<65>ƥ<EFBFBD>
|
||||
void COscDlg::SetOutputSize (int iOutSize)
|
||||
{
|
||||
m_iOutputSize = iOutSize;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>l<EFBFBD>ƥܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD>(channel<65>ƥ<EFBFBD>, <20>H<EFBFBD><48><EFBFBD>e<EFBFBD><65>)
|
||||
void COscDlg::InitialData ()
|
||||
{
|
||||
//<2F>]<5D>woutput combo box<6F><78><EFBFBD>e
|
||||
for (int i = 0; i < m_iOutputSize; i++)
|
||||
{
|
||||
CString strOutput;
|
||||
strOutput.Format (_T ("Output %d"), i + 1);
|
||||
m_ctrlComboOutput.AddString (strOutput);
|
||||
}
|
||||
|
||||
//<2F>إ<EFBFBD><D8A5>H<EFBFBD><48><EFBFBD>e<EFBFBD><65>
|
||||
for (int i = 0; i < m_iOutputSize; i++)
|
||||
{
|
||||
CPen* pRandPen = new CPen (PS_SOLID, 3, RGB (rand () % 256, rand () % 256, rand () % 256));
|
||||
m_deqPenPtr.push_back (pRandPen);
|
||||
}
|
||||
|
||||
m_ctrlComboOutput.SetCurSel (0);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>o<EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>j
|
||||
int COscDlg::GetTimeInterval () const
|
||||
{
|
||||
return m_iXInterval;
|
||||
}
|
72
TestSimulator/OscDlg.h
Normal file
72
TestSimulator/OscDlg.h
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
// OscDlg.h : <20><><EFBFBD>Y<EFBFBD><59>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "afxwin.h"
|
||||
#include <deque>
|
||||
|
||||
class CTestSimulatorDlg;
|
||||
|
||||
// COscDlg <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD>
|
||||
|
||||
class COscDlg : public CDialogEx
|
||||
{
|
||||
public:
|
||||
COscDlg (CWnd* pParent = NULL); // <20>зǫغc<D8BA>禡
|
||||
virtual ~COscDlg ();
|
||||
|
||||
// <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_OSC };
|
||||
|
||||
private:
|
||||
CTestSimulatorDlg* m_pSimulatorDlg; //<2F>D<EFBFBD><44><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
CComboBox m_ctrlComboOutput; //Output combo box<6F>ܼ<EFBFBD>
|
||||
CComboBox m_ctrlComboYInterval; //Y<>b<EFBFBD><62><EFBFBD>j combo box<6F>ܼ<EFBFBD>
|
||||
CComboBox m_ctrlComboXInterval; //X<>b<EFBFBD><62><EFBFBD>j combo box<6F>ܼ<EFBFBD>
|
||||
|
||||
std::deque <CPen*> m_deqPenPtr; //<2F>H<EFBFBD><48><EFBFBD>e<EFBFBD><65>deque
|
||||
|
||||
double m_dTime; //<2F><><EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD>
|
||||
double m_dSlctOutputValue; //<2F><><EFBFBD><EFBFBD>output value
|
||||
double m_dMaxDataValue; //<2F>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>̤ܳj<CCA4><6A>
|
||||
double m_dFreq; //<2F>W<EFBFBD>v
|
||||
|
||||
int m_iOutputSize; //channel<65>ƥ<EFBFBD>
|
||||
double m_dYInterval; //Y<>b<EFBFBD><62><EFBFBD>j
|
||||
int m_iXInterval; //X<>b<EFBFBD><62><EFBFBD>j
|
||||
int m_iYPos; //Y<>b<EFBFBD><62><EFBFBD>j combo box<6F><78><EFBFBD>m
|
||||
int m_iXPos; //X<>b<EFBFBD><62><EFBFBD>j combo box<6F><78><EFBFBD>m
|
||||
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
virtual void DoDataExchange (CDataExchange* pDX); // DDX/DDV <20>䴩
|
||||
|
||||
DECLARE_MESSAGE_MAP ()
|
||||
public:
|
||||
CRect m_rcWork; //<2F>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2>u<EFBFBD>@<40><>
|
||||
|
||||
int m_iSlctOutputNum; //<2F><><EFBFBD><EFBFBD>output<75>s<EFBFBD><73>
|
||||
|
||||
BOOL m_bSim; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD>
|
||||
BOOL m_bModify; //<2F>P<EFBFBD>_combo box<6F><78><EFBFBD><EFBFBD>
|
||||
BOOL m_bFFT; //<2F>P<EFBFBD>_<EFBFBD>i<EFBFBD><69>FFT
|
||||
|
||||
virtual BOOL OnInitDialog ();
|
||||
afx_msg void OnPaint ();
|
||||
afx_msg void OnBnClickedButtonStart ();
|
||||
afx_msg void OnBnClickedButtonStop ();
|
||||
afx_msg void OnCbnSelchangeComboOutput ();
|
||||
afx_msg void OnCbnSelchangeComboValueInterval ();
|
||||
afx_msg void OnCbnSelchangeComboTimeInterval ();
|
||||
virtual BOOL PreTranslateMessage (MSG* pMsg);
|
||||
afx_msg void OnClose ();
|
||||
void SetData (double, double, double);
|
||||
void SetData (double, double);
|
||||
void SetOutputSize (int);
|
||||
void InitialData ();
|
||||
int GetTimeInterval () const;
|
||||
};
|
102
TestSimulator/TestSimulator.cpp
Normal file
102
TestSimulator/TestSimulator.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
|
||||
// TestSimulator.cpp : <20>w<EFBFBD>q<EFBFBD><71><EFBFBD>ε{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>欰<EFBFBD>C
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TestSimulator.h"
|
||||
#include "TestSimulatorDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
|
||||
// CTestSimulatorApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTestSimulatorApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CTestSimulatorApp <20>غc
|
||||
|
||||
CTestSimulatorApp::CTestSimulatorApp()
|
||||
{
|
||||
// <20>䴩<EFBFBD><E4B4A9><EFBFBD>s<EFBFBD>Ұʺz<DEB2><7A>
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
// TODO: <20>b<EFBFBD><62><EFBFBD>[<5B>J<EFBFBD>غc<D8BA>{<7B><><EFBFBD>X<EFBFBD>A
|
||||
// <20>N<EFBFBD>Ҧ<EFBFBD><D2A6><EFBFBD><EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>]<5D>w<EFBFBD>[<5B>J InitInstance <20><>
|
||||
}
|
||||
|
||||
|
||||
// <20>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD>@<40><> CTestSimulatorApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CTestSimulatorApp theApp;
|
||||
|
||||
|
||||
// CTestSimulatorApp <20><><EFBFBD>l<EFBFBD>]<5D>w
|
||||
|
||||
BOOL CTestSimulatorApp::InitInstance()
|
||||
{
|
||||
// <20><><EFBFBD>p<EFBFBD><70><EFBFBD>ε{<7B><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD>M<EFBFBD><4D><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>ϥ<EFBFBD> ComCtl32.dll 6 (<28>t) <20>H<EFBFBD>᪩<EFBFBD><E1AAA9><EFBFBD>A
|
||||
// <20>ӱҰʵ<D2B0>ı<EFBFBD>Ƽ˦<C6BC><CBA6>A<EFBFBD>b Windows XP <20>W<EFBFBD>A<EFBFBD>h<EFBFBD>ݭn InitCommonControls()<29>C
|
||||
// <20>_<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>إ߳<D8A5><DFB3>N<EFBFBD><4E><EFBFBD>ѡC
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
// <20>]<5D>w<EFBFBD>n<EFBFBD>]<5D>t<EFBFBD>Ҧ<EFBFBD><D2A6>z<EFBFBD>Q<EFBFBD>n<EFBFBD>Ω<EFBFBD><CEA9><EFBFBD><EFBFBD>ε{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>q<EFBFBD>α<EFBFBD><CEB1><EFBFBD><EEB6B5><EFBFBD>O<EFBFBD>C
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// <20>إߴh<DFBC>z<DEB2><7A><EFBFBD>A<EFBFBD>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD>]<5D>t
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>h<DFBC><68><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>δh<DFBC>M<EFBFBD><4D><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>C
|
||||
CShellManager *pShellManager = new CShellManager;
|
||||
|
||||
// <20>Ұ<EFBFBD> [Windows <20><><EFBFBD><EFBFBD>] <20><>ı<EFBFBD>ƺz<DEB2><7A><EFBFBD>i<EFBFBD>ҥ<EFBFBD> MFC <20><><EFBFBD><EFBFBD><EEB6B5><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD>D
|
||||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||
|
||||
// <20>зǪ<D0B7><C7AA>l<EFBFBD>]<5D>w
|
||||
// <20>p<EFBFBD>G<EFBFBD>z<EFBFBD><7A><EFBFBD>ϥγo<CEB3>ǥ\<5C><><EFBFBD>åB<C3A5>Q<EFBFBD><51><EFBFBD><EFBFBD>
|
||||
// <20>̫᧹<CCAB><E1A7B9><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD>ɤj<C9A4>p<EFBFBD>A<EFBFBD>z<EFBFBD>i<EFBFBD>H
|
||||
// <20>q<EFBFBD>U<EFBFBD>C<EFBFBD>{<7B><><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݭn<DDAD><6E><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>Ʊ`<60><><EFBFBD>A
|
||||
// <20>ܧ<EFBFBD><DCA7>x<EFBFBD>s<EFBFBD>]<5D>w<EFBFBD>Ȫ<EFBFBD><C8AA>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD>X
|
||||
// TODO: <20>z<EFBFBD><7A><EFBFBD>ӾA<D3BE>ק惡<D7A7>r<EFBFBD><72>
|
||||
// (<28>Ҧp<D2A6>A<EFBFBD><41><EFBFBD>q<EFBFBD>W<EFBFBD>٩β<D9A9>´<EFBFBD>W<EFBFBD><57>)
|
||||
SetRegistryKey(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AppWizard <20>Ҳ<EFBFBD><D2B2>ͪ<EFBFBD><CDAA><EFBFBD><EFBFBD>ε{<7B><>"));
|
||||
|
||||
CTestSimulatorDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: <20>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>m<EFBFBD><6D><EFBFBD>ϥ<EFBFBD> [<5B>T<EFBFBD>w] <20>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>ϥι<CFA5><CEB9>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>B<EFBFBD>z<EFBFBD><7A><EFBFBD>{<7B><><EFBFBD>X
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: <20>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>m<EFBFBD><6D><EFBFBD>ϥ<EFBFBD> [<5B><><EFBFBD><EFBFBD>] <20>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>ϥι<CFA5><CEB9>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>B<EFBFBD>z<EFBFBD><7A><EFBFBD>{<7B><><EFBFBD>X
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "ĵ<EFBFBD>i: <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD>إߥ<D8A5><DFA5>ѡA<D1A1>]<5D><><EFBFBD>A<EFBFBD><41><EFBFBD>ε{<7B><><EFBFBD>N<EFBFBD>~<7E>פ<EFBFBD><D7A4>C\n");
|
||||
TRACE(traceAppMsg, 0, "ĵ<EFBFBD>i: <20>p<EFBFBD>G<EFBFBD>z<EFBFBD>n<EFBFBD>b<EFBFBD><62><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD>W<EFBFBD>ϥ<EFBFBD> MFC <20><><EFBFBD><EFBFBD>A<EFBFBD>h<EFBFBD>L<EFBFBD>k #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS<47>C\n");
|
||||
}
|
||||
|
||||
// <20>R<EFBFBD><52><EFBFBD>W<EFBFBD><57><EFBFBD>ҫإߪ<D8A5><DFAA>h<DFBC>z<DEB2><7A><EFBFBD>C
|
||||
if (pShellManager != NULL)
|
||||
{
|
||||
delete pShellManager;
|
||||
}
|
||||
|
||||
// <20>]<5D><><EFBFBD>w<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD>A<EFBFBD>Ǧ^ FALSE<53>A<EFBFBD>ҥH<D2A5>ڭ̷|<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε{<7B><><EFBFBD>A
|
||||
// <20>ӫD<D3AB><44><EFBFBD>ܶ}<7D>l<EFBFBD><6C><EFBFBD>ε{<7B><><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54><EFBFBD>C
|
||||
return FALSE;
|
||||
}
|
||||
|
32
TestSimulator/TestSimulator.h
Normal file
32
TestSimulator/TestSimulator.h
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
// TestSimulator.h : PROJECT_NAME <20><><EFBFBD>ε{<7B><><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD>n<EFBFBD><6E><EFBFBD>Y<EFBFBD><59>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "<22><> PCH <20>]<5D>t<EFBFBD><74><EFBFBD>ɮe<D7AB><65><EFBFBD>]<5D>t 'stdafx.h'"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // <20>D<EFBFBD>n<EFBFBD>Ÿ<EFBFBD>
|
||||
|
||||
|
||||
// CTestSimulatorApp:
|
||||
// <20>аѾ\<5C><><EFBFBD>@<40><><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD><4F> TestSimulator.cpp
|
||||
//
|
||||
|
||||
class CTestSimulatorApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CTestSimulatorApp();
|
||||
|
||||
// <20>мg
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// <20>{<7B><><EFBFBD>X<EFBFBD><58><EFBFBD>@
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CTestSimulatorApp theApp;
|
BIN
TestSimulator/TestSimulator.rc
Normal file
BIN
TestSimulator/TestSimulator.rc
Normal file
Binary file not shown.
163
TestSimulator/TestSimulator.vcxproj
Normal file
163
TestSimulator/TestSimulator.vcxproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C1F3E95D-9580-4550-A748-674E1D31DF84}</ProjectGuid>
|
||||
<RootNamespace>TestSimulator</RootNamespace>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0404</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0404</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BlockAnd.h" />
|
||||
<ClInclude Include="BlockBasis.h" />
|
||||
<ClInclude Include="BlockFun.h" />
|
||||
<ClInclude Include="BlockIn.h" />
|
||||
<ClInclude Include="BlockNot.h" />
|
||||
<ClInclude Include="BlockOr.h" />
|
||||
<ClInclude Include="BlockOut.h" />
|
||||
<ClInclude Include="Complex.h" />
|
||||
<ClInclude Include="FunDlg.h" />
|
||||
<ClInclude Include="InputDlg.h" />
|
||||
<ClInclude Include="OscDlg.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TestSimulator.h" />
|
||||
<ClInclude Include="TestSimulatorDlg.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BlockAnd.cpp" />
|
||||
<ClCompile Include="BlockBasis.cpp" />
|
||||
<ClCompile Include="BlockFun.cpp" />
|
||||
<ClCompile Include="BlockIn.cpp" />
|
||||
<ClCompile Include="BlockNot.cpp" />
|
||||
<ClCompile Include="BlockOr.cpp" />
|
||||
<ClCompile Include="BlockOut.cpp" />
|
||||
<ClCompile Include="Complex.cpp" />
|
||||
<ClCompile Include="FunDlg.cpp" />
|
||||
<ClCompile Include="InputDlg.cpp" />
|
||||
<ClCompile Include="OscDlg.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TestSimulator.cpp" />
|
||||
<ClCompile Include="TestSimulatorDlg.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TestSimulator.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\TestSimulator.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\TestSimulator.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="TestSimulator.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
129
TestSimulator/TestSimulator.vcxproj.filters
Normal file
129
TestSimulator/TestSimulator.vcxproj.filters
Normal file
@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="原始程式檔">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="標頭檔">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="資源檔">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="TestSimulator.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TestSimulatorDlg.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockBasis.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockIn.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockOut.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockAnd.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockOr.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockNot.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InputDlg.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BlockFun.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FunDlg.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="OscDlg.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Complex.h">
|
||||
<Filter>標頭檔</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="TestSimulator.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TestSimulatorDlg.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockBasis.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockIn.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockOut.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockAnd.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockNot.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputDlg.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockFun.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FunDlg.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="OscDlg.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BlockOr.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Complex.cpp">
|
||||
<Filter>原始程式檔</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TestSimulator.rc">
|
||||
<Filter>資源檔</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\TestSimulator.rc2">
|
||||
<Filter>資源檔</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\TestSimulator.ico">
|
||||
<Filter>資源檔</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
7
TestSimulator/TestSimulator.vcxproj.user
Normal file
7
TestSimulator/TestSimulator.vcxproj.user
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
1582
TestSimulator/TestSimulatorDlg.cpp
Normal file
1582
TestSimulator/TestSimulatorDlg.cpp
Normal file
File diff suppressed because it is too large
Load Diff
116
TestSimulator/TestSimulatorDlg.h
Normal file
116
TestSimulator/TestSimulatorDlg.h
Normal file
@ -0,0 +1,116 @@
|
||||
|
||||
// TestSimulatorDlg.h : <20><><EFBFBD>Y<EFBFBD><59>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BlockBasis.h"
|
||||
#include "BlockIn.h"
|
||||
#include "BlockOut.h"
|
||||
#include "BlockAnd.h"
|
||||
#include "BlockOr.h"
|
||||
#include "BlockNot.h"
|
||||
#include "BlockFun.h"
|
||||
#include "InputDlg.h"
|
||||
#include "FunDlg.h"
|
||||
#include "OscDlg.h"
|
||||
#include "Complex.h"
|
||||
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
|
||||
// CTestSimulatorDlg <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD>
|
||||
class CTestSimulatorDlg : public CDialogEx
|
||||
{
|
||||
// <20>غc
|
||||
public:
|
||||
CTestSimulatorDlg(CWnd* pParent = NULL); // <20>зǫغc<D8BA>禡
|
||||
|
||||
// <20><><EFBFBD>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_TESTSIMULATOR_DIALOG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV <20>䴩
|
||||
|
||||
private:
|
||||
std::vector <CBlockBasis*> m_vcBlkContainer; //<2F>s<EFBFBD>PBlock<63><6B>vector
|
||||
|
||||
CRect m_rcWork; //<2F>u<EFBFBD>@<40><>
|
||||
CRect m_rcClient; //<2F><><EFBFBD>ܲ<EFBFBD><DCB2>Ȥ<EFBFBD><C8A4><EFBFBD>
|
||||
CPoint m_ptLEnd; //<2F>s<EFBFBD>u<EFBFBD><75><EFBFBD>u<EFBFBD>q<EFBFBD><71><EFBFBD>I
|
||||
COscDlg* m_pOscDlg; //<2F>ܪi<DCAA><69><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
CDC m_dcBgPic; //<2F>s<EFBFBD><73><EFBFBD>I<EFBFBD><49><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD>dc
|
||||
CBitmap m_bitmapBgPic; //<2F>s<EFBFBD><73><EFBFBD>I<EFBFBD><49><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD>bitmap
|
||||
CBitmap* m_pOldBitmap; //<2F><><EFBFBD>V<EFBFBD><56>bitmap<61><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CString m_strPicPath; //<2F>I<EFBFBD><49><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>|
|
||||
COLORREF m_clrBg; //<2F>I<EFBFBD><49><EFBFBD>C<EFBFBD><43>
|
||||
|
||||
BOOL m_bInitDlg; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD>l<EFBFBD><6C>
|
||||
BOOL m_bSelectBlk; //<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
BOOL m_bMoveBlk; //<2F>P<EFBFBD>_Block<63><6B><EFBFBD><EFBFBD>
|
||||
BOOL m_bLineMode; //<2F>P<EFBFBD>_<EFBFBD>e<EFBFBD>u<EFBFBD>Ҧ<EFBFBD>
|
||||
BOOL m_bConnect; //<2F>P<EFBFBD>_<EFBFBD>s<EFBFBD>u
|
||||
BOOL m_bDelBlk; //<2F>P<EFBFBD>_Block<63>R<EFBFBD><52>
|
||||
BOOL m_bBgPic; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD>J<EFBFBD>I<EFBFBD><49><EFBFBD>Ϥ<EFBFBD>
|
||||
BOOL m_bGrid; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD>
|
||||
BOOL m_bLock; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD>w<EFBFBD><77><EFBFBD>I
|
||||
|
||||
int m_iWorkLeft; //<2F>u<EFBFBD>@<40>ϥ<EFBFBD><CFA5><EFBFBD><EFBFBD>y<EFBFBD><79>
|
||||
int m_iWorkTop; //<2F>u<EFBFBD>@<40>ϤW<CFA4><57><EFBFBD>y<EFBFBD><79>
|
||||
int m_iWorkRight; //<2F>u<EFBFBD>@<40>ϥk<CFA5><6B><EFBFBD>y<EFBFBD><79>
|
||||
int m_iWorkBottom; //<2F>u<EFBFBD>@<40>ϤU<CFA4><55><EFBFBD>y<EFBFBD><79>
|
||||
int m_iBlkWidth; //Block<63>e<EFBFBD><65>
|
||||
int m_iBlkHeight; //Block<63><6B><EFBFBD><EFBFBD>
|
||||
int m_iGridX; //X<><58><EFBFBD>V<EFBFBD><56><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int m_iGridY; //Y<><59><EFBFBD>V<EFBFBD><56><EFBFBD>I<EFBFBD><49><EFBFBD>j
|
||||
int m_iContainerSize; //<2F>s<EFBFBD><73>Block<63><6B>vector<6F>j<EFBFBD>p
|
||||
int m_iSlctBlkNum; //<2F><><EFBFBD><EFBFBD>Block<63>s<EFBFBD><73>
|
||||
int m_iHeadBlkNum; //<2F>s<EFBFBD><73>Block<63>s<EFBFBD><73>
|
||||
int m_iSimBlkNum; //<2F><><EFBFBD><EFBFBD>Block<63>s<EFBFBD><73>
|
||||
int m_iOutSize; //<2F><><EFBFBD><EFBFBD>Block<63><6B>channel<65>ƥ<EFBFBD>
|
||||
|
||||
// <20>{<7B><><EFBFBD>X<EFBFBD><58><EFBFBD>@
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// <20><><EFBFBD>ͪ<EFBFBD><CDAA>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>禡
|
||||
virtual BOOL OnInitDialog ();
|
||||
afx_msg void OnSysCommand (UINT nID, LPARAM lParam);
|
||||
afx_msg void OnPaint ();
|
||||
afx_msg HCURSOR OnQueryDragIcon ();
|
||||
DECLARE_MESSAGE_MAP ()
|
||||
public:
|
||||
std::deque <std::deque <double> > m_deq2DOutputValue; //<2F>s<EFBFBD><73>output value<75><65>deque
|
||||
BOOL m_bSimulate; //<2F>P<EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD>Ҧ<EFBFBD>
|
||||
int m_iStep; //<2F><><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD>B<EFBFBD><42>
|
||||
|
||||
afx_msg void OnBnClickedButtonIn ();
|
||||
afx_msg void OnBnClickedButtonOut ();
|
||||
afx_msg void OnBnClickedButtonAnd ();
|
||||
afx_msg void OnBnClickedButtonOr ();
|
||||
afx_msg void OnBnClickedButtonNot ();
|
||||
afx_msg void OnBnClickedButtonFunction ();
|
||||
afx_msg void OnBnClickedButtonLine ();
|
||||
afx_msg void OnBnClickedButtonSimulate ();
|
||||
afx_msg void OnBnClickedButtonGrid ();
|
||||
afx_msg void OnBnClickedButtonLock ();
|
||||
afx_msg void OnBnClickedButtonBgpic ();
|
||||
afx_msg void OnBnClickedButtonBgcolor ();
|
||||
afx_msg void OnBnClickedButtonOpen ();
|
||||
afx_msg void OnBnClickedButtonSave ();
|
||||
afx_msg void OnLButtonDown (UINT nFlags, CPoint ptCursor);
|
||||
afx_msg void OnMouseMove (UINT nFlags, CPoint ptCursor);
|
||||
afx_msg void OnLButtonUp (UINT nFlags, CPoint ptCursor);
|
||||
afx_msg void OnLButtonDblClk (UINT nFlags, CPoint point);
|
||||
afx_msg void OnTimer (UINT_PTR nIDEvent);
|
||||
afx_msg void OnSize (UINT nType, int cx, int cy);
|
||||
virtual BOOL PreTranslateMessage (MSG* pMsg);
|
||||
afx_msg void OnDestroy ();
|
||||
|
||||
void SplitString (CString, char, CStringArray&);
|
||||
void Resize (int nID, double dMulWid, double dMulHei);
|
||||
void Resize (CBlockBasis* pBlk, double dMulWid, double dMulHei);
|
||||
int GetComputationLayers (int iDataSize);
|
||||
double FFT (const std::deque <double> &, int, double);
|
||||
};
|
BIN
TestSimulator/res/TestSimulator.ico
Normal file
BIN
TestSimulator/res/TestSimulator.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
TestSimulator/res/TestSimulator.rc2
Normal file
BIN
TestSimulator/res/TestSimulator.rc2
Normal file
Binary file not shown.
BIN
TestSimulator/resource.h
Normal file
BIN
TestSimulator/resource.h
Normal file
Binary file not shown.
8
TestSimulator/stdafx.cpp
Normal file
8
TestSimulator/stdafx.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
// stdafx.cpp : <20>ȥ]<5D>t<EFBFBD>з<EFBFBD> Include <20>ɪ<EFBFBD><C9AA><EFBFBD><EFBFBD>l<EFBFBD>{<7B><><EFBFBD><EFBFBD>
|
||||
// TestSimulator.pch <20>|<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sĶ<73><C4B6><EFBFBD>Y<EFBFBD><59>
|
||||
// stdafx.obj <20>|<7C>]<5D>t<EFBFBD><74><EFBFBD><EFBFBD><EFBFBD>sĶ<73><C4B6><EFBFBD>O<EFBFBD><4F><EFBFBD>T
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
54
TestSimulator/stdafx.h
Normal file
54
TestSimulator/stdafx.h
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
// stdafx.h : <20>i<EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>ɤ<EFBFBD><C9A4>]<5D>t<EFBFBD>зǪ<D0B7><C7AA>t<EFBFBD><74> Include <20>ɡA
|
||||
// <20>άO<CEAC>g<EFBFBD>`<60>ϥΫo<CEAB>ܤ<EFBFBD><DCA4>ܧ<EFBFBD><DCA7><EFBFBD>
|
||||
// <20>M<EFBFBD>ױM<D7B1><4D> Include <20>ɮ<EFBFBD>
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // <20>q Windows <20><><EFBFBD>Y<EFBFBD>ư<EFBFBD><C6B0><EFBFBD><EFBFBD>`<60>ϥΪ<CFA5><CEAA><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // <20><><EFBFBD>T<EFBFBD>w<EFBFBD>q<EFBFBD><71><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CString <20>غc<D8BA>禡
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> MFC <20><><EFBFBD>ä@<40>DZ`<60><><EFBFBD>Υi<CEA5><69><EFBFBD><EFBFBD>ĵ<EFBFBD>i<EFBFBD>T<EFBFBD><54><EFBFBD><EFBFBD><EFBFBD>\<5C><>
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC <20>֤P<DFBB>зǤ<D0B7><C7A4><EFBFBD>
|
||||
#include <afxext.h> // MFC <20>X<EFBFBD>R<EFBFBD>\<5C><>
|
||||
|
||||
|
||||
#include <afxdisp.h> // MFC Automation <20><><EFBFBD>O
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC <20>䴩<EFBFBD><E4B4A9> Internet Explorer 4 <20>q<EFBFBD>α<EFBFBD><CEB1>
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC <20>䴩<EFBFBD><E4B4A9> Windows <20>q<EFBFBD>α<EFBFBD><CEB1>
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // <20>\<5C><><EFBFBD>ϩM<CFA9><4D><EFBFBD><EFBFBD><EFBFBD>C<EFBFBD><43> MFC <20>䴩
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
8
TestSimulator/targetver.h
Normal file
8
TestSimulator/targetver.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// <20>[<5B>W SDKDDKVer.h <20>i<EFBFBD>w<EFBFBD>q<EFBFBD>̰<EFBFBD><CCB0>i<EFBFBD>Ϊ<EFBFBD> Windows <20><><EFBFBD>x<EFBFBD>C
|
||||
|
||||
// <20>p<EFBFBD>G<EFBFBD>n<EFBFBD>w<EFBFBD><77><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65> Windows <20><><EFBFBD>x<EFBFBD>ظm<D8B8><6D><EFBFBD>ε{<7B><><EFBFBD>A<EFBFBD>Х[<5B>W WinSDKVer.h<>A
|
||||
// <20>æb<C3A6>[<5B>W SDKDDKVer.h <20><><EFBFBD>e<EFBFBD>N _WIN32_WINNT <20><><EFBFBD><EFBFBD><EFBFBD>]<5D><><EFBFBD>n<EFBFBD>䴩<EFBFBD><E4B4A9><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD>C
|
||||
|
||||
#include <SDKDDKVer.h>
|
Reference in New Issue
Block a user