0b8a267b7b
- DistPointLine correnta per versore non normalizzato - aggiunta GetGeoType a GeomDB e a GdbIterator - in lettura NGE binari aggiunta protezione da contemporanea scrittura - in PolyLine aggiunta funzione per inserimento punti onde raggiungere massima distanza - aggiunto oggetto VolZmap per virtual milling (per ora vuoto) - nuova versione file NGE 1009.
226 lines
13 KiB
C++
226 lines
13 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : GeomDB.h Data : 03.12.14 Versione : 1.5l1
|
|
// Contenuto : Dichiarazione della classe GeomDB.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.01.13 DS Creazione modulo.
|
|
// 03.12.14 DS Aggiunta gestione riferimento di griglia.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "GdbGeo.h"
|
|
#include "GdbGroup.h"
|
|
#include "IdManager.h"
|
|
#include "IterManager.h"
|
|
#include "SelManager.h"
|
|
#include "GdbMaterialMgr.h"
|
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
class GeomDB : public IGeomDB
|
|
{
|
|
friend class GdbIterator ;
|
|
friend class GdbObj ;
|
|
friend class GdbGroup ;
|
|
friend class GdbGeo ;
|
|
|
|
public :
|
|
virtual ~GeomDB( void) ;
|
|
virtual bool Init( void) ;
|
|
virtual bool Clear( void) ;
|
|
virtual bool Load( const std::string& sFileIn, int nGroupId = GDB_ID_ROOT) ;
|
|
virtual bool Save( const std::string& sFileOut, int nFlag = GDB_SV_BIN) const ;
|
|
virtual bool ExistsObj( int nId) const ;
|
|
virtual int AddGroup( int nId, int nParentId, const Frame3d& frFrame) ;
|
|
virtual int InsertGroup( int nId, int nRefId, int nSonBeforeAfter, const Frame3d& frFrame) ;
|
|
virtual int AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj) ;
|
|
virtual int InsertGeoObj( int nId, int nRefId, int nSonBeforeAfter, IGeoObj* pGeoObj) ;
|
|
virtual int GetFirstInGroup( int nIdGroup) const ;
|
|
virtual int GetNext( int nId) const ;
|
|
virtual int GetLastInGroup( int nIdGroup) const ;
|
|
virtual int GetPrev( int nId) const ;
|
|
virtual int GetFirstGroupInGroup( int nIdGroup) const ;
|
|
virtual int GetNextGroup( int nId) const ;
|
|
virtual int GetLastGroupInGroup( int nIdGroup) const ;
|
|
virtual int GetPrevGroup( int nId) const ;
|
|
virtual int GetGdbType( int nId) const ;
|
|
virtual int GetGeoType( int nId) const ;
|
|
virtual IGeoObj* GetGeoObj( int nId) ;
|
|
virtual const IGeoObj* GetGeoObj( int nId) const ;
|
|
virtual Frame3d* GetGroupFrame( int nId) ;
|
|
virtual const Frame3d* GetGroupFrame( int nId) const ;
|
|
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_STANDARD) const ;
|
|
virtual bool GetGlobalBBox( int nId, BBox3d& b3Glob, int nFlag = BBF_STANDARD) const ;
|
|
virtual bool GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
|
|
virtual int Copy( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON)
|
|
{ return Copy( nIdSou, nIdDest, nRefId, nSonBeforeAfter, false) ; }
|
|
virtual int CopyGlob( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter = GDB_SON)
|
|
{ return Copy( nIdSou, nIdDest, nRefId, nSonBeforeAfter, true) ; }
|
|
virtual bool Relocate( int nId, int nRefId, int nSonBeforeAfter = GDB_SON)
|
|
{ return Relocate( nId, nRefId, nSonBeforeAfter, false) ; }
|
|
virtual bool RelocateGlob( int nId, int nRefId, int nSonBeforeAfter = GDB_SON)
|
|
{ return Relocate( nId, nRefId, nSonBeforeAfter, true) ; }
|
|
virtual bool ChangeId( int nId, int nNewId) ;
|
|
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 dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return Rotate( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
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 dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return RotateGlob( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
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 dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return RotateGroup( nId, ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
virtual bool RotateGroup( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
|
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) ;
|
|
virtual bool Shear( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
|
virtual bool ShearGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
|
virtual bool ShearGroup( int nId, const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
|
// Selection
|
|
virtual bool SelectObj( int nId, bool bOnlyIfVisible = false) ;
|
|
virtual bool DeselectObj( int nId) ;
|
|
virtual bool SelectGroupObjs( int nId, int nFilter = 0, bool bOnlyIfVisible = false) ;
|
|
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 int GetLastSelectedObj( void) const ;
|
|
virtual int GetPrevSelectedObj( void) const ;
|
|
virtual bool ClearSelection( void) ;
|
|
// Attributes
|
|
virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const ;
|
|
virtual bool CopyAttributes( int nIdSou, int nIdDest) ;
|
|
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, const std::string& sMatName) ;
|
|
virtual bool SetMaterial( int nId, Color cCol) ;
|
|
virtual bool GetMaterial( int nId, int& nMat) const ;
|
|
virtual bool GetMaterial( int nId, Material& mMat) const ;
|
|
virtual bool GetMaterial( int nId, Color& cCol) const ;
|
|
virtual bool GetCalcMaterial( int nId, int& nMat) const ;
|
|
virtual bool GetCalcMaterial( int nId, Material& mMat) 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 ExistsName( int nId) const ;
|
|
virtual bool RemoveName( int nId) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, bool bInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, int nInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, double dInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, const Point3d& ptInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, const Vector3d& vtInfo) ;
|
|
virtual bool SetInfo( int nId, const std::string& sKey, const Frame3d& frInfo) ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, std::string& sInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, bool& bInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, int& nInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, double& dInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, Point3d& ptInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, Vector3d& vtInfo) const ;
|
|
virtual bool GetInfo( int nId, const std::string& sKey, Frame3d& frInfo) const ;
|
|
virtual bool ExistsInfo( int nId, const std::string& sKey) const ;
|
|
virtual bool RemoveInfo( int nId, const std::string& sKey) ;
|
|
// Material library
|
|
virtual int AddMaterial( const std::string& sName, const Material& matM) ;
|
|
virtual int FindMaterial( const std::string& sName) const ;
|
|
virtual bool EraseMaterial( int nMat, bool& bInUse) ;
|
|
virtual bool GetMaterialData( int nMat, Material& matM) const ;
|
|
virtual bool GetMaterialName( int nMat, std::string& sName) const ;
|
|
virtual int GetMaxMaterialId( void) const ;
|
|
virtual bool ExistsMaterial( int nMat) const ;
|
|
virtual bool IsCustomMaterial( int nMat, bool& bCustom) const ;
|
|
virtual bool ModifyMaterialData( int nMat, const Material& matM) ;
|
|
virtual bool ModifyMaterialName( int nMat, const std::string& sName) ;
|
|
// Grid
|
|
virtual bool SetGridFrame( const Frame3d& frFrame)
|
|
{ if ( ! frFrame.IsValid())
|
|
return false ;
|
|
m_GridFrame = frFrame ;
|
|
return true ; }
|
|
virtual const Frame3d& GetGridFrame( void)
|
|
{ return m_GridFrame ; }
|
|
|
|
public :
|
|
GeomDB( void) ;
|
|
|
|
private :
|
|
GdbObj* GetGdbObj( int nId) ;
|
|
const GdbObj* GetGdbObj( int nId) const ;
|
|
GdbGeo* GetGdbGeo( int nId)
|
|
{ return dynamic_cast<GdbGeo*>( GetGdbObj( nId)) ; }
|
|
const GdbGeo* GetGdbGeo( int nId) const
|
|
{ return dynamic_cast<const GdbGeo*>( GetGdbObj( nId)) ; }
|
|
GdbGroup* GetGdbGroup( int nId)
|
|
{ return dynamic_cast<GdbGroup*>( GetGdbObj( nId)) ; }
|
|
const GdbGroup* GetGdbGroup( int nId) const
|
|
{ return dynamic_cast<const GdbGroup*>( GetGdbObj( nId)) ; }
|
|
bool InsertInGeomDB( GdbObj* pGObj, int nRefId, int nSonBeforeAfter, bool bTestId = true) ;
|
|
int Copy( int nIdSou, int nIdDest, int nRefId, int nSonBeforeAfter, bool bGlob) ;
|
|
bool Relocate( int nId, int nRefId, int nSonBeforeAfter, bool bGlob) ;
|
|
bool Erase( GdbObj* pGObj) ;
|
|
bool LoadHeader( NgeReader& ngeIn, bool bSave) ;
|
|
bool LoadOneObj( NgeReader& ngeIn, int nGroupId, int nBaseGdbId, const INTVECTOR& vBaseMatId, bool& bEnd) ;
|
|
bool SaveHeader( NgeWriter& ngeOut) const ;
|
|
bool SaveFooter( NgeWriter& ngeOut) const ;
|
|
bool SetStatus( GdbObj* pGdbObj, int nStat) ;
|
|
bool RevertStatus( GdbObj* pGdbObj) ;
|
|
bool SetMaterial( GdbObj* pGdbObj, int nMat) ;
|
|
bool SetMaterial( GdbObj* pGdbObj, const std::string& sMatName) ;
|
|
bool GetMaterial( const GdbObj* pGdbObj, Material& mMat) const ;
|
|
bool GetCalcMaterial( const GdbObj* pGdbObj, Material& mMat) const ;
|
|
bool UsedMaterialInGroup( int nMat, const GdbGroup* pGdbGroup) const ;
|
|
bool NotifyObjectsWithMaterialInGroup( int nMat, Color cCol, bool bByParent, GdbGroup* pGdbGroup) ;
|
|
bool AddGdbIteratorToList( GdbIterator* pIter)
|
|
{ return m_IterManager.AddGdbIterator( pIter) ; }
|
|
bool RemoveGdbIteratorFromList( GdbIterator* pIter)
|
|
{ return m_IterManager.RemoveGdbIterator( pIter) ; }
|
|
|
|
private :
|
|
IdManager m_IdManager ; // gestore del nuovo Id
|
|
IterManager m_IterManager ; // gestore lista iteratori attivi
|
|
SelManager m_SelManager ; // gestore lista oggetti selezionati
|
|
GdbMaterialMgr m_MatManager ; // gestore lista materiali
|
|
GdbGroup m_GrpRadix ; // gruppo radice di tutto il DB
|
|
Frame3d m_GridFrame ; // riferimento della griglia
|
|
} ;
|