EgtGeomKernel 1.5d3 :
- aggiunte Move, Rot, Mirror e Scale di gruppo espresse nel suo proprio rif.
This commit is contained in:
Binary file not shown.
+72
-28
@@ -1542,18 +1542,29 @@ GdbExecutor::ExecuteTranslate( const std::string& sCmd2, const STRVECTOR& vsPara
|
||||
Vector3d vtVN ;
|
||||
if ( ! GetVectorParam( vsParams[1], vtVN))
|
||||
return false ;
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// recupero flag per locale/globale/gruppo
|
||||
enum { TRA_LOC = 0, TRA_GLOB = 1, TRA_GROUP = 2} ;
|
||||
int nTraType = TRA_LOC ;
|
||||
if ( sCmd2 == "GLOB" || sCmd2 == "G")
|
||||
nTraType = TRA_GLOB ;
|
||||
else if ( sCmd2 == "GROUP" || sCmd2 == "GR")
|
||||
nTraType = TRA_GROUP ;
|
||||
// esecuzione traslazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->TranslateGlob( *Iter, vtVN))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
switch ( nTraType) {
|
||||
case TRA_LOC :
|
||||
if ( ! m_pGDB->Translate( *Iter, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
case TRA_GLOB :
|
||||
if ( ! m_pGDB->TranslateGlob( *Iter, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
case TRA_GROUP :
|
||||
if ( ! m_pGDB->TranslateGroup( *Iter, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1583,18 +1594,29 @@ GdbExecutor::ExecuteRotate( const std::string& sCmd2, const STRVECTOR& vsParams)
|
||||
double dAngDeg ;
|
||||
if ( ! FromString( vsParams[3], dAngDeg))
|
||||
return false ;
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// recupero flag per locale/globale/gruppo
|
||||
enum { ROT_LOC = 0, ROT_GLOB = 1, ROT_GROUP = 2} ;
|
||||
int nRotType = ROT_LOC ;
|
||||
if ( sCmd2 == "GLOB" || sCmd2 == "G")
|
||||
nRotType = ROT_GLOB ;
|
||||
else if ( sCmd2 == "GROUP" || sCmd2 == "GR")
|
||||
nRotType = ROT_GROUP ;
|
||||
// esecuzione rotazioni
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->RotateGlob( *Iter, ptPC, vtVN, dAngDeg))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
switch ( nRotType) {
|
||||
case ROT_LOC :
|
||||
if ( ! m_pGDB->Rotate( *Iter, ptPC, vtVN, dAngDeg))
|
||||
return false ;
|
||||
break ;
|
||||
case ROT_GLOB :
|
||||
if ( ! m_pGDB->RotateGlob( *Iter, ptPC, vtVN, dAngDeg))
|
||||
return false ;
|
||||
break ;
|
||||
case ROT_GROUP :
|
||||
if ( ! m_pGDB->RotateGroup( *Iter, ptPC, vtVN, dAngDeg))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1629,18 +1651,29 @@ GdbExecutor::ExecuteScale( const std::string& sCmd2, const STRVECTOR& vsParams)
|
||||
! FromString( vsParams[3], dCoeffY) ||
|
||||
! FromString( vsParams[4], dCoeffZ))
|
||||
return false ;
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// recupero flag per locale/globale/gruppo
|
||||
enum { SCA_LOC = 0, SCA_GLOB = 1, SCA_GROUP = 2} ;
|
||||
int nScaType = SCA_LOC ;
|
||||
if ( sCmd2 == "GLOB" || sCmd2 == "G")
|
||||
nScaType = SCA_GLOB ;
|
||||
else if ( sCmd2 == "GROUP" || sCmd2 == "GR")
|
||||
nScaType = SCA_GROUP ;
|
||||
// esecuzione scalature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->ScaleGlob( *Iter, frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
switch ( nScaType) {
|
||||
case SCA_LOC :
|
||||
if ( ! m_pGDB->Scale( *Iter, frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
break ;
|
||||
case SCA_GLOB :
|
||||
if ( ! m_pGDB->ScaleGlob( *Iter, frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
break ;
|
||||
case SCA_GROUP :
|
||||
if ( ! m_pGDB->ScaleGroup( *Iter, frRef, dCoeffX, dCoeffY, dCoeffZ))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1666,18 +1699,29 @@ GdbExecutor::ExecuteMirror( const std::string& sCmd2, const STRVECTOR& vsParams)
|
||||
Vector3d vtVN ;
|
||||
if ( ! GetVectorParam( vsParams[2], vtVN))
|
||||
return false ;
|
||||
// recupero flag per globale
|
||||
bool bGlob = ( sCmd2 == "GLOB" || sCmd2 == "G") ;
|
||||
// recupero flag per locale/globale/gruppo
|
||||
enum { MIR_LOC = 0, MIR_GLOB = 1, MIR_GROUP = 2} ;
|
||||
int nMirType = MIR_LOC ;
|
||||
if ( sCmd2 == "GLOB" || sCmd2 == "G")
|
||||
nMirType = MIR_GLOB ;
|
||||
else if ( sCmd2 == "GROUP" || sCmd2 == "GR")
|
||||
nMirType = MIR_GROUP ;
|
||||
// esecuzione specchiature
|
||||
INTVECTOR::iterator Iter ;
|
||||
for ( Iter = vnNames.begin() ; Iter != vnNames.end() ; ++Iter) {
|
||||
if ( bGlob) {
|
||||
if ( ! m_pGDB->MirrorGlob( *Iter, ptPC, vtVN))
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
switch ( nMirType) {
|
||||
case MIR_LOC :
|
||||
if ( ! m_pGDB->Mirror( *Iter, ptPC, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
case MIR_GLOB :
|
||||
if ( ! m_pGDB->MirrorGlob( *Iter, ptPC, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
case MIR_GROUP :
|
||||
if ( ! m_pGDB->MirrorGroup( *Iter, ptPC, vtVN))
|
||||
return false ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ class GdbGroup : public GdbObj
|
||||
{ static std::string s_sKey = "A_GRP" ; return s_sKey ; }
|
||||
|
||||
public :
|
||||
const Frame3d& GetFrame( void) const
|
||||
{ return m_gfrFrame.GetFrame() ; }
|
||||
bool GetGlobFrame( Frame3d& frGlob) const ;
|
||||
|
||||
public :
|
||||
|
||||
+82
@@ -685,6 +685,25 @@ GeomDB::TranslateGlob( int nId, const Vector3d& vtMove)
|
||||
return pGdbObj->Translate( vtMoveLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La traslazione è espressa nel riferimento del gruppo (ovvero il proprio).
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::TranslateGroup( int nId, const Vector3d& vtMove)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
// utilizzo il riferimento proprio
|
||||
// porto il movimento nel riferimento in cui è immerso
|
||||
Vector3d vtMoveLoc = vtMove ;
|
||||
if ( ! vtMoveLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
// eseguo la traslazione
|
||||
return pGdbGroup->Translate( vtMoveLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
@@ -720,6 +739,28 @@ GeomDB::RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double d
|
||||
return pGdbObj->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La rotazione è espressa nel riferimento del gruppo (ovvero il proprio).
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
// utilizzo il riferimento proprio
|
||||
// porto i parametri di rotazione nel riferimento in cui è immerso
|
||||
Point3d ptAxLoc = ptAx ;
|
||||
if ( ! ptAxLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
Vector3d vtAxLoc = vtAx ;
|
||||
if ( ! vtAxLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
// eseguo la rotazione
|
||||
return pGdbGroup->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
@@ -752,6 +793,25 @@ GeomDB::ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY
|
||||
return pGdbObj->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La scalatura è espressa nel riferimento del gruppo (ovvero il proprio).
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::ScaleGroup( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
// utilizzo il riferimento proprio
|
||||
// porto il riferimento di scalatura nel riferimento in cui è immerso
|
||||
Frame3d frRefLoc = frRef ;
|
||||
if ( ! frRefLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
// eseguo la scalatura
|
||||
return pGdbGroup->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
@@ -787,6 +847,28 @@ GeomDB::MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
return pGdbObj->Mirror( ptOnLoc, vtNormLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La specchiatura è espressa nel riferimento del gruppo (ovvero il proprio).
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::MirrorGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
// utilizzo il riferimento proprio
|
||||
// porto i parametri di mirror nel riferimento in cui è immerso
|
||||
Point3d ptOnLoc = ptOn ;
|
||||
if ( ! ptOnLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
Vector3d vtNormLoc = vtNorm ;
|
||||
if ( ! vtNormLoc.ToGlob( pGdbGroup->GetFrame()))
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
return pGdbGroup->Mirror( ptOnLoc, vtNormLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Selection
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -52,18 +52,25 @@ class GeomDB : public IGeomDB
|
||||
virtual bool Erase( int nId) ;
|
||||
virtual bool Translate( int nId, const Vector3d& vtMove) ;
|
||||
virtual bool TranslateGlob( int nId, const Vector3d& vtMove) ;
|
||||
virtual bool TranslateGroup( int nId, const Vector3d& vtMove) ;
|
||||
virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
||||
virtual bool RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
||||
virtual bool RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
||||
virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
||||
{ double dAngRad = dAngDeg * DEGTORAD ;
|
||||
return Rotate( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
||||
virtual bool RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
||||
{ double dAngRad = dAngDeg * DEGTORAD ;
|
||||
return RotateGlob( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
||||
virtual bool RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
||||
{ double dAngRad = dAngDeg * DEGTORAD ;
|
||||
return RotateGroup( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
||||
virtual bool Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
||||
virtual bool ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
||||
virtual bool ScaleGroup( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
||||
virtual bool Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
||||
virtual bool MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
||||
virtual bool MirrorGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
||||
// selection
|
||||
virtual bool SelectObj( int nId) ;
|
||||
virtual bool DeselectObj( int nId) ;
|
||||
|
||||
Reference in New Issue
Block a user