EgtGeomKernel 2.5a2 :

- aggiunte funzioni GetAllInfo per recuperare tutte le info di una entità.
This commit is contained in:
DarioS
2023-01-30 09:40:53 +01:00
parent 368bd80c69
commit 078f730512
9 changed files with 86 additions and 6 deletions
+16
View File
@@ -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)
+4 -3
View File
@@ -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 ;
} ;
BIN
View File
Binary file not shown.
+33
View File
@@ -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<const GdbIterator*> (&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
//----------------------------------------------------------------------------
+4 -2
View File
@@ -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 ;
+13
View File
@@ -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
//----------------------------------------------------------------------------
+1
View File
@@ -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)
+14 -1
View File
@@ -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 ;
+1
View File
@@ -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 ;