Скачиваний:
17
Добавлен:
01.05.2014
Размер:
3.37 Кб
Скачать
// RegionSearchDoc.h : interface of the CRegionSearchDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_REGIONSEARCHDOC_H__163088E1_9BD7_4652_B957_CE6293002DB1__INCLUDED_)
#define AFX_REGIONSEARCHDOC_H__163088E1_9BD7_4652_B957_CE6293002DB1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Trees.h"
class CRegionSearchDoc : public CDocument
{
protected: // create from serialization only
	CRegionSearchDoc();
	DECLARE_DYNCREATE(CRegionSearchDoc)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRegionSearchDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CRegionSearchDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CRegionSearchDoc)
	afx_msg void OnGeneratePoints();
	afx_msg void OnBuildTree();
	afx_msg void OnSearch();
	afx_msg void OnUpdateSearch(CCmdUI* pCmdUI);
	afx_msg void OnUpdateBuildTree(CCmdUI* pCmdUI);
	afx_msg void OnBuildstep();
	afx_msg void OnUpdateBuildstep(CCmdUI* pCmdUI);
	afx_msg void OnOptions();
	afx_msg void OnSearchStep();
	afx_msg void OnUpdateSearchStep(CCmdUI* pCmdUI);
	afx_msg void OnSaveScreen();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

public:
	std::vector<Point> Points;
	
	RegionTree* Tree;

	
	bool IsRegionDisplayed() const;
	CRect GetRegion() const;

	const std::list<Point>& GetResult() const {return Result;}

	void StartEnterRegion(CPoint p);
	void ContinueEnterRegion(CPoint p);
	void EndEnterRegion(CPoint p);

	void EnterPoint(CPoint p);

	int GetBuildStepCounter() const { return BuildStepCounter; }
	const std::list<SearchStep>& GetSearchSteps() const { return SearchSteps; }

	BOOL GetShowNumbers() const {return ShowNumbers; }
	BOOL GetShowPoints() const { return ShowPoints; }
	BOOL GetShowSegments() const { return ShowSegments; }
	BOOL GetShowNodes() const { return ShowNodes; }
	int GetLevelCount() const { return LevelCount; }

	int GetWidth() const { return MaxX+2*MinX; }
	int GetHeight() const { return MaxY+2*MinY; }
private:
	std::list<Point> Result;
	
	enum {RegionEntered, RegionNotEntered, RegionEntering} RegionState;

	CRect Region;
	
	void RedrawRegion();

	int BuildStepCounter;
	bool IsTreeBuilt() const;
	void OnFinishBuild() const;

	//последовательность показанных шагов поиска
	std::list<SearchStep> SearchSteps;
	std::list<SearchStep>::const_iterator CurStep;
	void ResetSearch();
	void OnFinishSearch();
	bool IsSearchInProgress() const;

	bool CanBuildTree() const;

	void DeleteTree();

	BOOL ShowNumbers;
	BOOL ShowPoints;
	BOOL ShowSegments;
	BOOL ShowNodes;
	int LevelCount;

	static const int MaxX;
	static const int MinX;
	static const int MaxY;
	static const int MinY;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_REGIONSEARCHDOC_H__163088E1_9BD7_4652_B957_CE6293002DB1__INCLUDED_)
Соседние файлы в папке Source