#include "stdafx.h" #include "TInterfaceModifyMsg.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif TInterfaceModifyMsg::TInterfaceModifyMsg() { m_nGripIndex = -1; m_dWidth = 0; m_dHeight = 0; m_dEl = 0; m_vtOffset.set(0,0,0); m_bValidate = FALSE; m_eOperation = TDb::eMoveGripPoint; m_matXform.setToIdentity(); m_idOperateOn.setNull(); m_nKind = 0; m_nSubKind = 0; m_vtW.set(0,0,0); m_vtH.set(0,0,0); } TInterfaceModifyMsg::TInterfaceModifyMsg(const TInterfaceModifyMsg& iMsg) { m_ptGePos = iMsg.m_ptGePos; m_nGripIndex = iMsg.m_nGripIndex; m_dWidth = iMsg.m_dWidth; m_dHeight = iMsg.m_dHeight; m_dEl = iMsg.m_dEl; m_vtOffset = iMsg.m_vtOffset; m_bValidate = iMsg.m_bValidate; m_eOperation = iMsg.m_eOperation; m_matXform = iMsg.m_matXform; m_idOperateOn = iMsg.m_idOperateOn; m_nKind = iMsg.m_nKind; m_nSubKind = iMsg.m_nSubKind; m_vtW = iMsg.m_vtW; m_vtH = iMsg.m_vtH; } TInterfaceModifyMsg::~TInterfaceModifyMsg() { } void TInterfaceModifyMsg::SetSizeDir(const AcGeVector3d& vtW,const AcGeVector3d& vtH) { m_vtW = vtW; m_vtH = vtH; } void TInterfaceModifyMsg::GetSizeDir(AcGeVector3d& vtW,AcGeVector3d& vtH) { vtH = m_vtH; vtW = m_vtW; } void TInterfaceModifyMsg::GetSizeDir(AcGeVector3d& vtW,AcGeVector3d& vtH) const { vtH = m_vtH; vtW = m_vtW; } void TInterfaceModifyMsg::SetMsgPoint(const AcGePoint3d& ptGe) { m_ptGePos = ptGe; } AcGePoint3d TInterfaceModifyMsg::GetMsgPoint() const { return m_ptGePos; } void TInterfaceModifyMsg::SetGripPosition(int nIndex) { m_nGripIndex = nIndex; } int TInterfaceModifyMsg::GetGripPosition() { return m_nGripIndex; } int TInterfaceModifyMsg::GetGripPosition() const { return m_nGripIndex; } void TInterfaceModifyMsg::SetSize(double dWidth,double dHeight) { m_dWidth = dWidth; m_dHeight = dHeight; m_eOperation = TDb::eSize; } void TInterfaceModifyMsg::GetSize(double& dWidth,double& dHeight) { dWidth = m_dWidth; dHeight = m_dHeight; } void TInterfaceModifyMsg::GetSize(double& dWidth,double& dHeight) const { dWidth = m_dWidth; dHeight = m_dHeight; } void TInterfaceModifyMsg::SetElevation(double dEl) { m_dEl = dEl; } double TInterfaceModifyMsg::GetElevation() { return m_dEl; } double TInterfaceModifyMsg::GetElevation() const { return m_dEl; } void TInterfaceModifyMsg::SetMoveGripOffset(const AcGeVector3d& vtOffset) { m_vtOffset = vtOffset; m_eOperation = TDb::eMoveGripPoint; } AcGeVector3d TInterfaceModifyMsg::GetMoveGripOffset() { return m_vtOffset; } AcGeVector3d TInterfaceModifyMsg::GetMoveGripOffset() const { return m_vtOffset; } void TInterfaceModifyMsg::SetMsgValidate(BOOL bValidate) { m_bValidate = bValidate; } BOOL TInterfaceModifyMsg::IsMsgValidate() { return m_bValidate; } BOOL TInterfaceModifyMsg::IsMsgValidate() const { return m_bValidate; } void TInterfaceModifyMsg::SetInterfaceOper(TDb::InterfaceOper iOper) { m_eOperation = iOper; } TDb::InterfaceOper TInterfaceModifyMsg::GetInterfaceOper() { return m_eOperation; } TDb::InterfaceOper TInterfaceModifyMsg::GetInterfaceOper() const { return m_eOperation; } void TInterfaceModifyMsg::SetTransform(const AcGeMatrix3d& xform) { m_matXform = xform; m_eOperation = TDb::eTransformBy; } void TInterfaceModifyMsg::SetTransform(const AcGeVector3d& vtMove) { m_matXform.setToTranslation(vtMove); m_eOperation = TDb::eTransformBy; } AcGeMatrix3d TInterfaceModifyMsg::GetTransform() { return m_matXform; } AcGeMatrix3d TInterfaceModifyMsg::GetTransform() const { return m_matXform; } void TInterfaceModifyMsg::SetMsgOperateOn(const AcDbObjectId& id) { m_idOperateOn = id; } AcDbObjectId TInterfaceModifyMsg::GetMsgOperateOn() { AcDbObjectId id; id.setFromOldId(m_idOperateOn.asOldId()); return id; } AcDbObjectId TInterfaceModifyMsg::GetMsgOperateOn() const { AcDbObjectId id; id.setFromOldId(m_idOperateOn.asOldId()); return id; } void TInterfaceModifyMsg::SetPreviewObjToCreate(int nKind,int nSubKind) { m_nKind = nKind; m_nSubKind = nSubKind; } BOOL TInterfaceModifyMsg::GetPreviewObjToCreate(int& nKind,int& nSubKind) { nKind = m_nKind; nSubKind = m_nSubKind; //FALSE 表示没有对象需要御览后创建 if (nKind == 0 || nSubKind == 0) return FALSE; //有对象需要御览后创建,且关联 return TRUE; } TInterfaceModifyMsg& TInterfaceModifyMsg::operator = (const TInterfaceModifyMsg& iMsg) { m_ptGePos = iMsg.m_ptGePos; m_nGripIndex = iMsg.m_nGripIndex; m_dWidth = iMsg.m_dWidth; m_dHeight = iMsg.m_dHeight; m_dEl = iMsg.m_dEl; m_vtOffset = iMsg.m_vtOffset; m_bValidate = iMsg.m_bValidate; m_eOperation = iMsg.m_eOperation; m_matXform = iMsg.m_matXform; m_nKind = iMsg.m_nKind; m_nSubKind = iMsg.m_nSubKind; m_idOperateOn = iMsg.m_idOperateOn; m_vtW = iMsg.m_vtW; m_vtH = iMsg.m_vtH; return *this; } Acad::ErrorStatus TInterfaceModifyMsg::dxfOutFields(AcDbDxfFiler* pFiler) const { return Acad::eOk; } Acad::ErrorStatus TInterfaceModifyMsg::dxfInFields(AcDbDxfFiler* pFiler) { return Acad::eOk; } Acad::ErrorStatus TInterfaceModifyMsg::dwgInFields(AcDbDwgFiler* pFiler) { pFiler->readItem(&m_ptGePos); pFiler->readItem(&m_nGripIndex); pFiler->readItem(&m_dWidth); pFiler->readItem(&m_dHeight); pFiler->readItem(&m_dEl); pFiler->readItem(&m_vtOffset); pFiler->readUInt32(&m_nKind); pFiler->readUInt32(&m_nSubKind); AcDbSoftPointerId idSoft; pFiler->readSoftPointerId(&idSoft); m_idOperateOn = idSoft; Adesk::UInt16 nValidate = 0; pFiler->readItem(&nValidate); m_bValidate = nValidate; Adesk::UInt16 nOper = 0; pFiler->readItem(&nOper); m_eOperation = (TDb::InterfaceOper)nOper; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { pFiler->readItem(&m_matXform.entry[i][j]); } } return Acad::eOk; } Acad::ErrorStatus TInterfaceModifyMsg::dwgOutFields(AcDbDwgFiler* pFiler) const { pFiler->writeItem(m_ptGePos); pFiler->writeItem(m_nGripIndex); pFiler->writeItem(m_dWidth); pFiler->writeItem(m_dHeight); pFiler->writeItem(m_dEl); pFiler->writeItem(m_vtOffset); pFiler->writeItem((Adesk::UInt16)m_bValidate); pFiler->writeItem((Adesk::UInt16)m_eOperation); pFiler->writeUInt32(m_nKind); pFiler->writeUInt32(m_nSubKind); AcDbSoftPointerId idSoft(m_idOperateOn); pFiler->writeSoftPointerId(idSoft); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { pFiler->writeItem(m_matXform.entry[i][j]); } } return Acad::eOk; } TInterfaceModifyMsgs::TInterfaceModifyMsgs() { m_bFlowBack = FALSE; } TInterfaceModifyMsgs::~TInterfaceModifyMsgs() { } void TInterfaceModifyMsgs::SetFlowBackFlag(BOOL bFlowBack) { m_bFlowBack = bFlowBack; } BOOL TInterfaceModifyMsgs::IsFlowBackFlag() { return m_bFlowBack; } int TInterfaceModifyMsgs::append( const TInterfaceModifyMsg& value ) { return (int)m_arModifyMsgs.Add(value); } TInterfaceModifyMsg TInterfaceModifyMsgs::at(int index) const { return m_arModifyMsgs.GetAt(index); } int TInterfaceModifyMsgs::length() const { return (int)m_arModifyMsgs.GetSize(); } void TInterfaceModifyMsgs::removeAt(int iIndex) { m_arModifyMsgs.RemoveAt(iIndex); } TInterfaceModifyMsg TInterfaceModifyMsgs::operator[](int nIndex) const { return m_arModifyMsgs[nIndex]; } TInterfaceModifyMsg& TInterfaceModifyMsgs::operator[](int nIndex) { return m_arModifyMsgs[nIndex]; }