2cbdfc1db9
- cambiato Load, con uso di NgeReader.
151 lines
7.9 KiB
C++
151 lines
7.9 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// File : GeomDB.h Data : 08.04.13 Versione : 1.1c1
|
|
// Contenuto : Dichiarazione della classe GeomDB.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.01.13 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "GdbGeo.h"
|
|
#include "GdbGroup.h"
|
|
#include "IdManager.h"
|
|
#include "IterManager.h"
|
|
#include "SelManager.h"
|
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
|
|
class NgeWriter ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class GeomDB : public IGeomDB
|
|
{
|
|
friend class GdbIterator ;
|
|
|
|
public :
|
|
virtual ~GeomDB( void) ;
|
|
virtual bool Init( void) ;
|
|
virtual bool Clear( void) ;
|
|
virtual bool Load( const std::string& sFileIn) ;
|
|
virtual bool Save( const std::string& sFileOut, bool bBinary = true) const ;
|
|
virtual bool ExistsObj( int nId) const ;
|
|
virtual int AddGroup( int nId, int nParentId, const Frame3d& frFrame) ;
|
|
virtual int AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj) ;
|
|
virtual int GetGdbType( int nId) const ;
|
|
virtual IGeoObj* GetGeoObj( int nId) ;
|
|
virtual IGeoFrame3d* GetGeoFrame( int nId) ;
|
|
virtual bool GetGroupFrame( int nId, Frame3d& frGrp) const ;
|
|
virtual bool GetGroupGlobFrame( int nId, Frame3d& frGlob) const ;
|
|
virtual int GetGroupObjs( int nId) const ;
|
|
virtual int GetParentId( int nId) const ;
|
|
virtual bool GetGlobFrame( int nId, Frame3d& frGlob) const
|
|
{ return GetGroupGlobFrame( GetParentId( nId), frGlob) ; }
|
|
virtual bool GetLocalBBox( int nId, BBox3d& b3Loc, int nFlag = BBF_NONE) const ;
|
|
virtual bool GetGlobalBBox( int nId, BBox3d& b3Glob, int nFlag = BBF_NONE) const ;
|
|
virtual bool GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_NONE) const ;
|
|
virtual int Copy( int nIdSou, int nIdDest, int nParentIdDest) ;
|
|
virtual int CopyGlob( int nIdSou, int nIdDest, int nParentIdDest) ;
|
|
virtual bool Relocate( int nId, int nNewParentId)
|
|
{ return Relocate( nId, nNewParentId, false) ; }
|
|
virtual bool RelocateGlob( int nId, int nNewParentId)
|
|
{ return Relocate( nId, nNewParentId, true) ; }
|
|
virtual bool Erase( int nId) ;
|
|
virtual bool Translate( int nId, const Vector3d& vtMove) ;
|
|
virtual bool TranslateGlob( int nId, const Vector3d& vtMove) ;
|
|
virtual bool TranslateGroup( int nId, const Vector3d& vtMove) ;
|
|
virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
|
virtual bool RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
|
virtual bool RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
|
virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return Rotate( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
virtual bool RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return RotateGlob( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
virtual bool RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return RotateGroup( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
virtual bool Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
|
virtual bool ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
|
virtual bool ScaleGroup( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
|
virtual bool Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
|
virtual bool MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
|
virtual bool MirrorGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
|
// selection
|
|
virtual bool SelectObj( int nId) ;
|
|
virtual bool DeselectObj( int nId) ;
|
|
virtual bool SelectGroupObjs( int nId) ;
|
|
virtual bool DeselectGroupObjs( int nId) ;
|
|
virtual bool IsSelectedObj( int nId) const ;
|
|
virtual int GetSelectedObjNbr( void) const ;
|
|
virtual int GetFirstSelectedObj( void) const ;
|
|
virtual int GetNextSelectedObj( void) const ;
|
|
virtual bool ClearSelection( void) ;
|
|
// attributes
|
|
virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const ;
|
|
virtual bool SetLevel( int nId, int nLevel) ;
|
|
virtual bool RevertLevel( int nId) ;
|
|
virtual bool GetLevel( int nId, int& nLevel) const ;
|
|
virtual bool GetCalcLevel( int nId, int& nLevel) const ;
|
|
virtual bool SetMode( int nId, int nMode) ;
|
|
virtual bool RevertMode( int nId) ;
|
|
virtual bool GetMode( int nId, int& nMode) const ;
|
|
virtual bool GetCalcMode( int nId, int& nMode) const ;
|
|
virtual bool SetStatus( int nId, int nStat) ;
|
|
virtual bool RevertStatus( int nId) ;
|
|
virtual bool GetStatus( int nId, int& nStat) const ;
|
|
virtual bool GetCalcStatus( int nId, int& nStat) const ;
|
|
virtual bool SetMark( int nId) ;
|
|
virtual bool ResetMark( int nId) ;
|
|
virtual bool GetMark( int nId, int& nMark) const ;
|
|
virtual bool GetCalcMark( int nId, int& nMark) const ;
|
|
virtual bool SetDefaultMaterial( Color cCol) ;
|
|
virtual bool GetDefaultMaterial( Color& cCol) const ;
|
|
virtual bool SetMaterial( int nId, int nMat) ;
|
|
virtual bool SetMaterial( int nId, Color cCol) ;
|
|
virtual bool GetMaterial( int nId, int& nMat) const ;
|
|
virtual bool GetMaterial( int nId, Color& cCol) const ;
|
|
virtual bool GetCalcMaterial( int nId, int& nMat) const ;
|
|
virtual bool GetCalcMaterial( int nId, Color& cCol) const ;
|
|
virtual bool SetName( int nId, const std::string& sName) ;
|
|
virtual bool GetName( int nId, std::string& sName) const ;
|
|
virtual bool RemoveName( int nId) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, std::string& sInfo) const ;
|
|
virtual bool RemoveInfo( int nId, const std::string& sKey) ;
|
|
|
|
public :
|
|
GeomDB( void) ;
|
|
|
|
private :
|
|
GdbObj* GetGdbObj( int nId) ;
|
|
GdbGeo* GetGdbGeo( int nId)
|
|
{ return dynamic_cast<GdbGeo*>( GetGdbObj( nId)) ; }
|
|
GdbGroup* GetGdbGroup( int nId)
|
|
{ return dynamic_cast<GdbGroup*>( GetGdbObj( nId)) ; }
|
|
bool AddToGeomDB( GdbObj* pGObj, int nParentId) ;
|
|
bool Relocate( int nId, int nNewParentId, bool bGlob) ;
|
|
bool Erase( GdbObj* pGObj) ;
|
|
bool LoadHeader( NgeReader& ngeIn) ;
|
|
bool LoadOneObj( NgeReader& ngeIn, bool& bEnd) ;
|
|
bool SaveHeader( NgeWriter& ngeOut) const ;
|
|
bool SaveFooter( NgeWriter& ngeOut) const ;
|
|
bool SetStatus( GdbObj* pGdbObj, int nStat) ;
|
|
bool RevertStatus( GdbObj* pGdbObj) ;
|
|
bool AddGdbIteratorToList( GdbIterator* pIter)
|
|
{ return m_IterManager.AddGdbIterator( pIter) ; }
|
|
bool RemoveGdbIteratorFromList( GdbIterator* pIter)
|
|
{ return m_IterManager.RemoveGdbIterator( pIter) ; }
|
|
|
|
private :
|
|
GdbGroup m_GrpRadix ; // gruppo radice di tutto il DB
|
|
IdManager m_IdManager ; // gestore del nuovo Id
|
|
IterManager m_IterManager ; // gestore lista iteratori attivi
|
|
SelManager m_SelManager ; // gestore lista oggetti selezionati
|
|
} ;
|