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.

123 lines
3.8 KiB
C++

//////////////////////////////////////////////////////////////////////////////
//文件 CgmDC.h
//主要功能:
//
//程序编写: 2005-12-07
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "FormatDC.h"
#include "cgm.h"
#include "../Section.h"
#include "../Mesh.h"
#include "../InsertDraw.h"
namespace NFormatWriter
{
/* define the data structure this program will use to determine which elements to exercise */
class CCgmParameter
{
public:
CCgmParameter(void);
long colorspec; /* color specification */
long which_color_prec; /* color precision */
long font_list; /* font list */
long intpre; /* the integer precision */
long polymarker; /* draw some polymarkers */
long markertype; /* polymarker type */
long markersize; /* polymarker size */
long markercolor; /* polymarker color */
long interior; /* interior style */
long linetype; /* line types */
long linewidth; /* line thickness */
long textheight; /* the text height */
long textpath; /* the text path */
long bwcolor; /* a black/white color table*/
};
#define MAXSIZE 4096 //防止溢出,曲线最大节点个数不能超过此数
class CCgmDC :
public CFormatDC
{
public:
typedef struct cgm_colour_table
{
int index;
long rgb;
}CGMCOLOURTABLE;
public:
CCgmDC(void);
virtual ~CCgmDC(void);
virtual void Initial(void); //写CGM版本及打开文件写等
virtual int OutFront(void);
virtual int OutEnd(void);
virtual CSize GetOutputSize(double cx, double cy);
virtual void SetMapSize(CSize sz) { m_mapSize = sz; }
//virtual void Draw(CInsertDraw& m_insert);
//virtual void MoveTo(double x, double y);
//virtual void LineTo(double x, double y);
// virtual void PolyLine(CCurveEx& curve, bool bDirectOut = false);
virtual void PolyLine(CPointList& dp);
virtual void SetPixel(double x, double y, COLORREF col);
virtual void Ellipse(double x1, double y1, double x2, double y2);
virtual void PaintRgn(LPPOINT sp, int count);
virtual void Draw(CSection& section,CRect8* rect=NULL);
virtual void Draw(CText& text, CCurveEx& curve);
virtual void DrawOutlineChar(LPTTPOLYGONHEADER lpph, long cbTotal, CPoint scrpt, BOOL bFill);
virtual void DrawOutlineChar(COutlineFromBitmap& ofb, CPoint scrpt, BOOL bFill);
virtual void Draw(CMesh &mesh);
virtual void Draw(CImageInsert& image);
virtual void FillSolidRect(CRect8& rect, COLORREF color);
virtual void Draw(CEllipse &elp,COLORREF Color);
virtual void Draw(CInsertDraw& m_insert);
virtual void Draw(CInsertOld& m_insert);
void WriteImageToSolidCurve(CImageInsert& image);
void WriteImage(CImageInsert& image);
void operator=(CCgmDC& dc);
virtual CSize8 GetFontSize(CSize8 sz);
virtual void SelectClipRgn(CPointList* pPointList, int nMode=RGN_AND); //导出CGM或EPS等文件时,仅是为了填充符号时的边界剪辑问题
float cgmGetScreenWidth8(double dw);
float cgmGetScreenHeight8(double dw);
CPoint cgmGetScreen(double x, double y);
CPoint cgmGetScreen(const CPoint2D& pt);
CPoint2D cgmGetScreen8(double x, double y);
CRect8 cgmGetScreen8(CRect8& rect);
int cgm_y(int y);
double cgm_y(double y);
void ScreenToCGM(long& x, long& y);
void ScreenToCGM(double& x, double& y);
void WriteCgmSeismic(CSection& section);
void WriteTrace(CSection& section, CGMSEISMIC& ses);
virtual void DrawScreenCurve(void* pScreenCurve, BOOL bSolid);
CCgmParameter m_cgmPar;
char m_title[50]; // CGM title
char m_descrp[50]; // CGM description
CSize m_mapSize;
CArray<CGMCOLOURTABLE, CGMCOLOURTABLE> m_arrColTab; //颜色索引表
int WriteCgmColor(COLORREF col, int nColMode); //如果是索引方式时,返回的是该颜色的索引号
int WriteCgmColor(COLORREF col, int nColMode, int colorspec);
//void SetFileName(CString strFileName);
private:
//CPoint2D m_curMoveToPoint;
static CCgmDC* m_pForWrite;
static void CgmWrite(const void* pst, long len);
};
};