EgtMachKernel 1.6e7 :
- introdotto uso ObjUser per gruppi di macchina - prima versione prototipo delle forature - migliorie al calolo angoli e posizioni macchina.
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// 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/EGkObjUserFactory.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
OBJUSER_REGISTER( "EMkHead", Head) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string&
|
||||
Head::GetClassName( void) const
|
||||
{
|
||||
return OBJUSER_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_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, 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)
|
||||
{
|
||||
m_nOwnerId = nId ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Head::GetOwner( void) const
|
||||
{
|
||||
return m_nOwnerId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
Head::Head( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_nType( MCH_HT_NONE)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Head::Set( const string& sName, int nType, const string& sHSet, const Vector3d& vtADir)
|
||||
{
|
||||
m_sName = sName ;
|
||||
m_nType = nType ;
|
||||
m_vsHSet.clear() ;
|
||||
m_vsHSet.push_back( sHSet) ;
|
||||
m_vtADir = vtADir ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user