You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.2 KiB
C++

//////////////////////////////////////////////////////////////////////////////
//文件 TraceCurveWnd.h
//主要功能:
//
//程序编写: 2005-12-07
/////////////////////////////////////////////////////////////////////////////
#pragma once
//#include "rect8.h"
//#include "ScreenXY.h"
#include "TraceContour.h"
namespace NImage
{
class AFX_EXT_CLASS CTraceCurveWnd
{
public:
CTraceCurveWnd(void);
virtual ~CTraceCurveWnd(void);
CTraceContour& GetImageTrace(void);
int GetScreenCurveWidth(void); //获得曲线像素宽度
double GetCurveWidth(void); //获得曲线实际宽度
void SetCurveWidth(double dWidth);
COLORREF GetCurveTraceColor(void);
void SetCurveTraceColor(COLORREF color);
void SetImage(CImageBase* pImage);
CImageBase* GetImage(void);
void SetDC(CDC* pDC);
CDC* GetDC(void);
void SetScreenXY(CScreenXY& csxy);
void SetImageRealPosition(double x0, double y0, double realWidth, double realHeight); //设置图像实际位置
virtual POINT OnLButtonDown(UINT nFlags, CPoint point);
virtual POINT OnLButtonUp(UINT nFlags, CPoint point);
virtual POINT OnMouseMove(UINT nFlags, CPoint point);
virtual BOOL OnKeyDown(UINT nChar);
int AddCurve(POSITION AddImageCurve(CCurve *pCurve));
void CancelCurrentTrace(void); //将当前追踪的点清空,为了重新追踪
void DrawTrace(void);
void DrawTrace(CDC& dc, CRect8& rect, COLORREF color);
//全自动矢量化
int AutoTraceAll(int nTraceMode, double pnt_error_tolerance, double min_polyline_lenght,
POSITION AddImageCurve(CCurve *pCurve));//nTraceMode=1:中心线, nTraceMode=2:双线
protected:
POINT ScreenToImage(POINT pointScreen); //屏幕坐标转换为图像坐标
CPoint2D ImageToReal(CPoint2D pointImage); //图像坐标转换为实际坐标
POINT ImageToScreen(POINT pointImage); //图像坐标转换为屏幕坐标
protected:
CTraceContour m_ImageTrace; //进行图像追踪
CDC* m_pDrawDC;
int loop;
POINT tracePoint[2];
COLORREF CurveTraceColor;
COLORREF CurveDeleteColor;
double UndoLong;
double m_dCurveWidth; //追踪曲线的宽度
public:
CScreenXY cs;
CRect8 m_rect; //位图显示位置对应的屏幕坐标
double x0; //图像实际位置(原点,高度,宽度)
double y0;
double rWidth;
double rHeight;
};
};