631 lines
17 KiB
C++
631 lines
17 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "TEImpCabEnclosure.h"
|
|
#include "TDbXDataMap.h"
|
|
#include "TDbInterfaceMsgWrite.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
TEImpCabEnclosure::TEImpCabEnclosure()
|
|
{
|
|
|
|
}
|
|
|
|
TEImpCabEnclosure::~TEImpCabEnclosure()
|
|
{
|
|
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::GetInterface(int nIndex,TInterface& pipeInterface) const
|
|
{
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
AcGePoint3d ptInsert;
|
|
AcGeVector3d vtDir;
|
|
AcDbObjectId id;
|
|
|
|
m_pXDataMap->GetAt(KEY_MID,ptInsert); //终端封头插入点
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir); //终端封头主方向
|
|
|
|
if (0 == nIndex)
|
|
{
|
|
if (m_pXDataMap->GetAt(KEY_IDCNT1,id))
|
|
{
|
|
if (MakesureInterfaceValidate(id,ptInsert,vtDir,pipeInterface))
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
pipeInterface.SetOutDir(vtDir);
|
|
pipeInterface.SetOwnerId(m_pOwnerEnt->objectId());
|
|
pipeInterface.SetPosition(ptInsert);
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
BOOL TEImpCabEnclosure::GetInterface(const AcGePoint3d& ptCon,TInterface& pipeInterface) const
|
|
{
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
AcGePoint3d ptInsert;
|
|
AcGeVector3d vtDir;
|
|
double dDist = 0.0;
|
|
|
|
m_pXDataMap->GetAt(KEY_MID,ptInsert); //终端封头插入点
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir); //终端封头主方向
|
|
|
|
dDist = ptCon.distanceTo(ptInsert);
|
|
|
|
if (dDist < 1.e-3)
|
|
{
|
|
//判断点是否在接口对象上
|
|
AcDbObjectId id;
|
|
if (m_pXDataMap->GetAt(KEY_IDCNT1,id))
|
|
{
|
|
if (MakesureInterfaceValidate(id,ptCon,vtDir,pipeInterface))
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
pipeInterface.SetOutDir(vtDir);
|
|
pipeInterface.SetOwnerId(m_pOwnerEnt->objectId());
|
|
pipeInterface.SetPosition(ptInsert);
|
|
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::HasInterface(const AcGePoint3d& ptCon,const AcGeVector3d& vtDir)
|
|
{
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
AcGePoint3d ptInsert;
|
|
AcGeVector3d vtT;
|
|
double dDist = 0.0;
|
|
|
|
m_pXDataMap->GetAt(KEY_MID,ptInsert);
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtT);
|
|
|
|
dDist = ptCon.distanceTo(ptInsert);
|
|
if (dDist < 1.e-3)
|
|
{
|
|
if (vtT.isParallelTo(vtDir))
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::RemoveInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
//浅层次删除; 命名字典中的关系,需要外面移除关系,只移除内部关系
|
|
AcDbObjectId id;
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
m_pXDataMap->GetAt(KEY_IDCNT1,id);
|
|
|
|
BOOL bRemoved = FALSE;
|
|
if (id == idConnect)
|
|
{
|
|
m_pXDataMap->SetAt(KEY_IDCNT1,AcDbObjectId::kNull);
|
|
bRemoved = TRUE;
|
|
}
|
|
return bRemoved;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::NotifyInterfaceToModify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
|
|
{
|
|
BOOL bMsgTranslate = FALSE;
|
|
|
|
//接口更改通知
|
|
TDb::InterfaceOper eOper = iModiMsg.GetInterfaceOper();
|
|
switch(eOper)
|
|
{
|
|
case TDb::eMoveGripPoint:
|
|
{
|
|
//bMsgTranslate = OnMoveGripPointMsgNotify(iModiMsg,iModiMsgs);
|
|
break;
|
|
}
|
|
case TDb::eTransformBy:
|
|
{
|
|
bMsgTranslate = OnTransformByMsgNotify(iModiMsg,iModiMsgs);
|
|
break;
|
|
}
|
|
case TDb::eSize:
|
|
{
|
|
//bMsgTranslate = OnSizeMsgNotify(iModiMsg,iModiMsgs);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
if (m_pOwnerEnt != NULL) m_pOwnerEnt->recordGraphicsModified();
|
|
return bMsgTranslate;
|
|
}
|
|
|
|
int TEImpCabEnclosure::GetInterfaceCount() const
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::SetInterfaceRelation(const AcGePoint3d& ptConnect,const AcDbObjectId& idConnect)
|
|
{
|
|
if ( !idConnect.isValid())
|
|
return FALSE;
|
|
|
|
BOOL bSuccess = FALSE;
|
|
AcGePoint3d ptInsert;
|
|
AcGeVector3d vtDir;
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
m_pXDataMap->GetAt(KEY_MID,ptInsert);
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir);
|
|
|
|
vtDir.normalize();
|
|
|
|
double dDist = ptConnect.distanceTo(ptInsert);
|
|
if (dDist < 1.e-3)
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
if (Acad::eOk == acdbOpenAcDbEntity(pEnt,idConnect,AcDb::kForRead))
|
|
{
|
|
TDbPipeBase* pPipe = TDbPipeBase::cast(pEnt);
|
|
if (pPipe != NULL)
|
|
{
|
|
if (pPipe->HasInterface(ptConnect,vtDir))
|
|
{
|
|
if (dDist < 1.e-3)
|
|
m_pXDataMap->SetAt(KEY_IDCNT1,idConnect);
|
|
bSuccess = TRUE;
|
|
}
|
|
}
|
|
|
|
TDbFittingBase* pFitting = TDbFittingBase::cast(pEnt);
|
|
if (pPipe != NULL)
|
|
{
|
|
if (pPipe->HasInterface(ptConnect,vtDir))
|
|
{
|
|
if (dDist < 1.e-3)
|
|
m_pXDataMap->SetAt(KEY_IDCNT1,idConnect);
|
|
bSuccess = TRUE;
|
|
}
|
|
}
|
|
|
|
pEnt->close();
|
|
}
|
|
}
|
|
}
|
|
return bSuccess;
|
|
}
|
|
|
|
void TEImpCabEnclosure::CreateFace(XExplodeDraw &mode,const AcGePoint3d& pt1,const AcGePoint3d& pt2,const AcGePoint3d& pt3,const AcGePoint3d& pt4) const
|
|
{
|
|
AcGePoint3d ptFace[4];
|
|
ptFace[0] = pt1;
|
|
ptFace[1] = pt2;
|
|
ptFace[2] = pt3;
|
|
ptFace[3] = pt4;
|
|
mode.DrawMesh(2,2,ptFace);
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus TEImpCabEnclosure::ExplodeOrDraw3d(XExplodeDraw &mode) const
|
|
{
|
|
|
|
Acad::ErrorStatus errorState = Acad::eOk;
|
|
|
|
if (m_pXDataMap == NULL)
|
|
return Acad::eNotImplementedYet;
|
|
|
|
int nStyle = TDb::eC;
|
|
m_pXDataMap->GetAt(KEY_STYLE,nStyle);
|
|
|
|
switch (nStyle)
|
|
{
|
|
case TDb::eC:// 槽式桥架
|
|
{
|
|
errorState = ExplodeOrDraw3dOfC(mode);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return errorState;
|
|
|
|
}
|
|
|
|
Acad::ErrorStatus TEImpCabEnclosure::ExplodeOrDraw3dOfC(XExplodeDraw &mode) const
|
|
{
|
|
/**************************************************************************
|
|
终端封头示意图
|
|
7
|
|
4↗ ↗↓
|
|
↗ ↓ ↗ ↓
|
|
↗ ↓ ↗ ↓
|
|
↗ 3↙ ↗ ↓
|
|
↗ ↙ 6↗ ↓
|
|
5 ↓→ → → → → ↗ 0 vtDir
|
|
↓ ↓ ↗ ↗
|
|
↓ ↓ ↗ ↗
|
|
2→ → → → → →↗ 1 ↗
|
|
← ← ← ↗
|
|
vtTemp
|
|
***************************************************************************/
|
|
Acad::ErrorStatus errorState = Acad::eOk;
|
|
|
|
AcGePoint3d ptInsert,ptStart,ptEnd;
|
|
AcGePoint3d* pVertex = new AcGePoint3d[8];
|
|
AcGeVector3d vtNormal,vtDir,vtTemp;
|
|
double dB = 0.0,dH = 0.0;
|
|
int nType = 0;
|
|
|
|
if (!m_pXDataMap->GetAt(KEY_MID,ptInsert) ||
|
|
!m_pXDataMap->GetAt(KEY_NORMAL,vtNormal) ||
|
|
!m_pXDataMap->GetAt(KEY_B,dB) ||
|
|
!m_pXDataMap->GetAt(KEY_H,dH) ||
|
|
!m_pXDataMap->GetAt(KEY_MAINDIR,vtDir) ||
|
|
!m_pXDataMap->GetAt(KEY_TYPE,nType))
|
|
return Acad::eNotImplementedYet;
|
|
|
|
vtDir.normalize();
|
|
vtTemp = vtDir;
|
|
vtTemp = vtTemp.rotateBy(PI/2, vtNormal);
|
|
|
|
Adesk::UInt16 curColor = m_pOwnerEnt->colorIndex();
|
|
mode.SetColor(curColor);
|
|
|
|
if (nType == TDb::eStartEnclosure)
|
|
{
|
|
pVertex[1] = ptInsert - vtTemp * (dB / 2);
|
|
pVertex[2] = ptInsert + vtTemp * (dB / 2);
|
|
pVertex[0] = pVertex[1] + vtDir * dB;
|
|
pVertex[3] = pVertex[2] + vtDir * dB;
|
|
pVertex[4] = pVertex[3] + vtNormal * dH;
|
|
pVertex[5] = pVertex[2] + vtNormal * dH;
|
|
pVertex[6] = pVertex[1] + vtNormal * dH;
|
|
pVertex[7] = pVertex[0] + vtNormal * dH;
|
|
|
|
static Adesk::Int32 listFace[] = {8,0,1,2,3,4,5,6,7};
|
|
mode.DrawShell(8,pVertex,9,listFace);
|
|
CreateFace(mode,pVertex[0],pVertex[1],pVertex[7],pVertex[6]);
|
|
CreateFace(mode,pVertex[1],pVertex[2],pVertex[6],pVertex[5]);
|
|
CreateFace(mode,pVertex[2],pVertex[3],pVertex[5],pVertex[4]);
|
|
}
|
|
else if(nType == TDb::eEndEnclosure)
|
|
{
|
|
pVertex[0] = ptInsert - vtTemp * (dB / 2);
|
|
pVertex[3] = ptInsert + vtTemp * (dB / 2);
|
|
pVertex[1] = pVertex[0] + vtDir * dB;
|
|
pVertex[2] = pVertex[3] + vtDir * dB;
|
|
pVertex[7] = pVertex[0] + vtNormal * dH;
|
|
pVertex[4] = pVertex[3] + vtNormal * dH;
|
|
pVertex[6] = pVertex[1] + vtNormal * dH;
|
|
pVertex[5] = pVertex[2] + vtNormal * dH;
|
|
|
|
static Adesk::Int32 listFace[] = {8,1,0,3,2,5,4,7,6};
|
|
mode.DrawShell(8,pVertex,9,listFace);
|
|
CreateFace(mode,pVertex[1],pVertex[0],pVertex[6],pVertex[7]);
|
|
CreateFace(mode,pVertex[0],pVertex[3],pVertex[7],pVertex[4]);
|
|
CreateFace(mode,pVertex[3],pVertex[2],pVertex[4],pVertex[5]);
|
|
}
|
|
|
|
if (pVertex != NULL)
|
|
delete []pVertex;
|
|
|
|
return errorState;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::MakeCurves(TComplexCurve& cplCurve) const
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
Acad::ErrorStatus TEImpCabEnclosure::transformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
AcGePoint3d ptGeInsert;
|
|
AcGeVector3d vtDir;
|
|
|
|
if (!m_pXDataMap->GetAt(KEY_MID,ptGeInsert) ||
|
|
!m_pXDataMap->GetAt(KEY_MAINDIR,vtDir))
|
|
return Acad::eOk;
|
|
|
|
vtDir.transformBy(xform);
|
|
ptGeInsert.transformBy(xform);
|
|
|
|
if (!m_pXDataMap->SetAt(KEY_MID,ptGeInsert) ||
|
|
!m_pXDataMap->SetAt(KEY_MAINDIR,vtDir))
|
|
return Acad::eOk;
|
|
|
|
if (m_pOwnerEnt->objectId().isValid())
|
|
{
|
|
// 写入接口更改消息
|
|
TInterfaceModifyMsg iMsg;
|
|
iMsg.SetInterfaceOper(TDb::eTransformBy);
|
|
iMsg.SetMsgValidate(TRUE);
|
|
iMsg.SetTransform(xform);
|
|
iMsg.SetMsgOperateOn(m_pOwnerEnt->objectId());
|
|
|
|
TDbInterfaceMsgWrite msgWrite;
|
|
msgWrite.WriteInterfaceMsg(iMsg);
|
|
UpdateInterfaceRec(m_pOwnerEnt->objectId(),xform);
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
BOOL TEImpCabEnclosure::OnTransformByMsgNotify(const TInterfaceModifyMsg& iModiMsg,TInterfaceModifyMsgs& iModiMsgs)
|
|
{
|
|
// 不考虑其所属的接口的关系,变化后相当于断开关系
|
|
// 新位置的关系建立,由外部管理对象处理;
|
|
AcGePoint3d ptInsert;
|
|
BOOL bMsgTranslate = FALSE;
|
|
|
|
if (m_pXDataMap != NULL)
|
|
{
|
|
AcGeMatrix3d xform = iModiMsg.GetTransform();
|
|
|
|
AcGeVector3d vtDir;
|
|
m_pXDataMap->GetAt(KEY_MID,ptInsert);
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir);
|
|
|
|
ptInsert.transformBy(xform);
|
|
m_pXDataMap->SetAt(KEY_MID,ptInsert);
|
|
|
|
//产生新的接口消息
|
|
AcDbObjectId id;
|
|
m_pXDataMap->GetAt(KEY_IDCNT1,id);
|
|
|
|
// 构造接口消息传递 开始端检查
|
|
AcDbObjectId idT;
|
|
if (FindConnect(ptInsert,vtDir,m_pOwnerEnt->objectId(),idT))
|
|
{
|
|
TInterfaceModifyMsg msg;
|
|
msg.SetMsgPoint(ptInsert);
|
|
msg.SetTransform(xform);
|
|
msg.SetMsgOperateOn(idT);
|
|
iModiMsgs.append(msg);
|
|
bMsgTranslate = TRUE;
|
|
}
|
|
|
|
if (m_pOwnerEnt->objectId().isValid())
|
|
{
|
|
//更新接口记录接口信息
|
|
UpdateInterfaceRec(m_pOwnerEnt->objectId(),xform);
|
|
}
|
|
|
|
}
|
|
return bMsgTranslate;
|
|
}
|
|
|
|
CString TEImpCabEnclosure::GetXml() const
|
|
{
|
|
if (m_pXDataMap == NULL || m_pOwnerEnt == NULL)
|
|
{
|
|
return _T("");
|
|
}
|
|
|
|
int nValue(0);
|
|
double dValue(0.0);
|
|
int nSizePreci(3), nPtPreci(6); // 尺寸、位置精度
|
|
|
|
TXmlTree xmlTree;
|
|
CString csText;
|
|
AcGePoint3d pt;
|
|
AcGePoint3dArray arPts;
|
|
AcGeVector3d vtDir;
|
|
CString csX, csY, csZ;
|
|
|
|
POSITION posRoot = xmlTree.Insert(_T("ATS_EFITTING"), NULL, NULL);
|
|
{
|
|
CString sTemp = _T("");
|
|
sTemp.Format(_T("%d"),TDb::eEnclosure);
|
|
xmlTree.SetAttribute(posRoot, _T("name"), sTemp);
|
|
xmlTree.SetAttribute(posRoot, _T("comment"), _T("终端封头"));
|
|
}
|
|
POSITION nowPos = xmlTree.Insert(KEY_TYPE,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("类型"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("1:起点封头,2:终点封头"));
|
|
m_pXDataMap->GetAt(KEY_TYPE,nValue);
|
|
csText.Format(_T("%d"),nValue);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(_T("ptInsert"),posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("插入点"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("插入点"));
|
|
m_pXDataMap->GetAt(KEY_MID,pt);
|
|
TAuxTools::DoubleToString(pt.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(pt.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(pt.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(KEY_B,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("宽度"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("宽度"));
|
|
m_pXDataMap->GetAt(KEY_B,dValue);
|
|
TAuxTools::DoubleToString(dValue,nSizePreci,csText);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(KEY_H,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("高度"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("高度"));
|
|
m_pXDataMap->GetAt(KEY_H,dValue);
|
|
TAuxTools::DoubleToString(dValue,nSizePreci,csText);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(KEY_MAINDIR,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("主分支向量"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("主分支向量"));
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir);
|
|
TAuxTools::DoubleToString(vtDir.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(vtDir.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(vtDir.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(KEY_NORMAL,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("法相量"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("法相量"));
|
|
m_pXDataMap->GetAt(KEY_NORMAL,vtDir);
|
|
TAuxTools::DoubleToString(vtDir.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(vtDir.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(vtDir.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
// nowPos = xmlTree.Insert(KEY_COVER,posRoot,NULL);
|
|
// {
|
|
// xmlTree.SetAttribute(nowPos, _T("name"), _T("盖板"));
|
|
// xmlTree.SetAttribute(nowPos, _T("comment"), _T("0:不显示,1:显示"));
|
|
// m_pXDataMap->GetAt(KEY_COVER,nValue);
|
|
// csText.Format(_T("%d"),nValue);
|
|
// xmlTree.SetItemText(nowPos,csText);
|
|
// }
|
|
nowPos = xmlTree.Insert(_T("Object_ID"),posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos,_T("name"),_T("ID"));
|
|
xmlTree.SetAttribute(nowPos,_T("comment"),_T("终端封头ID"));
|
|
LONG_PTR nid = m_pOwnerEnt->objectId().asOldId();
|
|
|
|
csText.Format(_T("%ld"),nid);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
CString csXml = xmlTree.GetXml();
|
|
|
|
return csXml;
|
|
}
|
|
|
|
CString TEImpCabEnclosure::GetXml(const AcGeMatrix3d& mat) const
|
|
{
|
|
if (m_pXDataMap == NULL || m_pOwnerEnt == NULL)
|
|
{
|
|
return _T("");
|
|
}
|
|
|
|
int nValue(0);
|
|
double dValue(0.0);
|
|
int nSizePreci(3), nPtPreci(6); // 尺寸、位置精度
|
|
|
|
TXmlTree xmlTree;
|
|
CString csText;
|
|
AcGePoint3d pt;
|
|
AcGePoint3dArray arPts;
|
|
AcGeVector3d vtDir;
|
|
CString csX, csY, csZ;
|
|
|
|
POSITION posRoot = xmlTree.Insert(_T("ATS_EFITTING"), NULL, NULL);
|
|
{
|
|
CString sTemp = _T("");
|
|
sTemp.Format(_T("%d"),TDb::eEnclosure);
|
|
xmlTree.SetAttribute(posRoot, _T("name"), sTemp);
|
|
xmlTree.SetAttribute(posRoot, _T("comment"), _T("终端封头"));
|
|
}
|
|
POSITION nowPos = xmlTree.Insert(KEY_TYPE,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("类型"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("1:起点封头,2:终点封头"));
|
|
m_pXDataMap->GetAt(KEY_TYPE,nValue);
|
|
csText.Format(_T("%d"),nValue);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
nowPos = xmlTree.Insert(_T("ptInsert"),posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("插入点"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("插入点"));
|
|
m_pXDataMap->GetAt(KEY_MID,pt);
|
|
TAuxTools::DoubleToString(pt.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(pt.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(pt.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
nowPos = xmlTree.Insert(KEY_B,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("宽度"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("宽度"));
|
|
m_pXDataMap->GetAt(KEY_B,dValue);
|
|
TAuxTools::DoubleToString(dValue,nSizePreci,csText);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
nowPos = xmlTree.Insert(KEY_H,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("高度"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("高度"));
|
|
m_pXDataMap->GetAt(KEY_H,dValue);
|
|
TAuxTools::DoubleToString(dValue,nSizePreci,csText);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
nowPos = xmlTree.Insert(KEY_MAINDIR,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("主方向"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("主方向"));
|
|
m_pXDataMap->GetAt(KEY_MAINDIR,vtDir);
|
|
vtDir.transformBy(mat);
|
|
TAuxTools::DoubleToString(vtDir.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(vtDir.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(vtDir.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
nowPos = xmlTree.Insert(KEY_NORMAL,posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos, _T("name"), _T("法相量"));
|
|
xmlTree.SetAttribute(nowPos, _T("comment"), _T("法相量"));
|
|
m_pXDataMap->GetAt(KEY_NORMAL,vtDir);
|
|
vtDir.transformBy(mat);
|
|
TAuxTools::DoubleToString(vtDir.x,nPtPreci,csX);
|
|
TAuxTools::DoubleToString(vtDir.y,nPtPreci,csY);
|
|
TAuxTools::DoubleToString(vtDir.z,nPtPreci,csZ);
|
|
csText.Format(_T("%s,%s,%s"),csX,csY,csZ);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
//nowPos = xmlTree.Insert(KEY_COVER,posRoot,NULL);
|
|
//{
|
|
// xmlTree.SetAttribute(nowPos, _T("name"), _T("盖板"));
|
|
// xmlTree.SetAttribute(nowPos, _T("comment"), _T("0:不显示,1:显示"));
|
|
// m_pXDataMap->GetAt(KEY_COVER,nValue);
|
|
// csText.Format(_T("%d"),nValue);
|
|
// xmlTree.SetItemText(nowPos,csText);
|
|
//}
|
|
nowPos = xmlTree.Insert(_T("Object_ID"),posRoot,NULL);
|
|
{
|
|
xmlTree.SetAttribute(nowPos,_T("name"),_T("ID"));
|
|
xmlTree.SetAttribute(nowPos,_T("comment"),_T("终端封头ID"));
|
|
LONG_PTR nid = m_pOwnerEnt->objectId().asOldId();
|
|
|
|
csText.Format(_T("%ld"),nid);
|
|
xmlTree.SetItemText(nowPos,csText);
|
|
}
|
|
|
|
CString csXml = xmlTree.GetXml();
|
|
|
|
return csXml;
|
|
} |