EgtGeomKernel :

- correzione a PolyLine (Splice)
- impostazione Reset grafica sulle diverse entità geometriche.
This commit is contained in:
Dario Sassi
2014-02-17 09:39:49 +00:00
parent 997c65781f
commit 8a416970a3
14 changed files with 287 additions and 224 deletions
+40 -26
View File
@@ -113,6 +113,9 @@ CurveArc::Set( const Point3d& ptCen, double dRad)
m_dDeltaN = 0 ;
m_nStatus = TO_VERIFY ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -161,14 +164,14 @@ CurveArc::Save( ostream& osOut) const
bool
CurveArc::Load( Scanner& TheScanner)
{
string sLine ;
STRVECTOR vsParams ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ";", vsParams) ;
// 6 parametri : centro, versore normale, raggio, versore iniziale, angolo al centro e delta Z
if ( vsParams.size() != 6)
@@ -313,11 +316,7 @@ CurveArc::GetEndPoint( Point3d& ptEnd) const
bool
CurveArc::GetPointD1D2( double dU, Side nS, Point3d& ptPos, Vector3d* pvtDer1, Vector3d* pvtDer2) const
{
double dAng ;
Vector3d vtDir ;
// la curva deve essere validata
// la curva deve essere valida
if ( m_nStatus != OK)
return false ;
@@ -328,8 +327,8 @@ CurveArc::GetPointD1D2( double dU, Side nS, Point3d& ptPos, Vector3d* pvtDer1, V
dU = 1 ;
// versore al punto nel piano della circonferenza (ruoto m_VtS di dU di m_dAngCenDeg attorno a m_VtN)
dAng = dU * m_dAngCenDeg * DEGTORAD ;
vtDir = cos( dAng) * m_VtS + sin( dAng) * ( m_VtN ^ m_VtS) ;
double dAng = dU * m_dAngCenDeg * DEGTORAD ;
Vector3d vtDir = cos( dAng) * m_VtS + sin( dAng) * ( m_VtN ^ m_VtS) ;
// calcolo del punto
ptPos = m_PtCen + m_dRad * vtDir ;
@@ -384,10 +383,6 @@ CurveArc::ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) cons
bool
CurveArc::Invert( void)
{
double dAng ;
Point3d ptTemp ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -397,13 +392,16 @@ CurveArc::Invert( void)
m_PtCen += m_dDeltaN * m_VtN ;
// il versore normale rimane inalterato
// il versore iniziale diventa quello finale
dAng = m_dAngCenDeg * DEGTORAD ;
double dAng = m_dAngCenDeg * DEGTORAD ;
m_VtS = cos( dAng) * m_VtS + sin( dAng) * ( m_VtN ^ m_VtS) ;
// il raggio non cambia
// l'angolo al centro inverte il segno
m_dAngCenDeg = - m_dAngCenDeg ;
// l'incremento sulla normale inverte il segno
m_dDeltaN = - m_dDeltaN ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -448,15 +446,11 @@ CurveArc::TrimEndAtParam( double dUTrim)
bool
CurveArc::TrimStartAtLen( double dLenTrim)
{
double dLen ;
double dAngRot ;
double dMoveN ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// verifico che sia abbastanza lunga
double dLen ;
if ( ! GetLength( dLen))
return false ;
if ( ( dLen - dLenTrim) < EPS_SMALL)
@@ -464,6 +458,8 @@ CurveArc::TrimStartAtLen( double dLenTrim)
// eseguo il trim
if ( dLenTrim > EPS_ZERO) {
double dAngRot ;
double dMoveN ;
dAngRot = m_dAngCenDeg * dLenTrim / dLen ;
m_VtS.Rotate( m_VtN, dAngRot * DEGTORAD) ;
m_dAngCenDeg -= dAngRot ;
@@ -474,7 +470,8 @@ CurveArc::TrimStartAtLen( double dLenTrim)
}
}
// con i controlli sopra fatti rimane validata
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -483,13 +480,11 @@ CurveArc::TrimStartAtLen( double dLenTrim)
bool
CurveArc::TrimEndAtLen( double dLenTrim)
{
double dLen ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// verifico che sia abbastanza lunga
double dLen ;
if ( ! GetLength( dLen))
return false ;
if ( dLenTrim < EPS_SMALL)
@@ -502,7 +497,8 @@ CurveArc::TrimEndAtLen( double dLenTrim)
m_dDeltaN *= dLenTrim / dLen ;
}
// con i controlli sopra fatti rimane validata
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -518,6 +514,9 @@ CurveArc::Translate( const Vector3d& vtMove)
// traslo il centro
m_PtCen.Translate( vtMove) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -538,6 +537,9 @@ CurveArc::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, dou
m_VtN.Rotate( vtAx, dCosAng, dSinAng) ;
m_VtS.Rotate( vtAx, dCosAng, dSinAng) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -565,6 +567,9 @@ CurveArc::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dC
m_VtS = - m_VtS ;
m_nStatus = TO_VERIFY ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -586,6 +591,9 @@ CurveArc::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
m_VtS.Mirror( vtNorm) ;
m_dAngCenDeg *= -1 ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -606,6 +614,9 @@ CurveArc::ToGlob( const Frame3d& frRef)
m_VtN.ToGlob( frRef) ;
m_VtS.ToGlob( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -626,6 +637,9 @@ CurveArc::ToLoc( const Frame3d& frRef)
m_VtN.ToLoc( frRef) ;
m_VtS.ToLoc( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
+2 -1
View File
@@ -48,7 +48,8 @@ class CurveArc : public ICurveArc
{ return m_OGrMgr.GetObjGraphics() ; }
public : // ICurve
virtual bool IsSimple( void) const { return true ; }
virtual bool IsSimple( void) const
{ return true ; }
virtual bool IsClosed( void) const
{ return ::IsClosed( *this) ; }
virtual bool GetStartPoint( Point3d& ptStart) const ;
+78 -91
View File
@@ -104,6 +104,9 @@ CurveBezier::Init( int nDeg, bool bIsRational)
}
m_nStatus = TO_VERIFY ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -125,6 +128,9 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl)
// annullo analisi presenza singolarità
m_dParSing = - 2 ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -147,6 +153,9 @@ CurveBezier::SetControlPoint( int nInd, const Point3d& ptCtrl, double dW)
// annullo analisi presenza singolarità
m_dParSing = - 2 ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -279,15 +288,12 @@ CurveBezier::GetKey( void) const
bool
CurveBezier::Save( ostream& osOut) const
{
int i ;
// flag razionale
osOut << m_bRat ;
// dati della curva di bezier
osOut << ";" << ToString( m_nDeg) ;
// ciclo sui punti di controllo ( con pesi se razionale)
for ( i = 0 ; i <= m_nDeg ; ++ i) {
for ( int i = 0 ; i <= m_nDeg ; ++ i) {
osOut << ";" << ToString( m_aPtCtrl[i]) ;
if ( m_bRat) {
osOut << "," << ToString( m_aWeCtrl[i]) ;
@@ -303,27 +309,24 @@ CurveBezier::Save( ostream& osOut) const
bool
CurveBezier::Load( Scanner& TheScanner)
{
string sLine ;
STRVECTOR vsParams ;
bool bIsRat ;
int nDeg ;
Point3d ptP ;
double dW ;
int i ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ";", vsParams) ;
// almeno 2 parametri : flag razionale e grado
if ( vsParams.size() < 2)
return false ;
// recupero il flag
bool bIsRat ;
if ( ! FromString( vsParams[0], bIsRat))
return false ;
// recupero il grado
int nDeg ;
if ( ! FromString( vsParams[1], nDeg))
return false ;
// ri-controllo il numero dei parametri
@@ -335,7 +338,8 @@ CurveBezier::Load( Scanner& TheScanner)
// se integrale
if ( ! bIsRat) {
// recupero e setto punti di controllo
for ( i = 0 ; i <= nDeg ; ++ i) {
Point3d ptP ;
for ( int i = 0 ; i <= nDeg ; ++ i) {
if ( ! FromString( vsParams[i+2], ptP) ||
! SetControlPoint( i, ptP))
return false ;
@@ -344,7 +348,9 @@ CurveBezier::Load( Scanner& TheScanner)
// altrimenti razionale
else {
// recupero e setto punti di controllo
for ( i = 0 ; i <= nDeg ; ++ i) {
Point3d ptP ;
double dW ;
for ( int i = 0 ; i <= nDeg ; ++ i) {
if ( ! FromString( vsParams[i+2], ptP, dW) ||
! SetControlPoint( i, ptP, dW))
return false ;
@@ -777,16 +783,13 @@ CurveBezier::ToPowerBase( PolynomialPoint3d& pol3Num, Polynomial& polDen) const
bool
CurveBezier::GetControlPolygonLength( double& dLen) const
{
int i ;
// la curva deve essere validata
// la curva deve essere valida
if ( m_nStatus != OK)
return false ;
// ciclo sui punti di controllo
dLen = 0 ;
for ( i = 1 ; i <= m_nDeg ; ++ i)
for ( int i = 1 ; i <= m_nDeg ; ++ i)
dLen += Dist( m_aPtCtrl[i], m_aPtCtrl[i-1]) ;
return true ;
@@ -861,7 +864,6 @@ bool
CurveBezier::GetLengthAtParam( double dU, double& dLen) const
{
const int NUM_SEG = 16 ;
int i ;
double dUIni ;
double dUMid ;
double dUFin ;
@@ -890,7 +892,7 @@ CurveBezier::GetLengthAtParam( double dU, double& dLen) const
dLen = 0 ;
dUIni = 0 ;
GetPointD1D2( 0, ICurve::FROM_MINUS, ptIni) ;
for ( i = 1 ; i <= NUM_SEG ; ++ i) {
for ( int i = 1 ; i <= NUM_SEG ; ++ i) {
// ricavo il punto
dUFin = i / (double) NUM_SEG * dU ;
GetPointD1D2( dUFin, ICurve::FROM_MINUS, ptFin) ;
@@ -918,19 +920,16 @@ CurveBezier::GetSegmentParam( double dLen, double& dCurrLen, double& dSegLen,
double& dUIni, double& dUFin) const
{
const int NUM_SEG = 16 ;
int i ;
double dUStart ;
double dUEnd ;
double dUMid ;
double dUMid ;
Point3d ptIni ;
Point3d ptMid ;
Point3d ptFin ;
dUStart = dUIni ;
dUEnd = dUFin ;
double dUStart = dUIni ;
double dUEnd = dUFin ;
GetPointD1D2( dUIni, ICurve::FROM_MINUS, ptIni) ;
for ( i = 1 ; i <= NUM_SEG ; ++ i) {
for ( int i = 1 ; i <= NUM_SEG ; ++ i) {
// ricavo il punto
dUFin = dUStart + i / (double) NUM_SEG * ( dUEnd - dUStart) ;
GetPointD1D2( dUFin, ICurve::FROM_MINUS, ptFin) ;
@@ -962,12 +961,6 @@ bool
CurveBezier::GetParamAtLength( double dLen, double& dU) const
{
const double MAX_SEG_LEN = 0.2 ;
bool bOk ;
double dCurrLen ;
double dSegLen ;
double dUIni ;
double dUFin ;
// la curva deve essere validata
if ( m_nStatus != OK)
@@ -980,9 +973,11 @@ CurveBezier::GetParamAtLength( double dLen, double& dU) const
}
// approfondisco nell'intervallo di interesse
dCurrLen = 0 ;
dUIni = 0 ;
dUFin = 1 ;
bool bOk ;
double dSegLen ;
double dCurrLen = 0 ;
double dUIni = 0 ;
double dUFin = 1 ;
while ( ( bOk = GetSegmentParam( dLen, dCurrLen, dSegLen, dUIni, dUFin)) && dSegLen > MAX_SEG_LEN)
;
// aggiustamento finale parametro
@@ -1110,22 +1105,20 @@ CurveBezier::ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) c
bool
CurveBezier::Invert( void)
{
int i ;
int nMid ;
Point3d ptTemp ;
// la curva deve essere validata
// la curva deve essere valida
if ( m_nStatus != OK)
return false ;
// inverto i punti di controllo
nMid = ( m_nDeg + 1) / 2 ;
for ( i = 0 ; i < nMid ; ++ i) {
ptTemp = m_aPtCtrl[i] ;
int nMid = ( m_nDeg + 1) / 2 ;
for ( int i = 0 ; i < nMid ; ++ i) {
Point3d ptTemp = m_aPtCtrl[i] ;
m_aPtCtrl[i] = m_aPtCtrl[m_nDeg-i] ;
m_aPtCtrl[m_nDeg-i] = ptTemp ;
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1134,11 +1127,7 @@ CurveBezier::Invert( void)
bool
CurveBezier::TrimStartAtParam( double dUTrim)
{
int i ;
int k ;
// la curva deve essere validata
// la curva deve essere valida
if ( m_nStatus != OK)
return false ;
@@ -1149,8 +1138,8 @@ CurveBezier::TrimStartAtParam( double dUTrim)
if ( dUTrim >= 1)
return false ;
// eseguo il trim (algoritmo di de Casteljau)
for ( k = 1 ; k <= m_nDeg ; k ++) {
for ( i = 0 ; i <= m_nDeg - k ; i ++) {
for ( int k = 1 ; k <= m_nDeg ; k ++) {
for ( int i = 0 ; i <= m_nDeg - k ; i ++) {
if ( ! m_bRat) {
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i] + dUTrim * m_aPtCtrl[i+1] ;
}
@@ -1162,6 +1151,9 @@ CurveBezier::TrimStartAtParam( double dUTrim)
}
}
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -1169,11 +1161,7 @@ CurveBezier::TrimStartAtParam( double dUTrim)
bool
CurveBezier::TrimEndAtParam( double dUTrim)
{
int i ;
int k ;
// la curva deve essere validata
// la curva deve essere valida
if ( m_nStatus != OK)
return false ;
@@ -1184,8 +1172,8 @@ CurveBezier::TrimEndAtParam( double dUTrim)
if ( dUTrim >= 1)
return true ;
// eseguo il trim (algoritmo di de Casteljau)
for ( k = 1 ; k <= m_nDeg ; k ++) {
for ( i = m_nDeg ; i >= k ; i --) {
for ( int k = 1 ; k <= m_nDeg ; k ++) {
for ( int i = m_nDeg ; i >= k ; i --) {
if ( ! m_bRat) {
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i-1] + dUTrim * m_aPtCtrl[ i] ;
}
@@ -1197,6 +1185,9 @@ CurveBezier::TrimEndAtParam( double dUTrim)
}
}
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -1204,13 +1195,11 @@ CurveBezier::TrimEndAtParam( double dUTrim)
bool
CurveBezier::TrimStartAtLen( double dLenTrim)
{
double dUTrim ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// converto le lunghezze in valori parametrici
double dUTrim ;
if ( ! GetParamAtLength( dLenTrim, dUTrim))
return false ;
@@ -1222,13 +1211,11 @@ CurveBezier::TrimStartAtLen( double dLenTrim)
bool
CurveBezier::TrimEndAtLen( double dLenTrim)
{
double dUTrim ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// converto le lunghezze in valori parametrici
double dUTrim ;
if ( ! GetParamAtLength( dLenTrim, dUTrim))
return false ;
@@ -1240,17 +1227,17 @@ CurveBezier::TrimEndAtLen( double dLenTrim)
bool
CurveBezier::Translate( const Vector3d& vtMove)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// traslo i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].Translate( vtMove) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1258,9 +1245,6 @@ CurveBezier::Translate( const Vector3d& vtMove)
bool
CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -1270,9 +1254,12 @@ CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng,
return false ;
// ruoto i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1280,9 +1267,6 @@ CurveBezier::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng,
bool
CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -1292,9 +1276,12 @@ CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
return false ;
// scalo i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1302,9 +1289,6 @@ CurveBezier::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double
bool
CurveBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -1314,9 +1298,12 @@ CurveBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
return false ;
// specchio i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].Mirror( ptOn, vtNorm) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1324,9 +1311,6 @@ CurveBezier::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
bool
CurveBezier::ToGlob( const Frame3d& frRef)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -1336,9 +1320,12 @@ CurveBezier::ToGlob( const Frame3d& frRef)
return false ;
// trasformo i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].ToGlob( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -1346,9 +1333,6 @@ CurveBezier::ToGlob( const Frame3d& frRef)
bool
CurveBezier::ToLoc( const Frame3d& frRef)
{
int i ;
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
@@ -1358,8 +1342,11 @@ CurveBezier::ToLoc( const Frame3d& frRef)
return false ;
// trasformo i punti di controllo
for ( i = 0 ; i <= m_nDeg ; ++ i)
for ( int i = 0 ; i <= m_nDeg ; ++ i)
m_aPtCtrl[i].ToLoc( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
+65 -46
View File
@@ -56,6 +56,9 @@ CurveComposite::Clear( void)
m_nCounter = 0 ;
m_bClosed = false ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -100,6 +103,9 @@ CurveComposite::AddCurve( const ICurve& cCrv)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -184,6 +190,9 @@ CurveComposite::FromSplit( const ICurve& cCrv, int nParts)
return false ;
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -212,21 +221,16 @@ CurveComposite::GetKey( void) const
bool
CurveComposite::Save( ostream& osOut) const
{
int i ;
string sCrvName ;
const ICurve* pCrvSmpl ;
// numero di curve
osOut << ToString( m_nCounter) << endl ;
// ciclo sulle curve componenti
i = 0 ;
pCrvSmpl = GetFirstCurve() ;
int i = 0 ;
const ICurve* pCrvSmpl = GetFirstCurve() ;
while ( pCrvSmpl != nullptr) {
// emetto tipo della curva semplice
osOut << pCrvSmpl->GetKey() << endl ;
// assegno ed emetto nome della curva semplice
sCrvName = "#" + ToString( ++i) ;
string sCrvName = "#" + ToString( ++i) ;
osOut << sCrvName << endl ;
// salvataggio della curva semplice
if ( ! pCrvSmpl->Save( osOut))
@@ -242,43 +246,38 @@ CurveComposite::Save( ostream& osOut) const
bool
CurveComposite::Load( Scanner& TheScanner)
{
int nType ;
string sLine ;
STRVECTOR vsParams ;
bool bOk ;
int i ;
int nCounter ;
IGeoObj* pGeoO ;
ICurve* pCrv ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ",", vsParams) ;
// 1 parametro : numero di curve componenti
if ( vsParams.size() != 1)
return false ;
// recupero il numero di curve componenti
int nCounter ;
if ( ! FromString( vsParams[0], nCounter))
return false ;
// leggo le curve componenti
for ( i = 0 ; i < nCounter ; ++ i) {
for ( int i = 0 ; i < nCounter ; ++ i) {
// recupero la prossima linea (con il tipo di oggetto)
if ( ! TheScanner.GetLine( sLine))
return false ;
// creo l'oggetto
nType = GEOOBJ_KEYTOTYPE( sLine) ;
pGeoO = GEOOBJ_CREATE( nType) ;
int nType = GEOOBJ_KEYTOTYPE( sLine) ;
IGeoObj* pGeoO = GEOOBJ_CREATE( nType) ;
if ( pGeoO == nullptr)
return false ;
// recupero la linea con il nome
bOk = TheScanner.GetLine( sLine) ;
bool bOk = TheScanner.GetLine( sLine) ;
// ne leggo i dati
bOk = bOk && pGeoO->Load( TheScanner) ;
// verifico sia una curva
pCrv = ::GetCurve( pGeoO) ;
ICurve* pCrv = ::GetCurve( pGeoO) ;
bOk = bOk && ( pCrv != nullptr && pCrv->IsSimple()) ;
// aggiungo questa curva (sicuramente semplice)
bOk = bOk && AddSimpleCurve( pCrv) ;
@@ -341,8 +340,6 @@ CurveComposite::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
pCrvSmpl = GetNextCurve() ;
}
return true ;
return true ;
}
//----------------------------------------------------------------------------
@@ -518,10 +515,8 @@ CurveComposite::ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL
bool
CurveComposite::Invert( void)
{
PCRVSMPL_LIST::iterator Iter ;
// inverto le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->Invert() ;
@@ -530,6 +525,9 @@ CurveComposite::Invert( void)
// scambio punti iniziale e finale
swap( m_PtStart, m_PtEnd) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -582,6 +580,9 @@ CurveComposite::TrimStartAtParam( double dUTrim)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -643,6 +644,9 @@ CurveComposite::TrimEndAtParam( double dUTrim)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -694,6 +698,9 @@ CurveComposite::TrimStartAtLen( double dLenTrim)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -759,6 +766,9 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -766,10 +776,8 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
bool
CurveComposite::Translate( const Vector3d& vtMove)
{
PCRVSMPL_LIST::iterator Iter ;
// traslo le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->Translate( vtMove) ;
@@ -777,6 +785,9 @@ CurveComposite::Translate( const Vector3d& vtMove)
m_PtStart.Translate( vtMove) ;
m_PtEnd.Translate( vtMove) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -784,14 +795,12 @@ CurveComposite::Translate( const Vector3d& vtMove)
bool
CurveComposite::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{
PCRVSMPL_LIST::iterator Iter ;
// verifico validità dell'asse di rotazione
if ( vtAx.IsSmall())
return false ;
// ruoto le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
@@ -799,6 +808,9 @@ CurveComposite::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAn
m_PtStart.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
m_PtEnd.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -806,9 +818,6 @@ CurveComposite::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAn
bool
CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{
PCRVSMPL_LIST::iterator Iter ;
// verifico non sia nulla
if ( fabs( dCoeffX) < EPS_ZERO && fabs( dCoeffY) < EPS_ZERO && fabs( dCoeffZ) < EPS_ZERO)
return false ;
@@ -820,6 +829,7 @@ CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, dou
}
// scalo le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter) {
// eseguo la scalatura
if ( ! (*Iter)->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ))
@@ -830,6 +840,9 @@ CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, dou
m_PtStart.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
m_PtEnd.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -837,14 +850,12 @@ CurveComposite::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, dou
bool
CurveComposite::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{
PCRVSMPL_LIST::iterator Iter ;
// verifico validità del piano di specchiatura
if ( vtNorm.IsSmall())
return false ;
// specchio le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->Mirror( ptOn, vtNorm) ;
@@ -852,6 +863,9 @@ CurveComposite::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
m_PtStart.Mirror( ptOn, vtNorm) ;
m_PtEnd.Mirror( ptOn, vtNorm) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -859,14 +873,12 @@ CurveComposite::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
bool
CurveComposite::ToGlob( const Frame3d& frRef)
{
PCRVSMPL_LIST::iterator Iter ;
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
return false ;
// trasformo le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->ToGlob( frRef) ;
@@ -874,6 +886,9 @@ CurveComposite::ToGlob( const Frame3d& frRef)
m_PtStart.ToGlob( frRef) ;
m_PtEnd.ToGlob( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -881,14 +896,12 @@ CurveComposite::ToGlob( const Frame3d& frRef)
bool
CurveComposite::ToLoc( const Frame3d& frRef)
{
PCRVSMPL_LIST::iterator Iter ;
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
return false ;
// trasformo le singole curve
PCRVSMPL_LIST::iterator Iter ;
for ( Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++Iter)
(*Iter)->ToLoc( frRef) ;
@@ -896,6 +909,9 @@ CurveComposite::ToLoc( const Frame3d& frRef)
m_PtStart.ToLoc( frRef) ;
m_PtEnd.ToLoc( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -993,5 +1009,8 @@ CurveComposite::ArcsToBezierCurves( void)
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
+37 -18
View File
@@ -38,10 +38,14 @@ CurveLine::~CurveLine( void)
bool
CurveLine::Set( const Point3d& ptStart, const Point3d& ptEnd)
{
// assegno i dati
m_PtStart = ptStart ;
m_PtEnd = ptEnd ;
m_nStatus = TO_VERIFY ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -81,14 +85,14 @@ CurveLine::Save( ostream& osOut) const
bool
CurveLine::Load( Scanner& TheScanner)
{
string sLine ;
STRVECTOR vsParams ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ";", vsParams) ;
// 2 parametri : punto iniziale e punto finale
if ( vsParams.size() != 2)
@@ -241,6 +245,9 @@ CurveLine::Invert( void)
// inverto i punti estremi
swap( m_PtStart, m_PtEnd) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -249,13 +256,11 @@ CurveLine::Invert( void)
bool
CurveLine::TrimStartAtParam( double dUTrim)
{
double dLen ;
// riporto i parametri nel loro range
dUTrim = ( ( dUTrim < 0) ? 0 : (( dUTrim > 1) ? 1 : dUTrim)) ;
// recupero lunghezza
double dLen ;
if ( ! GetLength( dLen))
return false ;
@@ -267,13 +272,11 @@ CurveLine::TrimStartAtParam( double dUTrim)
bool
CurveLine::TrimEndAtParam( double dUTrim)
{
double dLen ;
// riporto i parametri nel loro range
dUTrim = ( ( dUTrim < 0) ? 0 : (( dUTrim > 1) ? 1 : dUTrim)) ;
// recupero lunghezza
double dLen ;
if ( ! GetLength( dLen))
return false ;
@@ -285,13 +288,11 @@ CurveLine::TrimEndAtParam( double dUTrim)
bool
CurveLine::TrimStartAtLen( double dLenTrim)
{
double dLen ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// verifico che sia abbastanza lunga
double dLen ;
if ( ! GetLength( dLen))
return false ;
if ( ( dLen - dLenTrim) < EPS_SMALL)
@@ -301,7 +302,8 @@ CurveLine::TrimStartAtLen( double dLenTrim)
if ( dLenTrim > EPS_ZERO)
m_PtStart = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
// con i controlli sopra fatti rimane validata
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -310,13 +312,11 @@ CurveLine::TrimStartAtLen( double dLenTrim)
bool
CurveLine::TrimEndAtLen( double dLenTrim)
{
double dLen ;
// lunghezze negative vengono considerate nulle
dLenTrim = __max( dLenTrim, 0) ;
// verifico che sia abbastanza lunga
double dLen ;
if ( ! GetLength( dLen))
return false ;
if ( dLenTrim < EPS_SMALL)
@@ -326,7 +326,8 @@ CurveLine::TrimEndAtLen( double dLenTrim)
if ( ( dLen - dLenTrim) > EPS_ZERO)
m_PtEnd = Media( m_PtStart, m_PtEnd, ( dLenTrim / dLen)) ;
// con i controlli sopra fatti rimane validata
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
m_OGrMgr.Reset() ;
return true ;
}
@@ -339,6 +340,9 @@ CurveLine::Translate( const Vector3d& vtMove)
m_PtStart.Translate( vtMove) ;
m_PtEnd.Translate( vtMove) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -354,6 +358,9 @@ CurveLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, do
m_PtStart.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
m_PtEnd.Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -370,6 +377,9 @@ CurveLine::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double d
m_PtEnd.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
m_nStatus = TO_VERIFY ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return Validate() ;
}
@@ -385,6 +395,9 @@ CurveLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
m_PtStart.Mirror( ptOn, vtNorm) ;
m_PtEnd.Mirror( ptOn, vtNorm) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -400,6 +413,9 @@ CurveLine::ToGlob( const Frame3d& frRef)
m_PtStart.ToGlob( frRef) ;
m_PtEnd.ToGlob( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -415,5 +431,8 @@ CurveLine::ToLoc( const Frame3d& frRef)
m_PtStart.ToLoc( frRef) ;
m_PtEnd.ToLoc( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
+2 -1
View File
@@ -48,7 +48,8 @@ class CurveLine : public ICurveLine
{ return m_OGrMgr.GetObjGraphics() ; }
public : // ICurve
virtual bool IsSimple( void) const { return true ; }
virtual bool IsSimple( void) const
{ return true ; }
virtual bool IsClosed( void) const
{ return ::IsClosed( *this) ; }
virtual bool GetStartPoint( Point3d& ptStart) const ;
+15 -8
View File
@@ -39,6 +39,9 @@ bool
GeoFrame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirX,
const Vector3d& vtDirY, const Vector3d& vtDirZ)
{
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// assegno i dati
return m_frF.Set( ptOrig, vtDirX, vtDirY, vtDirZ) ;
}
@@ -46,8 +49,12 @@ GeoFrame3d::Set( const Point3d& ptOrig, const Vector3d& vtDirX,
bool
GeoFrame3d::Set( const Frame3d& frF)
{
// assegno i dati
m_frF = frF ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -93,32 +100,32 @@ GeoFrame3d::Save( ostream& osOut) const
bool
GeoFrame3d::Load( Scanner& TheScanner)
{
Point3d ptOrig ;
Vector3d vtDirX ;
Vector3d vtDirY ;
Vector3d vtDirZ ;
string sLine ;
STRVECTOR vsParams ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// la divido in parametri
STRVECTOR vsParams ;
Tokenize( sLine, ";", vsParams) ;
// 4 parametri : origine, versore X, versore Y, versore Z
if ( vsParams.size() != 4)
return false ;
// recupero l'origine
Point3d ptOrig ;
if ( ! FromString( vsParams[0], ptOrig))
return false ;
// recupero il versore X
Vector3d vtDirX ;
if ( ! FromString( vsParams[1], vtDirX))
return false ;
// recupero il versore Y
Vector3d vtDirY ;
if ( ! FromString( vsParams[2], vtDirY))
return false ;
// recupero il versore Z
Vector3d vtDirZ ;
if ( ! FromString( vsParams[3], vtDirZ))
return false ;
// imposto il riferimento
+9 -7
View File
@@ -23,9 +23,11 @@ class GeoFrame3d : public IGeoFrame3d
public : // IGeoObj
virtual ~GeoFrame3d( void) ;
virtual GeoFrame3d* Clone( void) const ;
virtual GeoObjType GetType( void) const { return GEO_FRAME3D ; }
virtual GeoObjType GetType( void) const
{ return GEO_FRAME3D ; }
virtual const std::string& GetKey( void) const ;
virtual bool IsValid( void) const { return ( m_frF.GetType() != Frame3d::ERR) ; }
virtual bool IsValid( void) const
{ return ( m_frF.GetType() != Frame3d::ERR) ; }
virtual bool Save( std::ostream& osOut) const ;
virtual bool Load( Scanner& TheScanner) ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
@@ -33,9 +35,9 @@ class GeoFrame3d : public IGeoFrame3d
virtual bool GetFrame( Frame3d& frF) const
{ frF = m_frF ; return true ;}
virtual bool Translate( const Vector3d& vtMove)
{ m_frF.Translate( vtMove) ; return true ; }
{ m_OGrMgr.Reset() ; m_frF.Translate( vtMove) ; return true ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{ return m_frF.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; }
{ m_OGrMgr.Reset() ; return m_frF.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad)
{ return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
@@ -43,9 +45,9 @@ class GeoFrame3d : public IGeoFrame3d
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{ return false ; }
virtual bool ToGlob( const Frame3d& frRef)
{ return m_frF.ToGlob( frRef) ;}
{ m_OGrMgr.Reset() ; return m_frF.ToGlob( frRef) ;}
virtual bool ToLoc( const Frame3d& frRef)
{ return m_frF.ToLoc( frRef) ;}
{ m_OGrMgr.Reset() ; return m_frF.ToLoc( frRef) ;}
virtual void SetObjGraphics( IObjGraphics* pOGr)
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
virtual IObjGraphics* GetObjGraphics( void)
@@ -64,7 +66,7 @@ class GeoFrame3d : public IGeoFrame3d
GeoFrame3d( void) ;
inline const GeoFrame3d& operator =( const GeoFrame3d& gvSrc)
{ if ( &gvSrc != this)
m_frF = gvSrc.m_frF ;
Set( gvSrc.m_frF) ;
return *this ; }
public :
+7 -3
View File
@@ -38,8 +38,12 @@ GeoPoint3d::~GeoPoint3d( void)
bool
GeoPoint3d::Set( const Point3d& ptP)
{
// assegno i dati
m_ptP = ptP ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -79,10 +83,10 @@ GeoPoint3d::Save( ostream& osOut) const
bool
GeoPoint3d::Load( Scanner& TheScanner)
{
string sLine ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// 1 solo parametro : il punto
+11 -9
View File
@@ -23,9 +23,11 @@ class GeoPoint3d : public IGeoPoint3d
public :
virtual ~GeoPoint3d( void) ;
virtual GeoPoint3d* Clone( void) const ;
virtual GeoObjType GetType( void) const { return GEO_PNT3D ; }
virtual GeoObjType GetType( void) const
{ return GEO_PNT3D ; }
virtual const std::string& GetKey( void) const ;
virtual bool IsValid( void) const { return true ; }
virtual bool IsValid( void) const
{ return true ; }
virtual bool Save( std::ostream& osOut) const ;
virtual bool Load( Scanner& TheScanner) ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
@@ -33,19 +35,19 @@ class GeoPoint3d : public IGeoPoint3d
virtual bool GetPoint( Point3d& ptP) const
{ ptP = m_ptP ; return true ;}
virtual bool Translate( const Vector3d& vtMove)
{ m_ptP.Translate( vtMove) ; return true ; }
{ m_OGrMgr.Reset() ; m_ptP.Translate( vtMove) ; return true ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{ return m_ptP.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; }
{ m_OGrMgr.Reset() ; return m_ptP.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad)
{ return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{ return m_ptP.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;}
{ m_OGrMgr.Reset() ; return m_ptP.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;}
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{ return m_ptP.Mirror( ptOn, vtNorm) ;}
{ m_OGrMgr.Reset() ; return m_ptP.Mirror( ptOn, vtNorm) ;}
virtual bool ToGlob( const Frame3d& frRef)
{ return m_ptP.ToGlob( frRef) ;}
{ m_OGrMgr.Reset() ; return m_ptP.ToGlob( frRef) ;}
virtual bool ToLoc( const Frame3d& frRef)
{ return m_ptP.ToLoc( frRef) ;}
{ m_OGrMgr.Reset() ; return m_ptP.ToLoc( frRef) ;}
virtual void SetObjGraphics( IObjGraphics* pOGr)
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
virtual IObjGraphics* GetObjGraphics( void)
@@ -62,7 +64,7 @@ class GeoPoint3d : public IGeoPoint3d
GeoPoint3d( void) ;
const GeoPoint3d& operator =( const GeoPoint3d& gpSrc)
{ if ( &gpSrc != this)
m_ptP = gpSrc.m_ptP ;
Set( gpSrc.m_ptP) ;
return *this ; }
public :
+7 -3
View File
@@ -38,8 +38,12 @@ GeoVector3d::~GeoVector3d( void)
bool
GeoVector3d::Set( const Vector3d& vtV)
{
// assegno i dati
m_vtV = vtV ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
@@ -78,10 +82,10 @@ GeoVector3d::Save( ostream& osOut) const
bool
GeoVector3d::Load( Scanner& TheScanner)
{
string sLine ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
// leggo la prossima linea
string sLine ;
if ( ! TheScanner.GetLine( sLine))
return false ;
// 1 solo parametro : il vettore
+10 -8
View File
@@ -23,9 +23,11 @@ class GeoVector3d : public IGeoVector3d
public :
virtual ~GeoVector3d( void) ;
virtual GeoVector3d* Clone( void) const ;
virtual GeoObjType GetType( void) const { return GEO_VECT3D ; }
virtual GeoObjType GetType( void) const
{ return GEO_VECT3D ; }
virtual const std::string& GetKey( void) const ;
virtual bool IsValid( void) const { return true ; }
virtual bool IsValid( void) const
{ return true ; }
virtual bool Save( std::ostream& osOut) const ;
virtual bool Load( Scanner& TheScanner) ;
virtual bool GetLocalBBox( BBox3d& b3Loc) const ;
@@ -35,17 +37,17 @@ class GeoVector3d : public IGeoVector3d
virtual bool Translate( const Vector3d& vtMove)
{ return true ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
{ return m_vtV.Rotate( vtAx, dCosAng, dSinAng) ; }
{ m_OGrMgr.Reset() ; return m_vtV.Rotate( vtAx, dCosAng, dSinAng) ; }
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad)
{ return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
{ return m_vtV.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;}
{ m_OGrMgr.Reset() ; return m_vtV.Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;}
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
{ return m_vtV.Mirror( vtNorm) ;}
{ m_OGrMgr.Reset() ; return m_vtV.Mirror( vtNorm) ;}
virtual bool ToGlob( const Frame3d& frRef)
{ return m_vtV.ToGlob( frRef) ;}
{ m_OGrMgr.Reset() ; return m_vtV.ToGlob( frRef) ;}
virtual bool ToLoc( const Frame3d& frRef)
{ return m_vtV.ToLoc( frRef) ;}
{ m_OGrMgr.Reset() ; return m_vtV.ToLoc( frRef) ;}
virtual void SetObjGraphics( IObjGraphics* pOGr)
{ m_OGrMgr.SetObjGraphics( pOGr) ; }
virtual IObjGraphics* GetObjGraphics( void)
@@ -62,7 +64,7 @@ class GeoVector3d : public IGeoVector3d
GeoVector3d( void) ;
inline const GeoVector3d& operator =( const GeoVector3d& gvSrc)
{ if ( &gvSrc != this)
m_vtV = gvSrc.m_vtV ;
Set( gvSrc.m_vtV) ;
return *this ; }
public :
+2 -2
View File
@@ -33,9 +33,9 @@ class ObjGraphicsMgr
{ return m_pOGr ; }
const IObjGraphics* GetObjGraphics( void) const
{ return m_pOGr ; }
void Invalidate( void)
void Reset( void)
{ if ( m_pOGr != nullptr)
m_pOGr->Invalidate() ; }
m_pOGr->Reset() ; }
private :
IObjGraphics* m_pOGr ;
+2 -1
View File
@@ -75,7 +75,8 @@ bool
PolyLine::Splice( PolyLine& PL)
{
m_lUPoints.splice( m_lUPoints.end(), PL.m_lUPoints) ;
m_nCount += PL.GetPointNbr() ;
return true ;
}