EgtInterface 1.6a2 :
- numerose modifiche e correzioni - aggiunta registrazione comandi in formato lua - aggiunto valutatore di espressioni.
This commit is contained in:
+154
-36
@@ -1,13 +1,13 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : API_GdbCreate.cpp Data : 30.09.14 Versione : 1.5i5
|
||||
// File : API_GdbCreate.cpp Data : 07.01.15 Versione : 1.6a1
|
||||
// Contenuto : Funzioni di creazione oggetti del DB geometrico per API.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 30.09.14 DS Creazione modulo.
|
||||
//
|
||||
// 07.01.15 DS Agg. scrittura comandi Lua.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -15,16 +15,17 @@
|
||||
#include "stdafx.h"
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EgkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EgkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
|
||||
@@ -37,7 +38,24 @@ __stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
|
||||
if ( ! frFrame.Set( ptOrig, vX, vY, vZ))
|
||||
return GDB_ID_NULL ;
|
||||
// creo il gruppo
|
||||
return pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrame) ;
|
||||
int nId = pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrame) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( AreSameFrame( frFrame, GLOB_FRM))
|
||||
sLua = "EgtGroup(" + ToString( nParentId) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
else
|
||||
sLua = "EgtGroup(" + ToString( nParentId) + ",{{" +
|
||||
ToString( Point3d( ptOrig)) + "},{" +
|
||||
ToString( Vector3d( vX)) + "},{" +
|
||||
ToString( Vector3d( vY)) + "},{" +
|
||||
ToString( Vector3d( vZ)) + "}})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del nuovo gruppo
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -54,7 +72,16 @@ __stdcall EgtCreateGeoPoint( int nParentId, const double ptP[3])
|
||||
if ( ! pGeoPnt->Set( ptP))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il punto nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoPnt)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtPoint(" + ToString( nParentId) + ",{" +
|
||||
ToString( Point3d( ptP)) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -71,7 +98,23 @@ __stdcall EgtCreateGeoVector( int nParentId, const double vtV[3], const double p
|
||||
if ( ! pGeoVct->Set( vtV, ptB))
|
||||
return GDB_ID_NULL ;
|
||||
// inserisco il vettore nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) ;
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoVct)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua ;
|
||||
if ( Point3d( ptB).IsSmall())
|
||||
sLua = "EgtVector(" + ToString( nParentId) + ",{" +
|
||||
ToString( Vector3d( vtV)) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
else
|
||||
sLua = "EgtVector(" + ToString( nParentId) + ",{" +
|
||||
ToString( Vector3d( vtV)) + "},{" +
|
||||
ToString( Point3d( ptB)) + "})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
@@ -88,61 +131,136 @@ __stdcall EgtCreateGeoFrame( int nParentId, const double ptOrig[3],
|
||||
// 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)) ;
|
||||
// inserisco il riferimento nel DB
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pGeoFrm)) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtFrame(" + ToString( nParentId) + ",{{" +
|
||||
ToString( Point3d( ptOrig)) + "},{" +
|
||||
ToString( Vector3d( vX)) + "},{" +
|
||||
ToString( Vector3d( vY)) + "},{" +
|
||||
ToString( Vector3d( vZ)) + "}})" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del nuovo gruppo
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateText( int nParentId, const wchar_t* wsText,
|
||||
const double ptP[3], double dAngRotDeg, double dH)
|
||||
__stdcall EgtCreateText( int nParentId, const double ptP[3], double dAngRotDeg,
|
||||
const wchar_t* wsText, double dH)
|
||||
{
|
||||
return EgtCreateText( nParentId, wstrztoA( wsText), ptP, dAngRotDeg, dH) ;
|
||||
return EgtCreateText( nParentId, ptP, dAngRotDeg, wstrztoA( wsText), dH) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateText( int nParentId, const string& sText,
|
||||
const Point3d& ptP, double dAngRotDeg, double dH)
|
||||
__stdcall EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
|
||||
const string& sText, double dH)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// creo il testo
|
||||
// creo il testo e lo riempio
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
if ( IsNull( pTXT))
|
||||
return GDB_ID_NULL ;
|
||||
// lo riempio
|
||||
if ( ! pTXT->Set( sText, ptP, dAngRotDeg, dH))
|
||||
return GDB_ID_NULL ;
|
||||
bool bOk = ( ! IsNull( pTXT) && pTXT->Set( ptP, dAngRotDeg, sText, dH)) ;
|
||||
// inserisco il testo nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtText(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "}," +
|
||||
ToString( dAngRotDeg) + ",'" +
|
||||
sText + "','" +
|
||||
ToString( dH) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
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)
|
||||
__stdcall EgtCreateTextEx( int nParentId, const double ptP[3], const double vtN[3], const double vtD[3],
|
||||
const wchar_t* wsText, const wchar_t* wsFont, BOOL bItalic, double dH)
|
||||
{
|
||||
return EgtCreateTextEx( nParentId, wstrztoA( wsText), ptP, dAngRotDeg,
|
||||
wstrztoA( wsFont), nW, ( bItalic != FALSE), dH, dRat, dAddAdv, nInsPos) ;
|
||||
return EgtCreateTextEx( nParentId, ptP, vtN, vtD,
|
||||
wstrztoA( wsText), wstrztoA( wsFont), (bItalic != FALSE), dH) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
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)
|
||||
__stdcall EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, const string& sFont, bool bItalic, double dH)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// creo il testo
|
||||
// creo il testo e lo riempio
|
||||
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 ;
|
||||
//bool bOk = ( ! IsNull( pTXT) && pTXT->Set( ptP, dAngRotDeg, sText, dH)) ;
|
||||
bool bOk = ( ! IsNull( pTXT) && pTXT->Set( ptP, vtN, vtD, sText, sFont, bItalic, dH)) ;
|
||||
// inserisco il testo nel DB
|
||||
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) ;
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTextEx(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vtD) + "},'" +
|
||||
sText + "','" +
|
||||
sFont + "'," +
|
||||
( bItalic ? "'I'" : "'S'") + "," +
|
||||
ToString( dH) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateTextAdv( int nParentId, const double ptP[3], const double vtN[3], const double vtD[3],
|
||||
const wchar_t* wsText, const wchar_t* wsFont,
|
||||
int nW, BOOL bItalic, double dH, double dRat, double dAddAdv, int nInsPos)
|
||||
{
|
||||
return EgtCreateTextAdv( nParentId, ptP, vtN, vtD,
|
||||
wstrztoA( wsText), wstrztoA( wsFont),
|
||||
nW, ( bItalic != FALSE), dH, dRat, dAddAdv, nInsPos) ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
|
||||
const string& sText, 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 e lo imposto
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bool bOk = ( ! IsNull( pTXT) && pTXT->Set( ptP, vtN, vtD, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos)) ;
|
||||
// inserisco il testo nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)) : GDB_ID_NULL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtTextAdv(" + ToString( nParentId) + ",{" +
|
||||
ToString( ptP) + "},{" +
|
||||
ToString( vtN) + "},{" +
|
||||
ToString( vtD) + "},'" +
|
||||
sText + "','" +
|
||||
sFont + "'," +
|
||||
ToString( nW) + "," +
|
||||
( bItalic ? "'I'" : "'S'") + "," +
|
||||
ToString( dH) + "," +
|
||||
ToString( dRat) + "," +
|
||||
ToString( dAddAdv) + "," +
|
||||
ETxtInsPosToString( nInsPos) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo del oggetto
|
||||
return nId ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user