//---------------------------------------------------------------------------- // EgalTech 2015-2024 //---------------------------------------------------------------------------- // File : Table.cpp Data : 19.03.24 Versione : 2.6c2 // Contenuto : Oggetto tavola per gruppo tavola di macchina. // // // // Modifiche : 25.05.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "Table.h" #include "MachConst.h" #include "/EgtDev/Include/EGkGdbConst.h" #include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkUiUnits.h" using namespace std ; //---------------------------------------------------------------------------- USEROBJ_REGISTER( "EMkTable", Table) ; //---------------------------------------------------------------------------- const string& Table::GetClassName( void) const { return USEROBJ_GETNAME( Table) ; } //---------------------------------------------------------------------------- Table* Table::Clone( void) const { // alloco oggetto Table* pTab = new(nothrow) Table ; // eseguo copia dei dati if ( pTab != nullptr) { try { pTab->m_nOwnerId = GDB_ID_NULL ; pTab->m_pGeomDB = nullptr ; pTab->m_sName = m_sName ; pTab->m_nType = m_nType ; pTab->m_ptRef1 = m_ptRef1 ; pTab->m_vsColl = m_vsColl ; } catch( ...) { delete pTab ; return nullptr ; } } // ritorno l'oggetto return pTab ; } //---------------------------------------------------------------------------- bool Table::Dump( string& sOut, bool bMM, const char* szNewLine) const { sOut += GetClassName() + szNewLine ; sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ; sOut += "Name=" + m_sName + szNewLine ; sOut += "Type=" + ToString( m_nType) + szNewLine ; sOut += "Ref1=(" + ToString( GetInUiUnits( m_ptRef1, bMM), 4) + ")" + szNewLine ; sOut += "Area1=(" + ToString( GetInUiUnits( m_b3Area1.GetMin(), bMM), 4) + ";" + ToString( GetInUiUnits( m_b3Area1.GetMax(), bMM), 4) + szNewLine ; sOut += "Coll=" + ToString( m_vsColl) + szNewLine ; return true ; } //---------------------------------------------------------------------------- bool Table::SetOwner( int nId, IGeomDB* pGDB) { m_nOwnerId = nId ; m_pGeomDB = pGDB ; return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ; } //---------------------------------------------------------------------------- int Table::GetOwner( void) const { return m_nOwnerId ; } //---------------------------------------------------------------------------- IGeomDB* Table::GetGeomDB( void) const { return m_pGeomDB ; } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- Table::Table( void) : m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_TT_NONE), m_ptRef1() { } //---------------------------------------------------------------------------- bool Table::Set( const string& sName, int nType, const Point3d& ptRef1, const BBox3d& b3Area1, const STRVECTOR& vsColl) { m_sName = sName ; m_nType = nType ; m_ptRef1 = ptRef1 ; m_b3Area1 = b3Area1 ; m_vsColl = vsColl ; return true ; }