EgtGeomKernel 1.5f7 :
- aggiunta intersezione tra curve composte (e gestione loro topologia) - corretto salvataggio entità testo - aggiunto EPS_SMALL a test su box - aggiunte funzioni di verifica validità e tipo parametro di curve - aggiunto comando TSC OUTTEXTICCI.
This commit is contained in:
+42
-8
@@ -23,8 +23,6 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GEOOBJ_REGISTER( EXT_TEXT, NGE_E_TXT, ExtText) ;
|
||||
|
||||
@@ -44,7 +42,7 @@ ExtText::~ExtText( void)
|
||||
bool
|
||||
ExtText::Set( const string& sText, const Point3d& ptP, double dAngDeg, double dH)
|
||||
{
|
||||
// controllo testo
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
return false ;
|
||||
// assegno i dati
|
||||
@@ -72,9 +70,12 @@ 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)
|
||||
{
|
||||
// controllo testo
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
return false ;
|
||||
// controllo lunghezza nome font
|
||||
if ( sFont.size() > MAX_FONT_LEN)
|
||||
return false ;
|
||||
// assegno i dati
|
||||
m_ptP = ptP ;
|
||||
m_vtN = Z_AX ;
|
||||
@@ -100,9 +101,12 @@ ExtText::Set( const string& sText, const Point3d& ptP, const Vector3d& vtN, cons
|
||||
const string& sFont, int nW, bool bItl, double dH, double dRat, double dAddAdv,
|
||||
int nInsPos)
|
||||
{
|
||||
// controllo testo
|
||||
// controllo testo non vuoto
|
||||
if ( sText.empty())
|
||||
return false ;
|
||||
// controllo lunghezza nome font
|
||||
if ( sFont.size() > MAX_FONT_LEN)
|
||||
return false ;
|
||||
// assegno i dati
|
||||
m_ptP = ptP ;
|
||||
m_vtN = vtN ;
|
||||
@@ -232,8 +236,23 @@ ExtText::Save( NgeWriter& ngeOut) const
|
||||
if ( ! ngeOut.WriteVector( m_vtD, ";", true))
|
||||
return false ;
|
||||
// testo
|
||||
if ( ! ngeOut.WriteString( m_sText, nullptr, true))
|
||||
int nTextLines = int( m_sText.size()) / MAX_TXT_LINE +
|
||||
( ( int( m_sText.size()) % MAX_TXT_LINE) > 0 ? 1 : 0) ;
|
||||
if ( ! ngeOut.WriteInt( nTextLines, ";", true))
|
||||
return false ;
|
||||
string sBuff ;
|
||||
for ( int i = 0 ; i < nTextLines ; ++ i) {
|
||||
// copio i caratteri nel buffer
|
||||
sBuff = m_sText.substr( i * MAX_TXT_LINE, MAX_TXT_LINE) ;
|
||||
// sostituisco eventuale primo o ultimo spazio con carattere speciale
|
||||
if ( sBuff.front() == ' ')
|
||||
sBuff.front() = CHR_SPECIAL ;
|
||||
if ( sBuff.back() == ' ')
|
||||
sBuff.back() = CHR_SPECIAL ;
|
||||
// scrivo il testo
|
||||
if ( ! ngeOut.WriteString( sBuff, nullptr, true))
|
||||
return false ;
|
||||
}
|
||||
// font
|
||||
if ( ! ngeOut.WriteString( m_sFont, ";"))
|
||||
return false ;
|
||||
@@ -271,9 +290,24 @@ ExtText::Load( NgeReader& ngeIn)
|
||||
return false ;
|
||||
if ( ! ngeIn.ReadVector( m_vtD, ";", true))
|
||||
return false ;
|
||||
// leggo la prossima linea : testo
|
||||
if ( ! ngeIn.ReadString( m_sText, nullptr, true))
|
||||
// leggo la prossima linea : numero di righe di testo
|
||||
int nTextLines ;
|
||||
if ( ! ngeIn.ReadInt( nTextLines, ";", true))
|
||||
return false ;
|
||||
// leggo le stringhe che costituisco il testo
|
||||
string sBuff ;
|
||||
for ( int i = 0 ; i < nTextLines ; ++i) {
|
||||
// leggo la linea
|
||||
if ( ! ngeIn.ReadString( sBuff, nullptr, true))
|
||||
return false ;
|
||||
// sostituisco eventuale primo o ultimo carattere speciale con spazio
|
||||
if ( sBuff.front() == CHR_SPECIAL)
|
||||
sBuff.front() = ' ' ;
|
||||
if ( sBuff.back() == CHR_SPECIAL)
|
||||
sBuff.back() = ' ' ;
|
||||
// la accodo
|
||||
m_sText += sBuff ;
|
||||
}
|
||||
// leggo la prossima linea : font, spessore, italico, altezza, ratio, addAdvance
|
||||
if ( ! ngeIn.ReadString( m_sFont, ";"))
|
||||
return false ;
|
||||
|
||||
Reference in New Issue
Block a user