|
|
|
|
|
#ifndef CWellBaseObj_H
|
|
|
#define CWellBaseObj_H
|
|
|
#pragma once
|
|
|
#include "WellCommonDef.h"
|
|
|
#include "WellCommonFunction.h"
|
|
|
#include "NGraphExtend.h"
|
|
|
#include "DrawOperator/KXmlParse.h"
|
|
|
#include "Data/sqlvarint.h"
|
|
|
|
|
|
|
|
|
#define CLONE_WELLOBJECT(objName) \
|
|
|
virtual CWellBaseObj* CloneWellObject(void) {objName* pnew = new objName; *pnew = *this; return pnew;}
|
|
|
|
|
|
//#include "Data/DataLinkOb.h"
|
|
|
//For any coordinates (x, y) in world space, the transformed coordinates in page
|
|
|
//space (x', y') can be determined by the following algorithm:
|
|
|
//x' = x * eM11 + y * eM21 + eDx,
|
|
|
//y' = x * eM12 + y * eM22 + eDy,
|
|
|
//where the transformation matrix is represented by the following:
|
|
|
// | eM11 eM12 | | 1 0 | | m[0] m[1] |
|
|
|
//Matrix = | eM21 eM22 | = | 0 1 | = | m[2] m[3] |
|
|
|
// | eDx eDy | | 0 0 | | m[4] m[5] |
|
|
|
//XFORM struct
|
|
|
//matrix中的顺序为m11=scaleX, m12=, m21, m22=scaleY, m31=eDx, m32=eDy
|
|
|
|
|
|
static DWORD64 s_Number = 0;
|
|
|
|
|
|
class CWellPole;
|
|
|
class CBaseExtend;
|
|
|
class AFX_EXT_CLASS CWellBaseObj : public CBaseExtend
|
|
|
{
|
|
|
|
|
|
protected:
|
|
|
void Init();
|
|
|
public:
|
|
|
CWellBaseObj();
|
|
|
CWellBaseObj(const CRect8& rect);
|
|
|
virtual ~CWellBaseObj();
|
|
|
|
|
|
virtual CBaseExtend* CreateClone() { return NULL; }; //如果需要继承对象在CXy拷贝时发生作用,就需要实现这个函数,它负责给COne的value 复制扩展对象
|
|
|
virtual void* CloneElement(void) { return NULL; };
|
|
|
virtual void operator=(CWellBaseObj& object);
|
|
|
CLONE_WELLOBJECT(CWellBaseObj)
|
|
|
public:
|
|
|
GDFLOGPENEXT m_pen; //笔属性
|
|
|
GDFLOGBRUSH m_brush; //刷子属性
|
|
|
GDFLOGFONTEXT m_font; //字体属性
|
|
|
CPoint2D m_delta; //记录对象的移动位置
|
|
|
protected:
|
|
|
CWellBaseObj* m_pParent;
|
|
|
CRect8 m_position;
|
|
|
int m_type;
|
|
|
DWORD m_nFlags; //图元基本状态
|
|
|
DWORD m_nId;
|
|
|
CXy* m_pParentXY;
|
|
|
int m_nViewState;
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
//编辑、可视状态
|
|
|
virtual BOOL IsCanEdit(void);
|
|
|
virtual BOOL IsView(void);
|
|
|
CWellBaseObj* GetParent() { return m_pParent; };
|
|
|
void SetParent(CWellBaseObj* pParent) { m_pParent = pParent; };
|
|
|
|
|
|
virtual CRect8 GetRect(void);
|
|
|
virtual void GetRange(CRect8& range);
|
|
|
virtual BOOL IsInRange(CRect8& range);
|
|
|
|
|
|
virtual void SetRange(CRect8& range);
|
|
|
|
|
|
virtual int GetType(void) { return m_type; };
|
|
|
virtual void SetType(int type) { m_type = type; }
|
|
|
|
|
|
virtual CWellPole* GetWell();
|
|
|
|
|
|
virtual CXy* GetParentXY() { return m_pParentXY; }
|
|
|
virtual void SetParentXY(CXy* pxy) { m_pParentXY = pxy; }
|
|
|
|
|
|
static CWellBaseObj* CreateObj(int eType);
|
|
|
|
|
|
static void cTransform(CXyDC* pDC, float* matrix, double& x, double& y, BOOL bUndo);
|
|
|
static void cTransformPoint(float* matrix, double& x0, double& y0, BOOL bUndo);
|
|
|
static void cTransformPoint(float* matrix, CPoint2D& pt, BOOL bUndo);
|
|
|
static void cTransformCurve(CXyDC* pDC, CCurveEx& curve, float* matrix, BOOL bUndo);
|
|
|
static void cTransform(CXyDC* pDC, CRect8& rect, float* matrix, BOOL bUndo);
|
|
|
protected:
|
|
|
|
|
|
// 图元笔、刷子等 Flags
|
|
|
enum BaseFlags
|
|
|
{
|
|
|
FlagNULL = 0x0000, //空白
|
|
|
FlagPen = 0x0001, //使用笔
|
|
|
FlagBrush = 0x0002, //使用刷子
|
|
|
FlagCompound = 0x0004, //复合图元
|
|
|
FlagMove = 0x0008, //移动
|
|
|
FlagDepth = 0x0100, //显示深度值
|
|
|
|
|
|
FlagActionTemplate = 0x1000,// 写模板
|
|
|
FlagActionNoSaveData = 0x2000,// 不备份数据(针对大数据,撤销重做使用)
|
|
|
FlagNoSaveCallouts = 0x4000,// 不保存井位数据
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual LPVOID GetLogFont();
|
|
|
virtual void SetLogPen(LPVOID plogPen); //笔属性
|
|
|
virtual void SetlogBrush(LPVOID plogBrush); //刷子属性
|
|
|
virtual void SetLogFont(LPVOID pLogFont);
|
|
|
//virtual void SetTextFlags( CTextFlags& textFlags);
|
|
|
|
|
|
|
|
|
CRect8 & GetPos() { return m_position; };
|
|
|
virtual void SetDelta(CPoint2D delta) { m_delta = delta; }
|
|
|
virtual CPoint2D GetDelta() { return m_delta; };
|
|
|
//当前选择对象
|
|
|
// virtual CWellBaseObj* SelectWho() { return this; };
|
|
|
//删除对象
|
|
|
virtual BOOL DeleteSelection();
|
|
|
|
|
|
//开关变量值
|
|
|
virtual void SetFlags(DWORD flags);
|
|
|
virtual void SetFlagPen(BOOL bFlag);
|
|
|
virtual void SetFlagBrush(BOOL bFlag);
|
|
|
virtual void SetFlagCompound(BOOL bFlag);
|
|
|
virtual void SetFlagMove(BOOL bFlag);
|
|
|
virtual void SetFlagDepth(BOOL bFlag);
|
|
|
|
|
|
virtual DWORD GetFlags();
|
|
|
virtual BOOL IsFlagPen();
|
|
|
virtual BOOL IsFlagBrush();
|
|
|
virtual BOOL IsFlagCompound();
|
|
|
virtual BOOL IsFlagMove();
|
|
|
virtual BOOL IsFlagDepth();
|
|
|
|
|
|
//操作类开关变量
|
|
|
virtual BOOL IsActionTemplate();
|
|
|
virtual void SetActionTemplate(BOOL b);
|
|
|
virtual BOOL IsActionNoSaveData();
|
|
|
virtual void SetActionNoSaveData(BOOL b);
|
|
|
virtual BOOL IsNoSaveCallouts();
|
|
|
virtual void SetNoSaveCallouts(BOOL b);
|
|
|
|
|
|
//设置文本字体
|
|
|
virtual void SetTextFont(GDFLOGFONTEXT logfont);
|
|
|
|
|
|
//绘制
|
|
|
virtual void Draw(CXyDC *pDC);
|
|
|
virtual void Draw(CXyDC &pDC);
|
|
|
virtual void DrawHandle(CXyDC* pDC);
|
|
|
//画文本内容(换行处理) nHor = 0(右),1(中),2(左), nVer = 0(下),1(中),2(上)
|
|
|
virtual void DrawTextContent(CXyDC* pDC, CString text, CRect8 rect, GDFLOGFONTEXT *plogFont, int nHor = 1, int nVer = 1, double angle = 0);
|
|
|
//添加标题
|
|
|
virtual void AddTitleName(CString text, CRect8 rect, GDFLOGFONT *plogFont, int nAlign = 1);
|
|
|
|
|
|
//控制点操作函数
|
|
|
virtual int GetHandleCount();
|
|
|
virtual CPoint2D GetHandle(int nHandle);
|
|
|
virtual CRect8 GetHandleRect(int nHandleID, double dHandleSize);
|
|
|
|
|
|
//交互操作函数
|
|
|
virtual void MoveTo(CRect8& position);
|
|
|
virtual void MoveHandleTo(int nHandle, CPoint2D point);
|
|
|
virtual CWellBaseObj* ObjectAt(const CRect8& rect, double dHandleSize, BOOL bNesting = FALSE);//objectAt用来挖掘选中的最深层次的子对象.
|
|
|
|
|
|
virtual int HitTest(CPoint2D point, double dHandleSize, BOOL bSelected);
|
|
|
virtual BOOL Intersects(const CRect8& rect, double dHandleSize);
|
|
|
virtual void Serialize(CArchive& ar, const short &ver);
|
|
|
virtual void SerializeHead(CArchive& ar, const short& ver);
|
|
|
virtual void SerializeTail(CArchive& ar, const short& ver);
|
|
|
|
|
|
|
|
|
//重设矩形范围
|
|
|
virtual void ReSetPosition(CRect8 rect);
|
|
|
|
|
|
//标准化文字操作
|
|
|
virtual void NormalText();
|
|
|
|
|
|
//范围操作
|
|
|
virtual CRect8 GetPosition(void);
|
|
|
virtual CRect8 GetSelectedRange(void);
|
|
|
virtual void Transform(CXyDC* pDC, float* matrix, BOOL bUndo = FALSE);//matrix length is 6
|
|
|
|
|
|
//数据
|
|
|
virtual void TransferData(CWellBaseObj* pObj) {}
|
|
|
|
|
|
// 实际宽度与屏幕宽度坐标转换
|
|
|
double WidthToScreenCX(double dWidth/* 实际宽度cm */);
|
|
|
double ScreenCXToWidth(double dCX);
|
|
|
double HeightToScreenCY(double dHeight/* 实际高度mm */);
|
|
|
double ScreenCYToHeight(double dCY);
|
|
|
|
|
|
//根据图元类型构建对象
|
|
|
//static CObjectBase* CreateObj(EElementType eType);
|
|
|
|
|
|
virtual BOOL IsTrackChildTopEnd() { return FALSE; }; //是否是道内的子对象
|
|
|
|
|
|
virtual int GetId();
|
|
|
virtual void SetId(int id);
|
|
|
|
|
|
virtual int GetViewState() { return m_nViewState; };
|
|
|
virtual void SetViewState(int state) { m_nViewState = state; }
|
|
|
|
|
|
virtual BOOL IsDerivedTextBase(){ return FALSE; }
|
|
|
|
|
|
virtual void RecieveTopBottomChange(CWellBaseObj* pChangeObj, double top, double bottom) {};
|
|
|
virtual void RecieveDataChange(CWellBaseObj* pChangeObj) {};
|
|
|
//ROWLINK m_rowLink;
|
|
|
|
|
|
protected:
|
|
|
void DrawInsertDraw(CXyDC* pDC, CInsertDraw& insert, CRect8 rect);
|
|
|
};
|
|
|
|
|
|
typedef std::list<CWellBaseObj*> WELLOBJLIST;
|
|
|
typedef std::vector<CWellBaseObj*> WELLOBJVECTOR;
|
|
|
|
|
|
#endif
|
|
|
|