Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Построение выпуклой оболочки в режиме реального времени / Source / CHRealTimeView
.h// CHRealTimeView.h : interface of the CCHRealTimeView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHREALTIMEVIEW_H__F8E9BCE5_3FED_4672_AB1F_E409AB332223__INCLUDED_)
#define AFX_CHREALTIMEVIEW_H__F8E9BCE5_3FED_4672_AB1F_E409AB332223__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
#include "randomizesearchtree.cpp"
#include "Serialization.h"
#include "CHHelp.h"
namespace CHRealTimeSpace
{
using namespace std;
using namespace SubsidiaryClasses;
using namespace RandomTree;
typedef RandomizeSearchTree <TPoint>::iterator t_TreeIter;
class CCHRealTimeView : public CView
{
protected: // create from serialization only
CCHRealTimeView();
DECLARE_DYNCREATE(CCHRealTimeView)
// Attributes
public:
CCHRealTimeDoc* GetDocument();
vector<CPoint> Points;
vector<CPoint> OpenPoints;
vector<CLine> Convex_hull;
vector<StepStruct *> stepstruct;
int distribution;
bool generating;
int ClientX;
int ClientY;
CMenu m_Menu;
int TimerValue;
bool Animation;
bool Opening;
int Step;
int OpenNum;
CStatusBar *p_SB;
CBitmap *bmp[9];
CToolBar *m_ToolBar;
CRect ClientTree;
CRect ClientPoints;
CRect ClientBmp;
int Mxx;
int Myy;
TTree *tree,*stree,*ltree,*rtree;
RandomizeSearchTree<TPoint> RST;
RandomizeNode<TPoint> *CurrNode;
bool m_bCenterGenerating; // Происходит генерация с центрическим распределением
bool m_bRectGenerating; // Происходит генерация с распределением в прямоугольнике
bool m_bValueGenerating; // Происходит генерация с распределением в круге
bool m_bSituation; // Показывать ли изображение текущей ситуации
bool m_bSituationEnabled; // Скрыта ли кнопка "Показывать ситуацию"
bool m_bIsFirstExecute; // Первый запуск функции OnPaint
CString MyName;
int m_iMinR, m_iMaxR, m_iWid, m_iStep, m_iNumPoints, m_iCurrR;
int m_iNumGenPoints;
void DeleteTree(TTree * parent)
{
if(!parent) return;
if(parent->lchild)
DeleteTree(parent->lchild);
if(parent->rchild)
DeleteTree(parent->rchild);
if(parent->val) delete parent->val;
delete parent;
}
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCHRealTimeView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
CPoint Rovn(int Mx, int My, double sigmaX,double sigmaY);
void OnInitialUpdate();
//РЕФАКТОРИНГ TPoint* -> TPoint
int Situation(RandomizeNode<TPoint> *m, RandomizeNode<TPoint> *M,CPoint p);
//РЕФАКТОРИНГ TPoint* -> TPoint
bool Search(RandomizeNode<TPoint> *root,TTree *troot, CPoint p);
//РЕФАКТОРИНГ TPoint* -> TPoint
RandomizeNode<TPoint> * Left_Search(RandomizeNode<TPoint> *root, TTree *troot, CPoint p);
//РЕФАКТОРИНГ TPoint* -> TPoint
RandomizeNode<TPoint> * Right_Search(RandomizeNode<TPoint> *root,TTree *troot, CPoint p);
StepBack();
ShowStep(int stage,int situation, TTree *subtree,TTree *seltree);
SaveAs();
Open();
InsertNewPoint(CPoint point);
FExport();
DrawTree();
DrawPoints();
void Create_Convex_hull(CPoint point);
void Clear();
void OnPaint2();
void AutoSave(bool wasErr = false);
void AutoLoad();
void SaveToBmpFile(CString MyName); // сохранение картинки
int PointSurLine(CPoint p);
virtual ~CCHRealTimeView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CCHRealTimeView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnCancelMode();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCaptureChanged(CWnd *pWnd);
afx_msg void OnPaint();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void Generate();
afx_msg void Animate();
afx_msg void NextStep();
afx_msg void OnFileOpen();
afx_msg void OnFileSave();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnUpdateGenerateRect(CCmdUI* pCmdUI);
afx_msg void OnUpdateGenerateCenter(CCmdUI* pCmdUI);
afx_msg void OnGenerateCenter();
afx_msg void OnGenerateRect();
afx_msg void OnUpdateGenerateCenterTool(CCmdUI* pCmdUI);
afx_msg void OnUpdateGenerateRectTool(CCmdUI* pCmdUI);
afx_msg void LeftTree();
afx_msg void RightTree();
afx_msg void UpTree();
afx_msg void GoRoot();
afx_msg void OnGenerateValueTool();
afx_msg void OnUpdateGenerateValueTool(CCmdUI* pCmdUI);
afx_msg void OnPriority();
afx_msg void OnUpdatePriority(CCmdUI* pCmdUI);
afx_msg void OnSituation();
afx_msg void OnUpdateSituation(CCmdUI* pCmdUI);
afx_msg void OnUpdateGo(CCmdUI* pCmdUI);
afx_msg void OnGenerateValue();
afx_msg void OnUpdateGenerateValue(CCmdUI* pCmdUI);
afx_msg void OnCHHelp();
afx_msg void OnUpdateStep(CCmdUI* pCmdUI);
afx_msg void OnUpdateTree(CCmdUI* pCmdUI);
afx_msg void SaveToBmp();
afx_msg void OnPause();
afx_msg void OnUpdatePause(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
bool m_bPauseIsPress;
};
#ifndef _DEBUG // debug version in CHRealTimeView.cpp
inline CCHRealTimeDoc* CCHRealTimeView::GetDocument()
{ return (CCHRealTimeDoc*)m_pDocument; }
#endif
}
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHREALTIMEVIEW_H__F8E9BCE5_3FED_4672_AB1F_E409AB332223__INCLUDED_)
Соседние файлы в папке Source