/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// #pragma once #include #include #include "DbDatabase.h" #include "DbEntity.h" #include "DbBlockReference.h" #include "DbDatabaseReactor.h" #include "Ed/EdCommandStack.h" #include "Ed/EdCommandContext.h" #include "DbSmartCenterActionBody.h" #include "DbCenterLineActionBody.h" typedef std::map SmartMap; typedef SmartMap::iterator SmartMapIt; class OdSmartCenterObserver : public OdDbDatabaseReactor { public: OdSmartCenterObserver() = delete; OdSmartCenterObserver(const OdArray& comNames, OdRxClass* actClass) : m_comNames(comNames), m_actClass(actClass) {} ~OdSmartCenterObserver() {} void clearData(); virtual void objectModified( const OdDbDatabase* pDb, const OdDbObject* pObject) override; virtual bool hasCommand(const OdString& commandName) const; bool hasSmartCenterId(OdDbObjectId id) const; OdRxClass* getActClass() const { return m_actClass; } protected: void categorizeObject(const OdDbEntity* pEnt); SmartMapIt getOrInsertNewSmartCenter(OdDbObjectId smartCenterId); void insertSmartCenterEdge(const OdDbEntity* pEnt); OdArray m_comNames; OdRxClass* m_actClass; SmartMap m_smartMap; OdDbObjectIdArray m_smartCenterIds; }; typedef OdSmartPtr OdSmartCenterObserverPtr; class OdSmartCenterEditorReactor : public OdEdCommandStackReactor { public: OdSmartCenterEditorReactor(); ~OdSmartCenterEditorReactor() {} bool observerHasSmartCenter(OdDbObjectId smartCenterId, OdRxClass* pClass) const; static OdSmartCenterEditorReactor* getSmartCenterEditorReactor(); void clearObservers(); protected: const OdSmartCenterObserver* findObserver(OdRxClass* pClass) const; void removeObservers(OdDbDatabasePtr pDb); OdArray m_observers; private: virtual void commandWillStart(OdEdCommand* pCommand, OdEdCommandContext* pCmdCtx); virtual void commandEnded(OdEdCommand* pCommand, OdEdCommandContext* pCmdCtx); virtual void commandCancelled(OdEdCommand* pCommand, OdEdCommandContext* pCmdCtx); virtual void commandFailed(OdEdCommand* pCommand, OdEdCommandContext* pCmdCtx); };