EgtInterface 1.6a4 :
- completamento modifiche per registrazione comandi in lua e per gestione RefType e RefId.
This commit is contained in:
+70
-6
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "AuxTools.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include "/EgtDev/Include/EgkExtText.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
@@ -21,7 +22,7 @@ using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
__stdcall SepToString( int nSep)
|
||||
SepToString( int nSep)
|
||||
{
|
||||
switch ( nSep) {
|
||||
default :
|
||||
@@ -34,7 +35,7 @@ __stdcall SepToString( int nSep)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall StringToSep( const string& sSep)
|
||||
StringToSep( const string& sSep)
|
||||
{
|
||||
string sTmp = sSep ;
|
||||
ToUpper( sTmp) ;
|
||||
@@ -52,7 +53,7 @@ __stdcall StringToSep( const string& sSep)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
__stdcall RefTypeToString( int nRefType)
|
||||
RefTypeToString( int nRefType)
|
||||
{
|
||||
switch ( nRefType) {
|
||||
case RTY_GLOB : return "'GLOB'" ;
|
||||
@@ -64,7 +65,7 @@ __stdcall RefTypeToString( int nRefType)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall StringToRefType( const string& sRefType)
|
||||
StringToRefType( const string& sRefType)
|
||||
{
|
||||
string sTmp = sRefType ;
|
||||
ToUpper( sTmp) ;
|
||||
@@ -78,9 +79,23 @@ __stdcall StringToRefType( const string& sRefType)
|
||||
return RTY_LOC ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
StringToRefId( const string& sRefId)
|
||||
{
|
||||
string sTmp = sRefId ;
|
||||
ToUpper( sTmp) ;
|
||||
if ( sTmp == "GLOB")
|
||||
return GDB_ID_ROOT ;
|
||||
else if ( sTmp == "GRID")
|
||||
return GDB_ID_GRID ;
|
||||
// default
|
||||
return GDB_ID_ROOT ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const char*
|
||||
__stdcall ETxtInsPosToString( int nETxtInsPos)
|
||||
ETxtInsPosToString( int nETxtInsPos)
|
||||
{
|
||||
switch ( nETxtInsPos) {
|
||||
case ETXT_IPTL : return "'TL'" ;
|
||||
@@ -98,7 +113,7 @@ __stdcall ETxtInsPosToString( int nETxtInsPos)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall ETxtInsPosToString( const string& sETxtInsPos)
|
||||
ETxtInsPosToString( const string& sETxtInsPos)
|
||||
{
|
||||
string sInsPos = sETxtInsPos ;
|
||||
ToUpper( sInsPos) ;
|
||||
@@ -122,4 +137,53 @@ __stdcall ETxtInsPosToString( const string& sETxtInsPos)
|
||||
return ETXT_IPBR ;
|
||||
// default
|
||||
return ETXT_IPBL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
VerifySameFrame( IGeomDB* pGeomDB, INTVECTOR& vIds)
|
||||
{
|
||||
// verifico puntatore a GeomDB
|
||||
if ( pGeomDB == nullptr)
|
||||
return false ;
|
||||
// ciclo sul vettore degli identificativi
|
||||
bool bFirst = true ;
|
||||
Frame3d frFirst ;
|
||||
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
|
||||
// se si deve agire su un singolo oggetto ( gruppo o entità)
|
||||
if ( vIds[i] != GDB_ID_SEL) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( vIds[i], frLoc) &&
|
||||
! pGeomDB->GetGlobFrame( vIds[i], frLoc))
|
||||
return false ;
|
||||
if ( bFirst) {
|
||||
frFirst = frLoc ;
|
||||
bFirst = false ;
|
||||
}
|
||||
else {
|
||||
if ( ! AreSameFrame( frFirst, frLoc))
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// altrimenti si deve agire sugli oggetti selezionati
|
||||
else {
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nI, frLoc))
|
||||
return false ;
|
||||
if ( bFirst) {
|
||||
frFirst = frLoc ;
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if ( ! AreSameFrame( frFirst, frLoc))
|
||||
return false ;
|
||||
}
|
||||
// passo alla successiva
|
||||
nI = pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user