Смекни!
smekni.com

Разработка программного обеспечения для голосового управления трехмерными моделями функционирования промышленных роботов (стр. 17 из 17)

if(hspos>0)

hspos--;

break;

case SBRIGHT: hspos++;

break;

case SBLINELEFT: if(hspos>0) hspos--;

case SBLINEPJGHT: hspos++;

break;

case SBTHUMBPOSITION: hspos = nPos;

break;

case SBTFTUMBTRACK: hspos = nPos; break;

case SBPAGELEFT: if(hspos>0) hspos—;

break;

case SBPAGERIGHT.

hspos++;

break;}

CREATESTRUCT cs;

cs.cx =::GetSystemMetrics(SM_CXSCREEN);

SetScrollPos(SB_HORZ,hspos,TRUE);

curpos=hspos-curpos;

Scroll Window(-curpos* 10,0,NULL,NULL); CDialog::OnHScroll(nSBCode, nPos, pScrollBar);} CGraphicDlg::CGraphicDlg(CWnd* pParent /*=NULL*/): CDialog(CGraphicDlg::IDD, pParent)

(}

void CGraphicDlg..DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX);} BEGLN_MESSAGE_MAP(CGraphicDlg, CDialog)

ON_BN_CLICKED(IDC_GRAPHIC, OnGraphic) END MESSAGEJVIAP() void CRecordDlg::OnGraphicO (CGraphicDlg* a; a = new CGraphicDlgO; if(a!= NULL)

{ BOOL ret = a->Create(IDD_GRAPHIC,this); if(!ret)

AfxMessageBox("Error creating Dialog"); a->ShowWindow(S W_SHOW);} else AfxMessageBox("Error Creating Dialog Object");} void CGraphicDlg..OnGraphicQ

{ CClientDC dc(this);

dc.SelectObject(GetStockObject(WHITE_PEN));

for(int i=0; i<110;i++)

{ dc.MoveTo(10*i,0);

dc.LineTo(10*i,800);

dc.MoveTo(0,10*i);

dc.LineTo(1100,10*i);} dc.SelectObject(GetStockObject(BLACK_PEN)); dc.MoveTo(0,200); dc.LineTo(1100,200); m_pOutDev->Graphic(&dc);} CHammingDlg:.CHammingDlg(CWnd* pParent /*=NULL*/): CDialog(CHammingDlg::IDD, pParent)

0

void CHammingDlg.:DoDataExchange(CDataExchange* pDX)

{ CDialog.:DoDataExchange(pDX);}

BEGIN_MESSAGE_MAP(CHarnmingDlg, CDialog)

ON_BN_CLICKED(IDC_HAMMING, OnHamming) END_MESSAGE_MAP() void CRecordDlg::OnHamming() {CHammingDlg* a; a = new CHammingDlgO; if(a!=NULL)

{ BOOL ret = a->Create(roDJHAMMING,this);

ifTJret) ArxMessageBox("Error creating Dialog");

a->ShowWindow(SW_SHOW); } else AfxMessageBox("Error Creating Dialog Object");}

void CHammingDlg::OnHamming() (CClientDC dc(this);

dc.SelectObject(GetStockObject(WHITE_PEN));

for(inti=0; i<110;i-H-)

{ dc.MoveTo(10*i,0);

dc.LineTo(10*i,800); dc.MoveTo(0,10*i); dc.LineTo(l 100,10*i); } dc.SelectObject(GetStockObject(BLACK_PEN)); dc.MoveTo(0,250); dc.LineTo(l 100,250); m_pOutDev->ShowHamming(&dc);} void CRecordDlg::OnFilter() {CFilterDlg* a;

a = new CFilterDlg(); if(a!=NULL)

{ BOOL ret = a->Create(TDDJFILTER,this);

if(!ret) AfxMessageBox("Error creating Dialog");

a->ShowWindow(SW_SHOW);} else

AfxMessageBox("Error Creating Dialog Object");} CFurjeDlg::CFurjeDlg(CWnd* pParent /*=NULL*/): CDialog(CFurjeDlg::TDD, pParent)

{}

void CFurjeDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX);} BEGIN_MESSAGE_MAP(CFurjeDlg, CDialog)

ON_BN_CLICJQED(IDC_FURJE, OnFurje) ENDMESSAGEMAPQ

void CRecordDlg::OnFurje() {CFurjeDlg* a; a = new CFurjeDlgQ; if(a!=NULL)

{ BOOL ret = a->Create(lDD_FURJE,this); if(!ret) AfxMessageBox("Error creating Dialog");

a->ShowWindow(SW_SHOW); } else AfxMessageBox("Error Creating Dialog Object");} void CFurjeDlg::OnFurje() {CClientDC dc(this);

dc.SelectObject(GetStockObjectOVHITE_PEN));

for(inti=0; i<110;i++)

{ dc.MoveTo(10*i,0);

dc.LineTo(10*i,800);

dc.MoveTo(0,10*i);

dc.LineTo(1100,10*i); } dc.SelectObject(GetStockObject(BLACK_PEN)); dc.MoveTo(0,250); dc.LineTo(l 100,250); m jpOutDev->ShowFurje(&dc);} CObrFurjeDlg::CObrFurjeDlg(CWnd* pParent /*=NULL*/): CDialog(CObrFurjeDlg::IDD, pParent)

{}

void CObrFurjeDlg.:DoDataExchange(CDataExchange* pDX)

{ CDialog::DoDataExchange(pDX);}

BEGINMESS AGEM AP(CObrFurj eDlg, CDialog)

ON_BN_CLICBCED(IDC_OBRJFURJE, OnObrfurje) END_MESSAGE_MAP() void CRecordT>lg::OnObrfurje() {CObrFurjeDlg* a; a = new CObrFurjeDlg(); if(a!=NULL)

{ BOOL ret = a->Create(IDD_OBRFURJE,this);

if(!ret) AfxMessageBox("Error creating Dialog");

a->ShowWindow(SW_SHOW); } else

AfkMessageBox("Error Creating Dialog Object");} void CObrFurjeDlg::OnObrfurje() {CClientDC dc(this);

dc.SelectObject(GetStockObject(WHITE_PEN));

for(int i=0; i<l 10;i++)

{ dc.MoveTo(10*i,0);

dc.LineTo(10*i,800);

dc.MoveTo(0,10*i);

dc.LineTo(1100,10*i); } dc.SelectObject(GetStockObject(BLACK_PEN)); dc.MoveTo(0,250); dc.LineTo(l 100,250); m_pOutDev->ShowObrFurje(&dc);} CClipDlg::CClipDlg(CWnd* pParent /*=NULL*/): CDialog(CClipDlg::IDD, pParent)

{}

void CClipDlg..DoDataExchange(CDataExchange* pDX) { CDialog..DoDataExchange(pDX);} BEGIN_MESSAGE_MAP(CClipDlg, CDialog)

ON_BN_CLICKED(IDC_CLIP, OnClip) ENDMESSAGEMAPQ void CRecordDlg::OnClip() {CClipDlg* a; a = new CClipDlgQ; if(a!=NULL)

{ BOOL ret = a->CreateODD_CLIP,this); itXIret) AfxMessageBox("Error creating Dialog"); a->ShowWindow(SW_SHOW); } else AfxMessageBox("Error Creating Dialog Object");} void CClipDlg::OnClip() {CClientDC dc(this);

dc.SelectObject(GetStockObject(WHITE_PEN));

for(inti=0;i<llO;i++)

{ dc.MoveTo(10*L0);

dc.LineTo(10*i,800);

dc.MoveTo(0,10*i);

dc.LineTo(1100,10*i); } dc.SelectObject(GetStockObject(BLACK_PEN)); dc.MoveTo(0,100); dc.LineTo(l 100,100); m__pOutDev->ShowClip(&dc);}

// animate.h: header file #include <mmsystem.h> #include "OutDialog.h" /Mnclude "recorddl.h" #include "resource.h" #include <complex> using namespace std; class CDIB. public CObject { DECLARESERIAL(CDIB) public: CD1B0; ~CDIB();

BITMAPFNFO *GetBitmapInfoAddress()

{return m_pBMI;} void *GetBitsAddress()

{return m_pBits;} RGBQUAD *GetClrTabAddress()

{return (LPRGBQUAD)(((BYTE *)(m_pBMI)) + sizeof(BITMAPINFOHEADER));} int GetNumClrEntries();

BOOL Create(int width, int height, CPalette* pPal = NULL); BOOL Create(int width, int height,

HP ALETTE hPal);

BOOL Create(BITMAPrNFO* pBMI, BYTE* pBits, BOOL bOwnBits = FALSE); BOOL Create(BITMAPINFO* pPackedDTB); void *GetPixelAddress(int x, int y); int GetBitsPerPixelO

{return m_pBMI->bmiHeader.biBitCount;} virtual BOOL Load(const char* pszFileName = NULL); virtual BOOL Load(CFile* fp); virtual BOOL Load(WORD wResid); virtual BOOL Save(const char* pszFileName = NULL); virtual BOOL Save(CFile *fp);

virtual void Serialize(CArchive& ar); virtual void Draw(CDC *pDC, int x, int y); virtual void DrawfHDC hDC, int x, int y); virtual int GetWidthO (return DibWidth();} virtual int GetStorageWidth() (return StorageWidthQ;} virtual int GetHeight() (return DibHeight();} virtual BOOL MapColorsToPalette(CPalette *pPal); virtual BOOL MapColorsToPalette(HPALETTE hPal); virtual void GetRect(RECT* pRect);

virtual void CopyBits(CDIB* pDIB, int xd, int yd,int w, int h, int xs, int ys,COLORREF

clrTrans = OxFFFFFFFF);

virtual void StretchBits(CDIB* pDIB, int xd, int yd.int wd, int hd, int xs, int ys, int ws,

int hs,COLORREF clrTrans = OxFFFFFFFF);

virtual void DoubleBits(CDIB* pDIB, int xd, int yd,int xs, int ys, int ws, int

hs,COLORREF clrTrans = OxFFFFFFFF);

BOOL SetColorTable(CPalette* pPal); static BOOL IsWinDffi(BITMAPrNFOHEADER* pBIH); static int NumDIBColorEntries(BITMAPINFO* pBmpInfo); protected:

BITMAPINFO *m_pBMI; BYTE *m_pBits; BOOL mbMyBits; private:

int DibHeightO

(return m_pBMI->bmiHeader.biHeight;} int DibWidthQ

(return m_pBMI->bmiHeader.biWidth;} int StorageWidthO

(return (((m_pBMI->bmiHeader.biWidth * m_pBMI->bmiHeader.biBitCount)}}; class CDIBPal. public CPalette (public:

CDIBPalO;

~CDIBPal();

BOOL Create(CDIB *pDIB);

BOOL Create(BITMAPINFO* pBMI);

BOOL Create(RGBQUAD* pRGB, int iClrs);

void Draw(CDC *pDC, CRect *pRect, BOOL bBkgnd = FALSE);

void Draw(HDC hDC, RECT* pRect, BOOL bBkgnd = FALSE);

int GetNumColorsQ;

BOOL SetSysPalColors();

BOOL Load(const char* pszFileName = NULL);

BOOL Load(CFile* fp);

BOOL Load(UINT hFile);

BOOL Load(HMMIO hmmio);

BOOL Save(const char* pszFileName = NULL);

BOOL Save(CFile* fp);

BOOL SavefUTNT hFile);

BOOL Save(HMMIO hmmio);

BOOL CreateWash();

BOOL CreateSystemColorPaletteO;}; typedef HDC (WLNGAPI WinGCreateDCProc)(void); typedef HBITMAP (WLNGAPI WinGCreateBitmapProc)(HDC WinGDC,

const BITMAPINFO* pHeader, void** ppBits);

typedef UINT (WLNGAPI WinGSetDIBColorTableProc)(HDC WinGDC,

UINT Startlndex,

UINT NumberOfEntries,

const RGBQUAD* pCoIors);

typedef BOOL (WLNGAPI WinGBitBlfProc)(HDC hdcDest, int nXOriginDest,int

nYOriginDest, int nWidthDest,int nHeightDest,HDC hdcSrc, int nXOriginSrc,

int nYOriginSrc);

typedef BOOL (WINGAPI WinGStretchBltProcXHDC hdcDest, int

nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest, HDC hdcSrc,irt

nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc);

class CDIBSurface: public CDIB { DECLARE_SERIAL(CDrBSurface) public: CDIBSurfaceQ; -CDIBSurfaceO; public:

CDC* GetDCO {return &m_dcBuffer;} HDC GetHDCQ {return (HDC) m_dcBuffer.GetSafeHdc();} public:

BOOL Create(int cx, int cy, CPalette* pPal = NULL); BOOL Create(int width, int height, HP ALETTE hPal); void BitBlt(CDC* pDC, int xd, int yd, int w, int h,

int xs, int ys); void BitBlt(HDC hDC, int xd, int yd, int w, int h,

int xs, int ys);

void StretchBlt(CDC* pDC, int xd, int yd, int wd, int hd,

int xs, int ys, int ws, int hs); void Draw(CDC* pDC); void Draw(HDC hDC, int x, int y); void SefPalettelCPalette* pPal);

BOOL Load(const char* pszFileName = NULL);

BOOL MapColorsToPalette(CPalette *pPal);

BOOL MapColorsToPalette(HPALETTE hPal); protected:

CPalette* m_pPal;

HP ALETTE m_hPal;

CDC m_dcBuffer; private:

static BOOL mbUseCreateDIBSection;

static BOOL mbUseWinG;

static WinGCreateDCProc* m_pWinGCDCProc;

static WinGCreateBitmapProc* m_pWinGCBProc;

static WinGSetDIBColorTableProc* m_pWinGSDCTProc;

static WinGBitBltProc* mjpWinGBBProe;

static WinGStretchBltProc* m_pWinGSBProc;

HBITMAP mhbmBufFer;

HBITMAP mhbmOld;

static BOOL CDIBSurface::TestPlatform();}; class COSBView: public CScrollView {protected:

COSBViewQ;

DECLAREDYNCREATE(COSBView) public:

CDocument* GetDocumentO; CDIB* GetDffiO {return m_pDIBSurf;} CDIBPal* GetPaletteQ {return m_pPal;} CDC* GetBufferDCO; public:

BOOL Create(CDIB* pDIB); BOOL Create(int w, int h, CPalette* pPal); void Draw(CRect* pClipRect = NULL); virtual void RenderfCRect* pClipRect = NULL) {return;} void AddDirtyRegion(CRect* pRect); void RenderAndDrawDirtyListO; public: virtual -COSBViewQ; virtual void OnDraw(CDC* pDC); virtual void OnInitialUpdate(); virtual void OnUpdate{CView* pSender,

LP ARAM Hint,

CObject* pHint);

virtual void AssertValid() const;

virtual void Dump(CDumpContext& dc) const; protected:

CDIBSurface* mjpDIBSurf;

CDffiPal* m_pPal; private:

CObList mDirtyList;

void EmptyDirtyList(); protected:

afxmsg void OnPaletteChanged(CWnd* pFocusWnd);

afxmsg BOOL OnQueryNewPalette();

afxmsg BOOL OnEraseBkgnd(CDC* pDC);

DECLAREMESSAGEMAPO}; inline CDocument* COSBView::GetDocument()

{ return (CDocument*) m_pDocument; } class CSprite;

class CSpriteNotifyObj: public CObject {public:

enum CHANGETYPE { ZORDER =0x0001, POSITION =0x0002, IMAGE 0x0004 };

public:

virtual void Change(CSprite *pSprite,CHANGETYPE change, CRect*

pRectl = NULL, CRect* pRect2 = NULL) = 0;};

class CSprite: public CDBB { DECLARE_SERIAL(CSprite) public:

CSprite();

~CSprite();

virtual int GetXQ { return m_x;} // get x

virtual int GetY() { return m_y;} // get y

virtual int GetZ() { return m_z;} // get z order

virtual void Render(CDIB* pDIB, CRect* pClipRect = NULL);

virtual BOOL HitTest(CPoint point);

virtual void SetPosition(int x, int y);

virtual void SetZ(int z);

virtual void SetNotificationObject(CSpriteNotifyObj* pNO)

{m_pNotifyObj = pNO;} virtual void Serialize(CArchive& ar); virtual BOOL Load(CFile *fp); virtual BOOL Load(char *pszFileName = NULL); virtual BOOL Load(WORD wResid);

Формат Зона Поз. Позначення Назва Кільк. Примітка
1 ГЮИК. 505330.002 ПЗ Текстові документи
Пояснювальна записка 1 ___
арк. ф.А.4
Графічні документи
Елементи текстів програмного коду
файл формату *.doc 1 __ арк. ф.
А4
Демонстраційний графічний матеріал
у вигляді презентації, файл формату 1 __ арк. ф.
*.ppt А4
ГЮИК. 505330.002ВД
№ докум Підп. Дата
Виконав Голосове керування тривимірними моделями функціонування ПРвідомість дипломної роботи Літера Аркушш Аркушів
Перевір. 1
Н.контр. ХНУРЕКАФЕДРА ТАВР
Затв. Невлюдов