EgtGeomKernel 1.5f2 :

- aggiunta gestione testi multilinea
- migliorie e correzioni varie sui testi.
This commit is contained in:
Dario Sassi
2014-06-06 08:53:14 +00:00
parent 41a38fef3b
commit bf2eb6648e
14 changed files with 569 additions and 160 deletions
+58 -6
View File
@@ -264,8 +264,8 @@ GdbExecutor::ExecuteVector( const string& sCmd2, const STRVECTOR& vsParams)
// definizione diretta
if ( sCmd2 == "" || sCmd2 == "MAKE") {
Vector3d Vect ;
// 3 parametri : Id, IdParent e vettore
if ( vsParams.size() != 3)
// 3 o 4 parametri : Id, IdParent, Vettore [, ScaleFactor]
if ( vsParams.size() != 3 && vsParams.size() != 4)
return false ;
// recupero il riferimento in cui è immerso
Frame3d frVect ;
@@ -274,11 +274,15 @@ GdbExecutor::ExecuteVector( const string& sCmd2, const STRVECTOR& vsParams)
// recupero i tre componenti
if ( ! GetVectorParam( vsParams[2], frVect, Vect))
return false ;
// recupero l'eventuale fattore di scala
double dScale = 1 ;
if ( vsParams.size() == 4 && ! FromString( vsParams[3], dScale))
return false ;
// creo il vettore
IGeoVector3d* pGVect = CreateGeoVector3d() ;
if ( pGVect == nullptr)
return false ;
pGVect->Set( Vect) ;
pGVect->Set( Vect * dScale) ;
return AddGeoObj( vsParams[0], vsParams[1], pGVect) ;
}
// definizione come differenza di due punti
@@ -1971,8 +1975,8 @@ GdbExecutor::TextSimple( const STRVECTOR& vsParams)
bool
GdbExecutor::TextComplete( const STRVECTOR& vsParams)
{
// parametri : Id, ParentId, Text, Point, AngDeg, Font, W, Italic, H, Rat, AddAdv
if ( vsParams.size() != 11)
// parametri : Id, ParentId, Text, Point, AngDeg, Font, W, Italic, H, Rat, AddAdv, PosIns
if ( vsParams.size() != 12)
return false ;
// recupero il riferimento in cui è immerso
Frame3d frRef ;
@@ -2005,12 +2009,34 @@ GdbExecutor::TextComplete( const STRVECTOR& vsParams)
double dAddAdv ;
if ( ! FromString( vsParams[10], dAddAdv))
return false ;
// falg per posizione di inserimento
int nInsPos = ETXT_IPBL ;
string sInsPos = vsParams[11] ;
ToUpper( sInsPos) ;
if ( sInsPos == "TL")
nInsPos = ETXT_IPTL ;
else if ( sInsPos == "TC")
nInsPos = ETXT_IPTC ;
else if ( sInsPos == "TR")
nInsPos = ETXT_IPTR ;
else if ( sInsPos == "ML")
nInsPos = ETXT_IPML ;
else if ( sInsPos == "MC")
nInsPos = ETXT_IPMC ;
else if ( sInsPos == "MR")
nInsPos = ETXT_IPMR ;
else if ( sInsPos == "BL")
nInsPos = ETXT_IPBL ;
else if ( sInsPos == "BC")
nInsPos = ETXT_IPBC ;
else if ( sInsPos == "BR")
nInsPos = ETXT_IPBR ;
// creo il testo
PtrOwner<IExtText> pTXT( CreateExtText()) ;
if ( ! IsValid( pTXT))
return false ;
// lo riempio
if ( ! pTXT->Set( vsParams[2], ptP, dAngRotDeg, vsParams[5], nW, bItl, dH, dRat, dAddAdv))
if ( ! pTXT->Set( vsParams[2], ptP, dAngRotDeg, vsParams[5], nW, bItl, dH, dRat, dAddAdv, nInsPos))
return false ;
// inserisco il testo nel DB
return AddGeoObj( vsParams[0], vsParams[1], Release( pTXT)) ;
@@ -2301,6 +2327,24 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
return false ;
}
}
// se testo
else if ( pGObj->GetType() == EXT_TEXT) {
// recupero il testo
const IExtText* pTxt = GetExtText( pGObj) ;
switch ( cType) {
case 'D' : // versore direzione longitudinale del testo
vtV = pTxt->GetDirVersor() ;
return vtV.LocToLoc( frEnt, frVect) ;
case 'H' : // versore direzione trasversale del testo
return ( pTxt->GetHeightVersor( vtV) &&
vtV.LocToLoc( frEnt, frVect)) ;
case 'O' : // versore ortogonale al piano del testo
vtV = pTxt->GetNormVersor() ;
return vtV.LocToLoc( frEnt, frVect) ;
default :
return false ;
}
}
}
return false ;
}
@@ -2451,10 +2495,18 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
if ( ! pTxt->GetStartPoint( ptP))
return false ;
return ptP.LocToLoc( frEnt, frPnt) ;
case 'T' : // punto sopra l'iniziale
if ( ! pTxt->GetOverStartPoint( ptP))
return false ;
return ptP.LocToLoc( frEnt, frPnt) ;
case 'E' : // punto finale
if ( ! pTxt->GetEndPoint( ptP))
return false ;
return ptP.LocToLoc( frEnt, frPnt) ;
case 'F' : // punto sopra il finale
if ( ! pTxt->GetOverEndPoint( ptP))
return false ;
return ptP.LocToLoc( frEnt, frPnt) ;
case 'M' : // punto medio
if ( ! pTxt->GetMidPoint( ptP))
return false ;