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.
96 lines
3.3 KiB
C++
96 lines
3.3 KiB
C++
#pragma once
|
|
#include "itemcurve.h"
|
|
#include ".\ActionItem.h"
|
|
|
|
class HandleDrawer;
|
|
namespace NItem
|
|
{
|
|
#define DRAG_NODE_DEFAULT 0 //直接移动当前节点
|
|
#define DRAG_NODE_LINE 1 //线性移动节点
|
|
#define DRAG_NODE_COS 2 //余弦移动节点
|
|
#define DRAG_NODE_SPLINE 3 //三次样条移动节点
|
|
|
|
#define DRAG_LINE_COLOR RGB(0,153,255)
|
|
|
|
class CItemCurveEdit : public CItemCurve
|
|
{
|
|
public:
|
|
CItemCurveEdit(CSigmaDoc* ppDoc);
|
|
virtual ~CItemCurveEdit(void);
|
|
|
|
void OnDraw(CXyDC* pDC) override;
|
|
void OnLButtonDblClk(UINT nFlags, CPoint point) override;
|
|
void OnLButtonDown(CDC* pDC, UINT nFlags, CPoint point, int vk) override;
|
|
int OnMouseMove(CDC* pDC, UINT nFlags, CPoint point) override;
|
|
void OnLButtonUp(CDC* pDC, UINT nFlags, CPoint point, int vk) override;
|
|
BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) override;
|
|
BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) override;
|
|
BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) override;
|
|
int GetSubMenu() override;
|
|
void SetPos(POSITION pos) override;
|
|
virtual void GetXY(CCurveEx* pValue, int nIndex, dfPoint& point);
|
|
virtual void Clear(void);
|
|
virtual void SetModifiedFlag(BOOL bModified);
|
|
virtual void OnDragPointEnding(CPointList* pList);
|
|
virtual void OnDragPointEnd(int nIndex);
|
|
virtual void OnDragPointMove(int nIndex, CPoint2D pt);
|
|
virtual void AttachProcess(CPointList& oldPoints, CPointList& newPoints); //绑定处理坐标相同的曲线
|
|
virtual void DrawMoveLine(void);
|
|
|
|
void Draw(CDC* pDC);
|
|
void DrawAssistant(CDC* pDC, int mouseX, int mouseY) override;
|
|
int GetNumberOfNode();
|
|
void EreaseHandles(CDC* pDC);
|
|
|
|
protected:
|
|
CPoint2D c_down, c_last;
|
|
DWORD m_nHandleDrawMode;
|
|
COne* m_pBakOne; //备份曲线,为了编辑时取消所有移动、增加、删除操作
|
|
CPoint m_nMouseMovePoint; //鼠标移动点
|
|
CPoint m_nLButtonDownPoint;
|
|
int m_nModeX, m_nModeY; //为了编辑速度谱
|
|
bool m_bLButtonDwonWhenMoueseMove;
|
|
int typeIndex; //曲线原始类型
|
|
COLORREF color = RGB(0, 0, 0); //颜色
|
|
double width;
|
|
CActionItem* m_pAttachAction;
|
|
CPointList NewPointList;
|
|
int m_nBeginIndex, m_nEndIndex;
|
|
//for spline mode
|
|
CCurveEx* m_pMarkCurve; //自动冗余后的曲线坐标
|
|
HandleDrawer* m_handleDrawer;
|
|
protected:
|
|
void DrawOrEraseSelectHandleForMouseMove(CPoint point);
|
|
double GetPointOffset(double offset, int nMode);
|
|
void GetDragPoint(CPoint2D& dp, CPointList& NewPointList, int& begin, int& end);
|
|
void DrawMoveLine(CPointList& NewPointList, BOOL bDrawNode);
|
|
|
|
|
|
void DrawSelectHandle(int nHandle);
|
|
CRect GetRangeWidthIndex(int nIndex);
|
|
|
|
void DrawHandle(CXyDC* pDC, CCurveEx* pCurve);
|
|
void DrawHandle(CXyDC* pDC, double x0, double y0);
|
|
void DrawHandlesByCDC(CDC* pDC, CCurveEx* pCurve);
|
|
|
|
void GetDragSplinePoint(CPoint2D& dp, CPointList& NewPointList, int& begin, int& end);
|
|
public:
|
|
void GetMarkCurve(void);
|
|
int HitTestHandle(CPoint point);
|
|
int HitTestHandle(CCurveEx* pValue, CPoint point);
|
|
void DeleteHandle(int nIndex);
|
|
BOOL InsertHandleWithPointDistance(double x, double y);
|
|
int AddHandle(double l0);
|
|
int AddHandle(CCurveEx* pValue, dfPoint add);
|
|
int AddHandle(CPoint point);
|
|
void EndEdit(void);
|
|
BOOL IsCanAddHandle(CPoint point, double* pl0 = nullptr);
|
|
void CancelAll(void);
|
|
BOOL IsCanCancelAll(void);
|
|
CRect GetFirstNodeHandleRectFocus(CPoint point);//第一个点的
|
|
void SetDrawMode(int nModeX, int nModeY);
|
|
int GetOffsetMode(void);
|
|
CCurveEx* GetCurCurve(void);
|
|
};
|
|
|
|
}; |