EgtGeomKernel :
- aggiunti due nuovi comandi a TSC per creazione CurveComposte da punti e da punti con bulge.
This commit is contained in:
+119
-8
@@ -1147,6 +1147,12 @@ GdbExecutor::ExecuteCurveCompo( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
// creazione generica
|
||||
if ( sCmd2 == "" || sCmd2 == "MAKE")
|
||||
return CurveCompoMake( vsParams) ;
|
||||
// creazione per congiunzione di punti (segmenti di retta)
|
||||
else if ( sCmd2 == "P" || sCmd2 == "FROMPOINTS")
|
||||
return CurveCompoFromPoints( vsParams) ;
|
||||
// creazione per congiunzione di punti con bulge (segmenti di retta e arco)
|
||||
else if ( sCmd2 == "PB" || sCmd2 == "FROMPOINTBULGES")
|
||||
return CurveCompoFromPointBulges( vsParams) ;
|
||||
// creazione da split di curva semplice
|
||||
else if ( sCmd2 == "S" || sCmd2 == "FROMSPLIT")
|
||||
return CurveCompoFromSplit( vsParams) ;
|
||||
@@ -1229,6 +1235,58 @@ GdbExecutor::CurveCompoMake( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::CurveCompoFromPoints( const STRVECTOR& vsParams)
|
||||
{
|
||||
// 3 parametri : Id, ParentId, Points
|
||||
if ( vsParams.size() != 3)
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
||||
return false ;
|
||||
// recupero i punti
|
||||
PNTVECTOR vPoints ;
|
||||
if ( ! GetPointsParam( vsParams[2], frDest, vPoints))
|
||||
return false ;
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( ! IsValid( pCrvCompo))
|
||||
return false ;
|
||||
// inserisco i segmenti che uniscono i punti
|
||||
if ( ! pCrvCompo->FromPointVector( vPoints))
|
||||
return false ;
|
||||
// inserisco la curva composita nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::CurveCompoFromPointBulges( const STRVECTOR& vsParams)
|
||||
{
|
||||
// 3 parametri : Id, ParentId, PointWs
|
||||
if ( vsParams.size() != 3)
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! m_pGDB->GetGroupGlobFrame( GetIdParam( vsParams[1]), frDest))
|
||||
return false ;
|
||||
// recupero i punti
|
||||
UPNTVECTOR vPointWs ;
|
||||
if ( ! GetPointWsParam( vsParams[2], frDest, vPointWs))
|
||||
return false ;
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( ! IsValid( pCrvCompo))
|
||||
return false ;
|
||||
// inserisco i segmenti che uniscono i punti
|
||||
if ( ! pCrvCompo->FromPointBulgeVector( vPointWs, Z_AX))
|
||||
return false ;
|
||||
// inserisco la curva composita nel DB
|
||||
return AddGeoObj( vsParams[0], vsParams[1], Release( pCrvCompo)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::CurveCompoFromSplit( const STRVECTOR& vsParams)
|
||||
@@ -2082,7 +2140,7 @@ GdbExecutor::GetVectorParam( const string& sParam, const Frame3d& frVect, Vector
|
||||
bool
|
||||
GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d& ptP)
|
||||
{
|
||||
// se insieme di tre coordinate (considerate già nel riferimento frPnt)
|
||||
// se insieme di 2 o 3 coordinate (considerate già nel riferimento frPnt)
|
||||
if ( sParam[0] == '(') {
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
@@ -2090,12 +2148,21 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
// verifico siano 3 parti e le converto
|
||||
if ( vsParams.size() != 3)
|
||||
// se 2 parti, allora Z = 0
|
||||
if ( vsParams.size() == 2) {
|
||||
ptP.z = 0 ;
|
||||
return ( FromString( vsParams[0], ptP.x) &&
|
||||
FromString( vsParams[1], ptP.y)) ;
|
||||
}
|
||||
// se 3 parti
|
||||
else if ( vsParams.size() == 3) {
|
||||
return ( FromString( vsParams[0], ptP.x) &&
|
||||
FromString( vsParams[1], ptP.y) &&
|
||||
FromString( vsParams[2], ptP.z)) ;
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
return ( FromString( vsParams[0], ptP.x) &&
|
||||
FromString( vsParams[1], ptP.y) &&
|
||||
FromString( vsParams[2], ptP.z)) ;
|
||||
}
|
||||
// se altrimenti punto predefinito ORIG (considerato già nel riferimento frPnt)
|
||||
else if ( sParam == "ORIG") {
|
||||
@@ -2212,6 +2279,28 @@ GdbExecutor::GetPointParam( const string& sParam, const Frame3d& frPnt, Point3d&
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::GetPointsParam( const string& sParam, const Frame3d& frPnt, PNTVECTOR& vPoints)
|
||||
{
|
||||
// divido in parti
|
||||
STRVECTOR vsPoints ;
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPoints) ;
|
||||
// converto in punti
|
||||
vPoints.clear() ;
|
||||
vPoints.reserve( vsPoints.size()) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPoints.begin() ; Iter != vsPoints.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
Point3d ptP ;
|
||||
if ( ! GetPointParam( *Iter, frPnt, ptP))
|
||||
return false ;
|
||||
vPoints.push_back( ptP) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d& ptP, double& dW)
|
||||
@@ -2222,10 +2311,10 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
|
||||
|
||||
// divido in parti
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sParam, ",", vsParams) ;
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsParams) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsParams.begin() ; Iter != vsParams.end() ; ++Iter)
|
||||
Trim( (*Iter), " \t\r\n()") ;
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
|
||||
// se 4 parti, sono 3 coordinate e un peso
|
||||
if ( vsParams.size() == 4) {
|
||||
@@ -2247,6 +2336,28 @@ GdbExecutor::GetPointWParam( const string& sParam, const Frame3d& frPnt, Point3d
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::GetPointWsParam( const string& sParam, const Frame3d& frPnt, UPNTVECTOR& vPointWs)
|
||||
{
|
||||
// divido in parti
|
||||
STRVECTOR vsPointWs ;
|
||||
Tokenize( sParam.substr( 1, sParam.length()-2), ",", "(", ")", vsPointWs) ;
|
||||
// converto in punti
|
||||
vPointWs.clear() ;
|
||||
vPointWs.reserve( vsPointWs.size()) ;
|
||||
STRVECTOR::iterator Iter ;
|
||||
for ( Iter = vsPointWs.begin() ; Iter != vsPointWs.end() ; ++Iter) {
|
||||
Trim( (*Iter), " \t\r\n") ;
|
||||
UPOINT ptPW ;
|
||||
if ( ! GetPointWParam( *Iter, frPnt, ptPW.second, ptPW.first))
|
||||
return false ;
|
||||
vPointWs.push_back( ptPW) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbExecutor::GetLengthParam( const string& sParam, double& dLen)
|
||||
|
||||
Reference in New Issue
Block a user