#if !defined(__RV_GAUGE_H_INCLUDED_)
#define __RV_GAUGE_H_INCLUDED_


#ifdef GAUGE_EXPORTS
#define GAUGE_API __declspec(dllexport)
#else
#define GAUGE_API __declspec(dllimport)
#endif

#include <sst\ucb.h>
#include <cali\AreaCal.h>
#include <sst\diskhelper.h>
 

#define RV_UC_EDGE_DISTANCE    (RV_UC_GAUGE + 1)
#define RV_UC_EDGE_GAUGE       (RV_UC_GAUGE + 2)  //
//#define RV_UC_ZERO_POS         (RV_UC_GAUGE + 2) //已经转成INDICATER
//#define RV_UC_REFER_POS        (RV_UC_GAUGE + 3) //已经转成INDICATER
#define RV_UC_SYMMETRY_CHECK   (RV_UC_GAUGE + 4)
#define RV_UC_PART_SPACE       (RV_UC_GAUGE + 5)
#define RV_UC_CORNER_PROBE     (RV_UC_GAUGE + 6)
#define RV_UC_LINE_DETECT      (RV_UC_GAUGE + 7)
#define RV_UC_CIRCLE_DETECT    (RV_UC_GAUGE + 8)
#define RV_UC_MEASURE_SEG      (RV_UC_GAUGE + 9)

#define RV_UC_EDGE_PROBE       (RV_UC_GAUGE + 10)  //based on edge gauge
#define RV_UC_RIM_PROBE        (RV_UC_GAUGE + 11)
#define RV_UC_EDGE_COLLECT     (RV_UC_GAUGE + 12)  //based on edge gauge
#define RV_UC_BODY_PROBE       (RV_UC_GAUGE + 13)







//11 -> 6 by hdy on20190909
#define RV_MAX_GAUGE_SHRINGK_LEN    3

#define  RV_G_MIN_ARC_EDGE_POINT_COUNT   6
#define  RV_G_MIN_LINE_EDGE_POINT_COUNT  4

#define  RV_G_MAX_GAUGE_IMG_SZE       2592*4
 
#define LD_ENDPOS_COUNT  2

#define RV_GAUGE_BORDER_COLOR   GRGB(0, 0, 255)
#define RV_GAUGE_BODY_COLOR     GRGB(123, 0, 0)


typedef struct __cd_result_
{
	double     ratio; // 圆度
	double     radius;//半径
	RvPoint_f64 center;//中心
}CD_RESULT;
 

RvImage ScaleImageByLevel(RvImage image, int  level, int maxsize, double* pRatio);
 
//目前仅用于line detect
BOOL  GetEdgePoints(RvCut cut, RvPoint_f64* pArray, int& nSize);
BOOL  GetCornerEdgePoints(RvCut cut, RvPoint_f64* pArray1, int& nSize1, RvPoint_f64* pArray2, int& nSize2);

//将主方向的突出部位过滤掉,该函数与filter_spurs函数的效果其实是一样的，只是方向不一样而已。
//参数：cut - 切刀
//      pathcnt - 切刀的路线数量
//      pathidx - 当前路线的索引值
//      curPathPos - 当前路线中当前点位置(索引)
//      minlen  - 部位的最小尺寸（长度或宽度，其实是一条小的长度）
//      gap   -   采样宽度
 void  filter_protrusion(RvCut cut, int pathcnt, int pathIdx, int curPathPos, int minlen, int gap/*, BOOL bLeft*/);

 void filter_spurs(RvCut cut, /*GSize _zoneSize,*/ int spurWidth);


 BOOL   GAUGE_API filter_image_by_contour(RvImage image, int maxNum, int  selectBy, BOOL bFilling=FALSE);

#endif
