Files
envi-code/SourceCode/Code2026/tg_shs/shs_pipewire/DbIDEntity.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

1387 lines
36 KiB
C++

//////////////////////////////////////////////////////////////////////////////
// TDbIDEntity custom object, created by [2007-12-12], ,
#include "StdAfx.h"
#include "math.h"
#include "DbIDEntity.h"
#include "DbIDDot.h"
#include "dbtext.h"
//-----------------------------------------------------
#define HR_INTERVAL_WIDTH 5 * 100
#define D_INTERVAL_WIDTH 2 * 100
#define MARGIN 15 * 100
#define TEXT_HEIGHT 3.0
#define E_INTERVAL_WIDTH (D_INTERVAL_WIDTH / (sqrt(2.0) * 1.01 ))
#define MAX_HR 42
#define MIN_HR 0
#define MAX_D 65
#define MIN_D -30
#define RHLINE_PRECISION 0.5
//-----------------------------------------------------
ACRX_DXF_DEFINE_MEMBERS(ATSIDEntity, ATSEntity,AcDb::kDHL_CURRENT,
AcDb::kMReleaseCurrent, 1,ATS_IDENTITY,
"ATS_IDENTITY图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
IMPLEMENT_TENTBASE(TDbIDEntity);
const Adesk::UInt8 TDbIDEntity::g_nVersion = 2;
TDbIDEntity::TDbIDEntity(AcGePoint3d pt)
{
m_ptInsert = pt;
m_dbB = 101000;
m_dbInterval_HR = 5;
m_dbInterval_D = 5;
m_dbInterval_RH = 10;
m_dbInterval_E = 5;
m_FrameColor = 7;
m_DColor = 3;
m_RHColor = 1;
m_HRColor = 4;
m_EColor = 2;
m_TextColor = 7;
m_HWColor = 7;
m_WPColor = 7;
m_bFrame = TRUE;
m_bD = TRUE;
m_bHR = TRUE;
m_bRH = TRUE;
m_bE = TRUE;
m_bHW = TRUE;
m_IdLabelStyle = InitTextStyle(_T("Standard"));
}
TDbIDEntity::TDbIDEntity()
{
m_dbB = 101000;
m_dbInterval_HR = 5;
m_dbInterval_D = 5;
m_dbInterval_RH = 10;
m_dbInterval_E = 5;
m_FrameColor = 1;
m_RHColor = 2;
m_HRColor = 3;
m_DColor = 4;
m_EColor = 5;
m_TextColor = 1;
m_bFrame = TRUE;
m_bD = TRUE;
m_bHR = TRUE;
m_bRH = TRUE;
m_bE = TRUE;
m_IdLabelStyle = InitTextStyle(_T("Standard"));
}
void TDbIDEntity::SetBasePoint(AcGePoint3d pt)
{
assertWriteEnabled();
m_ptInsert = pt;
// recordGraphicsModified();
}
void TDbIDEntity::CopyPropertiesFrom(AcDbEntity *pSrc,unsigned gMatchFlag)
{
assertWriteEnabled();
TDbEntity::CopyPropertiesFrom(pSrc, gMatchFlag);
TDbIDEntity *pID = TDbIDEntity::cast(pSrc);
if(pID)
{
m_FrameColor = pID->m_FrameColor; //边框颜色
m_DColor = pID->m_DColor;//干球温度颜色
m_HRColor = pID->m_HRColor;//含湿量颜色
m_RHColor= pID->m_RHColor;//相对湿度颜色
m_EColor = pID->m_EColor;//焓线颜色
m_TextColor = pID->m_TextColor;//标注文字颜色
m_HWColor = pID->m_HWColor;//热湿比线颜色
m_WPColor = pID->m_WPColor;//水蒸气分压力颜色
}
}
Acad::ErrorStatus TDbIDEntity::copyFrom(const AcRxObject* pSrc)
{
assertWriteEnabled();
return AcDbObject::copyFrom(pSrc);
}
Acad::ErrorStatus TDbIDEntity::subGetClassID(CLSID* pClsid) const
{
return Acad::eOk;
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus TDbIDEntity::dwgInFields(AcDbDwgFiler* pFiler)
{
assertWriteEnabled();
Acad::ErrorStatus es;
if ((es = TDbEntity::dwgInFields(pFiler)) != Acad::eOk) {
return es;
}
Adesk::UInt16 version;
pFiler->readItem(&version);
if (version > g_nVersion)
return Acad::eMakeMeProxy;
pFiler->readItem(&m_ptInsert);
pFiler->readItem(&m_dbB);
pFiler->readItem(&m_EColor);
pFiler->readItem(&m_FrameColor);
pFiler->readItem(&m_DColor);
pFiler->readItem(&m_HRColor);
pFiler->readItem(&m_RHColor);
pFiler->readItem(&m_TextColor);
pFiler->readItem(&m_HWColor);
pFiler->readItem(&m_WPColor);
pFiler->readItem(&m_dbInterval_D);
pFiler->readItem(&m_dbInterval_HR);
pFiler->readItem(&m_dbInterval_E);
pFiler->readItem(&m_dbInterval_RH);
//pFiler->readItem(&m_bFrame);
//pFiler->readItem(&m_bD);
//pFiler->readItem(&m_bHR);
//pFiler->readItem(&m_bRH);
//pFiler->readItem(&m_bE);
//pFiler->readItem(&m_bHW);
FilerRead(pFiler, m_bFrame);
FilerRead(pFiler, m_bD);
FilerRead(pFiler, m_bHR);
FilerRead(pFiler, m_bRH);
FilerRead(pFiler, m_bE);
FilerRead(pFiler, m_bHW);
pFiler->readItem(&m_IdLabelStyle);
// Read the data members.
switch (version)
{
case (1):
break;
case(2):
ReadString(pFiler,m_szCity);
break;
}
return pFiler->filerStatus();
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus TDbIDEntity::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
// Call dwgOutFields from AcDbEntity
if ((es = TDbEntity::dwgOutFields(pFiler)) != Acad::eOk) {
return es;
}
// Write version number.
pFiler->writeItem((Adesk::UInt16) g_nVersion);
pFiler->writeItem(m_ptInsert);
pFiler->writeItem(m_dbB);
pFiler->writeItem(m_EColor);
pFiler->writeItem(m_FrameColor);
pFiler->writeItem(m_DColor);
pFiler->writeItem(m_HRColor);
pFiler->writeItem(m_RHColor);
pFiler->writeItem(m_TextColor);
pFiler->writeItem(m_HWColor);
pFiler->writeItem(m_WPColor);
pFiler->writeItem(m_dbInterval_D);
pFiler->writeItem(m_dbInterval_HR);
pFiler->writeItem(m_dbInterval_E);
pFiler->writeItem(m_dbInterval_RH);
//pFiler->writeItem(m_bFrame);
//pFiler->writeItem(m_bD);
//pFiler->writeItem(m_bHR);
//pFiler->writeItem(m_bRH);
//pFiler->writeItem(m_bE);
//pFiler->writeItem(m_bHW);
FilerWrite(pFiler, m_bFrame);
FilerWrite(pFiler, m_bD);
FilerWrite(pFiler, m_bHR);
FilerWrite(pFiler, m_bRH);
FilerWrite(pFiler, m_bE);
FilerWrite(pFiler, m_bHW);
if(m_IdLabelStyle.isValid())
pFiler->writeItem(m_IdLabelStyle);
else
{
AcDbHardPointerId Id = InitTextStyle(_T("Standard"));
pFiler->writeItem(Id);
}
pFiler->writeItem((const TCHAR *)m_szCity);
return pFiler->filerStatus();
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus TDbIDEntity::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
m_ptInsert.transformBy(xform);
return Acad::eOk;
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus TDbIDEntity::subGetGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
gripPoints.append(m_ptInsert);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::subGetOsnapPoints(AcDb::OsnapMode osnapMode,
INT_PTR gsSelectionMark,
const AcGePoint3d& pickPoint,
const AcGePoint3d& lastPoint,
const AcGeMatrix3d& viewXform,
AcGePoint3dArray& snapPoints,
AcDbIntArray& geomIds) const
{
struct resbuf rb2;
rb2.restype=RTSHORT;
//rb2.resval.rint=(short)512;
rb2.resval.rint=(short)0;
// modify by cq 2017-09-26 去掉捕捉 TFS29762
acedSetVar(_T("OSMODE"),&rb2);
Acad::ErrorStatus es=Acad::eOk;
if (osnapMode == AcDb::kOsModeIns)
{
snapPoints.append(m_ptInsert);
}
es = TDbEntity::subGetOsnapPoints(osnapMode, gsSelectionMark, pickPoint,
lastPoint, viewXform, snapPoints, geomIds);
return es;
}
//-----------------------------------------------------------------------------
Acad::ErrorStatus TDbIDEntity::subMoveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertReadEnabled();
m_ptInsert = m_ptInsert + offset;
SetBasePoint(m_ptInsert);
return Acad::eOk;
}
//-----------------------------------------------------------------------------
void TDbIDEntity::subList() const
{
assertReadEnabled();
AcDbEntity::subList();
CString sz;
sz.Format(_T("\nx = %f,y = %f,z = %f\n大气压力: %g Pa"),m_ptInsert.x,m_ptInsert.y,m_ptInsert.z,m_dbB);
acutPrintf(sz);
}
void TDbIDEntity::GetAcGePoint3d(AcGePoint3d& Basept,AcGePoint3d& LeftBottom,AcGePoint3d& RightTop)const
{
LeftBottom.x = m_ptInsert.x + MARGIN;
LeftBottom.y = m_ptInsert.y + MARGIN;
Basept.x = m_ptInsert.x + MARGIN;
Basept.y = m_ptInsert.y + MARGIN - D_INTERVAL_WIDTH * MIN_D;
RightTop.x = LeftBottom.x + (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
RightTop.y = LeftBottom.y + (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
}
//-----------------------------------------------------------------------------
double TDbIDEntity::GetFrameWidth()
{
double dbWidth = (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
double dbHeight = (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
double dbMargin = MARGIN;
double dbFrameWidth = dbWidth + 2.0 * dbMargin;
return dbFrameWidth;
}
double TDbIDEntity::GetFrameHeight()
{
double dbWidth = (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
double dbHeight = (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
double dbMargin = MARGIN;
double dbFrameHeigth = dbHeight + 2.0 * dbMargin;
return dbFrameHeigth;
}
Acad::ErrorStatus TDbIDEntity::DrawFrame(XExplodeDraw &dc)const
{
double dbWidth = (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
double dbHeight = (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
double dbMargin = MARGIN;
double dbFrameHeigth = dbHeight + 3.5 * dbMargin;
double dbFrameWidth = dbWidth + 2.0 * dbMargin;
AcGePoint3dArray ptAr;
ptAr.setLogicalLength(5);
ptAr[0] = m_ptInsert;
ptAr[1] = AcGePoint3d(m_ptInsert.x,m_ptInsert.y + dbFrameHeigth,0);
ptAr[2] = AcGePoint3d(m_ptInsert.x + dbFrameWidth,m_ptInsert.y+dbFrameHeigth,0);
ptAr[3] = AcGePoint3d(m_ptInsert.x + dbFrameWidth,m_ptInsert.y,0);
ptAr[4] = m_ptInsert;
AcDbPolyline Line;
PLine(Line,ptAr,m_FrameColor,0.5);
Adesk::UInt16 nColor = dc.GetColor();
dc.SetColor(m_FrameColor);
dc.Polyline(Line);
dc.SetColor(nColor);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity:: DrawRH100Line(XExplodeDraw &dc) const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
AcGePoint3dArray ptAr;
for (double dbHR = MIN_HR + 0.01; dbHR < MAX_HR+4; dbHR += (dbHR<8? RHLINE_PRECISION :RHLINE_PRECISION*8.0))
{
double dbRH = 1.0;
CAirState As(m_dbB);
As.SetHR_RH(dbHR,dbRH);
if(As.GetD()<MIN_D)
{
As.SetD_RH(MIN_D,dbRH);
dbHR = As.GetHR();
}
AcGePoint3d pt;
if(As.GetHR() > MAX_HR)
As.SetHR_RH(MAX_HR,dbRH);
pt = GetPoint(As);
ptAr.append(pt);
}
AcDbPolyline Line;
Adesk::UInt16 nColor = dc.GetColor();
dc.SetColor(m_RHColor);
PLine(Line,ptAr,m_RHColor,0.2);
dc.Polyline(Line);
dc.SetColor(nColor);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawRHLine(XExplodeDraw &dc)const//绘制相对湿度线
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
double rh;
for (rh = 100 - m_dbInterval_RH; rh > 0; rh-= m_dbInterval_RH )
{
AcGePoint3dArray ptAr;
BOOL bLabel = FALSE;
for (double dbHR = MIN_HR + 0.01; dbHR < MAX_HR+4; dbHR += (dbHR<8? RHLINE_PRECISION :RHLINE_PRECISION*8.0))
{
double dbRH = rh * 0.01;
CAirState As(m_dbB);
As.SetHR_RH(dbHR,dbRH);
if(As.GetD()<GetNear15D())
{
As.SetD_RH(GetNear15D(),dbRH);
dbHR = As.GetHR();
}
AcGePoint3d pt;
if(As.GetHR() > MAX_HR)
As.SetHR_RH(MAX_HR,dbRH);
pt = GetPoint(As);
if(pt.y > RightTopPt.y)
{
AcGeLineSeg3d Line2(AcGePoint3d(LeftBottomPt.x,RightTopPt.y,0),RightTopPt);
AcGeLineSeg3d Line1(ptAr.at(ptAr.length()-1),pt);
Line1.intersectWith(Line2,pt);
}
if(!bLabel)
{
if(rh == 10)
{
if(As.GetE() >70 && As.GetE() < 80 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 20||rh==90)
{
if(As.GetE() >90 && As.GetE() < 100 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 30)
{
if(As.GetE() >110 && As.GetE() < 120 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 40)
{
if(As.GetE() >120 && As.GetE() < 125 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 50 || rh == 80)
{
if(As.GetE() >128 && As.GetE() < 133 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 60)
{
if(As.GetE() >135 && As.GetE() < 142 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
if(rh == 70)
{
if(As.GetE() >143 && As.GetE() < 150 && pt.y < RightTopPt.y)
{
bLabel = TRUE;
CString sz;
sz.Format(_T("%0.0f%%"),rh);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(XPoint(pt.x,pt.y,0.0));
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
}
}
}
ptAr.append(pt);
}
Adesk::UInt16 nColor = dc.GetColor();
dc.SetColor(m_RHColor);
DrawPLine(dc,ptAr,m_RHColor);
dc.SetColor(nColor);
}
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawTitle(XExplodeDraw &dc)const
{
Adesk::UInt16 nColor = dc.GetColor();
dc.SetColor(m_TextColor);
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
XPoint pt1,pt2;
pt1.x = (LeftBottomPt.x + RightTopPt.x) * 0.5;
pt1.y = LeftBottomPt.y + TEXT_HEIGHT * 2.5 * 100;
CString szTitle = _T("湿空气焓湿图");
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetText(szTitle);
text.SetRotation(0);
text.SetLocation(XPoint(pt1.x,pt1.y,0.0));
text.SetHeight(TEXT_HEIGHT * 2.0);
text.SetAlignment(XExplodeDraw::kBottomCenter);
text.setColorIndex(m_TextColor);
dc.DrawEntity(text);
CString sz;
sz.Format(_T("大气压力:%0.0fPa"),m_dbB);
TDbText textB;
textB.setPropertiesFrom(this);
textB.SetStyleId(m_IdLabelStyle);
textB.SetText(sz);
textB.SetRotation(0);
textB.SetLocation(XPoint(pt1.x,pt1.y - TEXT_HEIGHT * 100 * 2.0,0.0));
textB.SetHeight(TEXT_HEIGHT * 1.2);
textB.SetAlignment(dc.kBottomCenter);
textB.setColorIndex(m_TextColor);
dc.DrawEntity(textB);
XPoint ptHR((LeftBottomPt.x + RightTopPt.x) * 0.5,RightTopPt.y + TEXT_HEIGHT);
ads_polar(ptHR,PI*0.5,TEXT_HEIGHT * 200,ptHR);
sz.Format(_T("含 湿 量 d, g/kg 干空气"));
TDbText textHR;
textHR.setPropertiesFrom(this);
textHR.SetStyleId(m_IdLabelStyle);
textHR.SetText(sz);
textHR.SetRotation(0);
textHR.SetLocation(ptHR);
textHR.SetHeight(TEXT_HEIGHT * 1.2);
textHR.SetAlignment(dc.kBottomCenter);
textHR.setColorIndex(m_TextColor);
dc.DrawEntity(textHR);
XPoint ptTemp(LeftBottomPt.x,(LeftBottomPt.y + RightTopPt.y)*0.5);
ads_polar(ptTemp,PI,TEXT_HEIGHT * 2.5 * 100,ptTemp);
sz.Format(_T("温 度 t, ℃"));
TDbText textT;
textT.setPropertiesFrom(this);
textT.SetStyleId(m_IdLabelStyle);
textT.SetText(sz);
textT.SetRotation(PI * 0.5);
textT.SetLocation(ptTemp);
textT.SetHeight(TEXT_HEIGHT * 1.2);
textT.SetAlignment(dc.kBottomCenter);
textT.setColorIndex(m_TextColor);
dc.DrawEntity(textT);
dc.SetColor(nColor);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawHWLine(XExplodeDraw &dc)const
{
Adesk::UInt16 color = dc.GetColor();
XPoint BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
double dbWidth = (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
double dbHeight = (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
XPoint ptCentre(RightTopPt.x -dbWidth * 0.15,LeftBottomPt.y + dbHeight * 0.2,0);
double dbR1,dbR2;
dbR1 = 0.18 * dbHeight;
dbR2 = 0.17 * dbHeight;
XArc arc(ptCentre,dbR1,-PI/2,PI/2);
dc.SetColor(m_HWColor);
dc.DrawArc(arc);
XArc arc1(ptCentre,dbR2,-PI/2,PI/2);
dc.SetColor(m_HWColor);
dc.DrawArc(arc1);
XPoint pt1,pt2;
ads_polar(ptCentre,-PI/2,dbR2,pt1);
ads_polar(ptCentre,+PI/2,dbR2,pt2);
DrawLine(dc,pt1,pt2,m_HWColor,0);
XCircle cir(ptCentre,MARGIN * 0.1);
dc.SetColor(m_HWColor);
dc.DrawCircle(cir);
XArc arc2(ptCentre,MARGIN * 0.12,-PI/2,PI/2);
dc.SetColor(m_HWColor);
dc.DrawArc(arc2);
ads_polar(ptCentre, 0, MARGIN * 0.13,pt1);
ads_polar(ptCentre, PI,MARGIN * 0.13,pt2);
DrawLine(dc,pt1,pt2,m_HWColor,0);
ads_polar(ptCentre,PI,MARGIN*0.2,pt1);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(pt1);
text.SetRotation(PI/2);
text.SetText(_T("热湿比ε"));
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kBottomCenter);
text.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text);
CString sz;
XPoint ptEnd,ptCir;
//绘制刻度
//-10000 -- +10000
int k(0);
for(k= -100; k<= 100; k++)
{
double HD = k * 100;
double d = 0.001;
double i = HD * d;
XPoint pt;
CAirState As;
As.SetE_HR(i,d * 1000);
pt = GetPoint(As);
double dbAngle;
dbAngle = ads_angle(BasePt,pt);
if(int(k/10) == (double)k / 10.0) //长刻度
{
if(k > -100 && k< -50)
{
ads_polar(ptCentre,dbAngle,dbR1,ptCir);
ads_polar(ptCir,dbAngle,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
}
else
{
ads_polar(ptCentre,dbAngle,dbR1,ptCir);
ads_polar(ptCir,dbAngle,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
sz.Format(_T("%d"),k*100);
TDbText text;
text.setPropertiesFrom(this);
text.SetStyleId(m_IdLabelStyle);
text.SetLocation(ptEnd);
text.SetRotation(dbAngle);
text.SetText(sz);
text.setColorIndex(m_TextColor);
text.SetAlignment(XExplodeDraw::kMiddleLeft);
text.SetHeight(TEXT_HEIGHT * 0.3);
dc.DrawEntity(text);
}
}
else //短刻度线
{
ads_polar(ptCentre,dbAngle,dbR1,ptCir);
ads_polar(ptCir,dbAngle,MARGIN*0.05,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
}
}
ads_polar(ptCentre,PI/2,dbR1,ptCir);
ads_polar(ptCir,PI/2,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(ptEnd);
text1.SetRotation(PI/2);
text1.SetText(_T(" ∞"));
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleLeft);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
ads_polar(ptCentre,-PI/2,dbR1,ptCir);
ads_polar(ptCir,-PI/2,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
//绘制单位 kj/kg
ads_polar(ptCentre,PI/2,dbR1 + MARGIN*0.05,ptCir);
ads_polar(ptCir,PI,MARGIN*0.05,ptCir);
TDbText text2;
text2.setPropertiesFrom(this);
text2.SetStyleId(m_IdLabelStyle);
text2.SetLocation(ptCir);
text2.SetRotation(0);
text2.SetText(_T("kJ/kg"));
text2.setColorIndex(m_TextColor);
text2.SetAlignment(XExplodeDraw::kMiddleRight);
text2.SetHeight(TEXT_HEIGHT * 0.3);
dc.DrawEntity(text2);
ads_polar(ptCentre,PI/2,dbR2 - MARGIN*0.05,ptCir);
ads_polar(ptCir,PI,MARGIN*0.05,ptCir);
TDbText text3;
text3.setPropertiesFrom(this);
text3.SetStyleId(m_IdLabelStyle);
text3.SetLocation(ptCir);
text3.SetRotation(0);
text3.SetText(_T("kcal/kg"));
text3.setColorIndex(m_TextColor);
text3.SetAlignment(XExplodeDraw::kMiddleRight);
text3.SetHeight(TEXT_HEIGHT * 0.3);
dc.DrawEntity(text3);
TDbText text4;
text4.setPropertiesFrom(this);
text4.SetStyleId(m_IdLabelStyle);
text4.SetLocation(ptEnd);
text4.SetRotation(-PI/2);
text4.SetText(_T(" -∞"));
text4.setColorIndex(m_TextColor);
text4.SetAlignment(XExplodeDraw::kMiddleLeft);
text4.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text4);
//-2500 -- +2500
for(k= -25; k<= 25; k++)
{
double HD;
HD = k * 100;
double d = 0.001;
double i = HD * d * 4.1868;
CAirState As;
As.SetE_HR(i,d * 1000);
XPoint pt;
pt = GetPoint(As);
double dbAngle;
dbAngle = ads_angle(BasePt,pt);
if(k==0)
{
ads_polar(ptCentre,dbAngle,dbR2-MARGIN*0.2,ptCir);
DrawLine(dc,ptCentre,ptCir,m_HWColor,0);
}
if(int(k/5) == (double)k / 5.0) //长刻度
{
if(k != -20) //HD = -2000kCal/kg的不标注
{
ads_polar(ptCentre,dbAngle,dbR2,ptCir);
ads_polar(ptCir,dbAngle+ PI,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
int nK = k*100;
sz.Format(_T("%d"),nK);
TDbText text4;
text4.setPropertiesFrom(this);
text4.SetStyleId(m_IdLabelStyle);
text4.SetLocation(ptEnd);
text4.SetRotation(dbAngle);
text4.SetText(sz);
text4.setColorIndex(m_TextColor);
text4.SetAlignment(XExplodeDraw::kMiddleRight);
text4.SetHeight(TEXT_HEIGHT * 0.3);
dc.DrawEntity(text4);
}
else
{
ads_polar(ptCentre,dbAngle,dbR2,ptCir);
ads_polar(ptCir,dbAngle+ PI,MARGIN*0.1,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
}
}
else //短刻度线
{
ads_polar(ptCentre,dbAngle,dbR2,ptCir);
ads_polar(ptCir,dbAngle+ PI,MARGIN*0.05,ptEnd);
DrawLine(dc,ptCir,ptEnd,m_HWColor,0);
}
}
dc.SetColor(color);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawWPLine(XExplodeDraw &dc)const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
XPoint pt1,pt2;
ads_polar(XPoint(LeftBottomPt.x,RightTopPt.y),PI * 0.5,MARGIN*1.4,pt1);
ads_polar(XPoint(RightTopPt.x,RightTopPt.y),PI * 0.5,MARGIN*1.4,pt2);
DrawLine(dc,pt1,pt2,m_WPColor,0);
XPoint p1,p2,p3;
//绘制名称
ads_polar(pt1,0,pt1.Distance(pt2) * 0.5,p1);
ads_polar(p1,PI * 0.5,HR_INTERVAL_WIDTH * 2.0,p2);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(p2);
text1.SetRotation(0);
text1.SetText(_T("水 蒸 气 分 压 力"));
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
//绘制端部
ads_polar(pt2,PI * 0.5,HR_INTERVAL_WIDTH * 0.6,p1);
DrawLine(dc,pt2,p1,m_WPColor,0);
ads_polar(pt2,-PI * 0.5,HR_INTERVAL_WIDTH * 0.6,p1);
DrawLine(dc,pt2,p1,m_WPColor,0);
ads_polar(pt1,-PI * 0.5,HR_INTERVAL_WIDTH * 0.6,p1);
DrawLine(dc,pt1,p1,m_WPColor,0);
int i(0);
for (i=0;i<1000;i+=5)
{
double dbWP = i * 10;
CAirState As;
As.SetB(m_dbB);
As.SetD_WP(0,dbWP);
double dbHR = As.GetHR(); //得到含湿量
if(dbHR > MAX_HR)
break;
if(i % 10 == 0)
{
double dbDistance = dbHR * HR_INTERVAL_WIDTH;
ads_polar(pt1,0,dbDistance,p1);
ads_polar(p1,PI * 0.5,HR_INTERVAL_WIDTH * 0.6,p2);
DrawLine(dc,p1,p2,m_WPColor,0);
if(i%50==0)
{
CString sz;
ads_polar(p2,PI*0.5,TEXT_HEIGHT * 0.5 * 100,p3);
sz.Format(_T("%d"),i/10);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(p3);
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
if (i==20)
{
ads_polar(p2,PI *0.5,TEXT_HEIGHT*1.5 * 100,p3);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(p3);
text1.SetRotation(0);
text1.SetText(_T("100Pa"));
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
}
else if(i % 5 == 0) //短线
{
double dbDistance = dbHR * HR_INTERVAL_WIDTH;
ads_polar(pt1,0,dbDistance,p1);
ads_polar(p1,PI * 0.5,HR_INTERVAL_WIDTH * 0.3,p2);
DrawLine(dc,p1,p2,m_WPColor,0);
}
}
for (i=0;i<1000;i+=5)
{
double dbWP = (double)i / 10.0 * 133.322;
CAirState As;
As.SetB(m_dbB);
As.SetD_WP(0,dbWP);
double dbHR = As.GetHR(); //得到含湿量
if(dbHR > MAX_HR)
break;
if(i % 10 == 0)
{
double dbDistance = dbHR * HR_INTERVAL_WIDTH;
ads_polar(pt1,0,dbDistance,p1);
ads_polar(p1,-PI * 0.5,HR_INTERVAL_WIDTH * 0.6,p2);
DrawLine(dc,p1,p2,m_WPColor,0);
if(i%50==0)
{
CString sz;
ads_polar(p2,-PI*0.5,TEXT_HEIGHT*100,p3);
sz.Format(_T("%d"),i/10);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(p3);
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
if (i==20)
{
ads_polar(p2,-PI *0.5,TEXT_HEIGHT*1.5*100,p3);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(p3);
text1.SetRotation(0);
text1.SetText(_T("mmHg"));
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
}
else if(i % 5 == 0) //短线
{
double dbDistance = dbHR * HR_INTERVAL_WIDTH;
ads_polar(pt1,0,dbDistance,p1);
ads_polar(p1,-PI * 0.5,HR_INTERVAL_WIDTH * 0.3,p2);
DrawLine(dc,p1,p2,m_WPColor,0);
}
}
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawELine(XExplodeDraw &dc)const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
double dbMinE;
double dbMaxE;
CAirState As(m_dbB);
As.SetD_HR(MIN_D,MIN_HR);
dbMinE = (double)(int) (As.GetE());
As.SetD_HR(MAX_D,MAX_HR);
dbMaxE = As.GetE();
double dbE;
for (dbE = dbMinE; dbE <= dbMaxE; dbE += m_dbInterval_E)
{
AcGePoint3d pt1,pt2;
As.SetE_HR(dbE,MIN_HR);
pt1 = GetPoint(As); //第一点
As.SetRH_E(1.0,dbE); //第二点
if(As.GetHR() > MAX_HR)
As.SetE_HR(dbE,MAX_HR);
if(As.GetD() < MIN_D)
As.SetD_E(MIN_D,dbE);
pt2 = GetPoint(As);
if(As.GetD() > MAX_D)
continue;
AcGeLineSeg3d Line1(pt1,pt2);
AcGeLineSeg3d Line2(AcGePoint3d(LeftBottomPt.x,RightTopPt.y,0),RightTopPt);
AcGePoint3d pt;
if(Line1.intersectWith(Line2,pt) == Adesk::kTrue)
pt1 = pt;
if(pt1.y > RightTopPt.y && pt2.y > RightTopPt.y)
continue;
DrawLine(dc,pt1,pt2,m_EColor);
if((int)dbE % 10 == 0)
{
CString sz;
sz.Format(_T("%g"),dbE);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(pt2.x+TEXT_HEIGHT * 100 * 0.6,pt2.y-TEXT_HEIGHT * 100 * 0.6,0.0));
text1.SetRotation(PI/4.0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kTopCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
if(20 == dbE)
{
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(pt2.x+TEXT_HEIGHT * 100 * 1.8,pt2.y-TEXT_HEIGHT*100 * 1.8,0.0));
text1.SetRotation(PI/4.0);
text1.SetText(_T("比 焓 h,kJ/kg"));
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kTopCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
}
return Acad::eOk;
}
Adesk::Boolean TDbIDEntity::DrawPLine(XExplodeDraw &dc,AcGePoint3dArray ptAr,Adesk::UInt16 color,double dbWidth)const
{
AcDbPolyline Line;
PLine(Line,ptAr,color);
Line.setConstantWidth(dbWidth);
dc.Polyline(Line);
return Acad::eOk;
}
Adesk::Boolean TDbIDEntity::DrawLine(XExplodeDraw &dc,AcGePoint3d pt1,AcGePoint3d pt2,Adesk::UInt16 color,double dbWidth)const
{
Adesk::UInt16 nColor = dc.GetColor();
dc.SetColor(color);
AcGePoint3dArray ptAr;
ptAr.append(pt1);
ptAr.append(pt2);
DrawPLine(dc,ptAr,color,dbWidth);
dc.SetColor(nColor);
return Acad::eOk;
}
Acad::ErrorStatus TDbIDEntity::DrawHRLine(XExplodeDraw &dc)const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
double dbHR;
for (dbHR = MIN_HR;dbHR<MAX_HR; dbHR+= m_dbInterval_HR)
{
AcGePoint3d ptBottom,ptTop;
CAirState As(m_dbB);
As.SetD_HR(MAX_D,dbHR);
ptTop = GetPoint(As);
//如果超过上边线,则Y坐标为上边线
if(ptTop.y > RightTopPt.y)
ptTop.y = RightTopPt.y;
if(fabs(dbHR - MIN_HR) < 0.01)
ptBottom = LeftBottomPt;
else
{
As.SetHR_RH(dbHR,1.0);
ptBottom = GetPoint(As);
if(ptBottom.y < LeftBottomPt.y)
ptBottom.y = LeftBottomPt.y;
}
AcGePoint3dArray ptAr;
ptAr.append(ptBottom);
ptAr.append(ptTop);
DrawPLine(dc,ptAr,m_HRColor);
if((int)dbHR % 5 == 0)
{
CString sz;
sz.Format(_T("%g"),dbHR);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(ptTop.x,ptTop.y+ TEXT_HEIGHT * 0.8 * 100,0.0));
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
}
dbHR = MAX_HR;
AcGePoint3d ptBottom,ptTop;
CAirState As(m_dbB);
As.SetD_HR(MAX_D,dbHR);
ptTop = GetPoint(As);
//如果超过上边线,则Y坐标为上边线
if(ptTop.y > RightTopPt.y)
ptTop.y = RightTopPt.y;
As.SetHR_RH(dbHR,1.0);
ptBottom = GetPoint(As);
if(ptBottom.y < LeftBottomPt.y)
ptBottom.y = LeftBottomPt.y;
DrawLine(dc,ptBottom,ptTop,m_HRColor);
CString sz;
sz.Format(_T("%g"),dbHR);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(ptTop.x,ptTop.y+ TEXT_HEIGHT * 0.8 * 100,0.0));
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleCenter);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
return Acad::eOk;
}
//绘制等温线
Acad::ErrorStatus TDbIDEntity::DrawDLine(XExplodeDraw &dc)const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
double dbD;
for (dbD = MIN_D; dbD < MAX_D; dbD+= m_dbInterval_D)
{
AcGePoint3d pt1,pt2;
CAirState As(m_dbB);
As.SetD_HR(dbD,0.0);
pt1 = GetPoint(As);
As.SetD_RH(dbD,1.0);
pt2 = GetPoint(As);
if(pt2.x > RightTopPt.x)
{
As.SetD_HR(dbD,MAX_HR);
pt2 = GetPoint(As);
}
if(pt2.y > RightTopPt.y)
{
AcGeLineSeg3d Line1(pt1,pt2);
AcGeLineSeg3d Line2(AcGePoint3d(LeftBottomPt.x,RightTopPt.y,0),RightTopPt);
Line1.intersectWith(Line2,pt2);
}
DrawLine(dc,pt1,pt2,m_DColor);
if((int)dbD % 5 == 0)
{
CString sz;
sz.Format(_T("%g"),dbD);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(pt1.x-TEXT_HEIGHT * 100* 0.3,pt1.y,0.0));
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleRight);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
}
}
dbD = MAX_D;
AcGePoint3d pt1,pt2;
CAirState As(m_dbB);
As.SetD_HR(dbD,0.0);
pt1 = GetPoint(As);
As.SetD_RH(dbD,1.0);
pt2 = GetPoint(As);
if(pt2.x > RightTopPt.x)
pt2.x = RightTopPt.x;
if(pt2.y > RightTopPt.y)
pt2.y = RightTopPt.y;
DrawLine(dc,pt1,pt2,m_DColor);
CString sz;
sz.Format(_T("%g"),dbD);
TDbText text1;
text1.setPropertiesFrom(this);
text1.SetStyleId(m_IdLabelStyle);
text1.SetLocation(XPoint(pt1.x-TEXT_HEIGHT * 100 * 0.3,pt1.y,0.0));
text1.SetRotation(0);
text1.SetText(sz);
text1.setColorIndex(m_TextColor);
text1.SetAlignment(XExplodeDraw::kMiddleRight);
text1.SetHeight(TEXT_HEIGHT);
dc.DrawEntity(text1);
return Acad::eOk;
}
Adesk::Boolean TDbIDEntity::PLine(AcDbPolyline& PLine,AcGePoint3dArray ptAr,Adesk::UInt16 color,double dbWidth)const
{
for (int i=0;i<ptAr.length();i++)
{
AcGePoint2d pt;
pt.x = ptAr.at(i).x;
pt.y = ptAr.at(i).y;
PLine.addVertexAt(i,pt);
}
PLine.setConstantWidth(dbWidth);
PLine.setColorIndex(color);
return Adesk::kTrue;
}
AcGePoint3d TDbIDEntity::GetPoint(CAirState As) const
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
AcGePoint3d pt;
pt.x = BasePt.x + As.GetHR() * HR_INTERVAL_WIDTH;
pt.y = BasePt.y + sqrt(2.0) * As.GetE() * E_INTERVAL_WIDTH - As.GetHR() * HR_INTERVAL_WIDTH;
pt.z = 0.0;
return pt;
}
CAirState TDbIDEntity::GetDot(AcGePoint3d pt)
{
AcGePoint3d BasePt,LeftBottomPt,RightTopPt;
GetAcGePoint3d(BasePt,LeftBottomPt,RightTopPt);
CAirState As(m_dbB);
double i,d;
d = 0.001 * (pt.x - BasePt.x) / (HR_INTERVAL_WIDTH) * 1000;
i = (pt.y - BasePt.y + d * HR_INTERVAL_WIDTH) / (sqrt(2.0) * E_INTERVAL_WIDTH);
As.SetE_HR(i,d);
return As;
}//-----------------------------------------------------------------------------
void TDbIDEntity::GetTips(DList<TObjInfoUnit> &info) const
{
TDbEntity::GetTips(info);
CString sz;
sz.Format(_T("%g Pa"),m_dbB);
info.Append(new TObjInfoUnit(_T("对象类型"), _T("焓湿图")));
info.Append(new TObjInfoUnit(_T("大气压力:"),sz));
}
// 取得夹点说明
Acad::ErrorStatus TDbIDEntity::GetGripText(int idx, CString &cs) const
{
Acad::ErrorStatus es = Acad::eOk;
switch(idx)
{
case 0:
cs="移动焓湿图";
break;
default:
break;
}
return es;
}
Acad::ErrorStatus TDbIDEntity::ExplodeOrDraw2d(XExplodeDraw &dc) const
{
// cet 2016.10.17 add 图层关闭时,实体不显示,不进行绘制(打印时,也不会绘制)
AcDbLayerTableRecordPointer player(this->layerId(), AcDb::kForRead);
if (player.openStatus() == Acad::eOk && player->isOff())
{
return Acad::eOk;
}
TMasterProperties prop;
dc.BackUpProperties(prop);
Acad::ErrorStatus es=Acad::eOk;
XAcGiViewDraw &viewDraw = (XAcGiViewDraw &)dc;
dc.SetStyle(m_IdLabelStyle);
dc.SetHeight(TEXT_HEIGHT);
if(m_bFrame)
DrawFrame(dc);
DrawRH100Line(dc);
if(m_bHR)
DrawHRLine(dc);
if(m_bD)
DrawDLine(dc);
if(m_bRH)
DrawRHLine(dc);
if(m_bE)
DrawELine(dc);
DrawTitle(dc);
DrawWPLine(dc);
if(m_bHW)
DrawHWLine(dc);
dc.RestoreProperties(prop);
return es;
}
double TDbIDEntity::GetNear15D()const
{
double dbNear15D = MIN_D;
double dbDiff = 100;
for (double dbD = MIN_D; dbD < MAX_D; dbD += m_dbInterval_D)
{
if(fabs(dbD - (-15)) < dbDiff )
{
dbDiff = fabs(dbD - (-15));
dbNear15D = dbD;
}
}
return dbNear15D;
}
BOOL TDbIDEntity::IsRightAirStateDot(AcGePoint3d pt)
{
CAirState As;
As = GetDot(pt);
// change by hh 2012-09-05 降低判断精度
// if(As.GetRH() <0 || As.GetRH() >1.0)
if(As.GetRH() <-1e-6 || As.GetRH() >(1.0 + 1e-6))
return FALSE;
if(As.GetD()< MIN_D || As.GetD()> MAX_D)
return FALSE;
if(As.GetHR() < MIN_HR || As.GetHR()> MAX_HR)
return FALSE;
return TRUE;
}
BOOL TDbIDEntity::IsRightAirStateDot(CAirState As)
{
AcGePoint3d pt = GetPoint(As);
return IsRightAirStateDot(pt);
}
void InitDbIDEntity(BOOL bTrue)
{
if (bTrue) {
TDbIDEntity::rxInit();
TDbIDEntity::InitMatchProtocol(TRUE);
}
else {
TDbIDEntity::InitMatchProtocol(FALSE);
deleteAcRxClass(TDbIDEntity::desc());
}
}
void TDbIDEntity::GetMarginPoints(AcGePoint3dArray& ptAr)
{
double dbWidth = (MAX_HR - MIN_HR) * HR_INTERVAL_WIDTH;
double dbHeight = (MAX_D - MIN_D) * D_INTERVAL_WIDTH;
double dbMargin = MARGIN;
double dbFrameHeigth = dbHeight + 3.5 * dbMargin;
double dbFrameWidth = dbWidth + 2.0 * dbMargin;
ptAr.setLogicalLength(2);
ptAr[0] = m_ptInsert;
ptAr[1] = AcGePoint3d(m_ptInsert.x + dbFrameWidth,m_ptInsert.y+dbFrameHeigth,0);
}