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.

108 lines
3.7 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
//////////////////////////////////////////////////////////////////////////////
//文件 CurveEx.h
//主要功能:
//
//程序编写: 2005-12-07 19:50:08
/////////////////////////////////////////////////////////////////////////////
#include "DrawModel\curve.h"
#include "CurveType.h"
#include "rect8ex.h"
#include "afxdb.h"
#include "CurveMark.h"
using namespace NCurveEmbellish;
#define PLINE_EMBELLISH_ALL (PLINE_NODRAW|PLINE_SOLID|PLINE_CLOSE|PLINE_BEZIER|PLINE_SPLINE|PLINE_OFFSET|PLINE_TRANSPARENT|PLINE_TRANSPARENT_VALUE|PLINE_WAVE) //曲线修饰中的所有曲线类型
#define PLINE_TYPE_ALL (PLINE_W|PLINE_MIDLE|/*PLINE_VIRTUAL|*/PLINE_DESIGN|PLINE_EMBELLISH_ALL) //曲线的所有类型
struct stuCurveWave
{
double T; //采样周期
double A; //振幅
long dnum; //一个周期内采样点个数
};
/**
* 该类仍然不能正确执行拷贝构造和拷贝赋值,因为它的基类 CCurve 没有正确实现它们
*/
class AFX_EXT_CLASS CCurveEx : public CCurve
{
public:
CCurveEx(int n);
CCurveEx(void);
CCurveEx(const CCurveEx& other);
virtual ~CCurveEx(void);
int64_t GetId() const;
void SetId(int64_t id);
virtual void Initial(void);
virtual void Clear(void);
void Serialize(CArchive& ar, const short &ver) override;
virtual int Read(CFile &fr, const short& ver);
virtual void Write(CFile& fw, const short& ver, double dRedundantError/*=-1.0*/);
virtual void GetRange(CRect8& range,void *HowToViewCurve=NULL);
virtual void GetRange(CPoint3D& minPoint, CPoint3D& maxPoint);
virtual BOOL IsInRange(CRect8& range,void *HowToViewCurve=NULL);
// type为校正类型,比如两点校位、四点校位等;pValue为类对象指针如CCalibrate2、CCalibrate4等
virtual void Calibrate(int type, void* pValue);
virtual void ScaleProperty(double sx, double sy);
virtual void ScaleCoor(double xs, double ys, double dx, double dy);
virtual void ScaleCoordinate(double sx, double sy, int mode); //mode=0:加1:减2:乘3:除
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);
int ReadPCG2(CFile &fr, const short &ver);
virtual void ExchangeXY(void); //交换XY坐标
virtual void ExchangeXY(void* pProjection); //转换到指定投影坐标,CPrljectio* pProjection
virtual BOOL SetPoints(CPointList &dp, int nnPoint, BOOL IsAutoLocation=TRUE);
void TransferFrom(CCurve& cv); //将曲线CCurve对象中的数据移动到当前对象中
public:
BOOL bAutoLocation = FALSE;
int midle = 0;
double width = 0.0;
double m_SmoothStep = 0.0;
double m_dOffset = 0.0;
CCurveType VirtualType;
CCurveMark* mark = nullptr;
stuCurveWave m_stuCurveWave; //为了波浪线的修饰,为了显示修饰中的波浪线
void operator=(const CCurveEx& curve);
void CloneOtherParameter(const CCurveEx& curve);
dfPoint MidleFilter(int i);
BOOL EnableClose(BOOL bEnable); //成功修改后才返回TRUE
void WriteXYZ(CFile& fw, char split=',', BOOL bWithName=TRUE);
void WriteXYZ(CFile& fw, long nID, CString layer, char split=',');
void WritePure(CFile& fw);
// void WriteNodeToDB(CDatabase &db, CString &strTableName, CString &Maker, CString &Date, CString &projection, CString &layer);
// void WriteToDB(CDatabase &db, CString &strTableName, CString &Maker, CString &Date, CString &projection, CString &layer);
void WriteBezier(CFile& fw, double sd, int bIsClose);
void WriteSpline(CFile& fw, double sd, int bIsClose);
int GetArrow(CCurveEx& curveArrow, double dArrowHeight, int nHeadTail); //获得首箭头或尾箭头的曲线三点坐标
BOOL CreateCurve(double x1, double y1, double x2, double y2, double bulge);
private:
void CopyFrom(const CCurveEx& other);
int64_t m_id = -1;
public:
virtual int ReadPCG(void *pxp, const short &ver);
int ReadPCG2(void *pxp, const short &ver);
};