//---------------------------------------------------------------------------- // EgalTech 2013-2013 //---------------------------------------------------------------------------- // File : GdbGroup.h Data : 28.11.13 Versione : 1.4a2 // Contenuto : Dichiarazione della classe GdbGroup. // // // // Modifiche : 28.11.13 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "GeoFrame3d.h" #include "GdbObj.h" #include "/EgtDev/Include/EGkGeoObj.h" #include //---------------------------------------------------------------------------- class GdbGroup : public GdbObj { friend class GdbObj ; public : virtual ~GdbGroup( void) ; virtual GdbGroup* Clone( int nId) const ; virtual GdbType GetGdbType( void) const { return GDB_TY_GROUP ; } virtual bool Save( NgeWriter& ngeOut) const ; virtual bool Load( int nNgeId, NgeReader& ngeIn, int nBaseGdbId, int& nParentId) ; virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag, int nLev = 0) const ; virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag, int nLev = 0) const ; virtual bool Translate( const Vector3d& vtMove) { m_frF.Translate( vtMove) ; return true ; } virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) { double dAngRad = dAngDeg * DEGTORAD ; return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) { return m_frF.Rotate( ptAx, vtAx, dCosAng, dSinAng) ; } virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ; virtual bool ToGlob( const Frame3d& frRef) { return m_frF.ToGlob( frRef) ; } virtual bool ToLoc( const Frame3d& frRef) { return m_frF.ToLoc( frRef) ; } virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) { return m_frF.LocToLoc( frOri, frDest) ; } virtual bool OnSetMaterial( void) ; public : GdbGroup( void) ; bool SaveEmpty( NgeWriter& ngeOut) const ; bool SaveChildren( NgeWriter& ngeOut) const ; bool Clear( void) ; void ObjCountInc( void) { ++ m_nObjCount ; } void ObjCountDec( void) { -- m_nObjCount ; } int GetObjCount( void) const { return m_nObjCount ; } GdbObj* GetFirstObj( void) { return m_pFirstObj ; } const GdbObj* GetFirstObj( void) const { return m_pFirstObj ; } GdbObj* GetLastObj( void) { return m_pLastObj ; } const GdbObj* GetLastObj( void) const { return m_pLastObj ; } public : bool SetFrame( const Frame3d& frF) { if ( ! frF.IsValid()) return false ; m_frF = frF ; return true ; } Frame3d& GetFrame( void) { return m_frF ; } const Frame3d& GetFrame( void) const { return m_frF ; } bool GetGlobFrame( Frame3d& frGlob) const ; private : Frame3d m_frF ; int m_nObjCount ; GdbObj* m_pFirstObj ; GdbObj* m_pLastObj ; } ; //---------------------------------------------------------------------------- inline const GdbGroup* GetGdbGroup( const GdbObj* pGObj) { return dynamic_cast(pGObj) ; } inline GdbGroup* GetGdbGroup( GdbObj* pGObj) { return dynamic_cast(pGObj) ; }