Files
EgtExchange/ExportThreeJS.h
Daniele Bariletti b6847a3da7 EgtExchage :
- miglioria al filtro degli oggetti/gruppi negli Export 3MF, Stl,
ThreeJS e Dxf
- modifiche di stile minori a Export3dm.
2023-11-09 15:47:06 +01:00

93 lines
5.5 KiB
C++

//----------------------------------------------------------------------------
// EgalWare 2022-2022
//----------------------------------------------------------------------------
// File : ExportThreeJS.h Data : 05.07.22 Versione : 2.4j1
// Contenuto : Dichiarazione della classe ExportThreeJS.
//
//
//
// Modifiche : 19.10.22
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EGnWriter.h"
#include "/EgtDev/Include/EGkColor.h"
#include "/EgtDev/Include/EGkIntersSurfTmSurfTm.h"
class IGdbIterator ;
class IGeoObj ;
class Frame3d ;
struct sSurfDist {
const ISurfTriMesh* SurvAlpha ;
double dDistance = 0 ;
std::string sName ;
};
//----------------------------------------------------------------------------
class ExportThreeJS : public IExportThreeJS
{
public:
virtual bool SetOptions( int nFilter) ;
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
public:
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {
CalcGroupFilter() ;
}
private:
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
bool FinishAmbient( void) ;
bool CompressAll( const std::string& sFile) ;
bool ExportVector3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportPoint3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportFrame3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportLine3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportCurveComp3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportSBezier(const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportText( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportDimension( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ScanGroup( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool ExportObject( const IGdbIterator& iIter, IGeomDB* pGDB, const int nIdGroup) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup) ;
bool CalcGroupFilter( void) ;
private:
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
Point3d m_ptMin ; // Punto minimo del box3d
double m_dimX ; // DimX Box3d Global
double m_dimY ; // DimY Box3d Global
double m_dimZ ; // DimZ Box3d Global
double m_dDistance ; // Scala per pan e zoom
Point3d m_ptCamera ; // Camera position
Point3d m_ptCenter ; // Camera look at
double m_dHalfWidth ; // Semilunghezza piano di proiezione (culling)
double m_dHalfHeight ; // Semialtezza piano di proiezione (culling)
double m_dZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
double m_dZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
double m_dCameraPhi ; // Angolo phi in coordinate polari della telecamera [0,180]
double m_dCameraTheta ; // Angolo Theta in coordinate polari della telecamera [0, 360)
Frame3d m_frTHREEJSFrame ; // Frame di ThreeJS
bool m_bShowGrid ; // Flag di esportazione griglia di scena
bool m_bUdm_mm ; // Flag unità di misura in mm
std::string m_sUdm ; // Stringa per unità di misura della scena
int m_nGroupCount ; // Contatore del gruppo
int m_nCont ; // contatore per linee interne ai testi
std::vector< sSurfDist> m_vTranspSurf ; // Vettore di superfici trasparenti
std::string m_sCodMenu ; // Stringa per la creazione del menu laterale della scena
Writer m_Writer ; // Scrittore di file di testo oggetto
public :
static std::string m_sThreeJSLibDir ; // Direttorio librerie
} ;