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.

108 lines
4.5 KiB
C++

#pragma once
#include "GlobalDefine.h"
#include "DataPoint.h"
#include "SequentialPoint.h"
#include "SmartPtr.h"
#include "ObjFill.h"
#include "PenParMgr.h"
#include "LabVecRang.h"
#include "ObjGeometryPorp.h"
class CModule;
class CObjPline;
class CObjBase
{
public:
CObjBase(void);
CObjBase(CObjBase &rhs);
virtual void WriteWorkFileExt(vector<CLab> &LabVec);
virtual void ReadWorkFileExt(CLabVecRang &LabVecRang);
virtual ~CObjBase(void);
virtual CString GetStr(){return "objbase";};
virtual CObjBase * Clone(){return new CObjBase;};
virtual void Draw(CDC* pDC,CPen &Pen);
virtual void Draw(CDC* pDC);
virtual bool IsInRect(DbRect rect,bool bNeedAllIn){return m_PtContainer.IsInRect(rect,bNeedAllIn);};//obj 的点是否在rect 内
virtual OBJ_TYPE GetType(){return _TYPE_BASE;};
//创建特殊设置属性-----------------------------------------------------------------------
virtual CMFCPropertyGridProperty *CreatSpecialGridProperty(CModule *pModule){return NULL;};
virtual void OnSpecialPropertyChanged(){};
virtual void SetSelected(bool bSelected);
virtual void Operate(SObjOperatePar &par);
virtual DbRect GetRect();
virtual Dbxy GetCenterPt(){return GetRect().GetCenterPt();};
virtual void BindingDlg(){};
virtual void GetPtData(vector<vector<Dbxy>> &vec);
virtual void GetFillData(vector<vector<Dbxy>> &vec);
virtual void CreatFillData(SFillPar FillPar);
virtual void GetLineInRect(DbRect &rect,vector<DbLine> &DataPtLineVec,bool bGetCatchNode = true);
virtual void DrawPtCoord(CDC* pDC);
public:
void WriteWorkFile(vector<CLab> &LabVec);
void ReadWorkFile(CLabVecRang &LabVecRang);
void AddDataPoint(CDataPoint pt);
void CopyPt(CObjBase &rhs);
void AddNodePt(CDataPoint pt);
bool Empty();
void DelAllPt();//删除所有数据点
void DelLastDataPoint();//删除最后一个节点
void DrawLastLine(CDC* pDC,CPen &Pen);
bool IsSelected();
bool HasNodeInRect(DbRect rect);
vector<CDataPoint>& GetPtContainer(){return m_PtContainer.GetPtContainer();};
void SetLastPoint(CDataPoint &pt);
Dbxy GetFirstPt();
Dbxy GetLastPt();
int GetNodePtIdx(Dbxy pt);
void DelNodePtByIdx(int idx);
void InsertNode(int idx,Dbxy pt);
void SetNodePtByIdx(int idx,Dbxy pt);
int GetPtCnt();
SFillPar GetFillPar(){return m_FillPar;};
bool IntersectWithLine(DbLine &line);
void SetLock(bool b){m_bLocked = b;};
void SetbDraw(bool b){m_bDraw = b;};
void SetPenNum(int n);
int GetPenNum(){return m_PenNum;};
bool IsbMarkPt(){return m_bMarkPt;};
void SetbMarkPt(bool b){m_bMarkPt = b;};
bool IsbCollected(){return m_bCollected;};
void SetbCollected(bool b){m_bCollected = b;};
bool IsbFillObj(){return m_bFillObj;};
void SetbFillObj(bool b){m_bFillObj = b;};
void SetbScaned(bool b){m_bScaned = b;};
bool IsbScaned(){return m_bScaned;};
protected:
void OnCreat();
void DrawFill(CDC* pDC,CPen &Pen);
void OperateFill(SObjOperatePar &par);
void SaveSequentialPoint(ofstream *pfile);
void SaveObjType(ofstream *pfile,CString s);
private:
void WriteWorkFileBase(vector<CLab> &LabVec);
void ReadWorkFileBase(CLabVecRang &LabVecRang);
COLORREF GetColor();
void AddDataPointVec(vector<CDataPoint> &DataPointVec);
void DrawPtCoordExt(CDC* pDC,Dbxy &pt);
protected:
CSequentialPoint m_PtContainer;//坐标数据的容器(一条连续线段)
CSequentialPoint m_NodePtContainer;//存储额外用于捕获的点(比如圆心点)
vector<CSequentialPoint> m_FillDataVec;//填充数据容器
SFillPar m_FillPar;//填充参数
bool m_bSelected;//是否被选中
bool m_bLocked;//是否锁定,锁定后不能修改
bool m_bDraw;//是否绘制
bool m_bMarkPt;//是否用来作为mark 定位点
bool m_bCollected;//是否被收集
bool m_bFillObj;//是否为填充obj
bool m_bScaned;//是否被扫描过
int m_PenNum;//笔号
CObjGeometryPorp m_GeometryPorp;//管理obj 的几何属性
};