|
|
#pragma once
|
|
|
#include "ItemPrint.h"
|
|
|
#include "ItemView.h"
|
|
|
#include "IView.h"
|
|
|
#include "QTransformTracker.h"
|
|
|
#include "ActionItem.h"
|
|
|
#include "CurveHandleDrawer.h"
|
|
|
#include "ItemTracker.h"
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
// Hints for UpdateAllViews/OnUpdate
|
|
|
#define HINT_UPDATE_VIEW 0
|
|
|
#define HINT_UPDATE_WINDOW 1
|
|
|
#define HINT_UPDATE_VIEW_ATTACH 2 //视图参数绑定更新
|
|
|
|
|
|
#define HINT_UPDATE_DRAWOBJ 4
|
|
|
#define HINT_UPDATE_SELECTION 5
|
|
|
#define HINT_DELETE_SELECTION 6
|
|
|
#define HINT_UPDATE_POSITION 7
|
|
|
#define HINT_UPDATE_OLE_ITEMS 8
|
|
|
|
|
|
#define TIMER_MONITOR_MOUSE 10 //监视鼠标位置
|
|
|
#define TIMER_REAL_TIME 11 //实时监控
|
|
|
|
|
|
namespace NItem
|
|
|
{
|
|
|
class CItem;
|
|
|
class CItemSelect;
|
|
|
class CItemMakeMark;
|
|
|
}
|
|
|
|
|
|
namespace NAction
|
|
|
{
|
|
|
class CActionManager;
|
|
|
}
|
|
|
|
|
|
struct WellGroupBranchStruct
|
|
|
{
|
|
|
int BranchIndex;
|
|
|
POSITION DataPosition;
|
|
|
int DataType; // 0-偏移段 1-水平段 2-入靶点 3-出靶点 4-井点
|
|
|
};
|
|
|
|
|
|
class CFindReplacement;
|
|
|
class CSigmaDoc
|
|
|
{
|
|
|
public:
|
|
|
CSigmaDoc();
|
|
|
virtual ~CSigmaDoc();
|
|
|
double GetCurrentUnitScale(void);
|
|
|
void EnableMeshPackage(BOOL isEnable, BOOL force = FALSE);
|
|
|
void SetFaultLayer(CString layer);
|
|
|
CString GetFaultLayer();
|
|
|
void SetBorderLayer(CString layer);
|
|
|
CString GetBorderLayer();
|
|
|
void SetFaultLayer3D(CString layer);
|
|
|
CString GetFaultLayer3D();
|
|
|
void SetBorderLayer3D(CString layer);
|
|
|
CString GetBorderLayer3D();
|
|
|
void SetWellLayer3D(CString layer);
|
|
|
CString GetWellLayer3D();
|
|
|
void SetMainMeshLayer3D(CString layer);
|
|
|
CString GetMainMeshLayer3D();
|
|
|
void SetMainMeshId3D(int64_t id);
|
|
|
int64_t GetMainMeshId3D();
|
|
|
void DocInit(void);
|
|
|
CXy* GetDraw(void);
|
|
|
void SetDraw(CXy * pXy);
|
|
|
void DrawHandle(double x, double y, DWORD nDrawMode, CDC* pDC);
|
|
|
CSize GetHandleSize(void);
|
|
|
void EnableRedraw(bool bRedraw);
|
|
|
|
|
|
/**
|
|
|
* 获取所有被选中的图元,隐藏图元素不会返回
|
|
|
*
|
|
|
* \param point 当前的点坐标
|
|
|
* \return
|
|
|
*/
|
|
|
std::vector<POSITION> GetSelectedItems(const CPoint2D& point);
|
|
|
|
|
|
/**
|
|
|
*当pos==NULL时,选择该点处的第一个元素,当不为空时,选择该位置处的下一个元素,当选中第一个元素时,绕回到最后一个元素
|
|
|
*
|
|
|
* \param point
|
|
|
* \param pos
|
|
|
* \return
|
|
|
*/
|
|
|
POSITION GetNextSelectedItem(const CPoint2D& point, POSITION pos);
|
|
|
|
|
|
POSITION GetSelectedItem(const CPoint2D& point);
|
|
|
CRect8 GetSelectedRect(const CPoint2D& point);
|
|
|
void InvalidateDelete(CPositionList& list);
|
|
|
CSize8 GetSelectSize(void);
|
|
|
CXyDC& GetDC(void);
|
|
|
void SetDC(CXyDC& xydc);
|
|
|
void SetCDC(CDC * pDC);
|
|
|
CDC * GetCDC();
|
|
|
virtual void ClearSelection(void);
|
|
|
void InvalidateSelection(CPositionList& list);
|
|
|
void Invalidate(POSITION pos);
|
|
|
//<undo/redo>
|
|
|
int Undo();
|
|
|
int Redo();
|
|
|
bool CanUndo();
|
|
|
bool CanRedo();
|
|
|
//BOOL CanAddNewAction();
|
|
|
//void RemoveLastAction();
|
|
|
//CActionItem* GetActionItem(void);
|
|
|
void SetActionItem(CActionItem* pAction, bool bDo = true);
|
|
|
//void DeleteActionItem(void);
|
|
|
//</undo/redo>
|
|
|
|
|
|
/**
|
|
|
* @brief 获取最后一次选中的元素
|
|
|
*/
|
|
|
NItem::CItemSelect * GetLastSelectItem(void);
|
|
|
|
|
|
virtual NItem::CItemSelect * GetSelectItem(void);
|
|
|
BOOL GetElementRect(POSITION pos, CRect8& range);
|
|
|
NItem::CItem * GetItem(void);
|
|
|
void SetItem(NItem::CItem* pItem);
|
|
|
int GetItemType(void);
|
|
|
void DeleteItem(void);
|
|
|
virtual NItem::CItem * FindItem(int nType);
|
|
|
|
|
|
CSigmaView * GetView(void);
|
|
|
void SetView(CSigmaView * pActiveView);
|
|
|
void SetBackColor(COLORREF color);
|
|
|
CItemView * GetItemView();
|
|
|
BOOL GetDrawRange(CRect8& rect);
|
|
|
void Invalidate();
|
|
|
COLORREF GetPaperColor(void) { return RGB(255, 255, 255); }
|
|
|
//<文件操作>
|
|
|
BOOL ReloadFile();
|
|
|
virtual BOOL OpenFile(LPCTSTR lpszFileName, BOOL bMergeFile);
|
|
|
void Serialize(CArchive& ar, double leftMargin = 0, double rightMargin = 0,
|
|
|
double topMargin = 0, double bottomMargin = 0, int paperSizeType = 0, int pdfAHType = 0, int pdfPapertDirectionType = 1);
|
|
|
void Serialize(CArchive& ar, CPositionList& list, CXy* pxy);//fbw
|
|
|
BOOL CreateNew(LPCTSTR fileName);
|
|
|
BOOL SaveFile();
|
|
|
BOOL SaveFile(LPCTSTR lpszPathName);
|
|
|
|
|
|
//pdf另存设置属性
|
|
|
BOOL SaveFile(LPCTSTR lpszPathName, double leftMargin, double rightMargin,
|
|
|
double topMargin, double bottomMargin, int paperSizeType, int pdfAHType, int pdfPapertDirectionType);
|
|
|
void SaveActionPosition();
|
|
|
//</文件操作>
|
|
|
virtual void OnDraw(CXyDC& dc);
|
|
|
//QTransformTracker & GetTracker(void);
|
|
|
void DrawItem(CXyDC& dc, int nModeX, int nModeY);
|
|
|
//<选择集>
|
|
|
void ClearSelectionSet();
|
|
|
//增加选择集 即使选择Item不在了 也可以利用之前的选择结果 不然没法进行某写操作
|
|
|
void AddToSelectionSet(POSITION pos);
|
|
|
void ReplaceSelectionSet(CPositionList & positionList);
|
|
|
void GetSelectionSet(CPositionList & positionListOut);
|
|
|
bool IsEmptySelectionSet();
|
|
|
CRect8 GetRectOfSelectedSet();
|
|
|
|
|
|
/**
|
|
|
* @brief 获取最后一个选中的矩形
|
|
|
*
|
|
|
* \return
|
|
|
*/
|
|
|
CRect8 GetRectOfLastSelected();
|
|
|
|
|
|
//</选择集>
|
|
|
CFindReplacement * GetFindReplacement();
|
|
|
void SetSelection(CPositionList& list);
|
|
|
void InsertParameterPair(CString & key, CString & value);
|
|
|
bool GetParameter(CString & key, CString & valueOut);
|
|
|
CString GetElementTypeString(POSITION pSelect);
|
|
|
void PushActionDC(UINT nTypeID);
|
|
|
void PushDC(void);
|
|
|
void EnablePreview(bool bEnable);
|
|
|
BOOL IsPreview(void);
|
|
|
int GetZoomStackCount(void);
|
|
|
void PopDC(void);
|
|
|
void Modified(BOOL isModified = TRUE);
|
|
|
bool IsModified();
|
|
|
|
|
|
bool IsCapturedScreen();
|
|
|
void SetCapturedScreenStatus(bool bCapture);
|
|
|
|
|
|
void GetDrawingWithAndHeightInScreen(int & widthOut, int & heightOut);
|
|
|
CString GetElementString(POSITION pSelect, CPoint2D* pPoint);
|
|
|
CString GetSelectedElementLayer(CPositionList& list);
|
|
|
int SerializeRead(CXy* pxy, CString strInput);
|
|
|
int SerializeRead(CXy* pxy, CArchive& ar);
|
|
|
BOOL VerifyPassword(CXy* pxy);
|
|
|
CItem* GetOtherItem(void);
|
|
|
void ClearItems(void);
|
|
|
void DeleteOtherItem(void);
|
|
|
BOOL SetDefaultCursor(void);
|
|
|
//函数功能:执行填充区域(交点)命令时 设置选中的图元是否有交点
|
|
|
void SetStatusOfCrossPoint(int status);
|
|
|
int GetStatusOfCrossPoint();
|
|
|
|
|
|
int GetEditLineStatus();
|
|
|
void SetEditLineStatus(int status);
|
|
|
|
|
|
NAction::CActionManager* GetActionManager();
|
|
|
|
|
|
private:
|
|
|
void SetSelection(POSITION pos);
|
|
|
// 保存断电恢复用的原始图件数据
|
|
|
void SaveRawFile();
|
|
|
public:
|
|
|
CXy * m_pXy;
|
|
|
CXyDC m_xyDC;
|
|
|
std::unique_ptr<CItemPrint> m_pItemPrint;
|
|
|
bool m_bRedraw; // 是否重新显示
|
|
|
//CXyDC m_zoom;
|
|
|
int m_nUnitMode; //根据设置的比例在打印单位与实际单位间变换方式
|
|
|
std::shared_ptr<NItem::CItemMakeMark> m_pItemMakeMark; //符号制作模式
|
|
|
CItemTracker m_itemTracker;
|
|
|
CActionItem *m_pLastAction; //支持Undo/Redo
|
|
|
CString m_FileName;
|
|
|
CString m_TempFileName;
|
|
|
COLORREF mBackColor;
|
|
|
vector<WellGroupBranchStruct> m_BranchElements;
|
|
|
void EnableRecoverMode(bool enable);
|
|
|
|
|
|
/**
|
|
|
* 是否开启了吸附功能
|
|
|
*
|
|
|
* \return
|
|
|
*/
|
|
|
bool IsSnapEnabled() const;
|
|
|
|
|
|
/**
|
|
|
* 启用/禁用吸附功能
|
|
|
* 这里只是记一个标记位,具体生效还得执行吸附的代码自己来获取该标识并进行处理
|
|
|
*
|
|
|
* \param enable
|
|
|
*/
|
|
|
void EnableSnap(bool enable);
|
|
|
protected:
|
|
|
int m_nDocTypeID; //文件打开保存类型
|
|
|
//private:
|
|
|
std::unique_ptr<CItemView> m_pItemView;
|
|
|
std::unique_ptr<NItem::CItem> m_pItem;
|
|
|
std::unique_ptr<NItem::CItem> m_pOtherItem;
|
|
|
CSigmaView* m_pView;
|
|
|
//QTransformTracker m_Tracker;
|
|
|
|
|
|
bool m_bSaveAllLayer;
|
|
|
CPositionList m_selectionSet;
|
|
|
std::unique_ptr<NAction::CActionManager> m_pActionMgr;
|
|
|
POSITION MoveSelect;//fbw
|
|
|
|
|
|
/**
|
|
|
* 标记该 Document 是否被修改,但是请注意,它为 false 并不意味着没有被修改,还得看 m_pActionMgr 中是否有修改
|
|
|
*/
|
|
|
bool m_bModified = false;;
|
|
|
|
|
|
std::unique_ptr<CFindReplacement> m_pFindReplacement;
|
|
|
std::map<CString, CString> m_parametersMap;
|
|
|
bool m_bCapture; //是否成功执行了区域截屏
|
|
|
BOOL m_bIsPreview; //标示是否已经进入打印预览状态,该状态下缩放图件时状态将入栈ZoomStackPreview中
|
|
|
CStack ZoomStack; //显示堆栈
|
|
|
CStack ZoomStackPreview; //打印预览堆栈
|
|
|
std::unique_ptr<CurveHandleDrawer> m_pDrawer;
|
|
|
protected:
|
|
|
BOOL m_bEnableMeshPackage = FALSE;
|
|
|
int m_crossPointStatus;
|
|
|
|
|
|
// 判断是否是恢复模式
|
|
|
bool m_recoverMode = false;
|
|
|
private:
|
|
|
// 吸附标记位
|
|
|
bool m_snapEnabled = false;
|
|
|
|
|
|
int m_EditLineState = 0; // 线的编辑状态,CURVE_STATE_LINE/CURVE_STATE_ARC/CURVE_STATE_ANGLE/CURVE_STATE_SPLINE/CURVE_STATE_MERGE
|
|
|
};
|
|
|
|