////////////////////////////////////////////////////////////////////////////// //文件 Net.h //主要功能: // //程序编写: 2005-12-07 ///////////////////////////////////////////////////////////////////////////// #pragma once #include "rect8ex.h" #include "curveex.h" #include "..\ProjectionLib\Projection.h" #include ".\text.h" #include ".\exchangexyz.h" #include ".\frame.h" class AFX_EXT_CLASS CNet : public CRect8 { public: CNet(void); virtual ~CNet(void); int64_t GetId() const; void SetId(int64_t id); protected: double L1,L2,B1,B2; CCurveEx *CurveL,*CurveB; double delt; CPositionList* m_pPosList; //当生成实际的曲线时的元素列表,根据此列表可以进行UNDO\设置颜色等操作 COLORREF m_colCurve; COLORREF m_colText; COLORREF m_colFrame; protected: void DrawCurve(void* pDC, CCurveEx &tc, BOOL bDraw, void* pXY); void DrawText (void* pDC, CText& text, BOOL bDraw, void* pXY); void DrawDFM(double x,double y,double wh,double angle,double l, void *pDC, int side, BOOL bDraw, void* pXY=NULL, BOOL bIsL=TRUE); void DrawNetCrossPoint (void *pDC, BOOL bDraw, void* pXY=NULL); void DrawNetPline (void *pDC, BOOL bDraw, void* pXY=NULL); void DrawScale (void* pDC, BOOL bDraw, void* pXY=NULL); //划刻度 void GetLCurve_M(double bb, double l0); //输入的经纬度为“分”单位 void GetBCurve_M(double lb, double b0); //外边框操作函数 void OutFrame_Serialize(CArchive& ar, const short &ver); int OutFrame_Read(CFile& fr, const short& ver); void OutFrame_Write(CFile& fw, const short& ver); void OutFrame_WriteDML(CFile& fw, const short& ver, int nBaseTabNum); int OutFrame_ReadDML(CXmlParse& xp, const short &ver); void OutFrame_WritePCG(CFile& fw, const short& ver, int nBaseTabNum); int OutFrame_ReadPCG(CXmlParse& xp, const short &ver); CRect8 GetEnlargeRangeBL(void); public: CProjection *m_pExchangeXYZ; CExchangeXYZ m_exchangeXYZ; double _FrameWidth; CSize8 m_step; //m_step.cx=steplx,m_step.cy=stepby;//经度,纬度网格的步长,以分为单位 double scale; //刻度,以分为单位 double CrossParameter; //交点因子 DWORD m_nFlags; //文字标注方式、中间的曲线显示方式、是否有边框 CSize8 m_szText; //文字尺寸 CFrame m_outFrame; //外边框 CFrame* GetOutFrame(void); CRect8 GetOutFrameRect(void); CRect8 GetInFrameRect(void); void SetFrameColor(COLORREF col); COLORREF GetFrameColor(void); void ChangeToBL_D(double &x, double &y); //转换为经纬度,输出单位为度 void ChangeToBL_DFM(double &x, double &y); //转换为经纬度,输出单位为度分秒 void ChangeToXY_M(double &l,double &b); //转换为坐标,输入单位为"分" void ChangeToXY_DFM(double &l_dfm,double &b_dfm); //转换为坐标,输入为"度分秒"格式 void ClearCurve(void); //删除CurveL,CurveB曲线 CRect8 GetRangeBL(void); virtual void Serialize(CArchive& ar, const short &ver); virtual int Read(CFile& fr, const short& ver); virtual void Write(CFile& fw, const short& ver); virtual void WriteDML(CFile& fw, const short& ver, int nBaseTabNum); virtual int ReadDML(CFile &fr, const short &ver); virtual void WritePCG(CFile& fw, const short& ver, int nBaseTabNum); virtual int ReadPCG(CFile &fr, const short &ver); virtual int ReadPCG2(CFile &fr, const short &ver); int Read_Old(CFile& fr, const short& ver); void Write_Old(CFile& fw, const short& ver); void WriteDML_Old(CFile& fw, const short& ver, int nBaseTabNum); int ReadDML_Old(CFile &fr, const short &ver); void WritePCG_Old(CFile& fw, const short& ver, int nBaseTabNum); int ReadPCG_Old(CFile &fr, const short &ver); virtual void GetRange(CRect8& range); virtual void GetRange(CPoint3D& minPoint, CPoint3D& maxPoint); virtual int IsInRange(CRect8& range); virtual void ScaleCoordinate(double sx, double sy, int mode); //mode=0:加,1:减,2:乘,3:除 virtual void ScaleCoor(double xs, double ys, double dx, double dy); virtual void ScaleProperty(double sx, double sy); virtual int Dissolution(void* pXY, CPositionList& list); //将经纬网解散生成实际的元素 virtual void Draw(void* pDC); virtual void Calibrate(int type, void* pValue); void operator=(CNet& net); void SetProjection(CProjection* pExchangeXYZ); void Offset(double dx, double dy); //风格设置函数 bool IsHasInFrame(void); bool IsHasOutFrame(void); bool IsHasText(void); void EnableInFrame(bool bView); void EnableOutFrame(bool bView); void EnableText(bool bView); DWORD GetSideMode(void); DWORD GetTextMode(void); DWORD GetDisplayMode(void); void SetDisplayMode(DWORD nMode); void SetTextMode(DWORD nMode); void SetSideMode(DWORD nMode); bool SetStep(const CSize8& step); void SetCurveColor(COLORREF color); void SetTextColor(COLORREF color); double GetFrameWidth(void); BOOL ChangeRangeToBL(void); enum enumGridingStyle { markLeft = 0x00000001, //左边 markTop = 0x00000002, //上边 markRight = 0x00000004, //右边 markBottom = 0x00000008, //下边 markAllSide = (markLeft | markTop | markRight | markBottom), //所有边 markLeftTop = (markLeft | markTop), //左边+上边 markTopRight = (markTop | markRight), //上边+右边 markRightBottom = (markRight| markBottom), //右边+下边 markBottomLeft = (markLeft | markBottom), //下边+左边 showLine = 0x00000010, //显示曲线 showCrossPoint = 0x00000020, //显示交点 showNull = 0x00000040, //显示为空 //showHorLine = 0x00000080, //显示横线 //showVerLine = 0x00010000, //显示纵线 textGeography = 0x00000100, //地理 textMath = 0x00000200, //数学 textGeography1 = 0x00000400, //地理1 textGeography2 = 0x00000800, //地理2(all) textMathHor = 0x00020000, //数学水平 textAll = (textGeography|textMath|textGeography1|textGeography2|textMathHor), showInFrame = 0x00001000, //是否显示内边框 showText = 0x00002000, //是否标识文字 showOutFrame = 0x00004000 //是否显示外边框 }; private: int m_id = -1; public: int OutFrame_ReadPCG(void *pxp, const short &ver); virtual int ReadPCG(void *pxp, const short &ver); virtual int ReadPCG2(void *pxp, const short &ver); int ReadPCG_Old(void *pxp, const short &ver); };