Files
EgtInterface/API_GdbObjects.cpp
T
Dario Sassi 4867bc0d7a EgtInterface 1.6t4 :
- aggiornamento per EgtGetGlobFrame.
2016-08-29 07:57:09 +00:00

315 lines
9.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : API_GdbObjects.cpp Data : 02.09.14 Versione : 1.5i1
// Contenuto : Funzioni iterazione di DB geometrico per API.
//
//
//
// Modifiche : 02.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtExistsObj( int nId)
{
return ( ExeExistsObj( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetParent( int nId)
{
return ExeGetParent( nId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGlobFrame( int nId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
{
// recupero il riferimento globale in cui è immerso l'oggetto
Frame3d frGlob ;
if ( ! ExeGetGlobFrame( nId, frGlob))
return FALSE ;
// aggiorno i parametri del frame
VEC_FROM_3D( ptOrig, frGlob.Orig())
VEC_FROM_3D( vtX, frGlob.VersX())
VEC_FROM_3D( vtY, frGlob.VersY())
VEC_FROM_3D( vtZ, frGlob.VersZ())
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGroupGlobFrame( int nGroupId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
{
// recupero il riferimento globale del gruppo
Frame3d frGlob ;
if ( ! ExeGetGroupGlobFrame( nGroupId, frGlob))
return FALSE ;
// aggiorno i parametri del frame
VEC_FROM_3D( ptOrig, frGlob.Orig())
VEC_FROM_3D( vtX, frGlob.VersX())
VEC_FROM_3D( vtY, frGlob.VersY())
VEC_FROM_3D( vtZ, frGlob.VersZ())
return TRUE ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetGroupObjs( int nGroupId)
{
return ExeGetGroupObjs( nGroupId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstInGroup( int nGroupId)
{
return ExeGetFirstInGroup( nGroupId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNext( int nId)
{
return ExeGetNext( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastInGroup( int nGroupId)
{
return ExeGetLastInGroup( nGroupId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrev( int nId)
{
return ExeGetPrev( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstGroupInGroup( int nGroupId)
{
return ExeGetFirstGroupInGroup( nGroupId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextGroup( int nId)
{
return ExeGetNextGroup( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastGroupInGroup( int nGroupId)
{
return ExeGetLastGroupInGroup( nGroupId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrevGroup( int nId)
{
return ExeGetPrevGroup( nId) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstNameInGroup( int nGroupId, const wchar_t* wsName)
{
return ExeGetFirstNameInGroup( nGroupId, wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextName( int nId, const wchar_t* wsName)
{
return ExeGetNextName( nId, wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetLastNameInGroup( int nGroupId, const wchar_t* wsName)
{
return ExeGetLastNameInGroup( nGroupId, wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetPrevName( int nId, const wchar_t* wsName)
{
return ExeGetPrevName( nId, wstrztoA( wsName)) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetBBox( int nId, int nFlag, double ptMin[3], double ptMax[3])
{
// recupero il bounding box dell'oggetto in locale
BBox3d b3Box ;
if ( ! ExeGetBBox( nId, nFlag, b3Box))
return FALSE ;
ptMin[0] = b3Box.GetMin().x ;
ptMin[1] = b3Box.GetMin().y ;
ptMin[2] = b3Box.GetMin().z ;
ptMax[0] = b3Box.GetMax().x ;
ptMax[1] = b3Box.GetMax().y ;
ptMax[2] = b3Box.GetMax().z ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetBBoxGlob( int nId, int nFlag, double ptMin[3], double ptMax[3])
{
// recupero il bounding box dell'oggetto in globale
BBox3d b3Box ;
if ( ! ExeGetBBoxGlob( nId, nFlag, b3Box))
return FALSE ;
// converto il risultato
ptMin[0] = b3Box.GetMin().x ;
ptMin[1] = b3Box.GetMin().y ;
ptMin[2] = b3Box.GetMin().z ;
ptMax[0] = b3Box.GetMax().x ;
ptMax[1] = b3Box.GetMax().y ;
ptMax[2] = b3Box.GetMax().z ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetBBoxRef( int nId, int nFlag, const double ptOrig[3],
const double vtX[3], const double vtY[3], const double vtZ[3],
double ptMin[3], double ptMax[3])
{
// calcolo il riferimento
Frame3d frRef ;
if ( ! frRef.Set( ptOrig, vtX, vtY, vtZ))
return FALSE ;
// recupero il bounding box dell'oggetto nel riferimento
BBox3d b3Box ;
if ( ! ExeGetBBoxRef( nId, nFlag, frRef, b3Box))
return FALSE ;
// converto il risultato
ptMin[0] = b3Box.GetMin().x ;
ptMin[1] = b3Box.GetMin().y ;
ptMin[2] = b3Box.GetMin().z ;
ptMax[0] = b3Box.GetMax().x ;
ptMax[1] = b3Box.GetMax().y ;
ptMax[2] = b3Box.GetMax().z ;
return TRUE ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtCopy( int nSouId, int nRefId, int nSonBeforeAfter)
{
return ExeCopy( nSouId, nRefId, nSonBeforeAfter) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtCopyGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
return ExeCopyGlob( nSouId, nRefId, nSonBeforeAfter) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRelocate( int nSouId, int nRefId, int nSonBeforeAfter)
{
return ( ExeRelocate( nSouId, nRefId, nSonBeforeAfter) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRelocateGlob( int nSouId, int nRefId, int nSonBeforeAfter)
{
return ( ExeRelocateGlob( nSouId, nRefId, nSonBeforeAfter) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtChangeId( int nId, int nNewId)
{
return ( ExeChangeId( nId, nNewId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtErase( int nId)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( ExeErase( vIds) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtEmptyGroup( int nId)
{
return ( ExeEmptyGroup( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetType( int nId)
{
return ExeGetType( nId) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTitle( int nId, wchar_t*& wsTitle)
{
// recupero la stringa del titolo
string sTitle ;
if ( ! ExeGetTitle( nId, sTitle))
return FALSE ;
// alloco buffer di ritorno ed eseguo copia
wsTitle = _wcsdup( stringtoW( sTitle)) ;
return (( wsTitle == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGroupDump( int nId, wchar_t*& wsDump)
{
// recupero la stringa di dump
string sDump ;
if ( ! ExeGroupDump( nId, sDump))
return FALSE ;
// alloco buffer di ritorno ed eseguo copia
wsDump = _wcsdup( stringtoW( sDump)) ;
return (( wsDump == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGeoObjDump( int nId, wchar_t*& wsDump)
{
// recupero la stringa di dump
string sDump ;
if ( ! ExeGeoObjDump( nId, sDump))
return FALSE ;
// alloco buffer di ritorno ed eseguo copia
wsDump = _wcsdup( stringtoW( sDump)) ;
return (( wsDump == nullptr) ? FALSE : TRUE) ;
}