FractalView.h
资源名称:Fractal.rar [点击查看]
上传用户:dxkjfz
上传日期:2021-06-06
资源大小:1930k
文件大小:3k
源码类别:
分形几何
开发平台:
Visual C++
- // FractalView.h : interface of the CFractalView class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_FRACTALVIEW_H__936474E6_41E8_4F92_A03D_AE280DDC51F4__INCLUDED_)
- #define AFX_FRACTALVIEW_H__936474E6_41E8_4F92_A03D_AE280DDC51F4__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- class CFractalView : public CView
- {
- public: //class defination
- /* 分行树 */
- class FractalTree{
- public:
- //定时器间隔,单位毫秒
- int m_Interval;
- //记录定时器是否在工作
- BOOL m_bRunning;
- };
- /* Sierpinski三角形 */
- class Sierpinski{
- public:
- int m_Interval;
- BOOL m_bRunning;
- };
- /* 万花筒 */
- class Flower{
- public:
- int m_Interval;
- BOOL m_bRunning;
- };
- /* 王冠 */
- class Crown{
- public:
- int m_Interval;
- BOOL m_bRunning;
- float m_C;
- COLORREF m_pColor;
- double cx,cy;
- double x,y;
- double wx,wy;
- double theta;
- int i;
- float rnd;
- int m,n;
- double r;
- BOOL stop;
- CDC memdc;
- BOOL ondraw;
- float cxspeed;
- float cyspeed;
- float cxmin;
- float cxmax;
- float cymin;
- float cymax;
- int cxdirect;
- int cydirect;
- int count;
- int cnt;
- };
- protected: // create from serialization only
- CFractalView();
- DECLARE_DYNCREATE(CFractalView)
- // Attributes
- public:
- CFractalDoc* GetDocument();
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CFractalView)
- 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:
- virtual ~CFractalView();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- FractalTree tree;
- Sierpinski sier;
- Flower flower;
- Crown crown;
- BOOL m_dir;
- /************************************************************************/
- //画笔
- CPen m_Pen;
- //前景颜色
- COLORREF m_fgColor;
- //背景颜色
- COLORREF m_bgColor;
- //物理画布
- CDC m_DC;
- //内存位图
- CBitmap m_Bitmap;
- //内存画布
- CDC m_MemDC;
- //窗口客户区大小
- CRect m_Rect;
- /************************************************************************/
- HICON m_hIcon;
- //绘制树叶
- void drawLeaf(double x, double y, double L, double a,float B,float C);
- //Sierpinski
- void sier_ifs(CDC *pDC, float k);
- //万花筒
- void flower_ifs(CDC *pDC, float k);
- //王冠
- void drawCrown();
- // Generated message map functions
- protected:
- //{{AFX_MSG(CFractalView)
- afx_msg void OnDrawtree();
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg void OnDrawstop();
- afx_msg void OnDrawsierpinski();
- afx_msg void OnDrawflower();
- afx_msg void OnDrawcrown();
- afx_msg void OnDrawnew();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- #ifndef _DEBUG // debug version in FractalView.cpp
- inline CFractalDoc* CFractalView::GetDocument()
- { return (CFractalDoc*)m_pDocument; }
- #endif
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_FRACTALVIEW_H__936474E6_41E8_4F92_A03D_AE280DDC51F4__INCLUDED_)