2c89d112fa
- aggiunta gestione DB utensili - migliorata simulazione - aggiunta impostazione macchina corrente anche senza macchinata.
126 lines
3.7 KiB
C++
126 lines
3.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : Head.cpp Data : 25.05.15 Versione : 1.6e7
|
|
// Contenuto : Oggetto testa per gruppo testa di macchina.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 25.05.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "Head.h"
|
|
#include "MachConst.h"
|
|
#include "/EgtDev/Include/EGkGdbConst.h"
|
|
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
#include "/EgtDev/Include/EGkUiUnits.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
USEROBJ_REGISTER( "EMkHead", Head) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
Head::GetClassName( void) const
|
|
{
|
|
return USEROBJ_GETNAME( Head) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
Head*
|
|
Head::Clone( void) const
|
|
{
|
|
// alloco oggetto
|
|
Head* pHead = new(nothrow) Head ;
|
|
// eseguo copia dei dati
|
|
if ( pHead != nullptr) {
|
|
try { pHead->m_nOwnerId = GDB_ID_NULL ;
|
|
pHead->m_pGeomDB = nullptr ;
|
|
pHead->m_sName = m_sName ;
|
|
pHead->m_nType = m_nType ;
|
|
pHead->m_vsHSet = m_vsHSet ;
|
|
pHead->m_vtADir = m_vtADir ;
|
|
}
|
|
catch( ...) {
|
|
delete pHead ;
|
|
return nullptr ;
|
|
}
|
|
}
|
|
// ritorno l'oggetto
|
|
return pHead ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::Dump( string& sOut, bool bMM, const char* szNewLine) const
|
|
{
|
|
sOut += GetClassName() + szNewLine ;
|
|
sOut += "Id=" + ToString( m_nOwnerId) + szNewLine ;
|
|
sOut += "Name=" + m_sName + szNewLine ;
|
|
sOut += "Type=" + ToString( m_nType) + szNewLine ;
|
|
sOut += "HSet=" + ToString( m_vsHSet) + szNewLine ;
|
|
sOut += "ADir=" + ToString( m_vtADir) + szNewLine ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::SetOwner( int nId, IGeomDB* pGDB)
|
|
{
|
|
m_nOwnerId = nId ;
|
|
m_pGeomDB = pGDB ;
|
|
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
int
|
|
Head::GetOwner( void) const
|
|
{
|
|
return m_nOwnerId ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
IGeomDB*
|
|
Head::GetGeomDB( void) const
|
|
{
|
|
return m_pGeomDB ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
Head::Head( void)
|
|
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_dRot1W( 1)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::Set( const string& sName, int nType, const string& sHSet, const Vector3d& vtADir, double dRot1W)
|
|
{
|
|
m_sName = sName ;
|
|
m_nType = nType ;
|
|
m_vsHSet.clear() ;
|
|
m_vsHSet.push_back( sHSet) ;
|
|
m_vtADir = vtADir ;
|
|
m_dRot1W = dRot1W ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
Head::AddHeadToHSet( const string& sHead)
|
|
{
|
|
// se già presente non devo fare alcunchè, altrimenti lo aggiungo
|
|
if ( find( m_vsHSet.begin(), m_vsHSet.end(), sHead) != m_vsHSet.end())
|
|
return true ;
|
|
m_vsHSet.emplace_back( sHead) ;
|
|
return true ;
|
|
}
|
|
|