From 1771b5a6ff39c6fbd4b062eb50e99aa258dea68b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 9 Nov 2016 14:07:38 +0000 Subject: [PATCH] EgtMachKernel : - aggiunta gestione flag modificato su parametri di lavorazione. --- MachMgr.h | 8 ++++---- MachMgrOperations.cpp | 28 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/MachMgr.h b/MachMgr.h index 94f101e..2f3dace 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -217,10 +217,10 @@ class MachMgr : public IMachMgr bool SetCurrMachining( int nId) override ; bool ResetCurrMachining( void) override ; int GetCurrMachining( void) const override ; - bool SetMachiningParam( int nType, bool bVal) override ; - bool SetMachiningParam( int nType, int nVal) override ; - bool SetMachiningParam( int nType, double dVal) override ; - bool SetMachiningParam( int nType, const std::string& sVal) override ; + bool SetMachiningParam( int nType, bool bVal, bool* pbChanged = nullptr) override ; + bool SetMachiningParam( int nType, int nVal, bool* pbChanged = nullptr) override ; + bool SetMachiningParam( int nType, double dVal, bool* pbChanged = nullptr) override ; + bool SetMachiningParam( int nType, const std::string& sVal, bool* pbChanged = nullptr) override ; bool SetMachiningGeometry( const SELVECTOR& vIds) override ; bool MachiningPreview( bool bRecalc) override ; bool ExistsMachiningPreview( void) override ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index 4bee034..d1775c3 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -742,7 +742,7 @@ MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool) //---------------------------------------------------------------------------- bool -MachMgr::SetMachiningParam( int nType, bool bVal) +MachMgr::SetMachiningParam( int nType, bool bVal, bool* pbChanged) { // recupero la lavorazione corrente int nCurrMchId = GetCurrMachining() ; @@ -752,13 +752,18 @@ MachMgr::SetMachiningParam( int nType, bool bVal) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // se richiesto, ne recupero il valore corrente, per verificare se modificato + if ( pbChanged != nullptr) { + bool bOldVal ; + *pbChanged = ( pMch->GetParam( nType, bOldVal) && bOldVal != bVal) ; + } // imposto il parametro return pMch->SetParam( nType, bVal) ; } //---------------------------------------------------------------------------- bool -MachMgr::SetMachiningParam( int nType, int nVal) +MachMgr::SetMachiningParam( int nType, int nVal, bool* pbChanged) { // recupero la lavorazione corrente int nCurrMchId = GetCurrMachining() ; @@ -768,13 +773,18 @@ MachMgr::SetMachiningParam( int nType, int nVal) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // ne recupero il valore corrente, per verificare se modificato + if ( pbChanged != nullptr) { + int nOldVal ; + *pbChanged = ( pMch->GetParam( nType, nOldVal) && nOldVal != nVal) ; + } // imposto il parametro return pMch->SetParam( nType, nVal) ; } //---------------------------------------------------------------------------- bool -MachMgr::SetMachiningParam( int nType, double dVal) +MachMgr::SetMachiningParam( int nType, double dVal, bool* pbChanged) { // recupero la lavorazione corrente int nCurrMchId = GetCurrMachining() ; @@ -784,13 +794,18 @@ MachMgr::SetMachiningParam( int nType, double dVal) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // ne recupero il valore corrente, per verificare se modificato + if ( pbChanged != nullptr) { + double dOldVal ; + *pbChanged = ( pMch->GetParam( nType, dOldVal) && abs( dOldVal - dVal) > EPS_SMALL) ; + } // imposto il parametro return pMch->SetParam( nType, dVal) ; } //---------------------------------------------------------------------------- bool -MachMgr::SetMachiningParam( int nType, const string& sVal) +MachMgr::SetMachiningParam( int nType, const string& sVal, bool* pbChanged) { // recupero la lavorazione corrente int nCurrMchId = GetCurrMachining() ; @@ -800,6 +815,11 @@ MachMgr::SetMachiningParam( int nType, const string& sVal) Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( nCurrMchId)) ; if ( pMch == nullptr) return false ; + // ne recupero il valore corrente, per verificare se modificato + if ( pbChanged != nullptr) { + string sOldVal ; + *pbChanged = ( pMch->GetParam( nType, sOldVal) && sOldVal != sVal) ; + } // imposto il parametro return pMch->SetParam( nType, sVal) ; }