237 lines
8.4 KiB
C++
237 lines
8.4 KiB
C++
// PipeStyle.h: interface for the CPipeStyle1 class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
#if !defined(AFX_PIPESTYLE_H__2CEA639D_2A41_436D_B585_635CE3BC80F4__INCLUDED_)
|
||
#define AFX_PIPESTYLE_H__2CEA639D_2A41_436D_B585_635CE3BC80F4__INCLUDED_
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif // _MSC_VER > 1000
|
||
|
||
#include "PipeLine.h"
|
||
#include <afxtempl.h>
|
||
|
||
typedef CArray<CPipeLine*, CPipeLine*> LINEARR;
|
||
typedef CArray<AcDbObjectId, AcDbObjectId&> ARCARR;
|
||
|
||
|
||
/*============================================================================*
|
||
* Copyright(c), 1994-2007, Beijing Tangent Engineering Software Co.Ltd.
|
||
* 文 件 名: PipeStyle1.h
|
||
* 版 本: 3.0
|
||
* 作 者:
|
||
* 创建时间:
|
||
* 描 述: 地热盘管样式一——回折型
|
||
* 归属项目: 暖通
|
||
* 历史记录: 1. 2005-3-25~2005-3-29 沈睿,增加四边可控间距
|
||
2. sg modify,增加了有关颜色和线宽的内容
|
||
3. 2007-10-25 sg modify,学习、整理该部分代码;修改了部分绘制错误
|
||
4. 2007-10-30 sg modify,增加了曲率半径、距墙距离等变量,
|
||
进一步修改了线宽、颜色
|
||
5. 2010-11-16 mcl modidy 增加供回图层区分、及供回口位置点设置
|
||
6. 2010-11-29 hh modify 修改正方形盘管中心线条错乱及间距过小的BUG
|
||
7. 2010-11-30 hh modify 修改曲率计算方法,使曲率半径不受管距限制
|
||
=============================================================================*/
|
||
class CPipeStyle1
|
||
{
|
||
public:
|
||
CPipeStyle1();
|
||
virtual ~CPipeStyle1();
|
||
|
||
// sg modify
|
||
// CPipeStyle1(XPoint rectStartPt, XPoint rectEndPt, int nLeftDist,
|
||
// int nRightDist, int nTopDist, int nBottomDist,
|
||
// double dbPGAng, int nEntryType);
|
||
// CPipeStyle1(XPoint rectStartPt, XPoint rectEndPt, int nDist,
|
||
// double dbPGAng, int nEntryType);
|
||
// 间距不统一
|
||
// change by myy 2014-11-12
|
||
// 增加边界区宽度和间距,任意开口的点坐标等
|
||
//CPipeStyle1(XPoint rectStartPt, XPoint rectEndPt, int nLeftDist,
|
||
// int nRightDist, int nTopDist, int nBottomDist, double dbPGAng,
|
||
// int nEntryType, double dDist, double dRadius, BOOL bWeight = FALSE,
|
||
// double dLineWeight = 0.35, int nColorIndex = 4);
|
||
CPipeStyle1(XPoint rectStartPt, XPoint rectEndPt, XPoint pipePickEntry, BOOL bSameDist, int nLeftDist,
|
||
int nRightDist, int nTopDist, int nBottomDist, double dbPGAng, int nEntryType, double dDist,
|
||
double dRadius, double dBorderLeftWidth, double dBorderRightWidth, double dBorderUpWidth,
|
||
double dBorderDownWidth, double dBorderLeftDist, double dBorderRightDist, double dBorderUpDist,
|
||
double dBorderDownDist, BOOL bWeight = FALSE, double dLineWeight = 0.35, int nColorIndex = 4);
|
||
// change end
|
||
// 间距统一
|
||
CPipeStyle1(XPoint rectStartPt, XPoint rectEndPt, int nDist,
|
||
double dbPGAng, int nEntryType, double dDist, double dRadius,
|
||
BOOL bWeight = FALSE, double dLineWeight = 0.35, int nColorIndex = 4);
|
||
|
||
void InitVirtaulRect(); // 初始化虚拟矩形中的数据,用于构造函数,sg add
|
||
|
||
public:
|
||
void SetStartPt(ads_point rectStartPt);
|
||
void SetPGAng(double dbPGAng);
|
||
void SetEntryType(int nEntryType);
|
||
void SetDist(int nDist); // 设置间距,间距统一时用
|
||
|
||
void SetArcRadius(double dRadius); // 设置曲率半径,sg add
|
||
void SetWeightShow(BOOL bWeight); // 设置是否粗显
|
||
void SetLineWeight(double dLineWeight); // 设置线宽
|
||
void SetDistToWall(double dDist); // 设置距墙距离
|
||
|
||
public:
|
||
XPoint GetEntryPt(int nNum); // 获取出口点位置
|
||
void GetCrossPts(XPoint &ptSupply, XPoint &ptReturn);
|
||
double GetCenterDist(); // 获取中心部分间距,用于倒角,sg add
|
||
|
||
public:
|
||
|
||
// mcl add idRetLayer 2010.11.10 : 回水图层
|
||
bool DrawPGLine(XExplodeDraw &dc, AcDbObjectId idRetLayer = AcDbObjectId::kNull); // 主要绘制函数
|
||
bool DrawPGLine();
|
||
|
||
public:
|
||
double GetPipeOutDist(){
|
||
return m_iLeftNum>0?m_dBorderLeftDist:m_iLeftDist;
|
||
}
|
||
BOOL GetRealSameDist(double &dSameDist);
|
||
int m_iLeftDist, m_iTopDist, m_iRightDist, m_iBottomDist; // 间距
|
||
XPoint m_ptDrawSupply; // 实际绘制供水点
|
||
XPoint m_ptDrawReturn; // 实际绘制回水点
|
||
// add by myy 2014-11-12
|
||
double m_dBorderLeftWidth, m_dBorderRightWidth, m_dBorderUpWidth, m_dBorderDownWidth; // 边界区设置中左、右、上、下宽度
|
||
double m_dBorderLeftDist, m_dBorderRightDist, m_dBorderUpDist, m_dBorderDownDist; // 边界区设置中左、右、上、下间距
|
||
XPoint m_ptPickEntry; // 任意开口点的坐标
|
||
BOOL m_bDefaultEntry; // 是否是之前默认的八个开口,1:是, 0:不是
|
||
BOOL m_bSameDist;
|
||
// add end
|
||
// add begin // 用于记录虚拟间距
|
||
BOOL m_iDrawInterL, m_iDrawInterR, m_iDrawInterB, m_iDrawInterT; // 各方向绘制了内、外区标识 0-外区 1-内区 2-内、外区
|
||
int m_iLeftNum, m_iRightNum, m_iTopNum, m_iBottomNum; // 各方向绘制的边界区圈数
|
||
int m_iLeftDistT, m_iTopDistT, m_iRightDistT, m_iBottomDistT;
|
||
double m_dBorderLeftWidthT, m_dBorderRightWidthT, m_dBorderUpWidthT, m_dBorderDownWidthT;
|
||
double m_dBorderLeftDistT, m_dBorderRightDistT, m_dBorderUpDistT, m_dBorderDownDistT;
|
||
BOOL m_bEntrType; // 开口方向为原先的八个方向
|
||
// add end by cq 15-04-03
|
||
|
||
protected: // 有关虚拟矩形
|
||
void NormalizeRect(); // 转换矩形到躺倒位置
|
||
|
||
void GetVirtaulRect(); // 得到虚拟矩形的四个顶点
|
||
void GetCenterPt(); // 得到矩形的中心点
|
||
void GetDiagAng(); // 得到对角线的锐角
|
||
void GetLengthofSide(); // 得到矩形边长
|
||
|
||
// 获取左右、上下边长度,并可控制是否自动去掉距墙距离,sg add
|
||
void GetLengthofLRandTBSide(double &dDistLR, double &dDistTB,
|
||
BOOL bDelToWall = TRUE);
|
||
|
||
// 矫正不同方向开口时 各边间距
|
||
void ReAllocateDist(); // add by cq 2015-4-3 14:02:51
|
||
// 将虚拟点转换到真实坐标
|
||
void TransToActualPt(ads_point point, ads_point retPt);
|
||
// 将真实坐标转换到虚拟点
|
||
void TransToVirtualPt(ads_point point, ads_point retPt);
|
||
|
||
// 计算盘管左侧的线条数量及中心线长度
|
||
void CalcLeftLines();
|
||
|
||
// 修正直线长度
|
||
void ReviseLen(double& dLen);
|
||
|
||
// 计算每一圈管线实际的曲率半径 iLineIndex 从0开始 0 代表最外圈,bShortSide = TRUE时取得短边曲率 FALSE取得长边曲率
|
||
double GetFilletRadius(int iLineIndex, BOOL bShortSide = TRUE);
|
||
|
||
|
||
protected: // 有关弧线
|
||
// 创建一个圆弧
|
||
bool CreateArc(ads_point StartPt, ads_point EndPt, ads_point CenPt,
|
||
AcDbObjectId& ObjID, double dRadius);
|
||
bool CreateArc(ads_point StartPt, ads_point EndPt, ads_point CenPt,
|
||
AcDbObjectId& ObjID, XExplodeDraw &dc, double dRadius);
|
||
|
||
// 得到圆弧圆心
|
||
void GetArcCenterPt(ads_point EndPt, double dbAng, ads_point& actCenPt, double dRadius);
|
||
|
||
protected:
|
||
bool DrawSingle(); // 单圈盘管
|
||
bool DrawMulti(); // 两圈及以上盘管
|
||
|
||
protected: // 创建LINEARR、ARCARR数组
|
||
void CreateLeftLineArr(int nNum); // 创建1边直线
|
||
void CreateTopLineArr(); // 创建2边直线
|
||
void CreateRightLineArr(); // 创建3边直线
|
||
void CreateBottomLineArr(); // 创建4边直线
|
||
|
||
void CreateCenterLine(); // 创建中心线
|
||
|
||
bool CreateArcArr(); // 创建圆弧
|
||
bool CreateArcArr(XExplodeDraw &dc, AcDbObjectId idRetLayer = AcDbObjectId::kNull); // 创建圆弧
|
||
|
||
|
||
protected: // 与盘管实体一致
|
||
ads_point m_rectStartPt; // 矩形起点
|
||
ads_point m_rectEndPt; // 矩形终点
|
||
ads_point m_CenterPt; // 矩形中心点
|
||
|
||
int m_nDist; // 间距
|
||
int m_nEntryType; // 入口方向
|
||
double m_dbPGAng; // 矩形倾斜角,即:盘管角度
|
||
double m_dbArcRadius; // 圆弧半径,即:曲率半径
|
||
double m_dCentRadius; // 中心线曲率半径
|
||
|
||
double m_dDistToWall; // 距墙距离,sg add
|
||
BOOL m_bWeight; // 是否粗显
|
||
double m_dLineWeight; // 管线线宽
|
||
int m_nColorInd; // 管线颜色
|
||
|
||
protected: // 辅助绘制使用
|
||
int m_nNum; // 一边的盘管数(n)
|
||
BOOL m_bIsHorz; // TRUE-横向中心线 FALSE-纵向中心线
|
||
|
||
double m_dbDiagAng; // 对角线与矩形夹角的锐角
|
||
double m_dbDiagDist; // 对角线长度
|
||
double m_dbShortDist; // 矩形短边长度
|
||
double m_dbLongDist; // 矩形长边长度
|
||
|
||
ads_point m_ptLT; // 虚拟矩形左上角
|
||
ads_point m_ptLB; // 虚拟矩形左下角
|
||
ads_point m_ptRT; // 虚拟矩形右上角
|
||
ads_point m_ptRB; // 虚拟矩形右下角
|
||
|
||
CPipeLine *m_pCenLine; // 中心线
|
||
double m_dbCenDist; // 中心线间距
|
||
|
||
LINEARR m_LineArrAp; // 1边附加开口直线 add by cq
|
||
LINEARR m_LineArr1; // 1边直线数组
|
||
LINEARR m_LineArr2; // 2边直线数组
|
||
LINEARR m_LineArr3; // 3边直线数组
|
||
LINEARR m_LineArr4; // 4边直线数组
|
||
ARCARR m_ArcArr; // 圆弧数组
|
||
|
||
double m_dbAssisAng; // 辅助角度
|
||
// 1:0,2:PI/2,3:PI/2*3,4:0,
|
||
// 5:PI,6:PI/2*3,7:PI/2,8:PI
|
||
double m_dbNormAng; // 转换矩形后的角度(一般为0,转换后为PI/2)
|
||
};
|
||
|
||
#endif // !defined(AFX_PIPESTYLE_H__2CEA639D_2A41_436D_B585_635CE3BC80F4__INCLUDED_)
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|