EgtGeomKernel 1.5k1 :
- aggiunta estensione di curve agli estremi di data lunghezza - a selezione oggetto aggiunto flag per farlo solo se già visibile - possibilità di ciclare gli oggetti selezionati a ritroso - a tutti gli oggetti Geo aggiunto il costruttore di copia.
This commit is contained in:
@@ -1299,6 +1299,46 @@ CurveArc::TrimEndAtLen( double dLenTrim)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::ExtendStartByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza di estensione deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// inverto l'arco, lo estendo alla fine o lo reinverto
|
||||
Invert() ;
|
||||
bool bOk = ExtendEndByLen( dLenExt) ;
|
||||
Invert() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::ExtendEndByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// ricavo la lunghezza originale
|
||||
double dLen ;
|
||||
if ( ! GetLength( dLen))
|
||||
return false ;
|
||||
|
||||
// eseguo l'estensione
|
||||
m_dAngCenDeg *= ( dLen + dLenExt) / dLen ;
|
||||
if ( IsFlat() && fabs( m_dAngCenDeg) > ANG_FULL)
|
||||
m_dAngCenDeg = _copysign( ANG_FULL, m_dAngCenDeg) ;
|
||||
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::Translate( const Vector3d& vtMove)
|
||||
|
||||
+6
-1
@@ -105,6 +105,8 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
virtual bool TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) ;
|
||||
virtual bool TrimStartAtLen( double dLenTrim) ;
|
||||
virtual bool TrimEndAtLen( double dLenTrim) ;
|
||||
virtual bool ExtendStartByLen( double dLenExt) ;
|
||||
virtual bool ExtendEndByLen( double dLenExt) ;
|
||||
|
||||
public : // ICurveArc
|
||||
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
||||
@@ -153,7 +155,10 @@ class CurveArc : public ICurveArc, public IGeoObjRW
|
||||
|
||||
public :
|
||||
CurveArc( void) ;
|
||||
const CurveArc& operator =( const CurveArc& caSrc)
|
||||
CurveArc( const CurveArc& caSrc)
|
||||
{ if ( ! CopyFrom( caSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveArc : copy constructor error")}
|
||||
CurveArc& operator =( const CurveArc& caSrc)
|
||||
{ if ( ! CopyFrom( caSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveArc : copy error")
|
||||
return *this ; }
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const double MIN_EXT_WEIGHT = 0.25 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GEOOBJ_REGISTER( CRV_BEZ, NGE_C_BEZ, CurveBezier) ;
|
||||
|
||||
@@ -1681,6 +1684,102 @@ CurveBezier::TrimEndAtLen( double dLenTrim)
|
||||
return TrimEndAtParam( dUTrim) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::ExtendStartByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
// determino la lunghezza originale della curva
|
||||
double dLen ;
|
||||
if ( ! GetLength( dLen))
|
||||
return false ;
|
||||
// stimo il valore del parametro al nuovo punto iniziale
|
||||
double dUTrim = - dLenExt / dLen ;
|
||||
// estrapolo sul parametro con de Casteljau
|
||||
// se polinomiale, va sicuramente bene
|
||||
if ( ! m_bRat) {
|
||||
for ( int k = 1 ; k <= m_nDeg ; k ++) {
|
||||
for ( int i = 0 ; i <= m_nDeg - k ; i ++)
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i] + dUTrim * m_aPtCtrl[i+1] ;
|
||||
}
|
||||
}
|
||||
// se razionale, devo verificare che i pesi non diventino negativi
|
||||
else {
|
||||
Point3d aPtCtrl[MAXDEG+1] ;
|
||||
double aWeCtrl[MAXDEG+1] ;
|
||||
for ( int i = 0 ; i <= m_nDeg ; i ++) {
|
||||
aPtCtrl[i] = m_aPtCtrl[i] ;
|
||||
aWeCtrl[i] = m_aWeCtrl[i] ;
|
||||
}
|
||||
for ( int k = 1 ; k <= m_nDeg ; k ++) {
|
||||
for ( int i = 0 ; i <= m_nDeg - k ; i ++) {
|
||||
aPtCtrl[i] = ( 1 - dUTrim) * aWeCtrl[i] * aPtCtrl[i] + dUTrim * aWeCtrl[i+1] * aPtCtrl[i+1] ;
|
||||
aWeCtrl[i] = ( 1 - dUTrim) * aWeCtrl[i] + dUTrim * aWeCtrl[i+1] ;
|
||||
if ( aWeCtrl[i] < MIN_EXT_WEIGHT)
|
||||
return false ;
|
||||
aPtCtrl[i] = aPtCtrl[i] * ( 1 / aWeCtrl[i]) ;
|
||||
}
|
||||
}
|
||||
for ( int i = 0 ; i <= m_nDeg ; i ++) {
|
||||
m_aPtCtrl[i] = aPtCtrl[i] ;
|
||||
m_aWeCtrl[i] = aWeCtrl[i] ;
|
||||
}
|
||||
}
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::ExtendEndByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
// determino la lunghezza originale della curva
|
||||
double dLen ;
|
||||
if ( ! GetLength( dLen))
|
||||
return false ;
|
||||
// stimo il valore del parametro al nuovo punto finale
|
||||
double dUTrim = 1 + dLenExt / dLen ;
|
||||
// estrapolo sul parametro con de Casteljau
|
||||
// se polinomiale, va sicuramente bene
|
||||
if ( ! m_bRat) {
|
||||
for ( int k = 1 ; k <= m_nDeg ; k ++) {
|
||||
for ( int i = m_nDeg ; i >= k ; i --)
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i-1] + dUTrim * m_aPtCtrl[ i] ;
|
||||
}
|
||||
}
|
||||
// se razionale, devo verificare che i pesi non diventino negativi
|
||||
else {
|
||||
Point3d aPtCtrl[MAXDEG+1] ;
|
||||
double aWeCtrl[MAXDEG+1] ;
|
||||
for ( int i = 0 ; i <= m_nDeg ; i ++) {
|
||||
aPtCtrl[i] = m_aPtCtrl[i] ;
|
||||
aWeCtrl[i] = m_aWeCtrl[i] ;
|
||||
}
|
||||
for ( int k = 1 ; k <= m_nDeg ; k ++) {
|
||||
for ( int i = m_nDeg ; i >= k ; i --) {
|
||||
aPtCtrl[i] = ( 1 - dUTrim) * aWeCtrl[i-1] * aPtCtrl[i-1] + dUTrim * aWeCtrl[ i] * aPtCtrl[ i] ;
|
||||
aWeCtrl[i] = ( 1 - dUTrim) * aWeCtrl[i-1] + dUTrim * aWeCtrl[ i] ;
|
||||
if ( aWeCtrl[i] < MIN_EXT_WEIGHT)
|
||||
return false ;
|
||||
aPtCtrl[i] = aPtCtrl[i] * ( 1 / aWeCtrl[i]) ;
|
||||
}
|
||||
}
|
||||
for ( int i = 0 ; i <= m_nDeg ; i ++) {
|
||||
m_aPtCtrl[i] = aPtCtrl[i] ;
|
||||
m_aWeCtrl[i] = aWeCtrl[i] ;
|
||||
}
|
||||
}
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveBezier::Translate( const Vector3d& vtMove)
|
||||
|
||||
+6
-1
@@ -107,6 +107,8 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
virtual bool TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) ;
|
||||
virtual bool TrimStartAtLen( double dLenTrim) ;
|
||||
virtual bool TrimEndAtLen( double dLenTrim) ;
|
||||
virtual bool ExtendStartByLen( double dLenExt) ;
|
||||
virtual bool ExtendEndByLen( double dLenExt) ;
|
||||
|
||||
public : // ICurveBezier
|
||||
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
||||
@@ -131,7 +133,10 @@ class CurveBezier : public ICurveBezier, public IGeoObjRW
|
||||
|
||||
public :
|
||||
CurveBezier( void) ;
|
||||
const CurveBezier& operator =( const CurveBezier& cbSrc)
|
||||
CurveBezier( const CurveBezier& cbSrc)
|
||||
{ if ( ! CopyFrom( cbSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveBezier : copy constructor error")}
|
||||
CurveBezier& operator =( const CurveBezier& cbSrc)
|
||||
{ if ( ! CopyFrom( cbSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveBezier : copy error")
|
||||
return *this ; }
|
||||
|
||||
+61
-1
@@ -1543,6 +1543,63 @@ CurveComposite::TrimEndAtLen( double dLenTrim)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::ExtendStartByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza di estensione deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// recupero la prima curva ed estendo quella
|
||||
if ( m_CrvSmplS.begin() == m_CrvSmplS.end())
|
||||
return false ;
|
||||
// estendo la prima curva
|
||||
if ( ! (*m_CrvSmplS.begin())->ExtendStartByLen( dLenExt)) {
|
||||
m_nStatus = ERR ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto punto iniziale e verifica curva chiusa
|
||||
(*m_CrvSmplS.begin())->GetStartPoint( m_PtStart) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::ExtendEndByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza di estensione deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// vado sulla fine
|
||||
PCRVSMPL_DEQUE::iterator Iter = m_CrvSmplS.end() ;
|
||||
if ( Iter == m_CrvSmplS.begin())
|
||||
return false ;
|
||||
-- Iter ;
|
||||
// recupero la curva
|
||||
if ( Iter == m_CrvSmplS.end())
|
||||
return false ;
|
||||
// estendo l'ultima curva
|
||||
if ( ! (*Iter)->ExtendEndByLen( dLenExt)) {
|
||||
m_nStatus = ERR ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// imposto punto finale e verifica curva chiusa
|
||||
(*m_CrvSmplS.begin())->GetEndPoint( m_PtEnd) ;
|
||||
m_bClosed = ( AreSamePointApprox( m_PtStart, m_PtEnd)) ;
|
||||
|
||||
// imposto ricalcolo della grafica
|
||||
m_OGrMgr.Reset() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::Translate( const Vector3d& vtMove)
|
||||
@@ -1834,7 +1891,10 @@ CurveComposite::GetPrevCurve( void) const
|
||||
-- m_Iter ;
|
||||
|
||||
// recupero la curva
|
||||
return (*m_Iter) ;
|
||||
if ( m_Iter != m_CrvSmplS.end())
|
||||
return (*m_Iter) ;
|
||||
else
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+6
-1
@@ -106,6 +106,8 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
virtual bool TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) ;
|
||||
virtual bool TrimStartAtLen( double dLenTrim) ;
|
||||
virtual bool TrimEndAtLen( double dLenTrim) ;
|
||||
virtual bool ExtendStartByLen( double dLenExt) ;
|
||||
virtual bool ExtendEndByLen( double dLenExt) ;
|
||||
|
||||
public : // ICurveComposite
|
||||
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
||||
@@ -136,7 +138,10 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW
|
||||
|
||||
public :
|
||||
CurveComposite( void) ;
|
||||
const CurveComposite& operator =( const CurveComposite& ccSrc)
|
||||
CurveComposite( const CurveComposite& ccSrc)
|
||||
{ if ( ! CopyFrom( ccSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveComposite : copy constructor error") }
|
||||
CurveComposite& operator =( const CurveComposite& ccSrc)
|
||||
{ if ( ! CopyFrom( ccSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveComposite : copy error")
|
||||
return *this ; }
|
||||
|
||||
@@ -681,6 +681,50 @@ CurveLine::TrimEndAtLen( double dLenTrim)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveLine::ExtendStartByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// versore della linea
|
||||
Vector3d vtDir ;
|
||||
if ( ! GetStartDir( vtDir))
|
||||
return false ;
|
||||
|
||||
// sposto il punto iniziale
|
||||
m_PtStart -= vtDir * dLenExt ;
|
||||
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveLine::ExtendEndByLen( double dLenExt)
|
||||
{
|
||||
// la lunghezza deve essere positiva
|
||||
if ( dLenExt < - EPS_ZERO)
|
||||
return false ;
|
||||
|
||||
// versore della linea
|
||||
Vector3d vtDir ;
|
||||
if ( ! GetEndDir( vtDir))
|
||||
return false ;
|
||||
|
||||
// sposto il punto finale
|
||||
m_PtEnd += vtDir * dLenExt ;
|
||||
|
||||
// con i controlli sopra fatti rimane validata, ma la grafica va ricalcolata
|
||||
m_OGrMgr.Reset() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveLine::Translate( const Vector3d& vtMove)
|
||||
|
||||
+6
-1
@@ -105,6 +105,8 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
virtual bool TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) ;
|
||||
virtual bool TrimStartAtLen( double dLenTrim) ;
|
||||
virtual bool TrimEndAtLen( double dLenTrim) ;
|
||||
virtual bool ExtendStartByLen( double dLenExt) ;
|
||||
virtual bool ExtendEndByLen( double dLenExt) ;
|
||||
|
||||
public : // ICurveLine
|
||||
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
||||
@@ -124,7 +126,10 @@ class CurveLine : public ICurveLine, public IGeoObjRW
|
||||
|
||||
public :
|
||||
CurveLine( void) ;
|
||||
const CurveLine& operator =( const CurveLine& clSrc)
|
||||
CurveLine( const CurveLine& clSrc)
|
||||
{ if ( ! CopyFrom( clSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy constructor error") }
|
||||
CurveLine& operator =( const CurveLine& clSrc)
|
||||
{ if ( ! CopyFrom( clSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "CurveLine : copy error")
|
||||
return *this ; }
|
||||
|
||||
Binary file not shown.
@@ -104,7 +104,10 @@ class ExtText : public IExtText, public IGeoObjRW
|
||||
|
||||
public :
|
||||
ExtText( void) ;
|
||||
const ExtText& operator =( const ExtText& gpSrc)
|
||||
ExtText( const ExtText& gpSrc)
|
||||
{ if ( ! CopyFrom( gpSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "ExtText : copy constructor error") }
|
||||
ExtText& operator =( const ExtText& gpSrc)
|
||||
{ if ( ! CopyFrom( gpSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "ExtText : copy error")
|
||||
return *this ; }
|
||||
|
||||
+7
-4
@@ -79,10 +79,13 @@ class GeoFrame3d : public IGeoFrame3d, public IGeoObjRW
|
||||
|
||||
public :
|
||||
GeoFrame3d( void) ;
|
||||
inline const GeoFrame3d& operator =( const GeoFrame3d& gfSrc)
|
||||
{ if ( ! CopyFrom( gfSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoFrame3d : copy error")
|
||||
return *this ; }
|
||||
GeoFrame3d( const GeoFrame3d& gfSrc)
|
||||
{ if ( ! CopyFrom( gfSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoFrame3d : copy constructor error") }
|
||||
GeoFrame3d& operator =( const GeoFrame3d& gfSrc)
|
||||
{ if ( ! CopyFrom( gfSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoFrame3d : copy error")
|
||||
return *this ; }
|
||||
|
||||
private :
|
||||
bool CopyFrom( const GeoFrame3d& gfSrc) ;
|
||||
|
||||
+4
-1
@@ -71,7 +71,10 @@ class GeoPoint3d : public IGeoPoint3d, public IGeoObjRW
|
||||
|
||||
public :
|
||||
GeoPoint3d( void) ;
|
||||
const GeoPoint3d& operator =( const GeoPoint3d& gpSrc)
|
||||
GeoPoint3d( const GeoPoint3d& gpSrc)
|
||||
{ if ( ! CopyFrom( gpSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoPoint3d : copy constructor error") }
|
||||
GeoPoint3d& operator =( const GeoPoint3d& gpSrc)
|
||||
{ if ( ! CopyFrom( gpSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoPoint3d : copy error")
|
||||
return *this ; }
|
||||
|
||||
+7
-4
@@ -85,10 +85,13 @@ class GeoVector3d : public IGeoVector3d, public IGeoObjRW
|
||||
|
||||
public :
|
||||
GeoVector3d( void) ;
|
||||
inline const GeoVector3d& operator =( const GeoVector3d& gvSrc)
|
||||
{ if ( ! CopyFrom( gvSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoVector3d : copy error")
|
||||
return *this ; }
|
||||
GeoVector3d( const GeoVector3d& gvSrc)
|
||||
{ if ( ! CopyFrom( gvSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoVector3d : copy constructor error") }
|
||||
GeoVector3d& operator =( const GeoVector3d& gvSrc)
|
||||
{ if ( ! CopyFrom( gvSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "GeoVector3d : copy error")
|
||||
return *this ; }
|
||||
|
||||
private :
|
||||
bool CopyFrom( const GeoVector3d& gvSrc) ;
|
||||
|
||||
+34
-2
@@ -1233,12 +1233,19 @@ GeomDB::ShearGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const
|
||||
// Selection
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SelectObj( int nId)
|
||||
GeomDB::SelectObj( int nId, bool bOnlyIfVisible)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj = GetGdbObj( nId) ;
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
// se richiesta verifica visibilità
|
||||
if ( bOnlyIfVisible) {
|
||||
int nOldStat = GDB_ST_ON ;
|
||||
pGdbObj->GetCalcStatus( nOldStat) ;
|
||||
if ( nOldStat == GDB_ST_OFF)
|
||||
return true ;
|
||||
}
|
||||
|
||||
return SetStatus( pGdbObj, GDB_ST_SEL) ;
|
||||
}
|
||||
@@ -1262,7 +1269,7 @@ GeomDB::DeselectObj( int nId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SelectGroupObjs( int nId, int nFilter)
|
||||
GeomDB::SelectGroupObjs( int nId, int nFilter, bool bOnlyIfVisible)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
@@ -1283,6 +1290,13 @@ GeomDB::SelectGroupObjs( int nId, int nFilter)
|
||||
if ( pGObj == nullptr || pGObj->GetType() != nFilter)
|
||||
continue ;
|
||||
}
|
||||
// se richiesta verifica visibilità
|
||||
if ( bOnlyIfVisible) {
|
||||
int nOldStat = GDB_ST_ON ;
|
||||
pGdbObj->GetCalcStatus( nOldStat) ;
|
||||
if ( nOldStat == GDB_ST_OFF)
|
||||
continue ;
|
||||
}
|
||||
// eseguo selezione
|
||||
if ( ! SetStatus( pGdbObj, GDB_ST_SEL))
|
||||
return false ;
|
||||
@@ -1350,6 +1364,24 @@ GeomDB::GetNextSelectedObj( void) const
|
||||
return (( pGObj == nullptr) ? GDB_ID_NULL : pGObj->m_nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetLastSelectedObj( void) const
|
||||
{
|
||||
GdbObj* pGObj = m_SelManager.GetLastObj() ;
|
||||
|
||||
return (( pGObj == nullptr) ? GDB_ID_NULL : pGObj->m_nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetPrevSelectedObj( void) const
|
||||
{
|
||||
GdbObj* pGObj = m_SelManager.GetPrevObj() ;
|
||||
|
||||
return (( pGObj == nullptr) ? GDB_ID_NULL : pGObj->m_nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::ClearSelection( void)
|
||||
|
||||
@@ -97,14 +97,16 @@ class GeomDB : public IGeomDB
|
||||
virtual bool ShearGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
||||
virtual bool ShearGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
||||
// selection
|
||||
virtual bool SelectObj( int nId) ;
|
||||
virtual bool SelectObj( int nId, bool bOnlyIfVisible = false) ;
|
||||
virtual bool DeselectObj( int nId) ;
|
||||
virtual bool SelectGroupObjs( int nId, int nFilter = 0) ;
|
||||
virtual bool SelectGroupObjs( int nId, int nFilter = 0, bool bOnlyIfVisible = false) ;
|
||||
virtual bool DeselectGroupObjs( int nId) ;
|
||||
virtual bool IsSelectedObj( int nId) const ;
|
||||
virtual int GetSelectedObjNbr( void) const ;
|
||||
virtual int GetFirstSelectedObj( void) const ;
|
||||
virtual int GetNextSelectedObj( void) const ;
|
||||
virtual int GetLastSelectedObj( void) const ;
|
||||
virtual int GetPrevSelectedObj( void) const ;
|
||||
virtual bool ClearSelection( void) ;
|
||||
// attributes
|
||||
virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const ;
|
||||
|
||||
@@ -91,7 +91,7 @@ PolynomialPoint3d::SetToConstant( const Point3d& ptP)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const PolynomialPoint3d&
|
||||
PolynomialPoint3d&
|
||||
PolynomialPoint3d::operator +=( const PolynomialPoint3d& pol3P)
|
||||
{
|
||||
// mi assicuro che il polinomio risultante abbia grado sufficiente
|
||||
@@ -105,7 +105,7 @@ PolynomialPoint3d::operator +=( const PolynomialPoint3d& pol3P)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const PolynomialPoint3d&
|
||||
PolynomialPoint3d&
|
||||
PolynomialPoint3d::operator -=( const PolynomialPoint3d& pol3P)
|
||||
{
|
||||
// mi assicuro che il polinomio risultante abbia grado sufficiente
|
||||
@@ -119,7 +119,7 @@ PolynomialPoint3d::operator -=( const PolynomialPoint3d& pol3P)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const PolynomialPoint3d&
|
||||
PolynomialPoint3d&
|
||||
PolynomialPoint3d::operator *=( const Polynomial& polP)
|
||||
{
|
||||
// copio il polinomio corrente
|
||||
|
||||
+9
-107
@@ -22,15 +22,19 @@ class PolynomialPoint3d
|
||||
{
|
||||
public :
|
||||
PolynomialPoint3d( void) : m_nDegree( -1) {}
|
||||
PolynomialPoint3d( const PolynomialPoint3d& pol3S)
|
||||
{ SetDegree( pol3S.m_nDegree) ;
|
||||
for ( int i = 0 ; i <= m_nDegree ; ++ i)
|
||||
m_Coeff[i] = pol3S.m_Coeff[i] ; }
|
||||
bool SetDegree( int nDegree) ;
|
||||
bool SetCoeff( int nPower, Point3d& ptP) ;
|
||||
bool Set( int nDegree, const PNTVECTOR& vP) ;
|
||||
bool SetToConstant( const Point3d& ptP) ;
|
||||
const PolynomialPoint3d& operator =( const PolynomialPoint3d& pol3S)
|
||||
PolynomialPoint3d& operator =( const PolynomialPoint3d& pol3S)
|
||||
{ if ( &pol3S != this) {
|
||||
SetDegree( pol3S.m_nDegree) ;
|
||||
for ( int i = 0 ; i <= m_nDegree ; ++ i)
|
||||
m_Coeff[i] = pol3S.m_Coeff[i] ;}
|
||||
m_Coeff[i] = pol3S.m_Coeff[i] ; }
|
||||
return *this ; }
|
||||
|
||||
public :
|
||||
@@ -39,9 +43,9 @@ class PolynomialPoint3d
|
||||
{ if ( nPower < 0 || nPower > m_nDegree)
|
||||
return Point3d( 0, 0, 0) ;
|
||||
return m_Coeff[nPower] ; }
|
||||
const PolynomialPoint3d& operator +=( const PolynomialPoint3d& pol3P) ;
|
||||
const PolynomialPoint3d& operator -=( const PolynomialPoint3d& pol3P) ;
|
||||
const PolynomialPoint3d& operator *=( const Polynomial& polP) ;
|
||||
PolynomialPoint3d& operator +=( const PolynomialPoint3d& pol3P) ;
|
||||
PolynomialPoint3d& operator -=( const PolynomialPoint3d& pol3P) ;
|
||||
PolynomialPoint3d& operator *=( const Polynomial& polP) ;
|
||||
void Derive( void) ;
|
||||
void Derive( const PolynomialPoint3d& pol3P) ;
|
||||
void AdjustDegree( void) ;
|
||||
@@ -89,105 +93,3 @@ operator*( const PolynomialPoint3d& pol3P1, const Polynomial& polP2)
|
||||
pol3Mul *= polP2 ;
|
||||
return pol3Mul ;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
PolynomialSumm( PNTVECTOR& vSou1, PNTVECTOR& vSou2, PNTVECTOR& vSumm)
|
||||
{
|
||||
int nDeg1 = vSou1.size() - 1 ;
|
||||
int nDeg2 = vSou2.size() - 1 ;
|
||||
int nMin = (( nDeg1 <= nDeg2) ? nDeg1 : nDeg2) ;
|
||||
int nMax = (( nDeg1 >= nDeg2) ? nDeg1 : nDeg2) ;
|
||||
vSumm.clear() ;
|
||||
vSumm.reserve( nMax + 1) ;
|
||||
for ( int i = 0 ; i < nMin ; ++ i)
|
||||
vSumm.push_back( vSou1[i] + vSou2[i]) ;
|
||||
if ( nDeg1 > nDeg2) {
|
||||
for ( int i = nMin ; i < nDeg1 ; ++ i)
|
||||
vSumm.push_back( vSou1[i]) ;
|
||||
}
|
||||
else if ( nDeg1 < nDeg2) {
|
||||
for ( int i = nMin ; i < nDeg2 ; ++ i)
|
||||
vSumm.push_back( vSou2[i]) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
PolynomialDiff( PNTVECTOR& vSou1, PNTVECTOR& vSou2, PNTVECTOR& vSumm)
|
||||
{
|
||||
int nDeg1 = vSou1.size() - 1 ;
|
||||
int nDeg2 = vSou2.size() - 1 ;
|
||||
int nMin = (( nDeg1 <= nDeg2) ? nDeg1 : nDeg2) ;
|
||||
int nMax = (( nDeg1 >= nDeg2) ? nDeg1 : nDeg2) ;
|
||||
vSumm.clear() ;
|
||||
vSumm.reserve( nMax + 1) ;
|
||||
for ( int i = 0 ; i < nMin ; ++ i)
|
||||
vSumm.push_back( vSou1[i] + ( - vSou2[i])) ;
|
||||
if ( nDeg1 > nDeg2) {
|
||||
for ( int i = nMin ; i < nDeg1 ; ++ i)
|
||||
vSumm.push_back( vSou1[i]) ;
|
||||
}
|
||||
else if ( nDeg1 < nDeg2) {
|
||||
for ( int i = nMin ; i < nDeg2 ; ++ i)
|
||||
vSumm.push_back( Point3d() + ( - vSou2[i])) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
PolynomialMult( PNTVECTOR& vSou1, DBLVECTOR& vSou2, PNTVECTOR& vMult)
|
||||
{
|
||||
int nDeg1 = vSou1.size() - 1 ;
|
||||
int nDeg2 = vSou2.size() - 1 ;
|
||||
int nDim = nDeg1 + nDeg2 + 1 ;
|
||||
vMult.clear() ;
|
||||
vMult.reserve( nDim) ;
|
||||
for ( int i = 0 ; i < nDim ; ++ i)
|
||||
vMult.push_back( Point3d()) ;
|
||||
for ( int i = 0 ; i <= nDeg1 ; ++ i) {
|
||||
for ( int j = 0 ; j <= nDeg2 ; ++ j)
|
||||
vMult[i+j] += vSou1[i] * vSou2[j] ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
PolynomialDerive( PNTVECTOR& vSou, PNTVECTOR& vDer)
|
||||
{
|
||||
int nDeg = vSou.size() - 1 ;
|
||||
vDer.clear() ;
|
||||
vDer.reserve( nDeg) ;
|
||||
for ( int i = 0 ; i < nDeg ; ++ i)
|
||||
vDer.push_back( ( i + 1) * vSou[i+1]) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
PolynomialGetMainCompo( PNTVECTOR& vSou, DBLVECTOR& vCompo)
|
||||
{
|
||||
int nDim = vSou.size() ;
|
||||
vCompo.clear() ;
|
||||
vCompo.reserve( nDim) ;
|
||||
Point3d ptSumm ;
|
||||
for ( int i = 0 ; i < nDim ; ++ i) {
|
||||
ptSumm.x += fabs( vSou[i].x) ;
|
||||
ptSumm.y += fabs( vSou[i].y) ;
|
||||
ptSumm.z += fabs( vSou[i].z) ;
|
||||
}
|
||||
if ( ptSumm.x > ptSumm.y && ptSumm.x > ptSumm.z) {
|
||||
for ( int i = 0 ; i < nDim ; ++ i)
|
||||
vCompo.push_back( vSou[i].x) ;
|
||||
}
|
||||
else if ( ptSumm.y > ptSumm.z) {
|
||||
for ( int i = 0 ; i < nDim ; ++ i)
|
||||
vCompo.push_back( vSou[i].y) ;
|
||||
}
|
||||
else {
|
||||
for ( int i = 0 ; i < nDim ; ++ i)
|
||||
vCompo.push_back( vSou[i].z) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -61,6 +61,21 @@ class SelManager
|
||||
if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
return (*m_Iter) ; }
|
||||
GdbObj* GetLastObj( void) const
|
||||
{ m_Iter = m_SelList.end() ;
|
||||
if ( m_Iter == m_SelList.begin())
|
||||
return nullptr ;
|
||||
-- m_Iter ;
|
||||
if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
return (*m_Iter) ; }
|
||||
GdbObj* GetPrevObj( void) const
|
||||
{ if ( m_Iter == m_SelList.begin())
|
||||
return nullptr ;
|
||||
-- m_Iter ;
|
||||
if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
return (*m_Iter) ; }
|
||||
|
||||
private :
|
||||
PGDBO_LIST m_SelList ;
|
||||
|
||||
+3
-1
@@ -1220,7 +1220,9 @@ SurfTriMesh::CreateByScrewing( const PolyLine& PL, const Point3d& ptAx, const Ve
|
||||
nStep = max( nStep, 1) ;
|
||||
double dCosStepRot = cos( dAngRot / nStep * DEGTORAD) ;
|
||||
double dSinStepRot = sin( dAngRot / nStep * DEGTORAD) ;
|
||||
Vector3d vtStepMove = ( dMove / nStep) * vtAx ;
|
||||
Vector3d vtStepMove = vtAx ;
|
||||
vtStepMove.Normalize() ;
|
||||
vtStepMove *= ( dMove / nStep) ;
|
||||
if ( bFullRev)
|
||||
-- nStep ;
|
||||
|
||||
|
||||
+4
-1
@@ -138,7 +138,10 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
|
||||
public :
|
||||
SurfTriMesh( void) ;
|
||||
const SurfTriMesh& operator =( const SurfTriMesh& stSrc)
|
||||
SurfTriMesh( const SurfTriMesh& stSrc)
|
||||
{ if ( ! CopyFrom( stSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "SurfTriMesh : copy constructor error") }
|
||||
SurfTriMesh& operator =( const SurfTriMesh& stSrc)
|
||||
{ if ( ! CopyFrom( stSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "SurfTriMesh : copy error")
|
||||
return *this ; }
|
||||
|
||||
Reference in New Issue
Block a user