Files
EgtExecutor/GseContext.h
DarioS 5c7ed7e3c1 EgtExecutor 2.4h1 :
- modifiche per gestione SelInfo di ultimi due oggetti selezionati
- corrette macro di doppia verifica come VERIFY_CTX_GEOMDB
- aggiunta gestione flag RUL_TYPE_ISOPAR_SMOOTH in creazione superficie rigata.
2022-08-17 19:14:00 +02:00

154 lines
5.8 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2019
//----------------------------------------------------------------------------
// File : GseContext.h Data : 18.07.19 Versione : 2.1g4
// Contenuto : Dichiarazioni per contesti GSE ( Geometria, Scena, Esecuzione).
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGrScene.h"
#include "/EgtDev/Include/EGnCmdParser.h"
#include "/EgtDev/Include/EMkMachMgr.h"
#include "/EgtDev/Include/EExBeamMgr.h"
#define NOMINMAX
#include <windows.h>
//----------------------------------------------------------------------------
// Struttura per info aggiuntive di selezione
struct SelInfo {
int nLastId ;
int nLastSub ;
Point3d ptLastSel ;
int nPrevId ;
int nPrevSub ;
Point3d ptPrevSel ;
SelInfo( void)
{ Reset() ; }
void Set( int nI, int nS, const Point3d& ptP)
{ nPrevId = nLastId ; nPrevSub = nLastSub ; ptPrevSel = ptLastSel ; nLastId = nI ; nLastSub = nS ; ptLastSel = ptP ; }
void Reset( void)
{ nLastId = GDB_ID_NULL ; nLastSub = 0 ; ptLastSel = ORIG ; nPrevId = GDB_ID_NULL ; nPrevSub = 0 ; ptPrevSel = ORIG ; }
void ResetLast( void)
{ nLastId = nPrevId ; nLastSub = nPrevSub ; ptLastSel = ptPrevSel ; nPrevId = GDB_ID_NULL ; nPrevSub = 0 ; ptPrevSel = ORIG ; }
void ResetPrev( void)
{ nPrevId = GDB_ID_NULL ; nPrevSub = 0 ; ptPrevSel = ORIG ; }
} ;
//----------------------------------------------------------------------------
// Valori standard per stile quotatura
static const double STD_EXTLINELEN = 5.0 ;
static const double STD_ARROWLEN = 5.0 ;
static const double STD_TEXTDIST = 2.0 ;
static const int STD_LENISMM = 1 ;
static const int STD_DECDIGIT = -2 ;
static const std::string STD_FONT = "ModernPropS.Nfe" ;
static const double STD_TEXTHEIGHT = 10.0 ;
// Struttura per stile quotatura corrente
struct DimensionStyle {
double dExtLineLen ;
double dArrowLen ;
double dTextDist ;
int nLenIsMM ; // 0=no, 1=si, 2=da UiUnits
int nDecDigit ;
std::string sFont ;
double dTextHeight ;
DimensionStyle( void)
{ Reset() ; }
void Set( double dELL, double dAL, double dTD, int nMM, int nDD, const std::string& sF, double dTH)
{ dExtLineLen = dELL ; dArrowLen = dAL ; dTextDist = dTD ; nLenIsMM = nMM ; nDecDigit = nDD ; sFont = sF ; dTextHeight = dTH ; }
void Reset( void)
{ dExtLineLen = STD_EXTLINELEN ; dArrowLen = STD_ARROWLEN ; dTextDist = STD_TEXTDIST ;
nLenIsMM = STD_LENISMM ; nDecDigit = STD_DECDIGIT ; sFont = STD_FONT ; dTextHeight = STD_TEXTHEIGHT ; }
} ;
//----------------------------------------------------------------------------
class GseContext
{
public :
IGeomDB* m_pGeomDB ;
Color m_colDef ;
IMachMgr* m_pMachMgr ;
IBeamMgr* m_pBeamMgr ;
HWND m_hWnd ;
IEGrScene* m_pScene ;
ICmdParser* m_pTscExec ;
std::string m_sFilePath ;
bool m_bEnableModified ;
bool m_bModified ;
int m_nCurrPart ;
int m_nCurrLayer ;
int m_nObjFilterForSelect ;
SelInfo m_siSel ;
DimensionStyle m_dsCurr ;
public :
GseContext( void)
: m_pGeomDB( nullptr), m_colDef( GRAY), m_pMachMgr( nullptr), m_pBeamMgr( nullptr), m_hWnd( nullptr), m_pScene( nullptr),
m_pTscExec( nullptr), m_sFilePath(), m_bEnableModified( true), m_bModified( false),
m_nCurrPart( GDB_ID_NULL), m_nCurrLayer( GDB_ID_NULL), m_nObjFilterForSelect(GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA),
m_siSel(), m_dsCurr()
{}
~GseContext( void)
{ Clear() ; }
void Clear( void)
{
if ( m_pTscExec != nullptr) {
delete m_pTscExec ;
m_pTscExec = nullptr ;
}
if ( m_pScene != nullptr) {
m_pScene->Destroy() ;
delete m_pScene ;
m_pScene = nullptr ;
}
m_hWnd = nullptr ;
if ( m_pMachMgr != nullptr) {
delete m_pMachMgr ;
m_pMachMgr = nullptr ;
}
if ( m_pBeamMgr != nullptr) {
delete m_pBeamMgr ;
m_pBeamMgr = nullptr ;
}
if ( m_pGeomDB != nullptr) {
delete m_pGeomDB ;
m_pGeomDB = nullptr ;
}
m_sFilePath.clear() ;
m_bEnableModified = true ;
m_bModified = false ;
m_nCurrPart = GDB_ID_NULL ;
m_nCurrLayer = GDB_ID_NULL ;
m_nObjFilterForSelect = GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA ;
m_siSel.Reset() ;
m_dsCurr.Reset() ;
}
} ;
//----------------------------------------------------------------------------
int CreateGseContext( void) ;
bool DeleteGseContext( int nInd) ;
bool GetAllGseContextOn( INTVECTOR& vOn) ;
bool ClearAllGseContexts( void) ;
GseContext* GetGseContext( int nInd) ;
IGeomDB* GetGeomDB( int nInd) ;
IEGrScene* GetScene( int nInd) ;
ICmdParser* GetTscExecutor( int nInd) ;
bool SetCurrGseContext( int nInd) ;
bool ResetCurrGseContext( void) ;
int GetIndCurrGseContext( void) ;
GseContext* GetCurrGseContext( void) ;
IGeomDB* GetCurrGeomDB( void) ;
IMachMgr* GetCurrMachMgr( void) ;
IBeamMgr* GetCurrBeamMgr( void) ;
IEGrScene* GetCurrScene( void) ;
ICmdParser* GetCurrTscExecutor( void) ;