Files
EgtInterface/API_GdbObjAttribs.cpp
T
Dario Sassi 875656bbed EgtInterface 2.6j1 :
- aggiunta interfaccia per EgtSurfTmSetFaceColor
- modificata interfaccia per EgtSetMark.
2024-10-01 15:23:28 +02:00

497 lines
15 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : API_GdbObjAttribs.cpp Data : 03.09.14 Versione : 1.5i1
// Contenuto : Funzioni sugli attributi degli oggetti di GeomDB per API.
//
//
//
// Modifiche : 03.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 EgtSetLevel( int nId, int nLevel)
{
return ( ExeSetLevel( nId, nLevel) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRevertLevel( int nId)
{
return ( ExeRevertLevel( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetLevel( int nId, int* pnLevel)
{
return ( ExeGetLevel( nId, pnLevel) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcLevel( int nId, int* pnLevel)
{
return ( ExeGetCalcLevel( nId, pnLevel) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMode( int nId, int nMode)
{
return ( ExeSetMode( nId, nMode) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRevertMode( int nId)
{
return ( ExeRevertMode( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMode( int nId, int* pnMode)
{
return ( ExeGetMode( nId, pnMode) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcMode( int nId, int* pnMode)
{
return ( ExeGetCalcMode( nId, pnMode) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetStatus( int nId, int nStat)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( ExeSetStatus( vIds, nStat) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRevertStatus( int nId)
{
return ( ExeRevertStatus( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetStatus( int nId, int* pnStat)
{
return ( ExeGetStatus( nId, pnStat) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcStatus( int nId, int* pnStat)
{
return ( ExeGetCalcStatus( nId, pnStat) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMark( int nId, int nMark)
{
return ( ExeSetMark( nId, nMark) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetMark( int nId)
{
return ( ExeResetMark( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetMark( int nId, BOOL* pbMark)
{
return ( ExeGetMark( nId, pbMark) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcMark( int nId, BOOL* pbMark)
{
return ( ExeGetCalcMark( nId, pbMark) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtStdColor( const wchar_t* wsName, int StdCol[4])
{
Color ColStd ;
if ( ExeStdColor( wstrztoA( wsName), ColStd)) {
StdCol[0] = ColStd.GetIntRed() ;
StdCol[1] = ColStd.GetIntGreen() ;
StdCol[2] = ColStd.GetIntBlue() ;
StdCol[3] = ColStd.GetIntAlpha() ;
return TRUE ;
}
return FALSE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetColor( int nId, const int ObjCol[4], BOOL bSetAlpha)
{
// assegno indice entità
INTVECTOR vIds ;
vIds.push_back( nId) ;
// sistemo il colore
Color cCol( ObjCol) ;
// eseguo
return ( ExeSetColor( vIds, cCol, ( bSetAlpha != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetAlpha( int nId, int nAlpha)
{
// assegno indice entità
INTVECTOR vIds ;
vIds.push_back( nId) ;
// eseguo
return ( ExeSetAlpha( vIds, nAlpha) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetColor( int nId)
{
// assegno indice entità
INTVECTOR vIds ;
vIds.push_back( nId) ;
// eseguo
return ( ExeResetColor( vIds) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetColor( int nId, int ObjCol[4])
{
// recupero il colore
Color cCol ;
if ( ExeGetColor( nId, cCol)) {
ObjCol[0] = cCol.GetIntRed() ;
ObjCol[1] = cCol.GetIntGreen() ;
ObjCol[2] = cCol.GetIntBlue() ;
ObjCol[3] = cCol.GetIntAlpha() ;
return TRUE ;
}
else
return FALSE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCalcColor( int nId, int ObjCol[4])
{
// recupero il colore
Color cCol ;
if ( ExeGetCalcColor( nId, cCol)) {
ObjCol[0] = cCol.GetIntRed() ;
ObjCol[1] = cCol.GetIntGreen() ;
ObjCol[2] = cCol.GetIntBlue() ;
ObjCol[3] = cCol.GetIntAlpha() ;
return TRUE ;
}
else
return FALSE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetName( int nId, const wchar_t* wsName)
{
return ( ExeSetName( nId, wstrztoA( wsName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetName( int nId, wchar_t*& wsName)
{
if ( &wsName == nullptr)
return FALSE ;
string sName ;
if ( ! ExeGetName( nId, sName))
return FALSE ;
wsName = _wcsdup( stringtoW( sName)) ;
return (( wsName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtExistsName( int nId)
{
return ( ExeExistsName( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveName( int nId)
{
return ( ExeRemoveName( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfo( int nId, const wchar_t* wsKey, const wchar_t* wsInfo)
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), string( wstrztoA( wsInfo))) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoBool( int nId, const wchar_t* wsKey, BOOL bInfo)
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), ( bInfo != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoInt( int nId, const wchar_t* wsKey, int nInfo)
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), nInfo) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoDouble( int nId, const wchar_t* wsKey, double dInfo)
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), dInfo) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoVector( int nId, const wchar_t* wsKey, const double vtV[3])
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), Vector3d( vtV)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoPoint( int nId, const wchar_t* wsKey, const double ptP[3])
{
return ( ExeSetInfo( nId, wstrztoA( wsKey), Point3d( ptP)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoBBox( int nId, const wchar_t* wsKey, const double ptMin[3], const double ptMax[3])
{
// costruisco il BBox3d
BBox3d b3Box( ptMin, ptMax) ;
// eseguo
return ( ExeSetInfo( nId, wstrztoA( wsKey), b3Box) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetInfoFrame( int nId, const wchar_t* wsKey, const double ptOrig[3],
const double vtX[3], const double vtY[3], const double vtZ[3])
{
// costruisco il riferimento
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vtX, vtY, vtZ))
return FALSE ;
// eseguo
return ( ExeSetInfo( nId, wstrztoA( wsKey), frFrame) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfo( int nId, const wchar_t* wsKey, wchar_t*& wsInfo)
{
string sInfo ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), sInfo))
return FALSE ;
wsInfo = _wcsdup( stringtoW( sInfo)) ;
return (( wsInfo == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoBool( int nId, const wchar_t* wsKey, BOOL* pbInfo)
{
// verifico il parametro
if ( pbInfo == nullptr)
return FALSE ;
// recupero info
bool bInfo ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), bInfo))
return FALSE ;
*pbInfo = ( bInfo ? TRUE : FALSE) ;
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoInt( int nId, const wchar_t* wsKey, int* pnInfo)
{
// verifico il parametro
if ( pnInfo == nullptr)
return FALSE ;
// recupero info
return ( ExeGetInfo( nId, wstrztoA( wsKey), *pnInfo) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoDouble( int nId, const wchar_t* wsKey, double* pdInfo)
{
// verifico il parametro
if ( pdInfo == nullptr)
return FALSE ;
// recupero info
return ( ExeGetInfo( nId, wstrztoA( wsKey), *pdInfo) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoVector( int nId, const wchar_t* wsKey, double vtV[3])
{
// recupero il vettore
Vector3d vtVett ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), vtVett))
return FALSE ;
// assegno il vettore
VEC_FROM_3D( vtV, vtVett)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoPoint( int nId, const wchar_t* wsKey, double ptP[3])
{
// recupero il punto
Point3d ptPoint ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), ptPoint))
return FALSE ;
// assegno il punto
VEC_FROM_3D( ptP, ptPoint)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoBBox( int nId, const wchar_t* wsKey, double ptMin[3], double ptMax[3])
{
// recupero il box
BBox3d b3Box ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), b3Box))
return FALSE ;
// assegno il minimo
VEC_FROM_3D( ptMin, b3Box.GetMin())
// assegno il massimo
VEC_FROM_3D( ptMax, b3Box.GetMax())
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetInfoFrame( int nId, const wchar_t* wsKey, double ptOrig[3],
double vtX[3], double vtY[3], double vtZ[3])
{
// recupero il frame
Frame3d frFrame ;
if ( ! ExeGetInfo( nId, wstrztoA( wsKey), frFrame))
return FALSE ;
// assegno l'origine
VEC_FROM_3D( ptOrig, frFrame.Orig())
// assegno il versore X
VEC_FROM_3D( vtX, frFrame.VersX())
// assegno il versore Y
VEC_FROM_3D( vtY, frFrame.VersY())
// assegno il versore Z
VEC_FROM_3D( vtZ, frFrame.VersZ())
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtExistsInfo( int nId, const wchar_t* wsKey)
{
return ( ExeExistsInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveInfo( int nId, const wchar_t* wsKey)
{
return ( ExeRemoveInfo( nId, wstrztoA( wsKey)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetTextureName( int nId, const wchar_t* wsTxrName)
{
return ( ExeSetTextureName( nId, wstrztoA( wsTxrName)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetTextureFrame( int nId, const double vOrig[3],
const double vX[3], const double vY[3], const double vZ[3], int nRefType)
{
Frame3d frFrame ;
if ( ! frFrame.Set( vOrig, vX, vY, vZ))
return GDB_ID_NULL ;
return ( ExeSetTextureFrame( nId, frFrame, nRefType) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRemoveTextureData( int nId)
{
return ( ExeRemoveTextureData( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTextureName( int nId, wchar_t*& wsTxrName)
{
string sTemp ;
if ( ! ExeGetTextureName( nId, sTemp))
return FALSE ;
wsTxrName = _wcsdup( stringtoW( sTemp)) ;
return (( wsTxrName == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetTextureFrame( int nId, int nRefId, double vOrig[3], double vX[3], double vY[3], double vZ[3])
{
// recupero il frame
Frame3d frFrame ;
if ( ! ExeGetTextureFrame( nId, nRefId, frFrame))
return FALSE ;
// assegno l'origine
VEC_FROM_3D( vOrig, frFrame.Orig())
// assegno il versore X
VEC_FROM_3D( vX, frFrame.VersX())
// assegno il versore Y
VEC_FROM_3D( vY, frFrame.VersY())
// assegno il versore Z
VEC_FROM_3D( vZ, frFrame.VersZ())
return TRUE ;
}