www.pudn.com > DrawVector.rar > DrawDoc.h
// DrawDoc.h : interface of the CDrawDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DRAWDOC_H__9442AAC2_5173_4ADF_A662_BB95DE02A9A9__INCLUDED_)
#define AFX_DRAWDOC_H__9442AAC2_5173_4ADF_A662_BB95DE02A9A9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Line.h"
#include "Circle.h"
#include "Arc.h"
#include "Text.h"
#include "Tag.h"
#include "Pline.h"
#include "PlineRgn.h"
#include "LinkNet.h"
#include "Data.h"
#include "Data1Set.h"
/*class CGraphPara
{
protected:
int n_ColorNumbAll;
int n_LayerNumbAll;
int n_ColorNumb;
int n_LayerNumb;
long * m_ColorList;
LayerStruct* m_LayerList;
BOOL b_Delete;
public:
CGraphPara()
{
n_ColorNumb=500;
n_LayerNumb=100;
m_ColorList=new long[n_ColorNumb];
m_LayerList=new LayerStruct[n_LayerNumb];
n_ColorNumb=4;
n_LayerNumb=1;
m_ColorList[0]=RGB(0,0,0);
m_ColorList[1]=RGB(255,0,0);
m_ColorList[2]=RGB(0,255,0);
m_ColorList[3]=RGB(0,0,255);
m_LayerList[0].b_Display=1;
strcpy(m_LayerList[0].m_Name,"Layer 0");
}
~CGraphPara()
{
delete m_LayerList;
delete m_ColorList;
}
public:
COLORREF GetColor(int n);
BOOL GetDisplayStatue(int n);
};*/
typedef struct GraphSelectStruct
{
short int Lb;
int index;
int id_only;
}GraphSelectStruct;
//BOOL IsRectCross(float minx,float miny,float maxx,float maxy);
//CGraphPara *p_GraphPara;
class CDrawDoc : public CDocument
{
protected: // create from serialization only
DECLARE_DYNCREATE(CDrawDoc)
GraphSelectStruct* GraphSelect; //存储选中的图形元素
int n_GraphSelect; //选中图形元素的数目
CGraphPara m_GraphPara;
//为了绘制某个图形元素
// Attributes
public:
CDrawDoc()
{
// TODO: add one-time construction code here
// p_GraphPara=&m_GraphPara;
m_Index=new int[3000];
m_MaxScreen=10000;
m_Screen=new ScreenStruct[m_MaxScreen];
//以下设置首屏的参数,并将当前屏幕设置为首屏
m_CurrentScreen=0;
m_Screen[0].sx=0;
m_Screen[0].sy=0;
m_Screen[0].blc=1;
GraphSelect=new GraphSelectStruct[10000];
}
CLine* AddLine(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,float X1,float Y1,float X2,float Y2);
CCircle* AddCircle(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,float CircleX,float CircleY,float CircleR,BOOL bFill);
CArc* AddArc(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,float CircleX,float CircleY,float CircleR,float Angle1,float Angle2);
CText* AddText(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,float StartX,float StartY,float Angle1,float Angle2,float TextHeight,float TextWide,float OffWide,unsigned char TextFont,int TextLong,CString Text);
CTag* AddTag(short ColorPen,int Layer,float xInsert,float yInsert,float xScale,float yScale,float angle,int only_id,int idBlock);
CPline* AddPLine(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,int Numble,PointStruct *PointList);
CPlineRgn* AddPLineRgn(short ColorPen,short ColorBrush,float LineWide,short LineType,short Layer,int id_only,int Numble,PointStruct *PointList,BOOL bTransparent,BOOL bFill);
CLinkNet* AddNetPoint(float x,float y,float rRadiu,short Layer,int id_only,short ColorPen);
CDraw * GetGraph(short Lb,int Index);
void DeleteGraph(short Lb,int Index);
int GetGraphNumb(short Lb);
int GetGraphUpperBound(short Lb);
int GetGraphIndex(short Lb,int ID);
int GetGraphID(short Lb);
CLinkNet* AddNetLink(float sID,float eID);
BOOL GetNetXy(int netID,float *x,float *y,BOOL *bDelete);
float GetAngle(float xx,float yy,float m_x,float m_y);
BOOL PointSelect(float x,float y,float j1,float blc,int *Lb,int* index,int* id_only);
void AddScreen(float StartX,float StartY,float blc);
//实现显示全图功能
BOOL GetRect(float *m_Xmin,float *m_Ymin,float *m_Xmax,float *m_Ymax);
//将选中的元素存储到数组结构中
BOOL AddSelectList(int Lb,int Index,int id_only);
//检查所有的图形元素,计算并返回选中的图形元素的参数
//为了绘制某个图形元素
void DrawGraph(CDC* pDC,int Lb,int index,int DrawMode,int DrawModel,short BackColor);
void Draw(CDC* pDC,int m_DrawMode,int m_DrawModel,short BackColor);
int* m_Index;
int m_CurrentScreen; //当前屏幕的序号
int m_MaxScreen; //最多能存储的屏幕数
ScreenStruct* m_Screen; //记录屏幕参数的结构数组
CData1Set m_data1;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDrawDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDrawDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CDrawDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CTypedPtrArraym_LineArray;
CTypedPtrArraym_CircleArray;
CTypedPtrArraym_ArcArray;
CTypedPtrArraym_TextArray;
CTypedPtrArraym_TagArray;
CTypedPtrArraym_PLineArray;
CTypedPtrArraym_PLineRgnArray;
CTypedPtrArraym_NetArray;
// void DrawGraph(CDC* pDC,int Lb,int index,int DrawMode,int DrawModel,short BackColor);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DRAWDOC_H__9442AAC2_5173_4ADF_A662_BB95DE02A9A9__INCLUDED_)
//long color=r_Color+g_Color*256+b_Color*256*256;