Files
EgtInterface/AuxTools.cpp
T
Dario Sassi 4e1dddee86 EgtInterface 1.6b1 :
- gestione estrusione con facce di chiusura
- gestione rivoluzione con facce di chiusura
- razionalizzazione passaggio a locale.
2015-02-02 08:18:35 +00:00

168 lines
4.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2015
//----------------------------------------------------------------------------
// File : AuxTools.cpp Data : 07.01.15 Versione : 1.6a1
// Contenuto : Funzioni ausiliarie.
//
//
//
// Modifiche : 07.01.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EgkExtText.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
using namespace std ;
//----------------------------------------------------------------------------
const char*
NgeTypeToString( int nNgeType)
{
switch ( nNgeType) {
case GDB_SV_TXT : return "'T'" ;
case GDB_SV_BIN : return "'B'" ;
default :
case GDB_SV_CMPTXT : return "'CT'" ;
}
}
//----------------------------------------------------------------------------
int
StringToNgeType( const string& sNgeType)
{
string sTmp = sNgeType ;
ToUpper( sTmp) ;
if ( sTmp == "T")
return GDB_SV_TXT ;
else if ( sTmp == "B")
return GDB_SV_BIN ;
else if ( sTmp == "CT")
return GDB_SV_CMPTXT ;
// default
return GDB_SV_CMPTXT ;
}
//----------------------------------------------------------------------------
const char*
SepToString( int nSep)
{
switch ( nSep) {
default :
case SEP_STD : return "'ST'" ;
case SEP_TG : return "'TG'" ;
case SEP_PERP : return "'PR'" ;
case SEP_MINDIST : return "'MD'" ;
}
}
//----------------------------------------------------------------------------
int
StringToSep( const string& sSep)
{
string sTmp = sSep ;
ToUpper( sTmp) ;
if ( sTmp == "ST")
return SEP_STD ;
else if ( sTmp == "TG")
return SEP_TG ;
else if ( sTmp == "PR")
return SEP_PERP ;
else if ( sTmp == "MD")
return SEP_MINDIST ;
// default
return SEP_STD ;
}
//----------------------------------------------------------------------------
const char*
RefTypeToString( int nRefType)
{
switch ( nRefType) {
case RTY_GLOB : return "'GLOB'" ;
default :
case RTY_LOC : return "'LOC'" ;
case RTY_GRID : return "'GRID'" ;
}
}
//----------------------------------------------------------------------------
int
StringToRefType( const string& sRefType)
{
string sTmp = sRefType ;
ToUpper( sTmp) ;
if ( sTmp == "GLOB")
return RTY_GLOB ;
else if ( sTmp == "LOC")
return RTY_LOC ;
else if ( sTmp == "GRID")
return RTY_GRID ;
// default
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*
ETxtInsPosToString( int nETxtInsPos)
{
switch ( nETxtInsPos) {
case ETXT_IPTL : return "'TL'" ;
case ETXT_IPTC : return "'TC'" ;
case ETXT_IPTR : return "'TR'" ;
case ETXT_IPML : return "'ML'" ;
case ETXT_IPMC : return "'MC'" ;
case ETXT_IPMR : return "'MR'" ;
default :
case ETXT_IPBL : return "'BL'" ;
case ETXT_IPBC : return "'BC'" ;
case ETXT_IPBR : return "'BR'" ;
}
}
//----------------------------------------------------------------------------
int
ETxtInsPosToString( const string& sETxtInsPos)
{
string sInsPos = sETxtInsPos ;
ToUpper( sInsPos) ;
if ( sInsPos == "TL")
return ETXT_IPTL ;
else if ( sInsPos == "TC")
return ETXT_IPTC ;
else if ( sInsPos == "TR")
return ETXT_IPTR ;
else if ( sInsPos == "ML")
return ETXT_IPML ;
else if ( sInsPos == "MC")
return ETXT_IPMC ;
else if ( sInsPos == "MR")
return ETXT_IPMR ;
else if ( sInsPos == "BL")
return ETXT_IPBL ;
else if ( sInsPos == "BC")
return ETXT_IPBC ;
else if ( sInsPos == "BR")
return ETXT_IPBR ;
// default
return ETXT_IPBL ;
}