/////////////////////////////////////////////////////////////////////////////// // 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 "DbAssocArrayActionBody.h" #include "DbImpAssocActionBody.h" #include "DbImpAssocDependency.h" #include "DbCurve.h" #include "DbGeomRef.h" #include "DbAssocActionParam.h" ODRX_DEFINE_MEMBERS_EX(OdDbAssocArrayActionBody, // ClassName OdDbAssocParamBasedActionBody, // ParentClass DBOBJECT_CONSTR, // DOCREATE OdDb::kDHL_1021, // DwgVer OdDb::kMRelease6, // MaintVer 1025, // nProxyFlags (kEraseAllowed | kDisableProxyWarning) L"AcDbAssocArrayActionBody", // DWG class name L"ACDBASSOCARRAYACTIONBODY", // DxfName L"ObjectDBX Classes", // AppName OdRx::kMTLoading | OdRx::kHistoryAware); OdDbAssocArrayActionBody::OdDbAssocArrayActionBody( bool bCreateImpl ) : OdDbAssocParamBasedActionBody(false) { if ( bCreateImpl ) m_pImpObj = static_cast(new OdDbImpAssocArrayActionBody()); } OdDbAssocArrayActionBody::~OdDbAssocArrayActionBody() { // via base class // delete m_pImpObj; } void OdDbAssocArrayActionBody::composeForLoad(OdDb::SaveType format, OdDb::DwgVersion version, OdDbAuditInfo* pAuditInfo) { OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); pImpl->composeForLoad(this, format, version, pAuditInfo); } const OdDbAssocArrayParametersPtr OdDbAssocArrayActionBody::parameters() const { OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->parameters(); } OdDbAssocArrayParametersPtr& OdDbAssocArrayActionBody::parameters() { OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->parameters(); } OdResult OdDbAssocArrayActionBody::deleteItem(const OdDbItemLocator& index, bool bErase) // = true { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->deleteItem(index, bErase); } OdResult OdDbAssocArrayActionBody::transformItemBy(const OdDbItemLocator& index, const OdGeMatrix3d& xform) { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->transformItemBy(index, xform); } void OdDbAssocArrayActionBody::getItems(OdArray& indices, bool skipErased) const // = true { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getItems(indices, skipErased); } const OdDbAssocArrayItemPtr OdDbAssocArrayActionBody::getItemAt(const OdDbItemLocator& index, OdDbFullSubentPath& path) const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getItemAt(index, path, getArrayEntity()); } const OdDbAssocArrayItemPtr OdDbAssocArrayActionBody::getItemAt(const OdDbItemLocator& index) const { assertReadEnabled(); OdDbFullSubentPath path = OdDbFullSubentPath(); return getItemAt(index, path); } const OdDbAssocArrayItemPtr OdDbAssocArrayActionBody::getItemAt(const OdDbFullSubentPath& path) const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getItemAt(path); } void OdDbAssocArrayActionBody::evaluateOverride() { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); pImpl->evaluateOverride( parentAction() ); } OdDbObjectId OdDbAssocArrayActionBody::getArrayEntity() const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getArrayEntity(parentAction()); } bool OdDbAssocArrayActionBody::controlsItem(const OdDbItemLocator &index) const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->controlsItem(index); } OdResult OdDbAssocArrayActionBody::transformBy(const OdGeMatrix3d& xform) { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->transformBy(xform); } OdGeMatrix3d OdDbAssocArrayActionBody::getTransform() const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getTransform(); } OdDbObjectIdArray OdDbAssocArrayActionBody::getSourceEntities() const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getSourceEntities(parentAction()); } OdResult OdDbAssocArrayActionBody::addSourceEntity(OdDbObjectId entity, const OdGePoint3d& basePoint) { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->addSourceEntity(entity, basePoint, parentAction()); } OdResult OdDbAssocArrayActionBody::removeSourceEntity(OdDbObjectId entity) { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->removeSourceEntity(entity, parentAction()); } OdResult OdDbAssocArrayActionBody::setSourceBasePoint(const OdDbVertexRef& basePoint) { assertWriteEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->setSourceBasePoint(basePoint, parentAction()); } OdResult OdDbAssocArrayActionBody::getSourceBasePoint(OdDbVertexRef& vertexRef, OdGePoint3d& position) const { assertReadEnabled(); OdDbImpAssocArrayActionBody* pImpl = static_cast(m_pImpObj); return pImpl->getSourceBasePoint(vertexRef, position); } OdDbObjectId OdDbAssocArrayActionBody::getArraySourceBTR() const { assertReadEnabled(); return static_cast (m_pImpObj)->getArraySourceBTR( parentAction() ); } OdResult OdDbAssocArrayActionBody::dragStatusOverride(const OdDb::DragStat /*status*/) { ODA_FAIL_ONCE(); return eNotImplementedYet; } inline bool profileGeomentryChangeCheck(OdDbAssocArrayParameters* params, const OdDbAssocDependency* dep, bool &isRelevantDepChange) { OdDbObjectId paramId; OdDbGeomRefPtr geomRef; OdResult res = params->getGeomParam("RowProfile", geomRef, paramId); if (res == eOk) { OdDbAssocEdgeActionParamPtr edgeActionParam = paramId.openObject(); OdDbObjectIdArray depids; res = edgeActionParam->getDependencies(true, false, depids); if (res != eOk || depids.isEmpty() || depids[0] != dep->objectId()) return false; // it's not profile dependency if (geomRef.isNull() || !geomRef->isKindOf(OdDbEdgeRef::desc())) return true; // can't check OdDbEdgeRefPtr edgeRef = static_cast(geomRef.get()); if (edgeRef.isNull()) return true; // can't check OdDbCurvePtr dependentOnCurve = OdDbCurve::cast(dep->dependentOnObject().openObject()); if (dependentOnCurve.isNull()) return true; // can't check OdGeCurve3d* dependentOnGeCurve; res = dependentOnCurve->getOdGeCurve(dependentOnGeCurve); if (res != eOk || !dependentOnGeCurve) return true; // can't check const OdGeCurve3d* profileCurve = edgeRef->curve(); if (profileCurve) isRelevantDepChange = !profileCurve->isEqualTo(*dependentOnGeCurve); delete dependentOnGeCurve; return true; } return false; // it's not profile-based array } OdResult OdDbAssocArrayActionBody::isRelevantDependencyChangeOverride(const OdDbAssocDependency* dep, bool& isRelevantDepChange) const { isRelevantDepChange = true; OdDbAssocArrayParametersPtr params = parameters(); if(::profileGeomentryChangeCheck(params, dep, isRelevantDepChange)) return eOk; // add here other dependency type change checking return eOk; } OdResult OdDbAssocArrayActionBody::createInstance( const OdDbObjectIdArray& sourceEntites, OdDbVertexRef& basePoint, const OdDbAssocArrayParametersPtr &pParameters, OdDbObjectId& arrayId, OdDbObjectId& actionBodyId ) { return OdDbImpAssocArrayActionBody::createInstance( sourceEntites, basePoint, pParameters, arrayId, actionBodyId ); } OdDbObjectId OdDbAssocArrayActionBody::getControllingActionBody( const OdDbEntity* pEntity, const OdDbItemLocator* pItemIndex /*= NULL*/ ) { return OdDbImpAssocArrayActionBody::getControllingActionBody( pEntity, pItemIndex ); } OdResult OdDbAssocArrayActionBody::explode( OdDbEntity* pEntity, OdDbObjectIdArray& newIds ) { return OdDbImpAssocArrayActionBody::explode( pEntity, newIds ); } bool OdDbAssocArrayActionBody::isAssociativeArray( const OdDbEntity* pEntity ) { return OdDbImpAssocArrayActionBody::isAssociativeArray( pEntity ); } OdResult OdDbAssocArrayActionBody::resetArrayItems( OdDbObjectId arrayEntityId, const OdArray& indices, bool resetAll) { return OdDbImpAssocArrayActionBody::resetArrayItems( arrayEntityId, indices, resetAll); } OdResult OdDbAssocArrayActionBody::getArrayItemLocators(const OdDbFullSubentPathArray& subents, OdArray& indices) { return OdDbImpAssocArrayActionBody::getArrayItemLocators( subents, indices ); } void OdDbAssocArrayActionBody::audit( OdDbAuditInfo* pAuditInfo ) { OdDbObject::audit( pAuditInfo ); static_cast( m_pImpObj )->audit( this, pAuditInfo ); }