diff --git a/Attribs.h b/Attribs.h
index 1287bf3..80062ad 100644
--- a/Attribs.h
+++ b/Attribs.h
@@ -2,7 +2,7 @@
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : Attribs.h Data : 03.03.14 Versione : 1.5c1
-// Contenuto : Dichiarazione della classe GeoAttributes.
+// Contenuto : Dichiarazione della classe Attribs.
//
//
//
diff --git a/EgtGeomKernel.vcxproj b/EgtGeomKernel.vcxproj
index fd9eb5f..6de2a81 100644
--- a/EgtGeomKernel.vcxproj
+++ b/EgtGeomKernel.vcxproj
@@ -325,6 +325,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
@@ -472,6 +473,7 @@ copy $(TargetPath) \EgtProg\Dll64
+
diff --git a/EgtGeomKernel.vcxproj.filters b/EgtGeomKernel.vcxproj.filters
index ce8707f..8dd2118 100644
--- a/EgtGeomKernel.vcxproj.filters
+++ b/EgtGeomKernel.vcxproj.filters
@@ -315,6 +315,9 @@
File di origine\GeoOffset
+
+ File di origine\Gdb
+
@@ -713,6 +716,9 @@
File di intestazione\Include
+
+ File di intestazione
+
diff --git a/GdbGeo.cpp b/GdbGeo.cpp
index e85f1b8..3cdbecc 100644
--- a/GdbGeo.cpp
+++ b/GdbGeo.cpp
@@ -109,6 +109,10 @@ GdbGeo::Save( NgeWriter& ngeOut) const
if ( ! GdbObj::SaveAttribs( ngeOut))
return false ;
+ // TextureData
+ if ( ! GdbObj::SaveTextureData( ngeOut))
+ return false ;
+
// UserObj
if ( ! GdbObj::SaveUserObj( ngeOut))
return false ;
@@ -123,10 +127,6 @@ GdbGeo::Save( NgeWriter& ngeOut) const
bool
GdbGeo::Load( int nNgeId, NgeReader& ngeIn, int& nParentId)
{
- string sLine ;
- STRVECTOR vsParams ;
-
-
// creo l'oggetto geometrico corrispondente
int nType = GEOOBJ_NGEIDTOTYPE( nNgeId) ;
m_pGeoObj = GEOOBJ_CREATE( nType) ;
@@ -153,6 +153,15 @@ GdbGeo::Load( int nNgeId, NgeReader& ngeIn, int& nParentId)
return false ;
}
+ // eventuale TextureData
+ if ( nKey == NGE_T) {
+ if ( ! GdbObj::LoadTextureData( ngeIn))
+ return false ;
+ // leggo la prossima linea
+ if ( ! ngeIn.ReadKey( nKey))
+ return false ;
+ }
+
// eventuale UserObj
if ( nKey == NGE_U) {
if ( ! GdbObj::LoadUserObj( ngeIn))
diff --git a/GdbGroup.cpp b/GdbGroup.cpp
index c5ac289..d3cd7ab 100644
--- a/GdbGroup.cpp
+++ b/GdbGroup.cpp
@@ -156,6 +156,10 @@ GdbGroup::SaveEmpty( NgeWriter& ngeOut) const
if ( ! GdbObj::SaveAttribs( ngeOut))
return false ;
+ // TextureData
+ if ( ! GdbObj::SaveTextureData( ngeOut))
+ return false ;
+
// UserObj
if ( ! GdbObj::SaveUserObj( ngeOut))
return false ;
@@ -217,6 +221,15 @@ GdbGroup::Load( int nNgeId, NgeReader& ngeIn, int& nParentId)
return false ;
}
+ // eventuale TextureData
+ if ( nKey == NGE_T) {
+ if ( ! GdbObj::LoadTextureData( ngeIn))
+ return false ;
+ // leggo la prossima linea
+ if ( ! ngeIn.ReadKey( nKey))
+ return false ;
+ }
+
// eventuale UserObj
if ( nKey == NGE_U) {
if ( ! GdbObj::LoadUserObj( ngeIn))
diff --git a/GdbIterator.cpp b/GdbIterator.cpp
index 6ba01b8..ae88e0a 100644
--- a/GdbIterator.cpp
+++ b/GdbIterator.cpp
@@ -1616,6 +1616,58 @@ GdbIterator::RemoveInfo( const string& sKey)
return m_pCurrObj->RemoveInfo( sKey) ;
}
+//----------------------------------------------------------------------------
+// TextureData
+//----------------------------------------------------------------------------
+bool
+GdbIterator::SetTextureName( const string& sTxrName)
+{
+ if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
+ return false ;
+ // imposto il nome della texture
+ return m_pCurrObj->SetTextureName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbIterator::SetTextureFrame( const Frame3d& frTxrRef)
+{
+ if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
+ return false ;
+ // imposto il nome della texture
+ return m_pCurrObj->SetTextureFrame( frTxrRef) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbIterator::RemoveTextureData( void)
+{
+ if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
+ return false ;
+ // rimuovo i dati della texture
+ return m_pCurrObj->RemoveTextureData() ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbIterator::GetTextureName( string& sTxrName) const
+{
+ if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
+ return false ;
+ // recupero il nome della texture
+ return m_pCurrObj->GetTextureName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbIterator::GetTextureFrame( Frame3d& frTxrRef) const
+{
+ if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
+ return false ;
+ // recupero il riferimento della texture
+ return m_pCurrObj->GetTextureFrame( frTxrRef) ;
+}
+
//----------------------------------------------------------------------------
// UserObj
//----------------------------------------------------------------------------
diff --git a/GdbIterator.h b/GdbIterator.h
index f465c02..97f066f 100644
--- a/GdbIterator.h
+++ b/GdbIterator.h
@@ -142,6 +142,12 @@ class GdbIterator : public IGdbIterator
virtual bool GetInfo( const std::string& sKey, STRVECTOR& vsInfo) const ;
virtual bool ExistsInfo( const std::string& sKey) const ;
virtual bool RemoveInfo( const std::string& sKey) ;
+ // TextureData
+ virtual bool SetTextureName( const std::string& sTxrName) ;
+ virtual bool SetTextureFrame( const Frame3d& frTxrRef) ;
+ virtual bool RemoveTextureData( void) ;
+ virtual bool GetTextureName( std::string& sTxrName) const ;
+ virtual bool GetTextureFrame( Frame3d& frTxrRef) const ;
// UserObj
virtual bool SetUserObj( IUserObj* pUserObj) ;
virtual IUserObj* GetUserObj( void) ;
diff --git a/GdbObj.cpp b/GdbObj.cpp
index 87954d3..938f1d4 100644
--- a/GdbObj.cpp
+++ b/GdbObj.cpp
@@ -17,6 +17,7 @@
#include "GdbObj.h"
#include "GdbGroup.h"
#include "Attribs.h"
+#include "TextureData.h"
#include "UserObjDefault.h"
#include "NgeWriter.h"
#include "NgeReader.h"
@@ -30,8 +31,9 @@ using namespace std ;
//----------------------------------------------------------------------------
GdbObj::GdbObj( void)
- : m_nId( GDB_ID_NULL), m_pAttribs( nullptr), m_pUserObj( nullptr), m_pSelPrev( nullptr),
- m_pSelNext( nullptr), m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr)
+ : m_nId( GDB_ID_NULL), m_pAttribs( nullptr), m_pTxrData( nullptr), m_pUserObj( nullptr),
+ m_pSelPrev( nullptr), m_pSelNext( nullptr),
+ m_pGDB( nullptr), m_pNext( nullptr), m_pPrev( nullptr), m_pParent( nullptr)
{
}
@@ -42,6 +44,10 @@ GdbObj::~GdbObj( void)
if ( m_pAttribs != nullptr)
delete m_pAttribs ;
m_pAttribs = nullptr ;
+ // cancello i dati della texture
+ if ( m_pTxrData != nullptr)
+ delete m_pTxrData ;
+ m_pTxrData = nullptr ;
// cancello UserObj
if ( m_pUserObj != nullptr)
delete m_pUserObj ;
@@ -66,6 +72,10 @@ GdbObj::CopyFrom( const GdbObj* pSou)
if ( m_pAttribs != nullptr)
delete m_pAttribs ;
m_pAttribs = nullptr ;
+ // elimino eventuali dati della texture pre-esistenti
+ if ( m_pTxrData != nullptr)
+ delete m_pTxrData ;
+ m_pTxrData = nullptr ;
// elimino eventuale UserObj pre-esistente
if ( m_pUserObj != nullptr)
delete m_pUserObj ;
@@ -80,8 +90,8 @@ GdbObj::CopyFrom( const GdbObj* pSou)
// copio Id
m_nId = pSou->m_nId ;
- // copio gli attributi e UserObj
- return ( CopyAttribsFrom( pSou) && CopyUserObjFrom( pSou)) ;
+ // copio gli attributi, i dati della texture e UserObj
+ return ( CopyAttribsFrom( pSou) && CopyTextureDataFrom( pSou) && CopyUserObjFrom( pSou)) ;
}
//----------------------------------------------------------------------------
@@ -91,7 +101,6 @@ GdbObj::CopyAttribsFrom( const GdbObj* pSou)
// se l'oggetto sorgente non esiste
if ( pSou == nullptr)
return false ;
-
// copio gli attributi
if ( pSou->m_pAttribs != nullptr) {
m_pAttribs = pSou->m_pAttribs->Clone() ;
@@ -113,6 +122,29 @@ GdbObj::CopyAttribsFrom( const GdbObj* pSou)
return true ;
}
+//----------------------------------------------------------------------------
+bool
+GdbObj::CopyTextureDataFrom( const GdbObj* pSou)
+{
+ // se l'oggetto sorgente non esiste
+ if ( pSou == nullptr)
+ return false ;
+ // copio texture data
+ if ( pSou->m_pTxrData != nullptr) {
+ m_pTxrData = pSou->m_pTxrData->Clone() ;
+ if ( m_pTxrData == nullptr)
+ return false ;
+ }
+ // altrimenti li cancello
+ else {
+ if ( m_pTxrData != nullptr)
+ delete m_pTxrData ;
+ m_pTxrData = nullptr ;
+ }
+
+ return true ;
+}
+
//----------------------------------------------------------------------------
bool
GdbObj::CopyUserObjFrom( const GdbObj* pSou)
@@ -993,6 +1025,99 @@ GdbObj::RemoveInfo( const string& sKey)
return m_pAttribs->RemoveInfo( sKey) ;
}
+//----------------------------------------------------------------------------
+// TextureData
+//----------------------------------------------------------------------------
+bool
+GdbObj::SaveTextureData( NgeWriter& ngeOut) const
+{
+ if ( m_pTxrData != nullptr)
+ return m_pTxrData->Save( ngeOut) ;
+
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::LoadTextureData( NgeReader& ngeIn)
+{
+ if ( GetSafeTextureData() == nullptr)
+ return false ;
+
+ return m_pTxrData->Load( ngeIn) ;
+}
+
+//----------------------------------------------------------------------------
+TextureData*
+GdbObj::GetSafeTextureData( void)
+{
+ if ( m_pTxrData == nullptr) {
+ TextureData* pTxrData = new (nothrow) TextureData ;
+ if ( pTxrData == nullptr)
+ return nullptr ;
+ m_pTxrData = pTxrData ;
+ }
+
+ return m_pTxrData ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::SetTextureName( const string& sTxrName)
+{
+ // se nome vuoto non faccio alcunché
+ if ( sTxrName.empty())
+ return false ;
+ // verifico esistenza (con eventuale creazione) dei dati di texture
+ if ( GetSafeTextureData() == nullptr)
+ return false ;
+ // assegno il nome
+ return m_pTxrData->SetName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::SetTextureFrame( const Frame3d& frTxrRef)
+{
+ // verifico esistenza dei dati di texture
+ if ( m_pTxrData == nullptr)
+ return false ;
+ // assegno il riferimento
+ return m_pTxrData->SetFrame( frTxrRef) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::RemoveTextureData( void)
+{
+ if ( m_pTxrData != nullptr)
+ delete m_pTxrData ;
+ m_pTxrData = nullptr ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::GetTextureName( string& sTxrName) const
+{
+ // se non ci sono dati di texture
+ if ( m_pTxrData == nullptr)
+ return false ;
+ // restituisco il nome
+ return m_pTxrData->GetName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GdbObj::GetTextureFrame( Frame3d& frTxrRef) const
+{
+ // verifico esistenza dei dati di texture
+ if ( m_pTxrData == nullptr)
+ return false ;
+ // restituisco il riferimento
+ return m_pTxrData->GetFrame( frTxrRef) ;
+}
+
//----------------------------------------------------------------------------
// IUserObj
//----------------------------------------------------------------------------
diff --git a/GdbObj.h b/GdbObj.h
index 0c961b2..8bf97dd 100644
--- a/GdbObj.h
+++ b/GdbObj.h
@@ -24,6 +24,7 @@ class GeomDB ;
class GdbGroup ;
class IdManager ;
class Attribs ;
+class TextureData ;
class IUserObj ;
class NgeWriter ;
class NgeReader ;
@@ -56,6 +57,7 @@ class GdbObj
GdbObj( void) ;
bool CopyFrom( const GdbObj* pSou) ;
bool CopyAttribsFrom( const GdbObj* pSou) ;
+ bool CopyTextureDataFrom( const GdbObj* pSou) ;
bool CopyUserObjFrom( const GdbObj* pSou) ;
public :
@@ -117,6 +119,16 @@ 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 SaveTextureData( NgeWriter& ngeOut) const ;
+ bool LoadTextureData( NgeReader& ngeIn) ;
+ TextureData* GetTextureData( void)
+ { return m_pTxrData ; }
+ TextureData* GetSafeTextureData( void) ;
+ bool SetTextureName( const std::string& sTxrName) ;
+ bool SetTextureFrame( const Frame3d& frTxrRef) ;
+ bool RemoveTextureData( void) ;
+ bool GetTextureName( std::string& sTxrName) const ;
+ bool GetTextureFrame( Frame3d& frTxrRef) const ;
bool SaveUserObj( NgeWriter& ngeOut) const ;
bool LoadUserObj( NgeReader& ngeIn) ;
@@ -146,9 +158,10 @@ class GdbObj
bool Remove( void) ;
public :
- int m_nId ;
- Attribs* m_pAttribs ;
- IUserObj* m_pUserObj ;
+ int m_nId ;
+ Attribs* m_pAttribs ;
+ TextureData* m_pTxrData ;
+ IUserObj* m_pUserObj ;
protected :
GeomDB* m_pGDB ;
diff --git a/GeomDB.cpp b/GeomDB.cpp
index cc36d75..53a2094 100644
--- a/GeomDB.cpp
+++ b/GeomDB.cpp
@@ -17,6 +17,7 @@
#include "GdbGeo.h"
#include "DllMain.h"
#include "Attribs.h"
+#include "TextureData.h"
#include "NgeReader.h"
#include "NgeWriter.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -2673,6 +2674,83 @@ GeomDB::RemoveInfo( int nId, const string& sKey)
return pGdbObj->RemoveInfo( sKey) ;
}
+//----------------------------------------------------------------------------
+// TextureData
+//----------------------------------------------------------------------------
+bool
+GeomDB::DumpTextureData( 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_pTxrData != nullptr)
+ return pGdbObj->m_pTxrData->Dump( *this, sOut, bMM, szNewLine) ;
+ else
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GeomDB::SetTextureName( int nId, const string& sTxrName)
+{
+ // recupero l'oggetto
+ GdbObj* pGdbObj = GetGdbObj( nId) ;
+ if ( pGdbObj == nullptr)
+ return false ;
+ // imposto il nome della texture
+ return pGdbObj->SetTextureName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GeomDB::SetTextureFrame( int nId, const Frame3d& frTxrRef)
+{
+ // recupero l'oggetto
+ GdbObj* pGdbObj = GetGdbObj( nId) ;
+ if ( pGdbObj == nullptr)
+ return false ;
+ // imposto il nome della texture
+ return pGdbObj->SetTextureFrame( frTxrRef) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GeomDB::RemoveTextureData( int nId)
+{
+ // recupero l'oggetto
+ GdbObj* pGdbObj = GetGdbObj( nId) ;
+ if ( pGdbObj == nullptr)
+ return false ;
+ // rimuovo i dati della texture
+ return pGdbObj->RemoveTextureData() ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GeomDB::GetTextureName( int nId, string& sTxrName) const
+{
+ // recupero l'oggetto
+ const GdbObj* pGdbObj = GetGdbObj( nId) ;
+ if ( pGdbObj == nullptr)
+ return false ;
+ // recupero il nome della texture
+ return pGdbObj->GetTextureName( sTxrName) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+GeomDB::GetTextureFrame( int nId, Frame3d& frTxrRef) const
+{
+ // recupero l'oggetto
+ const GdbObj* pGdbObj = GetGdbObj( nId) ;
+ if ( pGdbObj == nullptr)
+ return false ;
+ // recupero il riferimento della texture
+ return pGdbObj->GetTextureFrame( frTxrRef) ;
+}
+
//----------------------------------------------------------------------------
// UserObj
//----------------------------------------------------------------------------
diff --git a/GeomDB.h b/GeomDB.h
index b3b94c9..0efc6ff 100644
--- a/GeomDB.h
+++ b/GeomDB.h
@@ -179,6 +179,13 @@ class GeomDB : public IGeomDB
virtual bool GetInfo( int nId, const std::string& sKey, STRVECTOR& vsInfo) const ;
virtual bool ExistsInfo( int nId, const std::string& sKey) const ;
virtual bool RemoveInfo( int nId, const std::string& sKey) ;
+ // TextureData
+ virtual bool DumpTextureData( int nId, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const ;
+ virtual bool SetTextureName( int nId, const std::string& sTxrName) ;
+ virtual bool SetTextureFrame( int nId, const Frame3d& frTxrRef) ;
+ virtual bool RemoveTextureData( int nId) ;
+ virtual bool GetTextureName( int nId, std::string& sTxrName) const ;
+ virtual bool GetTextureFrame( int nId, Frame3d& frTxrRef) const ;
// UserObj
virtual bool SetUserObj( int nId, IUserObj* pUserObj) ;
virtual IUserObj* GetUserObj( int nId) ;
diff --git a/NgeConst.h b/NgeConst.h
index 193e29c..83690bf 100644
--- a/NgeConst.h
+++ b/NgeConst.h
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2015
//----------------------------------------------------------------------------
-// File : NgeConst.h Data : 05.08.15 Versione : 1.6h2
+// File : NgeConst.h Data : 04.10.15 Versione : 1.6j1
// Contenuto : Costanti per file Nge.
//
//
@@ -13,6 +13,7 @@
// 11.03.15 DS 1010 -> Aggiunto flag orientata e elenco facce a SurfTm.
// 22.05.15 DS 1011 -> Aggiunta possibilità estensione oggetti con IUserObj.
// 05.08.15 DS 1012 -> Aggiunta FlatRegion.
+// 04.10.15 DS 1013 -> Aggiunto TextureData.
//
//----------------------------------------------------------------------------
@@ -38,7 +39,9 @@ const int NGE_VER_1011 = 1011 ;
// 1011 : aggiunta possibilità estensione oggetti con IUserObj (Keyword U)
const int NGE_VER_1012 = 1012 ;
// 1012 : aggiunta superficie FlatRegion
-const int NGE_VER_LAST = NGE_VER_1012 ;
+const int NGE_VER_1013 = 1013 ;
+// 1013 : aggiunto TextureData (Keyword T)
+const int NGE_VER_LAST = NGE_VER_1013 ;
// Indici KeyWord
const int NGE_START = 0 ;
const int NGE_END = 1 ;
@@ -48,17 +51,18 @@ const int NGE_A = 4 ;
const int NGE_G = 5 ;
const int NGE_P = 6 ;
const int NGE_U = 7 ;
-const int NGE_A_GRP = 8 ;
-const int NGE_X_CPY = 9 ;
-const int NGE_G_VEC = 10 ;
-const int NGE_G_PNT = 11 ;
-const int NGE_G_FRM = 12 ;
-const int NGE_C_LIN = 13 ;
-const int NGE_C_ARC = 14 ;
-const int NGE_C_BEZ = 15 ;
-const int NGE_C_CMP = 16 ;
-const int NGE_S_TRM = 17 ;
-const int NGE_S_FRG = 18 ;
-const int NGE_V_ZMP = 19 ;
-const int NGE_E_TXT = 20 ;
-const int NGE_LAST_ID = 20 ; // ultimo valore
+const int NGE_T = 8 ;
+const int NGE_A_GRP = 9 ;
+const int NGE_X_CPY = 10 ;
+const int NGE_G_VEC = 11 ;
+const int NGE_G_PNT = 12 ;
+const int NGE_G_FRM = 13 ;
+const int NGE_C_LIN = 14 ;
+const int NGE_C_ARC = 15 ;
+const int NGE_C_BEZ = 16 ;
+const int NGE_C_CMP = 17 ;
+const int NGE_S_TRM = 18 ;
+const int NGE_S_FRG = 19 ;
+const int NGE_V_ZMP = 20 ;
+const int NGE_E_TXT = 21 ;
+const int NGE_LAST_ID = 21 ; // ultimo valore
diff --git a/NgeKeyW.h b/NgeKeyW.h
index 6f0d5f4..d7e4efe 100644
--- a/NgeKeyW.h
+++ b/NgeKeyW.h
@@ -28,6 +28,7 @@ const std::string NgeAscKeyW[] = { "START", // NGE_START
"G", // NGE_G
"P", // NGE_P
"U", // NGE_U
+ "T", // NGE_T
"A_GRP", // NGE_A_GRP
"X_CPY", // NGE_X_CPY
"G_VEC", // NGE_G_VEC
@@ -58,6 +59,7 @@ const int NgeBinKeyW[] = { NGEB_GEN_BASE + 0x0F0F, // NGE_START
NGEB_GEN_BASE + 0x0201, // NGE_G
NGEB_GEN_BASE + 0x0202, // NGE_P
NGEB_GEN_BASE + 0x0203, // NGE_U
+ NGEB_GEN_BASE + 0x0204, // NGE_T
NGEB_GDB_BASE + 0x0000, // NGE_A_GRP
NGEB_GDB_BASE + 0x0001, // NGE_X_CPY
NGEB_GEO_BASE + GEO_VECT3D, // NGE_G_VEC
diff --git a/TextureData.cpp b/TextureData.cpp
new file mode 100644
index 0000000..99157c6
--- /dev/null
+++ b/TextureData.cpp
@@ -0,0 +1,111 @@
+//----------------------------------------------------------------------------
+// EgalTech 2015-2015
+//----------------------------------------------------------------------------
+// File : TextureData.cpp Data : 04.10.15 Versione : 1.6j1
+// Contenuto : Implementazione della classe TextureData.
+//
+//
+//
+// Modifiche : 04.10.15 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+//--------------------------- Include ----------------------------------------
+#include "stdafx.h"
+#include "TextureData.h"
+#include "NgeWriter.h"
+#include "NgeReader.h"
+#include "GeomDB.h"
+#include "/EgtDev/Include/EGkStringUtils3d.h"
+#include "/EgtDev/Include/EGkUiUnits.h"
+#include "/EgtDev/Include/EgnStringKeyVal.h"
+
+using namespace std ;
+
+
+//----------------------------------------------------------------------------
+bool
+TextureData::Dump( const GeomDB& GDB, string& sOut, bool bMM, const char* szNewLine) const
+{
+ // nome della texture
+ sOut += "Texture Name=" ;
+ sOut += m_sTxrName ;
+ sOut += szNewLine ;
+ // riferimento della texture
+ sOut += "O(" + ToString( GetInUiUnits( m_frTxrRef.Orig(), bMM)) + ")" + szNewLine ;
+ sOut += "VX(" + ToString( m_frTxrRef.VersX()) + ")" + szNewLine ;
+ sOut += "VY(" + ToString( m_frTxrRef.VersY()) + ")" + szNewLine ;
+ sOut += "VZ(" + ToString( m_frTxrRef.VersZ()) + ")" + szNewLine ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::Save( NgeWriter& ngeOut) const
+{
+ // flag presenza dati di texture
+ if ( ! ngeOut.WriteKey( NGE_T))
+ return false ;
+ // nome della texture
+ if ( ! ngeOut.WriteString( m_sTxrName, ",", false))
+ return false ;
+ // spazio per un flag intero
+ if ( ! ngeOut.WriteInt( 0, ";", true))
+ return false ;
+ // riferimento della texture
+ if ( ! ngeOut.WriteFrame( m_frTxrRef, ";", true))
+ return false ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::Load( NgeReader& ngeIn)
+{
+ // nome della texture
+ if ( ! ngeIn.ReadString( m_sTxrName, ",", false))
+ return false ;
+ // spazio per un flag intero
+ int nFlag ;
+ if ( ! ngeIn.ReadInt( nFlag, ";", true))
+ return false ;
+ // riferimento della texture
+ if ( ! ngeIn.ReadFrame( m_frTxrRef, ";", true))
+ return false ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::SetName( const string& sTxrName)
+{
+ m_sTxrName = sTxrName ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::SetFrame( const Frame3d& frTxrRef)
+{
+ if ( ! frTxrRef.IsValid())
+ return false ;
+ m_frTxrRef = frTxrRef ;
+ return true ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::GetName( string& sTxrName) const
+{
+ sTxrName = m_sTxrName ;
+ return ( ! m_sTxrName.empty()) ;
+}
+
+//----------------------------------------------------------------------------
+bool
+TextureData::GetFrame( Frame3d& frTxrRef) const
+{
+ frTxrRef = m_frTxrRef ;
+ return m_frTxrRef.IsValid() ;
+}
diff --git a/TextureData.h b/TextureData.h
new file mode 100644
index 0000000..19f9654
--- /dev/null
+++ b/TextureData.h
@@ -0,0 +1,46 @@
+//----------------------------------------------------------------------------
+// EgalTech 2015-2015
+//----------------------------------------------------------------------------
+// File : TextureData.h Data : 04.10.15 Versione : 1.6j1
+// Contenuto : Dichiarazione della classe TextureData.
+//
+//
+//
+// Modifiche : 04.10.15 DS Creazione modulo.
+//
+//
+//----------------------------------------------------------------------------
+
+#pragma once
+
+#include "/EgtDev/Include/EGkGdbConst.h"
+#include "/EgtDev/Include/EGkFrame3d.h"
+#include "/EgtDev/Include/EgtStringBase.h"
+
+class NgeWriter ;
+class NgeReader ;
+class GeomDB ;
+
+//----------------------------------------------------------------------------
+class TextureData
+{
+ public :
+ TextureData* Clone( void) const
+ { TextureData* pTxrData ;
+ // alloco oggetto
+ pTxrData = new(std::nothrow) TextureData ;
+ if ( pTxrData != nullptr)
+ *pTxrData = *this ;
+ return pTxrData ; }
+ bool Dump( const GeomDB& GDB, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const ;
+ bool Save( NgeWriter& ngeOut) const ;
+ bool Load( NgeReader& ngeIn) ;
+ bool SetName( const std::string& sTxrName) ;
+ bool SetFrame( const Frame3d& frTxrRef) ;
+ bool GetName( std::string& sTxrName) const ;
+ bool GetFrame( Frame3d& frTxrRef) const ;
+
+ private :
+ std::string m_sTxrName ; // Nome della texture
+ Frame3d m_frTxrRef ; // Riferimento della texture
+} ;
\ No newline at end of file