EgtGeomKernel :

- aggiunta gestione Stipple di curve.
This commit is contained in:
DarioS
2023-07-10 11:14:20 +02:00
parent e4815830cd
commit baac48f7b9
6 changed files with 114 additions and 9 deletions
+23
View File
@@ -1651,6 +1651,29 @@ GdbIterator::CopyAllInfoFrom( const IGdbIterator& iIter)
return true ;
}
//----------------------------------------------------------------------------
// Stipple (significativo solo per curve)
//----------------------------------------------------------------------------
bool
GdbIterator::SetStipple( int nFactor, int nPattern)
{
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
return false ;
// imposto lo stipple
return m_pCurrObj->SetStipple( nFactor, nPattern) ;
}
//----------------------------------------------------------------------------
bool
GdbIterator::GetStipple( int& nFactor, int& nPattern) const
{
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
return false ;
// recupero lo stipple
return m_pCurrObj->GetStipple( nFactor, nPattern) ;
}
//----------------------------------------------------------------------------
// TextureData
//----------------------------------------------------------------------------
+5 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2022
// EgalTech 2013-2023
//----------------------------------------------------------------------------
// File : GdbIterator.h Data : 29.01.23 Versione : 2.5a2
// File : GdbIterator.h Data : 09.07.23 Versione : 2.5g1
// Contenuto : Dichiarazione della classe GdbIterator.
//
//
@@ -144,6 +144,9 @@ class GdbIterator : public IGdbIterator
bool RemoveInfo( const std::string& sKey) override ;
bool GetAllInfo( STRVECTOR& vsInfo) const override ;
bool CopyAllInfoFrom( const IGdbIterator& iIter) override ;
// Stipple
bool SetStipple( int nFactor, int nPattern) override ;
bool GetStipple( int& nFactor, int& nPattern) const override ;
// TextureData
bool SetTextureName( const std::string& sTxrName) override ;
bool SetTextureFrame( const Frame3d& frTxrRef) override ;
+29 -3
View File
@@ -31,10 +31,9 @@ using namespace std ;
//----------------------------------------------------------------------------
GdbObj::GdbObj( void)
: m_nId( GDB_ID_NULL), m_pAttribs( nullptr), m_pTxrData( nullptr), m_pUserObj( nullptr),
m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr),
: m_nId( GDB_ID_NULL), m_pAttribs( nullptr), m_nStpFactor( 0), m_nStpPattern( 0), m_pTxrData( nullptr),
m_pUserObj( nullptr), m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr),
m_pSelNext( nullptr), m_pSelPrev( nullptr)
{
}
@@ -73,6 +72,9 @@ GdbObj::CopyFrom( const GdbObj* pSou)
if ( m_pAttribs != nullptr)
delete m_pAttribs ;
m_pAttribs = nullptr ;
// reset stipple
m_nStpFactor = 0 ;
m_nStpPattern = 0 ;
// elimino eventuali dati della texture pre-esistenti
if ( m_pTxrData != nullptr)
delete m_pTxrData ;
@@ -91,6 +93,10 @@ GdbObj::CopyFrom( const GdbObj* pSou)
// copio Id
m_nId = pSou->m_nId ;
// copio stipple
m_nStpFactor = pSou->m_nStpFactor ;
m_nStpPattern = pSou->m_nStpPattern ;
// copio gli attributi, i dati della texture e UserObj
return ( CopyAttribsFrom( pSou) && CopyTextureDataFrom( pSou) && CopyUserObjFrom( pSou)) ;
}
@@ -1037,6 +1043,26 @@ GdbObj::GetAllInfo( STRVECTOR& vsInfo) const
return m_pAttribs->GetAllInfo( vsInfo) ;
}
//----------------------------------------------------------------------------
// Stipple (significativo solo per curve, per ora non viene salvato)
//----------------------------------------------------------------------------
bool
GdbObj::SetStipple( int nFactor, int nPattern)
{
m_nStpFactor = nFactor ;
m_nStpPattern = nPattern ;
return true ;
}
//----------------------------------------------------------------------------
bool
GdbObj::GetStipple( int& nFactor, int& nPattern) const
{
nFactor = m_nStpFactor ;
nPattern = m_nStpPattern ;
return true ;
}
//----------------------------------------------------------------------------
// TextureData
//----------------------------------------------------------------------------
+4
View File
@@ -120,6 +120,8 @@ class GdbObj
bool ExistsInfo( const std::string& sKey) const ;
bool RemoveInfo( const std::string& sKey) ;
bool GetAllInfo( STRVECTOR& vsInfo) const ;
bool SetStipple( int nFactor, int nPattern) ;
bool GetStipple( int& nFactor, int& nPattern) const ;
bool SaveTextureData( NgeWriter& ngeOut) const ;
bool LoadTextureData( NgeReader& ngeIn) ;
TextureData* GetTextureData( void)
@@ -161,6 +163,8 @@ class GdbObj
public :
int m_nId ;
Attribs* m_pAttribs ;
int m_nStpFactor ;
int m_nStpPattern ;
TextureData* m_pTxrData ;
IUserObj* m_pUserObj ;
+46 -1
View File
@@ -2990,6 +2990,51 @@ GeomDB::CopyAllInfoFrom( int nId, int nSouId)
return true ;
}
//----------------------------------------------------------------------------
// Stipple (significativo solo per curve)
//----------------------------------------------------------------------------
bool
GeomDB::DumpStipple( int nId, string& sOut, bool bMM, const char* szNewLine) const
{
// recupero l'oggetto
const GdbObj* pGdbObj = GetGdbObj( nId) ;
if ( pGdbObj == nullptr)
return false ;
// eseguo il dump
if ( pGdbObj->m_nStpFactor != 0) {
// nome della texture
sOut += "Stipple=" ;
sOut += ToString( pGdbObj->m_nStpFactor) ;
sOut += "-" + ToString( pGdbObj->m_nStpPattern, 1, 16) ;
sOut += szNewLine ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
GeomDB::SetStipple( int nId, int nFactor, int nPattern)
{
// recupero l'oggetto
GdbObj* pGdbObj = GetGdbObj( nId) ;
if ( pGdbObj == nullptr)
return false ;
// imposto lo stipple
return pGdbObj->SetStipple( nFactor, nPattern) ;
}
//----------------------------------------------------------------------------
bool
GeomDB::GetStipple( int nId, int& nFactor, int& nPattern) const
{
// recupero l'oggetto
const GdbObj* pGdbObj = GetGdbObj( nId) ;
if ( pGdbObj == nullptr)
return false ;
// recupero lo stipple
return pGdbObj->GetStipple( nFactor, nPattern) ;
}
//----------------------------------------------------------------------------
// TextureData
//----------------------------------------------------------------------------
@@ -3001,7 +3046,7 @@ GeomDB::DumpTextureData( int nId, string& sOut, bool bMM, const char* szNewLine)
if ( pGdbObj == nullptr)
return false ;
// eseguo il dump
if ( pGdbObj->m_pTxrData != nullptr)
if ( pGdbObj->m_pTxrData != nullptr)
return pGdbObj->m_pTxrData->Dump( *this, sOut, bMM, szNewLine) ;
else
return true ;
+7 -3
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2014
// EgalTech 2013-2023
//----------------------------------------------------------------------------
// File : GeomDB.h Data : 03.12.14 Versione : 1.5l1
// File : GeomDB.h Data : 09.07.23 Versione : 2.5g1
// Contenuto : Dichiarazione della classe GeomDB.
//
//
//
// Modifiche : 22.01.13 DS Creazione modulo.
// 03.12.14 DS Aggiunta gestione riferimento di griglia.
//
//
//----------------------------------------------------------------------------
@@ -182,6 +182,10 @@ class GeomDB : public IGeomDB
bool RemoveInfo( int nId, const std::string& sKey) override ;
bool GetAllInfo( int nId, STRVECTOR& vsInfo) const override ;
bool CopyAllInfoFrom( int nId, int nSouId) override ;
// Stipple (significativo solo per curve)
bool DumpStipple( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool SetStipple( int nId, int nFactor, int nPattern) override ;
bool GetStipple( int nId, int& nFactor, int& nPattern) const override ;
// TextureData
bool DumpTextureData( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const override ;
bool SetTextureName( int nId, const std::string& sTxrName) override ;