⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 painterfacade.h

📁 神经网络中的无监督学习中的SOM学习算法
💻 H
字号:
#ifndef _PAINTER_FACADE_H__
#define _PAINTER_FACADE_H__

#define BASE_UNIT 20.0

class CPointf
{
public:
    CPointf(){x = 0.0; y = 0.0;}
    CPointf(double xval, double yval):x(xval), y(yval){}
    double x;
    double y;
};

/*************************************************************************
  some draw methods which map the points of math coordinates to logical ones      
  notice that this class never change the properties the device content,
  and user must set its properties outside this class                   
/*************************************************************************/

class PainterFacade
{
public:
    PainterFacade(CRect& logicalRect, double dbBaseUnit = BASE_UNIT)
        :m_logicalRect(logicalRect), 
         m_dbBaseUnit(dbBaseUnit){};
    
    /* map the points of math coordinates to logical ones */
    int MPtoLP(const CPointf *pSrcPf, CPoint *pDstP);

    /* the inverse function of MPtoLP */
    int LPtoMP(const CPoint *pSrcP, CPointf *pDstPf);

    /* draw the math coordinate */
    int DrawCoordinate(CDC *pDC);

    /* draw point use method of draw ellipse */
    int DrawPoint(CDC *pDC, const CPointf *pf);

    /* draw point use method of draw line */
    int DrawPoint(CDC *pDC, const CPointf *pf, int nPointUnit);

    /* draw a line for the linear formula ax + by + c = 0 */
    int DrawLine(CDC* pDC, double a, double b, double c);
 
    int DrawEllipse(CDC* pDC, const CPointf *pf, int a, int b);

    const CRect &GetRect() { return m_logicalRect; }
private:
    CRect m_logicalRect;
    double m_dbBaseUnit;
};

#endif /* _PAINTER_FACADE_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -