EgtGeomKernel 1.6a2 :
- aggiunte GetNfeFontDir e GetDefaultFont - modifiche a Set di ExtText - migliorata gestione materiali - GeomDB::Load ora può funzionare aggiungendo a DB già carico per Insert.
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ DistPointArc::DistPointArc( const Point3d& ptP, const ICurveArc& arArc)
|
||||
// distanza non calcolata
|
||||
m_dDist = - 1 ;
|
||||
|
||||
if ( ! arArc.IsValid())
|
||||
if ( &arArc == nullptr || ! arArc.IsValid())
|
||||
return ;
|
||||
|
||||
// se circonferenza
|
||||
|
||||
@@ -26,7 +26,7 @@ DistPointCrvBezier::DistPointCrvBezier( const Point3d& ptP, const ICurveBezier&
|
||||
// distanza non calcolata
|
||||
m_dDist = - 1 ;
|
||||
|
||||
if ( ! CrvBez.IsValid())
|
||||
if ( &CrvBez == nullptr || ! CrvBez.IsValid())
|
||||
return ;
|
||||
|
||||
// determino tolleranza di approssimazione in base a ingombro curva
|
||||
|
||||
@@ -23,7 +23,7 @@ DistPointCrvComposite::DistPointCrvComposite( const Point3d& ptP, const ICurveCo
|
||||
// distanza non calcolata
|
||||
m_dDist = - 1 ;
|
||||
|
||||
if ( ! CrvCompo.IsValid())
|
||||
if ( &CrvCompo == nullptr || ! CrvCompo.IsValid())
|
||||
return ;
|
||||
|
||||
// ciclo su ogni curva
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ DistPointCurve::DistPointCurve( const Point3d& ptP, const ICurve& Curve, bool bI
|
||||
m_pCurve = nullptr ;
|
||||
|
||||
// curva non valida
|
||||
if ( ! Curve.IsValid())
|
||||
if ( &Curve == nullptr || ! Curve.IsValid())
|
||||
return ;
|
||||
|
||||
// chiamo calcolatore opportuno
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ DistPointLine::DistPointLine( const Point3d& ptP,
|
||||
// distanza non calcolata
|
||||
m_dSqDist = - 1 ;
|
||||
|
||||
if ( ! crvLine.IsValid())
|
||||
if ( &crvLine == nullptr || ! crvLine.IsValid())
|
||||
return ;
|
||||
|
||||
double dLen ;
|
||||
|
||||
@@ -119,3 +119,23 @@ InitFontManager( const std::string& sNfeFontDir, const std::string& sDefaultFont
|
||||
// lo inizializzo
|
||||
fntMgr.Init( sNfeFontDir, sDefaultFont) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const std::string&
|
||||
GetNfeFontDir( void)
|
||||
{
|
||||
// recupero il font manager
|
||||
FontManager& fntMgr = FontManager::GetFontManager() ;
|
||||
// restituisco il dato
|
||||
return fntMgr.GetNfeFontDir() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const std::string&
|
||||
GetDefaultFont( void)
|
||||
{
|
||||
// recupero il font manager
|
||||
FontManager& fntMgr = FontManager::GetFontManager() ;
|
||||
// restituisco il dato
|
||||
return fntMgr.GetDefaultFont() ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -75,24 +75,28 @@
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)D$(PlatformArchitecture)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>$(ProjectName)R$(PlatformArchitecture)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Configuration)$(PlatformArchitecture)\</OutDir>
|
||||
<IntDir>$(Configuration)$(PlatformArchitecture)\</IntDir>
|
||||
<IncludePath>C:\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -176,6 +180,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -216,6 +221,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
+12
-13
@@ -40,7 +40,7 @@ ExtText::~ExtText( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg, double dH)
|
||||
ExtText::Set( const Point3d& ptP, double dAngDeg, const string& sText, double dH)
|
||||
{
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
@@ -66,9 +66,8 @@ ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg, double dH
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg,
|
||||
const string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv,
|
||||
int nInsPos)
|
||||
ExtText::Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, const string& sFont, bool bItl, double dH)
|
||||
{
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
@@ -78,16 +77,16 @@ ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg,
|
||||
return false ;
|
||||
// assegno i dati
|
||||
m_ptP = ptP ;
|
||||
m_vtN = Z_AX ;
|
||||
m_vtD = FromPolar( 1, dAngDeg) ;
|
||||
m_vtN = vtN ;
|
||||
m_vtD = vtD ;
|
||||
m_sText = sText ;
|
||||
m_sFont = sFont ;
|
||||
m_nWeight = nW ;
|
||||
m_nWeight = 400 ;
|
||||
m_bItalic = bItl ;
|
||||
m_dHeight = dH ;
|
||||
m_dRatio = dRat ;
|
||||
m_dAddAdvance = dAddAdv ;
|
||||
m_nInsPos = (( nInsPos >= ETXT_IPTL && nInsPos <= ETXT_IPBR) ? nInsPos : ETXT_IPBL) ;
|
||||
m_dRatio = 1 ;
|
||||
m_dAddAdvance = 0 ;
|
||||
m_nInsPos = ETXT_IPBL ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
@@ -97,9 +96,9 @@ ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExtText::Set( const string& sText, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv,
|
||||
int nInsPos)
|
||||
ExtText::Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, const string& sFont, int nW, bool bItl, double dH,
|
||||
double dRat, double dAddAdv, int nInsPos)
|
||||
{
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
|
||||
@@ -56,13 +56,12 @@ class ExtText : public IExtText, public IGeoObjRW
|
||||
|
||||
public : // IExtText
|
||||
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
||||
virtual bool Set( const std::string& sText, const Point3d& ptP, double dAngDeg, double dH) ;
|
||||
virtual bool Set( const std::string& sText, const Point3d& ptP, double dAngDeg,
|
||||
const std::string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv,
|
||||
int nInsPos = 7) ;
|
||||
virtual bool Set( const std::string& sText, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const std::string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv,
|
||||
int nInsPos = 7) ;
|
||||
virtual bool Set( const Point3d& ptP, double dAngDeg, const std::string& sText, double dH) ;
|
||||
virtual bool Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const std::string& sText, const std::string& sFont, bool bItl, double dH) ;
|
||||
virtual bool Set( const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const std::string& sText, const std::string& sFont, int nW, bool bItl, double dH,
|
||||
double dRat, double dAddAdv, int nInsPos = 7) ;
|
||||
virtual const Point3d& GetPoint( void) const
|
||||
{ return m_ptP ; }
|
||||
virtual const Vector3d& GetNormVersor( void) const
|
||||
|
||||
@@ -26,6 +26,10 @@ class FontManager
|
||||
bool Init( const std::string& sNfeFontDir, const std::string& sDefaultFont) ;
|
||||
bool SetCurrFont( const std::string& sFont, int nWeight, bool bItalic,
|
||||
double dHeight, double dRatio, double dAddAdvance) ;
|
||||
const std::string& GetNfeFontDir( void)
|
||||
{ return m_sNfeFontDir ; }
|
||||
const std::string& GetDefaultFont( void)
|
||||
{ return m_sDefaultFont ; }
|
||||
bool GetCapHeight( double& dCapH) ;
|
||||
bool GetAscent( double& dAsc) ;
|
||||
bool GetDescent( double& dDesc) ;
|
||||
|
||||
+3
-3
@@ -2721,7 +2721,7 @@ GdbExecutor::TextSimple( const STRVECTOR& vsParams)
|
||||
if ( IsNull( pTXT))
|
||||
return false ;
|
||||
// lo riempio
|
||||
if ( ! pTXT->Set( sText, ptP, dAngRotDeg, dH))
|
||||
if ( ! pTXT->Set( ptP, dAngRotDeg, sText, dH))
|
||||
return false ;
|
||||
// inserisco il testo nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pTXT)) ;
|
||||
@@ -2796,7 +2796,7 @@ GdbExecutor::TextComplete( const STRVECTOR& vsParams)
|
||||
if ( IsNull( pTXT))
|
||||
return false ;
|
||||
// lo riempio
|
||||
if ( ! pTXT->Set( sText, ptP, dAngRotDeg, vsParams[5], nW, bItl, dH, dRat, dAddAdv, nInsPos))
|
||||
if ( ! pTXT->Set( ptP, Z_AX, FromPolar( 1, dAngRotDeg), sText, vsParams[5], nW, bItl, dH, dRat, dAddAdv, nInsPos))
|
||||
return false ;
|
||||
// inserisco il testo nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pTXT)) ;
|
||||
@@ -5424,7 +5424,7 @@ GdbExecutor::ExecuteOutTextIcci( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
if ( IsNull( pTXT))
|
||||
return false ;
|
||||
// lo riempio
|
||||
if ( ! pTXT->Set( sText, ptText, 0, dH))
|
||||
if ( ! pTXT->Set( ptText, 0, sText, dH))
|
||||
return false ;
|
||||
// inserisco il testo nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pTXT)) ;
|
||||
|
||||
+23
-9
@@ -20,6 +20,10 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const string RESERVED_NAME = "$$" ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GdbMaterialMgr::GdbMaterialMgr( void)
|
||||
{
|
||||
@@ -58,7 +62,7 @@ GdbMaterialMgr::Save( NgeWriter& ngeOut) const
|
||||
// scrittura dei materiali custom
|
||||
for ( int i = m_nStdNum ; i < int( m_GdbMats.size()) ; ++ i) {
|
||||
// Nome, Id, Tipo (1=materiale senza texture)
|
||||
string sMatName = ( m_GdbMats[i].sName.empty() ? "$$" : m_GdbMats[i].sName) ;
|
||||
string sMatName = ( m_GdbMats[i].sName.empty() ? RESERVED_NAME : m_GdbMats[i].sName) ;
|
||||
if ( ! ngeOut.WriteString( sMatName, ","))
|
||||
return false ;
|
||||
if ( ! ngeOut.WriteInt( i + 1, ","))
|
||||
@@ -81,7 +85,7 @@ GdbMaterialMgr::Save( NgeWriter& ngeOut) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbMaterialMgr::Load( NgeReader& ngeIn)
|
||||
GdbMaterialMgr::Load( NgeReader& ngeIn, INTVECTOR& vBaseMatId)
|
||||
{
|
||||
// lettura eventuale intestazione libreria
|
||||
int nKey ;
|
||||
@@ -91,6 +95,10 @@ GdbMaterialMgr::Load( NgeReader& ngeIn)
|
||||
ngeIn.UngetKey() ;
|
||||
return true ;
|
||||
}
|
||||
// aggiorno indice rilocazione per materiali standard (1 based)
|
||||
vBaseMatId.resize( m_nStdNum + 1, 0) ;
|
||||
for ( int i = 0 ; i <= m_nStdNum ; ++ i)
|
||||
vBaseMatId[i] = i ;
|
||||
// lettura numero di materiali custom
|
||||
int nCustNum ;
|
||||
if ( ! ngeIn.ReadInt( nCustNum, ";", true))
|
||||
@@ -107,6 +115,9 @@ GdbMaterialMgr::Load( NgeReader& ngeIn)
|
||||
int nType ;
|
||||
if ( ! ngeIn.ReadInt( nType, ";", true))
|
||||
return false ;
|
||||
// verifico correttezza indice
|
||||
if ( nInd != m_nStdNum + i + 1)
|
||||
return false ;
|
||||
// dati del materiale
|
||||
Color colAmb ;
|
||||
if ( ! ngeIn.ReadCol( colAmb, ";"))
|
||||
@@ -120,14 +131,17 @@ GdbMaterialMgr::Load( NgeReader& ngeIn)
|
||||
double dShin ;
|
||||
if ( ! ngeIn.ReadDouble( dShin, ";", true))
|
||||
return false ;
|
||||
// inserisco il materiale
|
||||
int nNew = AddMaterial( sMatName, Material( colAmb, colDiff, colSpec, dShin)) ;
|
||||
if ( nNew == GDB_MT_NULL || nNew != nInd)
|
||||
// inserisco il materiale, verificando non sia già presente (escludo nome riservato)
|
||||
int nNew = (( sMatName != RESERVED_NAME) ? FindMaterial( sMatName) : GDB_MT_NULL) ;
|
||||
if ( nNew == GDB_MT_NULL)
|
||||
nNew = AddMaterial( sMatName, Material( colAmb, colDiff, colSpec, dShin), true) ;
|
||||
if ( nNew == GDB_MT_NULL)
|
||||
return false ;
|
||||
vBaseMatId.push_back( nNew) ;
|
||||
}
|
||||
// sistemazione dei materiali cancellati
|
||||
for ( int i = m_nStdNum ; i < int( m_GdbMats.size()) ; ++ i) {
|
||||
if ( m_GdbMats[i].sName == "$$")
|
||||
if ( m_GdbMats[i].sName == RESERVED_NAME)
|
||||
EraseMaterial( i + 1) ;
|
||||
}
|
||||
|
||||
@@ -136,13 +150,13 @@ GdbMaterialMgr::Load( NgeReader& ngeIn)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GdbMaterialMgr::AddMaterial( const string& sName, const Material& matM)
|
||||
GdbMaterialMgr::AddMaterial( const string& sName, const Material& matM, bool bLoad)
|
||||
{
|
||||
// verifico validità nome
|
||||
if ( ! IsValidName( sName))
|
||||
if ( ! IsValidName( sName) || ( ! bLoad && sName == RESERVED_NAME))
|
||||
return GDB_MT_NULL ;
|
||||
// se il materiale già esiste ritorno errore
|
||||
if ( FindMaterial( sName) > 0)
|
||||
if ( sName != RESERVED_NAME && FindMaterial( sName) > 0)
|
||||
return GDB_MT_NULL ;
|
||||
// provo ad inserire al posto del primo cancellato
|
||||
int nId = FindFirstErased() ;
|
||||
|
||||
+5
-3
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "Material.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include <vector>
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class NgeWriter ;
|
||||
class NgeReader ;
|
||||
@@ -27,10 +27,12 @@ class GdbMaterialMgr
|
||||
GdbMaterialMgr( void) ;
|
||||
bool Clear( void) ;
|
||||
bool Save( NgeWriter& ngeOut) const ;
|
||||
bool Load( NgeReader& ngeIn) ;
|
||||
int AddMaterial( const std::string& sName, const Material& matM) ;
|
||||
bool Load( NgeReader& ngeIn, INTVECTOR& vBaseMatId) ;
|
||||
int AddMaterial( const std::string& sName, const Material& matM, bool bLoad = false) ;
|
||||
bool EraseMaterial( int nId) ;
|
||||
int FindMaterial( const std::string& sName) const ;
|
||||
int GetMaxStdMaterialId( void) const
|
||||
{ return m_nStdNum ; }
|
||||
int GetMaxMaterialId( void) const
|
||||
{ return int( m_GdbMats.size()) ; }
|
||||
bool ExistsMaterial( int nId) const
|
||||
|
||||
+37
-17
@@ -19,10 +19,10 @@
|
||||
#include "Attribs.h"
|
||||
#include "NgeReader.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/SELkMachineId.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include <new>
|
||||
@@ -95,8 +95,11 @@ GeomDB::Clear( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::Load( const std::string& sFileIn)
|
||||
GeomDB::Load( const string& sFileIn, int nGroupId)
|
||||
{
|
||||
// recupero massimo Id (diventa Id base per entità da caricare)
|
||||
int nBaseGdbId = m_IdManager.GetMaxId() ;
|
||||
|
||||
// apertura file
|
||||
NgeReader ngeIn ;
|
||||
if ( ! ngeIn.Init( sFileIn)) {
|
||||
@@ -105,14 +108,16 @@ GeomDB::Load( const std::string& sFileIn)
|
||||
}
|
||||
|
||||
// leggo l'intestazione
|
||||
if ( ! LoadHeader( ngeIn)) {
|
||||
if ( ! LoadHeader( ngeIn, ( nBaseGdbId == 0))) {
|
||||
string sOut = "GeomDbLoad : Error on pos " + ToString( ngeIn.GetCurrPos()) ;
|
||||
LOG_ERROR( GetEGkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
}
|
||||
|
||||
// leggo i materiali custom
|
||||
if ( ! m_MatManager.Load( ngeIn)) {
|
||||
INTVECTOR vBaseMatId ;
|
||||
vBaseMatId.reserve( 48) ;
|
||||
if ( ! m_MatManager.Load( ngeIn, vBaseMatId)) {
|
||||
string sOut = "GeomDbLoad : Error on pos " + ToString( ngeIn.GetCurrPos()) ;
|
||||
LOG_ERROR( GetEGkLogger(), sOut.c_str())
|
||||
return false ;
|
||||
@@ -122,7 +127,7 @@ GeomDB::Load( const std::string& sFileIn)
|
||||
bool bEnd ;
|
||||
bool bOk = true ;
|
||||
do {
|
||||
if ( ! LoadOneObj( ngeIn, bEnd)) {
|
||||
if ( ! LoadOneObj( ngeIn, nGroupId, nBaseGdbId, vBaseMatId, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "GeomDbLoad : Error on pos " + ToString( ngeIn.GetCurrPos()) ;
|
||||
LOG_ERROR( GetEGkLogger(), sOut.c_str())
|
||||
@@ -134,7 +139,7 @@ GeomDB::Load( const std::string& sFileIn)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::LoadHeader( NgeReader& ngeIn)
|
||||
GeomDB::LoadHeader( NgeReader& ngeIn, bool bSave)
|
||||
{
|
||||
// intestazione
|
||||
int nKey ;
|
||||
@@ -156,12 +161,15 @@ GeomDB::LoadHeader( NgeReader& ngeIn)
|
||||
Color colDef( 0, 0, 0, 0) ;
|
||||
if ( ! ngeIn.ReadCol( colDef, ";", true))
|
||||
return false ;
|
||||
return SetDefaultMaterial( colDef) ;
|
||||
if ( bSave)
|
||||
return SetDefaultMaterial(colDef) ;
|
||||
else
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::LoadOneObj( NgeReader& ngeIn, bool& bEnd)
|
||||
GeomDB::LoadOneObj( NgeReader& ngeIn, int nGroupId, int nBaseGdbId, const INTVECTOR& vBaseMatId, bool& bEnd)
|
||||
{
|
||||
// in generale non è fine file
|
||||
bEnd = false ;
|
||||
@@ -193,21 +201,33 @@ GeomDB::LoadOneObj( NgeReader& ngeIn, bool& bEnd)
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// se lettura dati e inserimento nel DB vanno bene
|
||||
// se lettura dati va bene
|
||||
int nParentId ;
|
||||
if ( pGdbObj->Load( nKey, ngeIn, nParentId) &&
|
||||
InsertInGeomDB( pGdbObj, nParentId, GDB_SON))
|
||||
return true ;
|
||||
// altrimenti errore
|
||||
else {
|
||||
delete pGdbObj ;
|
||||
return false ;
|
||||
if ( pGdbObj->Load( nKey, ngeIn, nParentId)) {
|
||||
// aggiusto Id
|
||||
pGdbObj->m_nId += nBaseGdbId ;
|
||||
// aggiusto Id del gruppo di appartenenza
|
||||
if ( nParentId == GDB_ID_ROOT)
|
||||
nParentId += nGroupId ;
|
||||
else
|
||||
nParentId += nBaseGdbId ;
|
||||
// aggiusto eventuale indice del materiale
|
||||
int nMat ;
|
||||
if ( pGdbObj->GetMaterial( nMat) &&
|
||||
nMat > 0 && nMat < int( vBaseMatId.size()))
|
||||
pGdbObj->SetMaterial( vBaseMatId[nMat]) ;
|
||||
// se inserimento nel DB va bene, ritorno con successo
|
||||
if ( InsertInGeomDB( pGdbObj, nParentId, GDB_SON))
|
||||
return true ;
|
||||
}
|
||||
// altrimenti errore
|
||||
delete pGdbObj ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::Save( const std::string& sFileOut, int nFlag) const
|
||||
GeomDB::Save( const string& sFileOut, int nFlag) const
|
||||
{
|
||||
// apertura file
|
||||
NgeWriter ngeOut ;
|
||||
|
||||
@@ -34,7 +34,7 @@ class GeomDB : public IGeomDB
|
||||
virtual ~GeomDB( void) ;
|
||||
virtual bool Init( void) ;
|
||||
virtual bool Clear( void) ;
|
||||
virtual bool Load( const std::string& sFileIn) ;
|
||||
virtual bool Load( const std::string& sFileIn, int nGroupId = GDB_ID_ROOT) ;
|
||||
virtual bool Save( const std::string& sFileOut, int nFlag = GDB_SV_BIN) const ;
|
||||
virtual bool ExistsObj( int nId) const ;
|
||||
virtual int AddGroup( int nId, int nParentId, const Frame3d& frFrame) ;
|
||||
@@ -196,8 +196,8 @@ class GeomDB : public IGeomDB
|
||||
int Copy( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter, bool bGlob) ;
|
||||
bool Relocate( int nId, int nRefId, int nSonBeforeAfter, bool bGlob) ;
|
||||
bool Erase( GdbObj* pGObj) ;
|
||||
bool LoadHeader( NgeReader& ngeIn) ;
|
||||
bool LoadOneObj( NgeReader& ngeIn, bool& bEnd) ;
|
||||
bool LoadHeader( NgeReader& ngeIn, bool bSave) ;
|
||||
bool LoadOneObj( NgeReader& ngeIn, int nGroupId, int nBaseGdbId, const INTVECTOR& vBaseMatId, bool& bEnd) ;
|
||||
bool SaveHeader( NgeWriter& ngeOut) const ;
|
||||
bool SaveFooter( NgeWriter& ngeOut) const ;
|
||||
bool SetStatus( GdbObj* pGdbObj, int nStat) ;
|
||||
|
||||
Reference in New Issue
Block a user