0e648470ed
- migliorate API per modifica e snap
149 lines
5.5 KiB
C++
149 lines
5.5 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : API_GdbCreate.cpp Data : 30.09.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni di creazione oggetti del DB geometrico per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 30.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "API.h"
|
|
#include "API_Macro.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
|
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
|
#include "/EgtDev/Include/EgkExtText.h"
|
|
#include "/EgtDev/Include/EGnStringConverter.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
|
|
const double vX[3], const double vY[3], const double vZ[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// costruisco il riferimento
|
|
Frame3d frFrame ;
|
|
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
|
|
return GDB_ID_NULL ;
|
|
// creo il gruppo
|
|
return pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrame) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateGeoPoint( int nParentId, const double ptP[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// creo il punto
|
|
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
|
|
if ( IsNull( pGeoPnt))
|
|
return GDB_ID_NULL ;
|
|
// setto il punto
|
|
if ( ! pGeoPnt->Set( ptP))
|
|
return GDB_ID_NULL ;
|
|
// inserisco il punto nel DB
|
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateGeoVector( int nParentId, const double vtV[3], const double ptB[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// creo il vettore
|
|
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
|
if ( IsNull( pGeoVct))
|
|
return GDB_ID_NULL ;
|
|
// setto il vettore (con il punto base)
|
|
if ( ! pGeoVct->Set( vtV, ptB))
|
|
return GDB_ID_NULL ;
|
|
// inserisco il vettore nel DB
|
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateGeoFrame( int nParentId, const double ptOrig[3],
|
|
const double vX[3], const double vY[3], const double vZ[3])
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// creo il riferimento
|
|
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
|
|
if ( IsNull( pGeoFrm))
|
|
return GDB_ID_NULL ;
|
|
// setto il riferimento
|
|
if ( ! pGeoFrm->Set( ptOrig, vX, vY, vZ))
|
|
return GDB_ID_NULL ;
|
|
// inserisco il vettore nel DB
|
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateText( int nParentId, const wchar_t* wsText,
|
|
const double ptP[3], double dAngRotDeg, double dH)
|
|
{
|
|
return EgtCreateText( nParentId, wstrztoA( wsText), ptP, dAngRotDeg, dH) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateText( int nParentId, const string& sText,
|
|
const Point3d& ptP, double dAngRotDeg, double dH)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// creo il testo
|
|
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
|
if ( IsNull( pTXT))
|
|
return GDB_ID_NULL ;
|
|
// lo riempio
|
|
if ( ! pTXT->Set( sText, ptP, dAngRotDeg, dH))
|
|
return GDB_ID_NULL ;
|
|
// inserisco il testo nel DB
|
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateTextEx( int nParentId, const wchar_t* wsText,
|
|
const double ptP[3], double dAngRotDeg, const wchar_t* wsFont,
|
|
int nW, BOOL bItalic, double dH, double dRat, double dAddAdv, int nInsPos)
|
|
{
|
|
return EgtCreateTextEx( nParentId, wstrztoA( wsText), ptP, dAngRotDeg,
|
|
wstrztoA( wsFont), nW, ( bItalic != FALSE), dH, dRat, dAddAdv, nInsPos) ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
int
|
|
__stdcall EgtCreateTextEx( int nParentId, const string& sText,
|
|
const Point3d& ptP, double dAngRotDeg, const string& sFont,
|
|
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
|
// creo il testo
|
|
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
|
if ( IsNull( pTXT))
|
|
return GDB_ID_NULL ;
|
|
// lo riempio
|
|
if ( ! pTXT->Set( sText, ptP, dAngRotDeg, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos))
|
|
return GDB_ID_NULL ;
|
|
// inserisco il testo nel DB
|
|
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
|
}
|