diff --git a/Attribs.cpp b/Attribs.cpp index b9648a3..a6552f0 100644 --- a/Attribs.cpp +++ b/Attribs.cpp @@ -356,6 +356,22 @@ Attribs::RemoveInfo( const string& sKey) return true ; } +//---------------------------------------------------------------------------- +bool +Attribs::GetAllInfo( STRVECTOR& vsInfo) const +{ + // riservo spazio opportuno per il vettore delle stringhe + vsInfo.clear() ; + vsInfo.reserve( m_slInfo.size()) ; + // recupero tutte le info tranne il nome (se presente sempre al primo posto) + auto iIter = m_slInfo.cbegin() ; + if ( FindKey( *iIter, NAME)) + ++ iIter ; + for ( ; iIter != m_slInfo.cend() ; ++ iIter) + vsInfo.emplace_back( *iIter) ; + return true ; +} + //---------------------------------------------------------------------------- bool Attribs::CopyAllInfoFrom( const Attribs& attrSou) diff --git a/Attribs.h b/Attribs.h index de11e99..e8eb0c5 100644 --- a/Attribs.h +++ b/Attribs.h @@ -89,6 +89,7 @@ class Attribs bool GetInfo( const std::string& sKey, std::string& sVal) const ; bool ExistsInfo( const std::string& sKey) const ; bool RemoveInfo( const std::string& sKey) ; + bool GetAllInfo( STRVECTOR& vsInfo) const ; bool CopyAllInfoFrom( const Attribs& attrSou) ; private : @@ -100,7 +101,7 @@ class Attribs private : unsigned char m_Data[DIM] ; unsigned char m_OldData[DIM] ; - int m_Material ; - Color m_Color ; - STRLIST m_slInfo ; + int m_Material ; + Color m_Color ; + STRLIST m_slInfo ; } ; \ No newline at end of file diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index ee161d9..613ee4f 100644 Binary files a/EgtGeomKernel.rc and b/EgtGeomKernel.rc differ diff --git a/GdbIterator.cpp b/GdbIterator.cpp index d35ad15..ddf3b8a 100644 --- a/GdbIterator.cpp +++ b/GdbIterator.cpp @@ -1618,6 +1618,39 @@ GdbIterator::RemoveInfo( const string& sKey) return m_pCurrObj->RemoveInfo( sKey) ; } +//---------------------------------------------------------------------------- +bool +GdbIterator::GetAllInfo( STRVECTOR& vsInfo) const +{ + if ( m_pGDB == nullptr || m_pCurrObj == nullptr) + return false ; + + // recupero tutte le Info + return m_pCurrObj->GetAllInfo( vsInfo) ; +} + +//---------------------------------------------------------------------------- +bool +GdbIterator::CopyAllInfoFrom( const IGdbIterator& iIter) +{ + if ( m_pGDB == nullptr || m_pCurrObj == nullptr) + return false ; + + // recupero l'oggetto sorgente + const GdbIterator* pIter = dynamic_cast (&iIter) ; + if ( pIter == nullptr || pIter->m_pGDB != m_pGDB || pIter->m_pCurrObj == nullptr) + return false ; + const GdbObj* pGdbObjSou = pIter->m_pCurrObj ; + + // copio tutte le Info + if ( m_pCurrObj != pGdbObjSou && pGdbObjSou->m_pAttribs != nullptr) { + m_pCurrObj->GetSafeAttribs() ; + return ( m_pCurrObj->m_pAttribs != nullptr && m_pCurrObj->m_pAttribs->CopyAllInfoFrom( *(pGdbObjSou->m_pAttribs))) ; + } + else + return true ; +} + //---------------------------------------------------------------------------- // TextureData //---------------------------------------------------------------------------- diff --git a/GdbIterator.h b/GdbIterator.h index d2e6efe..89a5848 100644 --- a/GdbIterator.h +++ b/GdbIterator.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2013-2013 +// EgalTech 2013-2022 //---------------------------------------------------------------------------- -// File : GdbIterator.h Data : 04.12.13 Versione : 1.4a3 +// File : GdbIterator.h Data : 29.01.23 Versione : 2.5a2 // Contenuto : Dichiarazione della classe GdbIterator. // // @@ -142,6 +142,8 @@ class GdbIterator : public IGdbIterator bool GetInfo( const std::string& sKey, STRVECTOR& vsInfo) const override ; bool ExistsInfo( const std::string& sKey) const override ; bool RemoveInfo( const std::string& sKey) override ; + bool GetAllInfo( STRVECTOR& vsInfo) const override ; + bool CopyAllInfoFrom( const IGdbIterator& iIter) override ; // TextureData bool SetTextureName( const std::string& sTxrName) override ; bool SetTextureFrame( const Frame3d& frTxrRef) override ; diff --git a/GdbObj.cpp b/GdbObj.cpp index 5346ddf..a9a4bd9 100644 --- a/GdbObj.cpp +++ b/GdbObj.cpp @@ -1024,6 +1024,19 @@ GdbObj::RemoveInfo( const string& sKey) return m_pAttribs->RemoveInfo( sKey) ; } +//---------------------------------------------------------------------------- +bool +GdbObj::GetAllInfo( STRVECTOR& vsInfo) const +{ + // se non ci sono attributi + if ( m_pAttribs == nullptr) { + vsInfo.clear() ; + return true ; + } + // recupero tutte le Info + return m_pAttribs->GetAllInfo( vsInfo) ; +} + //---------------------------------------------------------------------------- // TextureData //---------------------------------------------------------------------------- diff --git a/GdbObj.h b/GdbObj.h index c23e655..5e1ae02 100644 --- a/GdbObj.h +++ b/GdbObj.h @@ -119,6 +119,7 @@ class GdbObj bool GetInfo( const std::string& sKey, STRVECTOR& vsInfo) const ; bool ExistsInfo( const std::string& sKey) const ; bool RemoveInfo( const std::string& sKey) ; + bool GetAllInfo( STRVECTOR& vsInfo) const ; bool SaveTextureData( NgeWriter& ngeOut) const ; bool LoadTextureData( NgeReader& ngeIn) ; TextureData* GetTextureData( void) diff --git a/GeomDB.cpp b/GeomDB.cpp index 7cf67a4..87f2b92 100644 --- a/GeomDB.cpp +++ b/GeomDB.cpp @@ -2887,6 +2887,19 @@ GeomDB::RemoveInfo( int nId, const string& sKey) return pGdbObj->RemoveInfo( sKey) ; } +//---------------------------------------------------------------------------- +bool +GeomDB::GetAllInfo( int nId, STRVECTOR& vsInfo) const +{ + // recupero l'oggetto + const GdbObj* pGdbObj = GetGdbObj( nId) ; + if ( pGdbObj == nullptr) + return false ; + + // recupero tutte le Info + return pGdbObj->GetAllInfo( vsInfo) ; +} + //---------------------------------------------------------------------------- bool GeomDB::CopyAllInfoFrom( int nId, int nSouId) @@ -2896,7 +2909,7 @@ GeomDB::CopyAllInfoFrom( int nId, int nSouId) if ( pGdbObj == nullptr) return false ; // recupero l'oggetto sorgente - GdbObj* pGdbObjSou = GetGdbObj( nSouId) ; + const GdbObj* pGdbObjSou = GetGdbObj( nSouId) ; if ( pGdbObjSou == nullptr) return false ; diff --git a/GeomDB.h b/GeomDB.h index a60b30d..5295b92 100644 --- a/GeomDB.h +++ b/GeomDB.h @@ -179,6 +179,7 @@ class GeomDB : public IGeomDB bool GetInfo( int nId, const std::string& sKey, STRVECTOR& vsInfo) const override ; bool ExistsInfo( int nId, const std::string& sKey) const override ; bool RemoveInfo( int nId, const std::string& sKey) override ; + bool GetAllInfo( int nId, STRVECTOR& vsInfo) const override ; bool CopyAllInfoFrom( int nId, int nSouId) override ; // TextureData bool DumpTextureData( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;