1039 lines
28 KiB
C++
1039 lines
28 KiB
C++
#include "stdafx.h"
|
||
#include "TchKernalGlobalFunc.h"
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
// Audit Status: OK
|
||
extern AcDbObjectId GetMSpaceId();
|
||
extern TARCH_IMPEXP int g_nProductId;
|
||
|
||
//extern void WblockCloneCompStyleDict(AcRxObject* pOwner,
|
||
// AcDbIdMapping& idMap);
|
||
|
||
// 3-TArch5;4,5-TArch6;6-TArch7;7-TArch8beta1;8-TArch8;9-TArch9
|
||
// const Adesk::UInt8 TDbConfig::g_nVersion = 8;
|
||
//const Adesk::UInt8 TDbConfig::g_nVersion = 9;
|
||
//const Adesk::UInt8 TDbConfig::g_nVersion = 10; // modify by gjm for t20
|
||
const Adesk::UInt8 TDbConfig::g_nVersion = 11; // modify by jsx on 1620519 for t20v3
|
||
|
||
|
||
ACRX_DXF_DEFINE_MEMBERS(ATSConfig, AcDbObject, AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
||
1, ATS_DBCONFIG, "ATS_DBCONFIG图形无法解析, 请下载上华软件|网址: www.shanghuasoft.com");
|
||
|
||
extern double g_nText2Base;
|
||
TDbConfig::TDbConfig()
|
||
{
|
||
|
||
m_bByLayerForDOR = true;
|
||
m_bByLayerForSym = true;
|
||
m_bByLayerForElev = true;
|
||
|
||
m_nPScale=(g_nProductId==kTSUN ? 500.0*_UNIT_SCALE : 100.0*_UNIT_SCALE);
|
||
m_nLHeight=_AS_SYS_UNIT(3000.0);
|
||
m_nDrawMode=DRAW_2D|DRAW_3D;
|
||
m_bSolidFill=FALSE;
|
||
m_bLineWeight=FALSE;
|
||
m_nSpaceDispMode=SPF_AREA;
|
||
m_bShowWallBase=FALSE;
|
||
m_bCheckDim=FALSE;
|
||
m_nHighBold=0.4;
|
||
m_nElevDiff=450;
|
||
|
||
m_nControlFlag=0;
|
||
|
||
// TArch6 data
|
||
m_nText2Base=g_nText2Base;
|
||
m_nDetailScale=100.0;
|
||
// 标准填充名称 比例 >= 100
|
||
//m_sHatchDivider1, //隔墙
|
||
//m_sHatchFill1, //填充墙
|
||
//m_sHatchBrick1, //砖墙柱
|
||
//m_sHatchRocket1, //石墙柱
|
||
m_sHatchConcrete1=_T("SOLID"), //砼墙柱
|
||
//m_sHatchSteel1; //钢墙柱
|
||
|
||
// 详图填充名称 比例 < 100
|
||
//m_sHatchDivider2, //隔墙
|
||
//m_sHatchFill2, //填充墙
|
||
m_sHatchBrick2=_T("普通砖"), //砖墙柱
|
||
m_sHatchRocket2=_T("天然石材"), //石墙柱
|
||
m_sHatchConcrete2=_T("钢筋混凝土"), //砼墙柱
|
||
m_sHatchSteel2=_T("金属"); //钢墙柱
|
||
|
||
// 线粗细
|
||
// 比例 >= 100
|
||
m_nBoldDivider1=0.2, //隔墙
|
||
m_nBoldFill1=0.4, //填充墙
|
||
m_nBoldFill11=0.4, //填充墙1
|
||
m_nBoldFill21=0.4, //填充墙2
|
||
m_nBoldBrick1=0.4, //砖墙柱
|
||
m_nBoldRocket1=0.4, //石墙柱
|
||
m_nBoldConcrete1=0.4, //砼墙柱
|
||
m_nBoldSteel1=0.4; //钢墙柱
|
||
// 比例 < 100
|
||
m_nBoldDivider2=0.25, //隔墙
|
||
m_nBoldFill2=0.5, //填充墙
|
||
m_nBoldFill12=0.5, //填充墙1
|
||
m_nBoldFill22=0.5, //填充墙2
|
||
m_nBoldBrick2=0.5, //砖墙柱
|
||
m_nBoldRocket2=0.5, //石墙柱
|
||
m_nBoldConcrete2=0.5, //砼墙柱
|
||
m_nBoldSteel2=0.5; //钢墙柱
|
||
|
||
m_nDividerFlag=0;
|
||
m_nFillFlag=0;
|
||
m_nFill1Flag=0;
|
||
m_nFill2Flag=0;
|
||
m_nBrickFlag=0;
|
||
m_nRocketFlag=0;
|
||
m_nConcreteFlag=0;
|
||
m_nSteelFlag=0;
|
||
|
||
m_nDividerColor=256;
|
||
m_nFillColor=256;
|
||
m_nFill1Color=256;
|
||
m_nFill2Color=256;
|
||
m_nBrickColor=256;
|
||
m_nRocketColor=256;
|
||
m_nConcreteColor=256;
|
||
m_nSteelColor=256;
|
||
|
||
m_nText2BaseRatio=g_nText2BaseRatio;//字高系数
|
||
m_nSpaceAreaPrecision = 2; // sg add 081126
|
||
m_dDrawingIndexTextRatio = g_dDrawIndexTextRatio; // sg add 090115,sg modify 090512
|
||
|
||
// sg modify 110209,支持出圈样式
|
||
// m_bOldDrawingIndex = g_bDrawIndexOldStyle?TRUE:FALSE; // sg add 090612
|
||
m_bOldDrawingIndex = g_bDrawIndexOldStyle ? 1 : 0;
|
||
m_bOldDrawingIndex = g_bDIOutCircleStyle ? 3 : m_bOldDrawingIndex;
|
||
|
||
//m_dEleDoteSize = 0.75; // sg add 090212
|
||
//m_dEleTriangleSize = 3.0;
|
||
m_dEleDoteSize = g_dEleDoteSize*0.5; // sg add 110301,默认值从高级选项中读取
|
||
m_dEleCrossSize = g_dEleCrossSize ; //jsx add 160517,默认值从高级选项中读取
|
||
m_dEleTriangleSize = g_dEleTriangleSize;
|
||
m_dMultiLeaderDistRatio = 0.3; // sg add 090216
|
||
SetAxisLabelTextRatio(g_dAxisLabelTextRatio); // sg add 090512
|
||
SetCurtainWall3Scale(g_nCurtainWall3Scale); // sg add 090609,带形窗幕墙改变样式的比例界限
|
||
SetCurtainWallFixStyle(g_bCurtainWallFixStyle); // sg add 090609,带形窗幕墙比例改变后是否不改样式
|
||
SetCurtainWallStyle(g_nCurtainWallStyle); // sg add 090609,带形窗幕墙,不改样式时的设定类型
|
||
|
||
// sg add 110120,凸窗挡板、转角窗挡板、门窗套是否加保温
|
||
SetProWinSlabInsu(TRUE);
|
||
|
||
// sg add 110303,设置默认的单行文字、多行文字、专业词库文字样式
|
||
SetTgSingleTextStyle(_T("STANDARD"));
|
||
|
||
// sg add 120412,根据9.0需求,增加设置弧长标注样式的设置
|
||
m_nArcLenDimType = g_nArcLenDimType;
|
||
|
||
// sg add 120413,用于解决旧的尺寸标注,有可能箭头标注大小固定为2的问题,至少让它看上去是一样大的,0表示旧版本,1表示9以上版本
|
||
m_nDealOldDimArrowSize = 1;
|
||
}
|
||
|
||
TDbConfig::~TDbConfig()
|
||
{
|
||
}
|
||
|
||
void SplitPath(const TCHAR* pathName, CString &filePath, CString &fileName)
|
||
{
|
||
TCHAR drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]=_T("");
|
||
_tsplitpath(pathName, drive, dir, fname, ext);
|
||
filePath.Format(_T("%s%s"), drive, dir);
|
||
fileName.Format(_T("%s"), fname);
|
||
}
|
||
|
||
CString TDbConfig::GetLineHatch(long i)const
|
||
{
|
||
AcDbObjectId id;
|
||
switch(i)
|
||
{
|
||
case 0:id=GetHatchDividerId();break;
|
||
case 1:id=GetHatchFillId();break;
|
||
case 2:id=GetHatchFill1Id();break;
|
||
case 3:id=GetHatchFill2Id();break;
|
||
case 4:id=GetHatchBrickId();break;
|
||
case 5:id=GetHatchRocketId();break;
|
||
case 6:id=GetHatchConcreteId();break;
|
||
case 7:id=GetHatchSteelId();break;
|
||
}
|
||
if(id.isNull()||!id.isValid())
|
||
return _T("");
|
||
|
||
AcDbBlockTableRecord* pRecord=NULL;
|
||
acdbOpenObject(pRecord,id,AcDb::kForRead);
|
||
if(pRecord!=NULL)
|
||
{
|
||
const TCHAR* sName=NULL;
|
||
pRecord->getName(sName);
|
||
pRecord->close();
|
||
CString name(sName);
|
||
int pos=name.ReverseFind(_T('$'));
|
||
if(pos!=-1)
|
||
name=name.Right(name.GetLength()-pos-1);
|
||
return name;
|
||
}
|
||
return _T("");
|
||
}
|
||
|
||
void TDbConfig::SetLineHatch(long i,const TCHAR* sPat)
|
||
{
|
||
XString sTemp,sBlockName;
|
||
sTemp<<g_sDwbPath<<_T("LinePat(")<<sPat<<_T(")");
|
||
|
||
if(LoadDwbBlock(sTemp,sBlockName,database())!=RTNORM)
|
||
return;
|
||
AcDbObjectId id=InitBlock(sBlockName,database());
|
||
switch(i)
|
||
{
|
||
case 0:SetHatchDividerId(id);break;
|
||
case 1:SetHatchFillId(id);break;
|
||
case 2:SetHatchFill1Id(id);break;
|
||
case 3:SetHatchFill2Id(id);break;
|
||
case 4:SetHatchBrickId(id);break;
|
||
case 5:SetHatchRocketId(id);break;
|
||
case 6:SetHatchConcreteId(id);break;
|
||
case 7:SetHatchSteelId(id);break;
|
||
}
|
||
}
|
||
|
||
CString TDbConfig::GetProjectFile()const
|
||
{
|
||
assertReadEnabled();
|
||
|
||
if(m_sProjectFile==_T(""))
|
||
return _T("");
|
||
|
||
const TCHAR* sBuf=NULL;
|
||
database()->getFilename(sBuf);
|
||
if(sBuf==NULL)
|
||
return _T("");
|
||
CString sDwgFilePath(sBuf);
|
||
//delete[] sBuf;不删除更加稳定
|
||
|
||
CString sPrjPath,sPrjName,sDwgPath,sDwgName;
|
||
sDwgFilePath.MakeUpper();
|
||
SplitPath(m_sProjectFile,sPrjPath,sPrjName);
|
||
SplitPath(sDwgFilePath,sDwgPath,sDwgName);
|
||
if(sPrjName==_T(""))
|
||
return _T("");
|
||
|
||
long s1=(sPrjPath==_T(""))?sDwgPath.GetLength():sDwgPath.Find(sPrjPath);
|
||
if(s1!=sDwgPath.GetLength()-sPrjPath.GetLength())
|
||
return (const TCHAR*)m_sProjectFile;
|
||
else
|
||
{
|
||
CString sDir=sDwgPath.Left(sDwgPath.GetLength()-sPrjPath.GetLength());
|
||
return sDir+sPrjName+_T(".TPR");
|
||
}
|
||
}
|
||
|
||
void TDbConfig::SetProjectFile(CString sPrjFilePath)
|
||
{
|
||
assertWriteEnabled();
|
||
|
||
if(sPrjFilePath==_T(""))
|
||
{
|
||
m_sProjectFile=_T("");
|
||
return;
|
||
}
|
||
|
||
const TCHAR* sBuf=NULL;
|
||
database()->getFilename(sBuf);
|
||
if(sBuf==NULL)
|
||
return;
|
||
CString sDwgFilePath(sBuf);
|
||
//delete[] sBuf;不删除更加稳定
|
||
|
||
CString sPrjPath,sPrjName,sDwgPath,sDwgName;
|
||
sPrjFilePath.MakeUpper();
|
||
sDwgFilePath.MakeUpper();
|
||
SplitPath(sPrjFilePath,sPrjPath,sPrjName);
|
||
SplitPath(sDwgFilePath,sDwgPath,sDwgName);
|
||
|
||
long s1=sDwgPath.Find(sPrjPath);
|
||
if(s1!=0)
|
||
m_sProjectFile=sPrjFilePath;
|
||
else
|
||
{
|
||
CString sSub=sDwgPath.Right(sDwgPath.GetLength()-sPrjPath.GetLength());
|
||
m_sProjectFile=sSub+sPrjName;
|
||
}
|
||
}
|
||
|
||
// 从DWG读入数据:
|
||
Acad::ErrorStatus TDbConfig::dwgInFields (AcDbDwgFiler* pFiler)
|
||
{
|
||
assertWriteEnabled();
|
||
|
||
Acad::ErrorStatus es = AcDbObject::dwgInFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
Adesk::UInt8 nVer;
|
||
pFiler->readItem(&nVer);
|
||
if(nVer>g_nVersion)
|
||
return Acad::eMakeMeProxy;
|
||
|
||
pFiler->readItem(&m_nPScale);
|
||
pFiler->readItem(&m_nLHeight);
|
||
pFiler->readItem(&m_nDrawMode);
|
||
if(nVer==1)
|
||
{
|
||
AcDbHardPointerId m_idWallStyle;
|
||
pFiler->readItem(&m_idWallStyle);
|
||
}
|
||
pFiler->readItem(&m_bSolidFill);
|
||
pFiler->readItem(&m_bLineWeight);
|
||
if(nVer==1)
|
||
{
|
||
XString m_sDimBlk;
|
||
ReadString(pFiler, m_sDimBlk);
|
||
}
|
||
pFiler->readItem(&m_nSpaceDispMode);
|
||
if(nVer==1)
|
||
{
|
||
Adesk::UInt8 m_nWallOsnap;
|
||
pFiler->readItem(&m_nWallOsnap);
|
||
}
|
||
pFiler->readItem(&m_bShowWallBase);
|
||
if(nVer==1)
|
||
{
|
||
Adesk::UInt8 m_bModelNumber;
|
||
pFiler->readItem(&m_bModelNumber);
|
||
double m_nInsulateThickness;
|
||
pFiler->readItem(&m_nInsulateThickness);
|
||
}
|
||
else
|
||
{
|
||
pFiler->readItem(&m_nHighBold);
|
||
pFiler->readItem(&m_nElevDiff);
|
||
pFiler->readItem(&m_bCheckDim);
|
||
pFiler->readItem(&m_bDimAreaUnit);
|
||
if(nVer>2)
|
||
{
|
||
if(nVer>3) // TArch6
|
||
pFiler->readItem(&m_nControlFlag);
|
||
else
|
||
{ // UInt8->UInt32
|
||
Adesk::UInt8 nTempFlag=0;
|
||
pFiler->readItem(&nTempFlag);
|
||
m_nControlFlag=nTempFlag;
|
||
}
|
||
}
|
||
}
|
||
|
||
if(nVer>3)
|
||
{//TArch6
|
||
pFiler->readItem(&m_nText2Base);
|
||
pFiler->readItem(&m_nDetailScale);
|
||
ReadString(pFiler, m_sHatchDivider1);
|
||
ReadString(pFiler, m_sHatchFill1);
|
||
ReadString(pFiler, m_sHatchBrick1);
|
||
ReadString(pFiler, m_sHatchRocket1);
|
||
ReadString(pFiler, m_sHatchConcrete1);
|
||
ReadString(pFiler, m_sHatchSteel1);
|
||
ReadString(pFiler, m_sHatchDivider2);
|
||
ReadString(pFiler, m_sHatchFill2);
|
||
ReadString(pFiler, m_sHatchBrick2);
|
||
ReadString(pFiler, m_sHatchRocket2);
|
||
ReadString(pFiler, m_sHatchConcrete2);
|
||
ReadString(pFiler, m_sHatchSteel2);
|
||
|
||
pFiler->readItem(&m_nBoldDivider1);
|
||
pFiler->readItem(&m_nBoldFill1);
|
||
pFiler->readItem(&m_nBoldBrick1);
|
||
pFiler->readItem(&m_nBoldRocket1);
|
||
pFiler->readItem(&m_nBoldConcrete1);
|
||
pFiler->readItem(&m_nBoldSteel1);
|
||
pFiler->readItem(&m_nBoldDivider2);
|
||
pFiler->readItem(&m_nBoldFill2);
|
||
pFiler->readItem(&m_nBoldBrick2);
|
||
pFiler->readItem(&m_nBoldRocket2);
|
||
pFiler->readItem(&m_nBoldConcrete2);
|
||
pFiler->readItem(&m_nBoldSteel2);
|
||
}
|
||
else
|
||
{
|
||
m_nText2Base=1.5; //旧图设置
|
||
m_nDetailScale=100.0;
|
||
m_sHatchDivider1=_T(""), //隔墙
|
||
m_sHatchFill1=_T(""), //填充墙
|
||
m_sHatchBrick1=_T(""), //砖墙柱
|
||
m_sHatchRocket1=_T(""), //石墙柱
|
||
m_sHatchConcrete1=_T("SOLID"), //砼墙柱
|
||
m_sHatchSteel1=_T(""); //钢墙柱
|
||
|
||
// 详图填充名称 比例 < 100
|
||
m_sHatchDivider2=_T(""), //隔墙
|
||
m_sHatchFill2=_T(""), //填充墙
|
||
m_sHatchBrick2=_T(""), //砖墙柱
|
||
m_sHatchRocket2=_T(""), //石墙柱
|
||
m_sHatchConcrete2=_T("钢筋混凝土"), //砼墙柱
|
||
m_sHatchSteel2=_T(""); //钢墙柱
|
||
|
||
// 线粗细
|
||
// 比例 >= 100
|
||
m_nBoldDivider1=m_nHighBold, //隔墙
|
||
m_nBoldFill1=m_nHighBold, //填充墙
|
||
m_nBoldBrick1=m_nHighBold, //砖墙柱
|
||
m_nBoldRocket1=m_nHighBold, //石墙柱
|
||
m_nBoldConcrete1=m_nHighBold, //砼墙柱
|
||
m_nBoldSteel1=m_nHighBold; //钢墙柱
|
||
// 比例 < 100
|
||
m_nBoldDivider2=m_nHighBold, //隔墙
|
||
m_nBoldFill2=m_nHighBold, //填充墙
|
||
m_nBoldBrick2=m_nHighBold, //砖墙柱
|
||
m_nBoldRocket2=m_nHighBold, //石墙柱
|
||
m_nBoldConcrete2=m_nHighBold, //砼墙柱
|
||
m_nBoldSteel2=m_nHighBold; //钢墙柱
|
||
|
||
SetCapLabel(TRUE);
|
||
}
|
||
|
||
if(nVer>4)
|
||
{
|
||
pFiler->readItem(&m_idLinetypeDote);
|
||
pFiler->readItem(&m_idLinetypeDash);
|
||
}
|
||
else
|
||
{
|
||
if(database()==acdbCurDwg())
|
||
{
|
||
m_idLinetypeDote = InitLineType(_T("DOTE"));
|
||
m_idLinetypeDash = InitLineType(_T("DASH"));
|
||
}
|
||
else
|
||
{
|
||
//modify by xlc on 100628 解决弹出cad警告,提示保存时出错,建议对图形进行recover的问题
|
||
//m_idLinetypeDote = GetLinetypeIdFromString(_T("DOTE"));
|
||
//m_idLinetypeDash = GetLinetypeIdFromString(_T("DASH"));
|
||
m_idLinetypeDote = GetLinetypeIdFromString(_T("DOTE"), database());
|
||
m_idLinetypeDash = GetLinetypeIdFromString(_T("DASH"), database());
|
||
}
|
||
}
|
||
|
||
if(nVer>5)
|
||
{
|
||
ReadString(pFiler,m_sProjectFile);
|
||
ReadString(pFiler,m_sLayerStd);
|
||
|
||
ReadString(pFiler, m_sHatchFill11);
|
||
ReadString(pFiler, m_sHatchFill12);
|
||
pFiler->readItem(&m_nBoldFill11);
|
||
pFiler->readItem(&m_nBoldFill12);
|
||
|
||
ReadString(pFiler, m_sHatchFill21);
|
||
ReadString(pFiler, m_sHatchFill22);
|
||
pFiler->readItem(&m_nBoldFill21);
|
||
pFiler->readItem(&m_nBoldFill22);
|
||
|
||
#if ADS>18
|
||
pFiler->readItem((Adesk::Boolean*)&m_nDividerFlag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nFillFlag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nFill1Flag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nFill2Flag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nBrickFlag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nRocketFlag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nConcreteFlag);
|
||
pFiler->readItem((Adesk::Boolean*)&m_nSteelFlag);
|
||
#else
|
||
pFiler->readItem(&m_nDividerFlag);
|
||
pFiler->readItem(&m_nFillFlag);
|
||
pFiler->readItem(&m_nFill1Flag);
|
||
pFiler->readItem(&m_nFill2Flag);
|
||
pFiler->readItem(&m_nBrickFlag);
|
||
pFiler->readItem(&m_nRocketFlag);
|
||
pFiler->readItem(&m_nConcreteFlag);
|
||
pFiler->readItem(&m_nSteelFlag);
|
||
#endif
|
||
|
||
pFiler->readItem(&m_idHatchDivider);
|
||
pFiler->readItem(&m_idHatchFill);
|
||
pFiler->readItem(&m_idHatchFill1);
|
||
pFiler->readItem(&m_idHatchFill2);
|
||
pFiler->readItem(&m_idHatchBrick);
|
||
pFiler->readItem(&m_idHatchRocket);
|
||
pFiler->readItem(&m_idHatchConcrete);
|
||
pFiler->readItem(&m_idHatchSteel);
|
||
|
||
pFiler->readItem(&m_nDividerColor);
|
||
pFiler->readItem(&m_nFillColor);
|
||
pFiler->readItem(&m_nFill1Color);
|
||
pFiler->readItem(&m_nFill2Color);
|
||
pFiler->readItem(&m_nBrickColor);
|
||
pFiler->readItem(&m_nRocketColor);
|
||
pFiler->readItem(&m_nConcreteColor);
|
||
pFiler->readItem(&m_nSteelColor);
|
||
}
|
||
else
|
||
{
|
||
m_sProjectFile=_T("");
|
||
m_sLayerStd=_T("");
|
||
}
|
||
|
||
if (nVer>6) // TArch8 beta1
|
||
{
|
||
pFiler->readItem(&m_nText2BaseRatio);
|
||
pFiler->readItem(&m_nSpaceAreaPrecision); // sg add 081126
|
||
pFiler->readItem(&m_dDrawingIndexTextRatio); // sg add 090115
|
||
pFiler->readItem(&m_bOldDrawingIndex);
|
||
pFiler->readItem(&m_dEleTriangleSize); // sg add 090212
|
||
pFiler->readItem(&m_dEleDoteSize);
|
||
pFiler->readItem(&m_dMultiLeaderDistRatio); // sg add 090216
|
||
}
|
||
else
|
||
{
|
||
// m_nText2BaseRatio = m_nText2Base*0.3; // sg modify 090527,将文字距离基线距离与系数间的换算关系由0.3精确到0.286
|
||
m_nText2BaseRatio = m_nText2Base*0.286;
|
||
m_nSpaceAreaPrecision = 2; // sg add 081126
|
||
m_bOldDrawingIndex = 1; // sg add 090115
|
||
m_dDrawingIndexTextRatio = 0.8;
|
||
//m_dEleTriangleSize = 3.0; // sg add 090212
|
||
//m_dEleDoteSize = 0.75; // sg modify 090320
|
||
m_dEleDoteSize = g_dEleDoteSize*0.5; // sg add 110301,默认值从高级选项中读取
|
||
m_dEleTriangleSize = g_dEleTriangleSize;
|
||
m_dMultiLeaderDistRatio = 0; // sg add 090216
|
||
m_dEleCrossSize = 2.5;//jsx add 160517
|
||
}
|
||
|
||
if(nVer>7)// TArch8
|
||
m_allFields.DwgIn(pFiler);
|
||
|
||
if (nVer > 10) // T20V3
|
||
{
|
||
pFiler->readItem(&m_nArcLenDimType);
|
||
pFiler->readItem(&m_nDealOldDimArrowSize);
|
||
}
|
||
else if (nVer > 8 && nVer <= 10) // TArch9
|
||
{
|
||
pFiler->readItem(&m_nArcLenDimType);
|
||
pFiler->readItem(&m_nDealOldDimArrowSize);
|
||
m_nArcLenDimType = 1;
|
||
m_nDealOldDimArrowSize = 0;//T20V3之前版本的箭头大小固定写为2
|
||
}
|
||
else
|
||
{
|
||
m_nArcLenDimType = 1;
|
||
m_nDealOldDimArrowSize = 0;
|
||
}
|
||
|
||
if (nVer > 9) // t20
|
||
{
|
||
pFiler->readItem(&m_bByLayerForDOR);
|
||
pFiler->readItem(&m_bByLayerForSym);
|
||
pFiler->readItem(&m_bByLayerForElev);
|
||
}
|
||
|
||
if (nVer > 10 && g_nSaveTArchVer > 10) //TArch20v3
|
||
{
|
||
pFiler->readItem(&m_dEleCrossSize); // jsx add 160517
|
||
}
|
||
else
|
||
{
|
||
m_dEleCrossSize = g_dEleCrossSize;
|
||
}
|
||
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
|
||
// 写出数据到dwg:
|
||
Acad::ErrorStatus TDbConfig::dwgOutFields(AcDbDwgFiler* pFiler) const
|
||
{
|
||
assertReadEnabled();
|
||
Acad::ErrorStatus es = AcDbObject::dwgOutFields(pFiler);
|
||
if(es != Acad::eOk) return es;
|
||
|
||
if(g_nSaveTArchVer==5)
|
||
pFiler->writeItem((Adesk::UInt8)3);
|
||
else if(g_nSaveTArchVer==6)
|
||
pFiler->writeItem((Adesk::UInt8)5);
|
||
else if(g_nSaveTArchVer==7)
|
||
pFiler->writeItem((Adesk::UInt8)6);
|
||
else if (g_nSaveTArchVer==8) // sg modify 120617,9.0升级版本号
|
||
pFiler->writeItem((Adesk::UInt8)8);
|
||
else if (g_nSaveTArchVer==9)
|
||
pFiler->writeItem((Adesk::UInt8)9);
|
||
else if (g_nSaveTArchVer==10)
|
||
pFiler->writeItem((Adesk::UInt8)10);
|
||
else
|
||
pFiler->writeItem(g_nVersion);
|
||
|
||
pFiler->writeItem(m_nPScale);
|
||
pFiler->writeItem(m_nLHeight);
|
||
pFiler->writeItem(m_nDrawMode);
|
||
pFiler->writeItem(m_bSolidFill);
|
||
pFiler->writeItem(m_bLineWeight);
|
||
pFiler->writeItem(m_nSpaceDispMode);
|
||
pFiler->writeItem(m_bShowWallBase);
|
||
pFiler->writeItem(m_nHighBold);
|
||
pFiler->writeItem(m_nElevDiff);
|
||
pFiler->writeItem(m_bCheckDim);
|
||
pFiler->writeItem(m_bDimAreaUnit);
|
||
|
||
Adesk::UInt32 nFlag=m_nControlFlag;
|
||
if(g_nSaveTArchVer==5)
|
||
pFiler->writeItem((Adesk::UInt8)nFlag);
|
||
else
|
||
pFiler->writeItem(nFlag);
|
||
|
||
|
||
// TArch6 data
|
||
if(g_nSaveTArchVer>5) {
|
||
pFiler->writeItem(m_nText2Base);
|
||
pFiler->writeItem(m_nDetailScale);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchDivider1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchFill1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchBrick1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchRocket1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchConcrete1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchSteel1);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchDivider2);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchFill2);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchBrick2);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchRocket2);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchConcrete2);
|
||
pFiler->writeItem((const TCHAR *)m_sHatchSteel2);
|
||
|
||
pFiler->writeItem(m_nBoldDivider1);
|
||
pFiler->writeItem(m_nBoldFill1);
|
||
pFiler->writeItem(m_nBoldBrick1);
|
||
pFiler->writeItem(m_nBoldRocket1);
|
||
pFiler->writeItem(m_nBoldConcrete1);
|
||
pFiler->writeItem(m_nBoldSteel1);
|
||
pFiler->writeItem(m_nBoldDivider2);
|
||
pFiler->writeItem(m_nBoldFill2);
|
||
pFiler->writeItem(m_nBoldBrick2);
|
||
pFiler->writeItem(m_nBoldRocket2);
|
||
pFiler->writeItem(m_nBoldConcrete2);
|
||
pFiler->writeItem(m_nBoldSteel2);
|
||
|
||
pFiler->writeItem(m_idLinetypeDote);
|
||
pFiler->writeItem(m_idLinetypeDash);
|
||
}
|
||
|
||
if(g_nSaveTArchVer>6)
|
||
{
|
||
pFiler->writeItem((const TCHAR*)m_sProjectFile);
|
||
pFiler->writeItem((const TCHAR*)m_sLayerStd);
|
||
|
||
pFiler->writeString((const TCHAR*)m_sHatchFill11);
|
||
pFiler->writeString((const TCHAR*)m_sHatchFill12);
|
||
pFiler->writeItem(m_nBoldFill11);
|
||
pFiler->writeItem(m_nBoldFill12);
|
||
|
||
pFiler->writeString((const TCHAR*)m_sHatchFill21);
|
||
pFiler->writeString((const TCHAR*)m_sHatchFill22);
|
||
pFiler->writeItem(m_nBoldFill21);
|
||
pFiler->writeItem(m_nBoldFill22);
|
||
|
||
#if ADS>18
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nDividerFlag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nFillFlag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nFill1Flag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nFill2Flag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nBrickFlag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nRocketFlag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nConcreteFlag);
|
||
pFiler->writeBoolean((Adesk::Boolean)m_nSteelFlag);
|
||
#else
|
||
pFiler->writeItem(m_nDividerFlag);
|
||
pFiler->writeItem(m_nFillFlag);
|
||
pFiler->writeItem(m_nFill1Flag);
|
||
pFiler->writeItem(m_nFill2Flag);
|
||
pFiler->writeItem(m_nBrickFlag);
|
||
pFiler->writeItem(m_nRocketFlag);
|
||
pFiler->writeItem(m_nConcreteFlag);
|
||
pFiler->writeItem(m_nSteelFlag);
|
||
#endif
|
||
pFiler->writeItem(m_idHatchDivider);
|
||
pFiler->writeItem(m_idHatchFill);
|
||
pFiler->writeItem(m_idHatchFill1);
|
||
pFiler->writeItem(m_idHatchFill2);
|
||
pFiler->writeItem(m_idHatchBrick);
|
||
pFiler->writeItem(m_idHatchRocket);
|
||
pFiler->writeItem(m_idHatchConcrete);
|
||
pFiler->writeItem(m_idHatchSteel);
|
||
|
||
pFiler->writeItem(m_nDividerColor);
|
||
pFiler->writeItem(m_nFillColor);
|
||
pFiler->writeItem(m_nFill1Color);
|
||
pFiler->writeItem(m_nFill2Color);
|
||
pFiler->writeItem(m_nBrickColor);
|
||
pFiler->writeItem(m_nRocketColor);
|
||
pFiler->writeItem(m_nConcreteColor);
|
||
pFiler->writeItem(m_nSteelColor);
|
||
}
|
||
|
||
if(g_nSaveTArchVer>7)
|
||
{
|
||
pFiler->writeItem(m_nText2BaseRatio);
|
||
pFiler->writeItem(m_nSpaceAreaPrecision); // sg add 081126
|
||
pFiler->writeItem(m_dDrawingIndexTextRatio); // sg add 090115
|
||
pFiler->writeItem(m_bOldDrawingIndex);
|
||
pFiler->writeItem(m_dEleTriangleSize); // sg add 090212
|
||
pFiler->writeItem(m_dEleDoteSize);
|
||
pFiler->writeItem(m_dMultiLeaderDistRatio); // sg add 090216
|
||
|
||
m_allFields.DwgOut(pFiler);//add by whl on 090401
|
||
}
|
||
|
||
if (g_nSaveTArchVer > 8)
|
||
{
|
||
pFiler->writeItem(m_nArcLenDimType);
|
||
pFiler->writeItem(m_nDealOldDimArrowSize);
|
||
}
|
||
if (g_nSaveTArchVer > 9)
|
||
{
|
||
pFiler->writeItem(m_bByLayerForDOR);
|
||
pFiler->writeItem(m_bByLayerForSym);
|
||
pFiler->writeItem(m_bByLayerForElev);
|
||
}
|
||
|
||
if (g_nSaveTArchVer > 10 && g_nVersion > 10)
|
||
{
|
||
pFiler->writeItem(m_dEleCrossSize);
|
||
}
|
||
return pFiler->filerStatus();
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus TDbConfig::dxfInFields (AcDbDxfFiler* pFiler)
|
||
{
|
||
Acad::ErrorStatus es = AcDbObject::dxfInFields(pFiler);
|
||
if(es!=Acad::eOk)
|
||
return es;
|
||
if (!pFiler->atSubclassData(_T("TDbConfig"))) {
|
||
return Acad::eBadDxfSequence;
|
||
}
|
||
|
||
return pFiler->filerStatus();
|
||
|
||
// 不读入任何数据
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus TDbConfig::dxfOutFields(AcDbDxfFiler* pFiler) const
|
||
{
|
||
Acad::ErrorStatus es;
|
||
|
||
es = AcDbObject::dxfOutFields(pFiler);
|
||
assert(es == Acad::eOk);
|
||
|
||
es = pFiler->writeItem(AcDb::kDxfSubclass,_T("TDbConfig"));
|
||
assert(es == Acad::eOk);
|
||
|
||
return es;
|
||
}
|
||
|
||
|
||
Acad::ErrorStatus
|
||
TDbConfig::subWblockClone(AcRxObject* pOwner,
|
||
AcDbObject*& pClonedObject,
|
||
AcDbIdMapping& idMap,
|
||
Adesk::Boolean isPrimary) const
|
||
{
|
||
// ::WblockCloneCompStyleDict(pOwner, idMap);
|
||
Acad::ErrorStatus es=AcDbObject::subWblockClone(pOwner, pClonedObject, idMap, isPrimary);
|
||
return es;
|
||
}
|
||
|
||
resbuf * TDbConfig::xData(const TCHAR* regappName) const
|
||
{
|
||
assertReadEnabled();
|
||
if (regappName == NULL)
|
||
{
|
||
return AcDbObject::xData(regappName);
|
||
}
|
||
|
||
if (_tcsicmp(regappName,_T("TDbConfig")) == 0
|
||
//del by xlc on 100505 统一调整为通过TDbConfig获取变量
|
||
/*|| _tcsicmp(regappName,_T("InitLayer") == 0
|
||
|| _tcsicmp(regappName,_T("DocSetMeterUnitDraw") == 0*/
|
||
)
|
||
{
|
||
static TConfigDataTearoff cfgBaseData;
|
||
return (resbuf *)&cfgBaseData;
|
||
}
|
||
|
||
return AcDbObject::xData(regappName);
|
||
}
|
||
|
||
Acad::ErrorStatus TDbConfig::setXData(const resbuf* xdata)
|
||
{
|
||
assertWriteEnabled();
|
||
if (xdata->restype == RTSTR)
|
||
{
|
||
if (xdata->resval.rstring != NULL && _tcsicmp(xdata->resval.rstring,_T("InitLineType")) == 0)
|
||
{
|
||
AcDbDatabase* pDb = acdbCurDwg();
|
||
if (xdata->rbnext != NULL && xdata->rbnext->resval.rstring != NULL)
|
||
{
|
||
pDb = (AcDbDatabase*)xdata->rbnext->resval.rstring;
|
||
}
|
||
this->SetLinetypeDash(InitLineType(_T("DASH"), pDb)); //InitTchLineType(_T("GB_DASH1"))
|
||
this->SetLinetypeDote(InitLineType(_T("DOTE"), pDb)); // GB_DOT1
|
||
return Acad::eOk;
|
||
}
|
||
}
|
||
return AcDbObject::setXData(xdata);
|
||
}
|
||
|
||
TConfigDataTearoff::TConfigDataTearoff()
|
||
{
|
||
|
||
}
|
||
|
||
TConfigDataTearoff::~TConfigDataTearoff()
|
||
{
|
||
|
||
}
|
||
|
||
BOOL TConfigDataTearoff::DocSetPScale(double nScale)
|
||
{
|
||
return ::DocSetPScale(nScale);
|
||
}
|
||
|
||
double TConfigDataTearoff::DocGetPScale()
|
||
{
|
||
return ::DocGetPScale();
|
||
}
|
||
|
||
double TConfigDataTearoff::DocGetLHeight()
|
||
{
|
||
return ::DocGetLHeight();
|
||
}
|
||
|
||
double TConfigDataTearoff::DocGetHighBold()
|
||
{
|
||
return ::DocGetHighBold();
|
||
}
|
||
|
||
BOOL TConfigDataTearoff::DocGetDrawMode()
|
||
{
|
||
return ::DocGetDrawMode();
|
||
}
|
||
|
||
BOOL TConfigDataTearoff::DocGetIsSolidFill()
|
||
{
|
||
return ::DocGetIsSolidFill();
|
||
}
|
||
|
||
BOOL TConfigDataTearoff::DocGetIsLineWeight()
|
||
{
|
||
return ::DocGetIsLineWeight();
|
||
}
|
||
|
||
BOOL TConfigDataTearoff::DocGetMeterUnitDraw()
|
||
{
|
||
return ::DocGetMeterUnitDraw();
|
||
}
|
||
|
||
void TConfigDataTearoff::DocSetMeterUnitDraw(BOOL bTrue)
|
||
{
|
||
::DocSetMeterUnitDraw(bTrue);
|
||
}
|
||
|
||
AcDbObjectId TConfigDataTearoff::InitLayer(const TCHAR *szLayer, BOOL bApplyChange)
|
||
{
|
||
return ::InitLayer(szLayer, bApplyChange);
|
||
}
|
||
|
||
|
||
int TConfigDataTearoff::BoolOper(AcDb::BoolOperType nOperType,LPVOID pPoly1,LPVOID pPoly2,LPVOID pPtrListPoly2d)
|
||
{
|
||
TGGePoly2D* pPoly2D1 = (TGGePoly2D*)pPoly1;
|
||
TGGePoly2D* pPoly2D2 = (TGGePoly2D*)pPoly2;
|
||
TDPtrList<TGGePoly2D>* pPoly2dList = (TDPtrList<TGGePoly2D>*)pPtrListPoly2d;
|
||
|
||
switch(nOperType)
|
||
{
|
||
case AcDb::kBoolUnite:
|
||
{
|
||
return TchSubExport::Union(*pPoly2D1, *pPoly2D2,*pPoly2dList);
|
||
}
|
||
case AcDb::kBoolIntersect:
|
||
{
|
||
return TchSubExport::Intersect(*pPoly2D1, *pPoly2D2,*pPoly2dList);
|
||
}
|
||
case AcDb::kBoolSubtract:
|
||
{
|
||
return TchSubExport::Subtract(*pPoly2D1, *pPoly2D2,*pPoly2dList);
|
||
}
|
||
default:
|
||
break;
|
||
}
|
||
return -1;
|
||
}
|
||
|
||
|
||
CString TConfigDataTearoff::GetCurrentCommand()
|
||
{
|
||
//modify by xlc on 100610消除编译警告
|
||
//return ::GetCurCommand();
|
||
return CString(::GetCurCommand());
|
||
}
|
||
|
||
void TConfigDataTearoff::Close()
|
||
{
|
||
}
|
||
|
||
// sg add 090512,轴号字高系数,动态数据
|
||
void TDbConfig::SetAxisLabelTextRatio(double dValue)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("轴号字高系数"), dValue);
|
||
}
|
||
|
||
double TDbConfig::GetAxisLabelTextRatio() const
|
||
{
|
||
assertReadEnabled();
|
||
double dVal = g_dAxisLabelTextRatio;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("轴号字高系数"), dVal);
|
||
return dVal;
|
||
}
|
||
|
||
// sg add 090609,带形窗幕墙改变样式的比例界限,动态数据
|
||
void TDbConfig::SetCurtainWall3Scale(double dValue)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("幕墙样式界限比例"), dValue);
|
||
}
|
||
|
||
double TDbConfig::GetCurtainWall3Scale() const
|
||
{
|
||
assertReadEnabled();
|
||
double dVal = g_nCurtainWall3Scale;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("幕墙样式界限比例"), dVal);
|
||
return dVal;
|
||
}
|
||
|
||
// sg add 090609,带形窗幕墙比例改变后是否不改样式,动态数据
|
||
void TDbConfig::SetCurtainWallFixStyle(BOOL bVal)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("幕墙样式不随比例"), bVal);
|
||
}
|
||
|
||
Adesk::UInt8 TDbConfig::IsCurtainWallFixStyle() const
|
||
{
|
||
assertReadEnabled();
|
||
BOOL bVal = g_bCurtainWallFixStyle;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("幕墙样式不随比例"), bVal);
|
||
return bVal;
|
||
}
|
||
|
||
// sg add 090609,带形窗幕墙,不改样式时的设定类型,动态数据
|
||
void TDbConfig::SetCurtainWallStyle(int nValue)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("幕墙固定样式"), nValue);
|
||
}
|
||
|
||
Adesk::UInt8 TDbConfig::GetCurtainWallStyle() const
|
||
{
|
||
assertReadEnabled();
|
||
int nVal = g_nCurtainWallStyle;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("幕墙固定样式"), nVal);
|
||
return nVal;
|
||
}
|
||
|
||
// sg add 110120,凸窗挡板、转角窗挡板、门窗套是否加保温
|
||
void TDbConfig::SetProWinSlabInsu(BOOL bValue)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("凸窗加保温"), bValue);
|
||
}
|
||
|
||
BOOL TDbConfig::IsProWinSlabInsu() const
|
||
{
|
||
assertReadEnabled();
|
||
BOOL bValue = TRUE;
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("凸窗加保温"), bValue);
|
||
return bValue;
|
||
}
|
||
|
||
// sg add 110303,增加单行文字、多行文字、专业词库样式的动态数据
|
||
void TDbConfig::SetTgSingleTextStyle(CString csStyle)
|
||
{
|
||
assertWriteEnabled();
|
||
TEntityFields &fd = Fields();
|
||
fd.SFD(_T("单行文字样式"), (const TCHAR*)csStyle);
|
||
}
|
||
|
||
CString TDbConfig::GetTgSingleTextStyle() const
|
||
{
|
||
assertReadEnabled();
|
||
CString csResult = _T("");
|
||
const TEntityFields &fd = GetFields();
|
||
fd.GFD(_T("单行文字样式"), csResult);
|
||
return csResult;
|
||
}
|
||
|
||
void InitDbInitSet(BOOL bTrue)
|
||
{
|
||
if(bTrue) {
|
||
TDbConfig::rxInit();
|
||
} else {
|
||
deleteAcRxClass(TDbConfig::desc());
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// Assure pXDict is open for write
|
||
TARCH_IMPEXP
|
||
TDbConfig * GetDbConfigFromDict(AcDbDictionary *pXDict, AcDb::OpenMode mode)
|
||
{
|
||
Acad::ErrorStatus es=Acad::eOk;
|
||
// Now, get and open the inventory object, if it is there.
|
||
// If we can_T('t open it, that')s OK for now.
|
||
//AcDbObject *pExtObj=NULL;
|
||
AcDbObjectId idExist;
|
||
TDbConfig *pIObj=NULL;
|
||
es = pXDict->getAt(_T("ATS_DBCONFIG"), idExist);
|
||
if(es==Acad::eOk && !!idExist) {
|
||
es=acdbOpenObject(pIObj, idExist, mode);
|
||
if(es==Acad::eOk)
|
||
return pIObj;
|
||
}
|
||
|
||
if(mode==AcDb::kForWrite) {
|
||
//AcAxDocLock docLock;
|
||
//VERIFY(docLock.lockStatus() == Acad::eOk);
|
||
if(pXDict->upgradeOpen()==Acad::eOk) {
|
||
pIObj = new TDbConfig;
|
||
pIObj->SetLinetypeDash(InitLineType(_T("DASH"), pXDict->database())); //InitTchLineType(_T("GB_DASH1"))
|
||
pIObj->SetLinetypeDote(InitLineType(_T("DOTE"), pXDict->database())); // GB_DOT1
|
||
AcDbObjectId id;
|
||
es=pXDict->setAt(_T("ATS_DBCONFIG"), pIObj, id);
|
||
ASSERT(es==Acad::eOk);
|
||
pXDict->downgradeOpen();
|
||
}
|
||
}
|
||
return pIObj;
|
||
}
|
||
|
||
// 保存全局到DWG
|
||
TDbConfig * GetDwgGlobal(AcDb::OpenMode opMode, AcDbDatabase *pDb)
|
||
{
|
||
// TDbConfig *pInitSet=NULL;
|
||
// AcDbDictionary *pNamedObj=NULL;
|
||
//if(!pDb)
|
||
// pDb=acdbCurDwg();
|
||
// if(pDb && pDb->getNamedObjectsDictionary(pNamedObj, AcDb::kForRead)==Acad::eOk &&
|
||
// pNamedObj) {
|
||
// pInitSet=GetDbConfigFromDict(pNamedObj, opMode);
|
||
// pNamedObj->close();
|
||
// }
|
||
return NULL;
|
||
}
|