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.

127 lines
3.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//////////////////////////////////////////////////////////////////////////////
//文件: CItem类扩展
//主要功能:
// 操作各类元素或完成一定的功能
//
//程序编写: 2006-12-07
//
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include ".\itemlinkcurve.h"
namespace NItem
{
class CItemSolidLink :
public CItemLinkCurve
{
public:
CItemSolidLink(CSigmaDoc * ppDoc);
virtual ~CItemSolidLink(void);
virtual BOOL DoSelectEnd(void);
int GetSubMenu() override;
void ClearAssistantCurve(void);
CList<POSITION, POSITION> AssistantCurveList; //辅助线列表
};
class CItemSolid : public CItemSolidLink
{
public:
CItemSolid(CSigmaDoc * ppDoc);
virtual ~CItemSolid(void);
int m_iMaxExtendLength;
protected:
class CURVE_SEGMENT
{
public:
CURVE_SEGMENT(void)
{
m_bExtend = FALSE;
head = -1e100;
tail = 1e100;
pCurve = NULL;
m_bExtendLastCurve = FALSE;
};
int m_bExtend = FALSE;
double head, tail;
CCurveEx* pCurve;
//为了UNDO与REDO而备份状态
CCrossPoint PrevPoint;
int m_bExtendLastCurve = 0;
};
CList<CURVE_SEGMENT, CURVE_SEGMENT> CurveGroup;
CCrossPoint PrevPoint, FirstPoint;
BOOL m_bExtendFirstCurve = FALSE;
BOOL m_bExtendLastCurve = FALSE;
CCrossPoint GetPoint(SELECT_ITEM& item, CCurveEx* p1, CCurveEx* p2, CCrossPoint& otherPoint);
BOOL CreateTwoCurveSolid(SELECT_ITEM& item1, SELECT_ITEM& item2);
public:
virtual BOOL SelectItem(POSITION pos, CPoint2D point) override;
virtual BOOL DoSelectEnd(void);
int GetSubMenu() override;
int OnMouseMove(CDC* pDC, UINT nFlags, CPoint point) override;
virtual void Undo(void);
static CCrossPoint GetNearestCrossPoint(CCrossList& cross, CPoint2D point);
int CrossWithExtend(CCurveEx* p1, CCurveEx* p2, CCrossList& cross);
int CrossWithMustExtend(CCurveEx* p1, CCurveEx* p2, CCrossList& cross);
void GetCurve(CURVE_SEGMENT& segment, CList <dfPoint, dfPoint>& list);
POSITION CreateCurve(CList<CURVE_SEGMENT, CURVE_SEGMENT>& cg);
};
class CItemPathFill :
public CItem
{
public:
CItemPathFill(CSigmaDoc * ppDoc);
virtual ~CItemPathFill(void);
//virtual BOOL InitPropertyGrid(CXTPPropertyGrid& grid);
//virtual BOOL OnGridItemChangeValue(CXTPPropertyGridItem* pItem);
protected:
CString m_strBlockName;
COLORREF m_colFill = RGB(0, 0, 0); //填充色
int m_fillMode; //填充方式
};
//自动填充 ITEM
class CItemSolidAuto :
public CItem
{
public:
CItemSolidAuto(CSigmaDoc * ppDoc);
virtual ~CItemSolidAuto(void);
int m_iMaxExtendLength;
virtual void OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk) override;
virtual BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) override;
/** @brief 得到所有曲线*/
void GetCurves();
void ClearCurveList(void);
int GetSubMenu();
CCurveEx* CreateSolid();
CCurveEx* GetMinInsideCurve();
double CItemSolidAuto::CrossProduct(dfPoint p, dfPoint q);
// 判断两线段是否相交,并求得交点,p1、q1是线段1的首尾端点p2、q2是线段2的首尾端点cr是交点
bool CItemSolidAuto::Cross(dfPoint p1, dfPoint q1, dfPoint p2, dfPoint q2, dfPoint& cr);
public:
CPtrList CurveList;
CPtrList InsideCurveList;
dfPoint dfp;
};
};