/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "OdaCommon.h" #include "DbBlockReference.h" #include "DbBlockTableRecord.h" #include "DbBlockTable.h" #include "DbAssocGeomDependency.h" #include "DbImpAssocLeaderActionBody.h" #include "DbAssocNetwork.h" #include "DbLeader.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// OdDbImpAssocLeaderActionBody::OdDbImpAssocLeaderActionBody() { // CORE-14828 m_version = 0; // m_ActionBodyType = kLeader; m_paramBasedActionBody = new OdDbImpAssocParamBasedActionBody(true); } OdDbImpAssocLeaderActionBody::~OdDbImpAssocLeaderActionBody() { } OdResult OdDbImpAssocLeaderActionBody::dwgInFields(OdDbDwgFiler* pFiler) { OdResult res = OdDbImpAssocAnnotationActionBody::dwgInFields(pFiler); if (res != eOk) return res; m_version = pFiler->rdInt16(); ODA_ASSERT_ONCE_X(MDSO, !m_version); m_leaderPointRefActionParamId = pFiler->rdSoftPointerId(); return res; } void OdDbImpAssocLeaderActionBody::dwgOutFields(OdDbDwgFiler* pFiler) const { OdDbImpAssocAnnotationActionBody::dwgOutFields(pFiler); //m_paramBasedActionBody->dwgOutFields(pFiler); ODA_ASSERT_ONCE_X(MDSO, !m_version); pFiler->wrInt16(m_version); pFiler->wrSoftPointerId(m_leaderPointRefActionParamId); } OdResult OdDbImpAssocLeaderActionBody::dxfInFields(OdDbDxfFiler* pFiler) { OdResult res = OdDbImpAssocAnnotationActionBody::dxfInFields(pFiler); if (res != eOk) return res; if (!pFiler->atSubclassData(OdDbAssocLeaderActionBody::desc()->dxfName())) { ODA_FAIL_ONCE(); return eMakeMeProxy; } NEXT_CODE(90); m_version = OdUInt16(pFiler->rdUInt32()); ODA_ASSERT_ONCE_X(MDSO, !m_version); NEXT_CODE(330); m_leaderPointRefActionParamId = pFiler->rdObjectId(); return eOk; } void OdDbImpAssocLeaderActionBody::dxfOutFields(OdDbDxfFiler* pFiler) const { OdDbImpAssocAnnotationActionBody::dxfOutFields(pFiler); pFiler->wrSubclassMarker(OdDbAssocLeaderActionBody::desc()->dxfName()); ODA_ASSERT_ONCE_X(MDSO, !m_version); pFiler->wrUInt32(90, m_version); pFiler->wrObjectId(330, m_leaderPointRefActionParamId); } //void OdDbImpAssocLeaderActionBody::composeForLoad(OdDbObject *pObject, // OdDb::SaveType format, // OdDb::DwgVersion version, // OdDbAuditInfo* pAuditInfo) //{ // OdDbAssocRotatedDimActionBody *Body = static_cast(pObject); // //m_matrix = OdDbBlockReference::cast(getArrayEntity(Body->parentAction()).safeOpenObject())->blockTransform(); //} void OdDbImpAssocLeaderActionBody::evaluateOverride(OdDbObjectId parentActionId) { OdResult res = eOk; OdDbAssocActionPtr action = OdDbAssocAction::cast(parentActionId.openObject(OdDb::kForWrite)); OdDbAssocDependencyPtr dimDep = m_annotationEntDepId.openObject(); if (dimDep.isNull()) { res = action->setStatus(kErasedAssocStatus); return; } OdDbLeaderPtr leader = dimDep->dependentOnObject().openObject(OdDb::kForWrite); if (leader.isNull() || action->paramCount()==0) { res = action->setStatus(kErasedAssocStatus); return; } OdDbAssocDependencyPtr vpDep = lookUpVpDep(action); bool vpChanged = vpDep.get() && isEvaluationRequest(vpDep->status()); bool dimModified = isEvaluationRequest(dimDep->status()); // dim modified, check associativity OdDbAssocOsnapPointRefActionParamPtr osnapPointRefParam = action->paramAtIndex(0).openObject(); if (osnapPointRefParam.get()) { OdDbOsnapPointRefPtr pRefPt = osnapPointRefParam->asOsnapPointRef(); if (isEvaluationRequest(osnapPointRefParam->status(true)) || vpChanged) { OdGePoint3d ptVal; osnapPointRefParam->evaluatePointOverride(ptVal); //res = pRefPt->evalPoint(ptVal); if (dimModified) { OdGePoint3d leaderPt = leader->vertexAt(0); if (!leaderPt.isEqualTo(ptVal)) { res = breakAssociativity(action, dimDep); return; } } leader->setVertexAt(0, ptVal); } } res = action->evaluateDependencies(); res = action->setStatus(kIsUpToDateAssocStatus); }