#pragma once #include "itemfocusrect.h" namespace NItem { #define CURVE_NULL_EMBELLISH 1 //空修饰 #define CURVE_SET_EMBELLISH 2 //设置修饰 #define CURVE_CONTOUR 3 //根据等值线值设置等值线颜色 #define CURVE_AUTO_LOCATION 4 //自动计算查桩号 #define CURVE_REVERSAL 5 //曲线反转顺序 #define CURVE_SET_NAME 6 //设置曲线名称 #define CURVE_NAME_TO_Z 7 //名称变为Z值 #define CURVE_Z_TO_NAME 8 //Z值变为名称 #define CURVE_NAME_LOG 9 //对曲线名称取对数 #define CURVE_NAME_EXPONENTIAL 10 //对曲线名称取指数 #define CURVE_NAME_IS_NULL 11 //发现名称为空的曲线 #define CURVE_ANY_NAME 12 //曲线任意处上名字 #define ARC_TO_CURVE 13 //圆弧到曲线 #define CURVE_SMOOTH 14 //光滑曲线 #define CURVE_TO_WAVE 15 //波浪线 #define CURVE_OFFSET 16 //平行线 #define CURVE_NODE_ENCRYPT 17 //曲线节点加密 #define CURVE_REDUNDANT 18 //曲线冗余 #define CURVE_CLOSE 19 //曲线闭合首尾 #define CURVE_LAYER_TO_NAME 20 //类别变为名称 #define CURVE_AUTO_LINK 21 //曲线自动连接,主要针对打开CGM文件后其线条断开的情况 #define CURVE_FITTING 22 //曲线拟合,将指定散点拟合为一条曲线 #define CURVE_SURFACE_Z 23 // 由曲面Z值设置曲线Z值 class CItemCurveProcess : public CItemFocusRect { public: CItemCurveProcess(CSigmaDoc * ppDoc); virtual ~CItemCurveProcess(void); void OnDraw(CXyDC* pDC) override; void OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk) override; void OnRButtonDown(UINT nFlags, CPoint point) override; BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) override; void DoLButtonUp(CDC *pDC) override; //加密节点 //mode 0--加密时保留已有节点 1--根据步长重新生成节点 //bRounding true 根据步长取整 bool NodeEncrypt(int mode, double step, bool bRounding, CPositionList & selectionSet); int PolygonConnect(CPositionList& selections, CString& layerName, bool deleteOriginalCurves); /** * 消除曲线拐点 * * \param tolerance * \param selectionSet * \return */ bool ToRedundant(double tolerance, CPositionList & selectionSet); //光滑曲线 //mode 0--B样条 1--三次样条 bool SmoothCurve(int mode, double step, CPositionList & selecctionSet); int SetProcessIdea(int nIdea); CString name; int GetProcessResult() { return m_processResult; } void SetCurveStyle(CHowToViewCurve& curveStyle); //函数功能:将圆弧转变成曲线 //参数说明:step 步长 // bDeletion 是否删除原始元素 //返回值: int ArcToCurve(CPositionList & select, double step); void SetCurveName(CString curveName, CPositionList & selectionSet); std::string FindNameIsNull(CPositionList & selecctionSet); protected: int SetNullEmbellish(void); int SetEmbellish(void); int CurveContour(void); int AutoLocation(void); int Reversal(void); int SetName(void); int NameToZ(void); int SetZFromSurface(void); int ZToName(void); int LayerToName(void); int NameLog(void); int NameExponential(void); int AnyName(void); int CurveSmooth(void); int CurveOffset(void); int NodeEncrypt(void); int ToRedundant(void); int CloseCurve(void); int ToWave(void); POSITION SelectOneCurve(UINT nFlags, CPoint point); int m_idea; //处理方式 CColorBase* m_pColor; double a; long decimal; BOOL m_bIsE; bool m_bIsLog; int m_selSmooth; //平滑曲线的方式,0为S样条,1为B样条 BOOL m_bIsDelete; //波浪线 cycle=采样周期,swing=振幅,dnum=一周期内采样点个数 double cycle; double swing; long dnum; BOOL m_bDeleteSourveCurve; double m_dCurveOffset; //节点加密 int m_nMode; double m_dStep; BOOL m_bInteger; //是否根据步长取整 //曲线冗余,曲线连接 double m_error; int m_processResult; CHowToViewCurve m_CurveStyle; public: int AutoLinkCurve(double maxError = 1E-5, bool onlySameName = false); int GetNextLinkCurve(CPositionList& select, void* pActionList, double maxError, bool onlySameName); int FittingCurve(void); }; };