EgtGeomKernel 1.5c1 :
- aggiunta prima gestione attributi.
This commit is contained in:
+175
-117
@@ -14,8 +14,9 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "GeomDB.h"
|
||||
#include "GdbObj.h"
|
||||
#include "GdbGeo.h"
|
||||
#include "DllMain.h"
|
||||
#include "Attribs.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgnStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
@@ -36,6 +37,7 @@ CreateGeomDB( void)
|
||||
GeomDB::GeomDB( void)
|
||||
{
|
||||
m_GrpRadix.m_nId = GDB_ID_ROOT ;
|
||||
m_GrpRadix.SetColor( Color( 0, 0, 0)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -48,9 +50,10 @@ GeomDB::~GeomDB( void)
|
||||
bool
|
||||
GeomDB::Init( void)
|
||||
{
|
||||
|
||||
// imposto numero minimo buckets del map degli Id
|
||||
m_IdManager.Init( 1024) ;
|
||||
// imposto colore di default
|
||||
m_GrpRadix.SetColor( Color( 0, 0, 0)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -93,7 +96,7 @@ GeomDB::Load( const std::string& sFileIn)
|
||||
// ciclo di lettura dei nodi
|
||||
bOk = true ;
|
||||
do {
|
||||
if ( ! LoadOneNode( TheScanner, bEnd)) {
|
||||
if ( ! LoadOneObj( TheScanner, bEnd)) {
|
||||
bOk = false ;
|
||||
string sOut = "GeomDbLoad : Error on line " + ToString( TheScanner.GetCurrLineNbr()) ;
|
||||
LOG_ERROR( GetEGkLogger(), sOut.c_str())
|
||||
@@ -130,11 +133,11 @@ GeomDB::LoadStart( Scanner& TheScanner)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::LoadOneNode( Scanner& TheScanner, bool& bEnd)
|
||||
GeomDB::LoadOneObj( Scanner& TheScanner, bool& bEnd)
|
||||
{
|
||||
int nParentId ;
|
||||
string sType ;
|
||||
GdbNode* pGdbNode ;
|
||||
int nParentId ;
|
||||
string sType ;
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// in generale non è fine file
|
||||
@@ -151,27 +154,27 @@ GeomDB::LoadOneNode( Scanner& TheScanner, bool& bEnd)
|
||||
}
|
||||
// se gruppo
|
||||
else if ( sType == GdbGroup::GetKey()) {
|
||||
pGdbNode = new( nothrow) GdbGroup ;
|
||||
pGdbObj = new( nothrow) GdbGroup ;
|
||||
}
|
||||
// se copia TODO ("X_CPY")..
|
||||
//else if ( sType == GdbCopy::GetKey) {
|
||||
// pGdbNode = new( nothrow) GdbCopy ;
|
||||
// pGdbObj = new( nothrow) GdbCopy ;
|
||||
//}
|
||||
// altrimenti oggetto geometrico
|
||||
else
|
||||
pGdbNode = new( nothrow) GdbObj ;
|
||||
pGdbObj = new( nothrow) GdbGeo ;
|
||||
|
||||
// verifico il nodo GDB
|
||||
if ( pGdbNode == nullptr)
|
||||
// verifico l'oggetto GDB
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// se lettura dati e inserimento nel DB vanno bene
|
||||
if ( pGdbNode->Load( sType, TheScanner, nParentId) &&
|
||||
AddToGeomDB( pGdbNode, nParentId))
|
||||
if ( pGdbObj->Load( sType, TheScanner, nParentId) &&
|
||||
AddToGeomDB( pGdbObj, nParentId))
|
||||
return true ;
|
||||
// altrimenti errore
|
||||
else {
|
||||
delete pGdbNode ;
|
||||
delete pGdbObj ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -190,15 +193,15 @@ GeomDB::Save( const std::string& sFileOut) const
|
||||
|
||||
// intestazione
|
||||
ofSave << "START" << endl ;
|
||||
ofSave << "GeomDB,1.4a4" << endl ;
|
||||
ofSave << "GeomDB,1.5c1" << endl ;
|
||||
// ciclo di scrittura degli oggetti
|
||||
bool bOk = true ;
|
||||
const GdbNode* pGdbNode = m_GrpRadix.GetFirstNode() ;
|
||||
while ( pGdbNode != nullptr) {
|
||||
const GdbObj* pGdbObj = m_GrpRadix.GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
// oggetto geometrico
|
||||
if ( ! pGdbNode->Save( ofSave))
|
||||
if ( ! pGdbObj->Save( ofSave))
|
||||
bOk = false ;
|
||||
pGdbNode = pGdbNode->GetNext() ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
ofSave << "END" << endl ;
|
||||
|
||||
@@ -210,14 +213,14 @@ GeomDB::Save( const std::string& sFileOut) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::ExistsNode( int nId) const
|
||||
GeomDB::ExistsObj( int nId) const
|
||||
{
|
||||
return ( (const_cast<GeomDB*>(this))->GetGdbNode(nId) != nullptr) ;
|
||||
return ( (const_cast<GeomDB*>(this))->GetGdbObj( nId) != nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
GdbNode*
|
||||
GeomDB::GetGdbNode( int nId)
|
||||
GdbObj*
|
||||
GeomDB::GetGdbObj( int nId)
|
||||
{
|
||||
// impossibile
|
||||
if ( nId < GDB_ID_ROOT)
|
||||
@@ -227,19 +230,19 @@ GeomDB::GetGdbNode( int nId)
|
||||
return &m_GrpRadix ;
|
||||
// un nodo qualubque
|
||||
else
|
||||
return m_IdManager.FindNode( nId) ;
|
||||
return m_IdManager.FindObj( nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::AddToGeomDB( GdbNode* pGNode, int nParentId)
|
||||
GeomDB::AddToGeomDB( GdbObj* pGObj, int nParentId)
|
||||
{
|
||||
// verifico validità oggetto puntato
|
||||
if ( pGNode == nullptr)
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// verifica validità e unicità del nome
|
||||
if ( pGNode->m_nId <= GDB_ID_ROOT || ExistsNode( pGNode->m_nId))
|
||||
if ( pGObj->m_nId <= GDB_ID_ROOT || ExistsObj( pGObj->m_nId))
|
||||
return false ;
|
||||
|
||||
// cerco il padre
|
||||
@@ -247,14 +250,14 @@ GeomDB::AddToGeomDB( GdbNode* pGNode, int nParentId)
|
||||
if ( pGroup == nullptr)
|
||||
return false ;
|
||||
// inserisco in coda alla lista del padre
|
||||
if ( ! pGNode->AddTail( pGroup))
|
||||
if ( ! pGObj->AddTail( pGroup))
|
||||
return false ;
|
||||
|
||||
// aggiorno gestore Id
|
||||
m_IdManager.UpdateMaxId( pGNode->m_nId) ;
|
||||
m_IdManager.UpdateMaxId( pGObj->m_nId) ;
|
||||
|
||||
// inserisco in mappa nomi
|
||||
return m_IdManager.AddNode( pGNode->m_nId, pGNode) ;
|
||||
return m_IdManager.AddObj( pGObj->m_nId, pGObj) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -270,7 +273,7 @@ GeomDB::AddGroup( int nId, int nParentId, const Frame3d& frFrame)
|
||||
// verifico validità Id
|
||||
if ( nId <= GDB_ID_ROOT)
|
||||
nId = m_IdManager.GetNewId() ;
|
||||
if ( ExistsNode( nId))
|
||||
if ( ExistsObj( nId))
|
||||
return GDB_ID_NULL ;
|
||||
// alloco gruppo Gdb
|
||||
pGdbGroup = new(nothrow) GdbGroup ;
|
||||
@@ -293,7 +296,7 @@ GeomDB::AddGroup( int nId, int nParentId, const Frame3d& frFrame)
|
||||
int
|
||||
GeomDB::AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj)
|
||||
{
|
||||
GdbObj* pGdbObj ;
|
||||
GdbGeo* pGdbGeo ;
|
||||
|
||||
|
||||
// assegno GeoObj a gestore puntatore con rilascio automatico
|
||||
@@ -301,22 +304,22 @@ GeomDB::AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj)
|
||||
// verifico validità identificativo
|
||||
if ( nId <= GDB_ID_ROOT)
|
||||
nId = m_IdManager.GetNewId() ;
|
||||
if ( ExistsNode( nId))
|
||||
if ( ExistsObj( nId))
|
||||
return GDB_ID_NULL ;
|
||||
// verifico validità oggetto Geo
|
||||
if ( ! IsValid( pRPGeoObj) || ! pRPGeoObj->IsValid())
|
||||
return GDB_ID_NULL ;
|
||||
// alloco oggetto Gdb
|
||||
pGdbObj = new(nothrow) GdbObj ;
|
||||
if ( pGdbObj == nullptr)
|
||||
pGdbGeo = new(nothrow) GdbGeo ;
|
||||
if ( pGdbGeo == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
// assegno identificativo
|
||||
pGdbObj->m_nId = nId ;
|
||||
pGdbGeo->m_nId = nId ;
|
||||
// assegno dati
|
||||
pGdbObj->m_pGeoObj = Release( pRPGeoObj) ;
|
||||
pGdbGeo->m_pGeoObj = Release( pRPGeoObj) ;
|
||||
// inserisco nel DB
|
||||
if ( ! AddToGeomDB( pGdbObj, nParentId)) {
|
||||
delete pGdbObj ;
|
||||
if ( ! AddToGeomDB( pGdbGeo, nParentId)) {
|
||||
delete pGdbGeo ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
@@ -327,18 +330,18 @@ GeomDB::AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj)
|
||||
GdbType
|
||||
GeomDB::GetGdbType( int nId) const
|
||||
{
|
||||
const GdbNode* pGdbNode ;
|
||||
const GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// recupero il nodo
|
||||
if ( ( pGdbNode = (const_cast<GeomDB*> (this))->GetGdbNode( nId)) == nullptr)
|
||||
// recupero l'oggetto
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*> (this))->GetGdbObj( nId)) == nullptr)
|
||||
return GDB_NONE ;
|
||||
|
||||
// se oggetto geometrico
|
||||
if ( ::GetGdbObj( pGdbNode) != nullptr)
|
||||
if ( ::GetGdbGeo( pGdbObj) != nullptr)
|
||||
return GDB_GEO ;
|
||||
// se gruppo
|
||||
else if ( ::GetGdbGroup( pGdbNode) != nullptr)
|
||||
else if ( ::GetGdbGroup( pGdbObj) != nullptr)
|
||||
return GDB_GROUP ;
|
||||
// altro
|
||||
else
|
||||
@@ -349,25 +352,21 @@ GeomDB::GetGdbType( int nId) const
|
||||
IGeoObj*
|
||||
GeomDB::GetGeoObj( int nId)
|
||||
{
|
||||
const GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// recupero l'oggetto Gdb
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
const GdbGeo* pGdbGeo ;
|
||||
if ( ( pGdbGeo = GetGdbGeo( nId)) == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
// restituisco il suo contenuto geometrico
|
||||
return pGdbObj->m_pGeoObj ;
|
||||
return pGdbGeo->m_pGeoObj ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IGeoFrame3d*
|
||||
GeomDB::GetGeoFrame( int nId)
|
||||
{
|
||||
GdbGroup* pGdbGroup ;
|
||||
|
||||
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
@@ -404,7 +403,7 @@ GeomDB::GetGroupGlobFrame( int nId, Frame3d& frGlob) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetGroupNodes( int nId) const
|
||||
GeomDB::GetGroupObjs( int nId) const
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
const GdbGroup* pGdbGroup ;
|
||||
@@ -412,35 +411,35 @@ GeomDB::GetGroupNodes( int nId) const
|
||||
return 0 ;
|
||||
|
||||
// restituisco il numero di nodi (figli)
|
||||
return pGdbGroup->GetNodeCount() ;
|
||||
return pGdbGroup->GetObjCount() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetParentId( int nId) const
|
||||
{
|
||||
// recupero il nodo Gdb
|
||||
const GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = (const_cast<GeomDB*> (this))->GetGdbNode( nId)) == nullptr)
|
||||
// recupero l'oggetto Gdb
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*> (this))->GetGdbObj( nId)) == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// restituisco l'Id del padre
|
||||
return pGdbNode->GetParentId() ;
|
||||
return pGdbObj->GetParentId() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::GetLocalBBox( int nId, BBox3d& b3Loc) const
|
||||
{
|
||||
const GdbNode* pGdbNode ;
|
||||
const GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// recupero l'oggetto
|
||||
if ( ( pGdbNode = (const_cast<GeomDB*> (this))->GetGdbNode( nId)) == nullptr)
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*> (this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// eseguo l'operazione
|
||||
return pGdbNode->GetLocalBBox( b3Loc) ;
|
||||
return pGdbObj->GetLocalBBox( b3Loc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -448,17 +447,17 @@ bool
|
||||
GeomDB::GetGlobalBBox( int nId, BBox3d& b3Glob) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = (const_cast<GeomDB*> (this))->GetGdbNode( nId)) == nullptr)
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*> (this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frGlob ;
|
||||
if ( ! GetGroupGlobFrame( pGdbNode->GetParentId(), frGlob))
|
||||
if ( ! GetGroupGlobFrame( pGdbObj->GetParentId(), frGlob))
|
||||
return false ;
|
||||
|
||||
// eseguo l'operazione
|
||||
return pGdbNode->GetBBox( frGlob, b3Glob) ;
|
||||
return pGdbObj->GetBBox( frGlob, b3Glob) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -466,20 +465,20 @@ bool
|
||||
GeomDB::GetRefBBox( int nId, const Frame3d& frRef, BBox3d& b3Ref) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = (const_cast<GeomDB*> (this))->GetGdbNode( nId)) == nullptr)
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*> (this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frGlob ;
|
||||
if ( ! GetGroupGlobFrame( pGdbNode->GetParentId(), frGlob))
|
||||
if ( ! GetGroupGlobFrame( pGdbObj->GetParentId(), frGlob))
|
||||
return false ;
|
||||
|
||||
// lo porto nel riferimento passato
|
||||
frGlob.ToLoc( frRef) ;
|
||||
|
||||
// eseguo l'operazione
|
||||
return pGdbNode->GetBBox( frGlob, b3Ref) ;
|
||||
return pGdbObj->GetBBox( frGlob, b3Ref) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -489,22 +488,22 @@ GeomDB::Copy( int nIdSou, int nIdDest, int nParentIdDest)
|
||||
// verifico Id destinazione
|
||||
if ( nIdDest <= GDB_ID_ROOT)
|
||||
nIdDest = m_IdManager.GetNewId() ;
|
||||
if ( ExistsNode( nIdDest))
|
||||
if ( ExistsObj( nIdDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// verifico esistenza del sorgente
|
||||
GdbNode* pGdNSou ;
|
||||
if ( ( pGdNSou = GetGdbNode( nIdSou)) == nullptr)
|
||||
GdbObj* pGdOSou ;
|
||||
if ( ( pGdOSou = GetGdbObj( nIdSou)) == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// eseguo la copia
|
||||
GdbNode* pGdNDest ;
|
||||
if ( ( pGdNDest = pGdNSou->Clone( nIdDest, m_IdManager)) == nullptr)
|
||||
GdbObj* pGdODest ;
|
||||
if ( ( pGdODest = pGdOSou->Clone( nIdDest, m_IdManager)) == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// inserisco nel DB
|
||||
if ( ! AddToGeomDB( pGdNDest, nParentIdDest)) {
|
||||
delete pGdNDest ;
|
||||
if ( ! AddToGeomDB( pGdODest, nParentIdDest)) {
|
||||
delete pGdODest ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
@@ -518,12 +517,12 @@ GeomDB::CopyGlob( int nIdSou, int nIdDest, int nParentIdDest)
|
||||
// verifico Id destinazione
|
||||
if ( nIdDest <= GDB_ID_ROOT)
|
||||
nIdDest = m_IdManager.GetNewId() ;
|
||||
if ( ExistsNode( nIdDest))
|
||||
if ( ExistsObj( nIdDest))
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// verifico esistenza del sorgente
|
||||
GdbNode* pGdNSou ;
|
||||
if ( ( pGdNSou = GetGdbNode( nIdSou)) == nullptr)
|
||||
GdbObj* pGdOSou ;
|
||||
if ( ( pGdOSou = GetGdbObj( nIdSou)) == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// recupero il riferimento del sorgente
|
||||
@@ -537,19 +536,19 @@ GeomDB::CopyGlob( int nIdSou, int nIdDest, int nParentIdDest)
|
||||
return false ;
|
||||
|
||||
// eseguo la copia
|
||||
GdbNode* pGdNDest ;
|
||||
if ( ( pGdNDest = pGdNSou->Clone( nIdDest, m_IdManager)) == nullptr)
|
||||
GdbObj* pGdODest ;
|
||||
if ( ( pGdODest = pGdOSou->Clone( nIdDest, m_IdManager)) == nullptr)
|
||||
return GDB_ID_NULL ;
|
||||
|
||||
// porto la copia da riferimento sorgente a quello destinazione
|
||||
if ( ! AreSameFrame( frSou, frDest)) {
|
||||
pGdNDest->ToGlob( frSou) ;
|
||||
pGdNDest->ToLoc( frDest) ;
|
||||
pGdODest->ToGlob( frSou) ;
|
||||
pGdODest->ToLoc( frDest) ;
|
||||
}
|
||||
|
||||
// inserisco nel DB
|
||||
if ( ! AddToGeomDB( pGdNDest, nParentIdDest)) {
|
||||
delete pGdNDest ;
|
||||
if ( ! AddToGeomDB( pGdODest, nParentIdDest)) {
|
||||
delete pGdODest ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
@@ -560,8 +559,8 @@ GeomDB::CopyGlob( int nIdSou, int nIdDest, int nParentIdDest)
|
||||
bool
|
||||
GeomDB::Erase( int nId)
|
||||
{
|
||||
INTPGDBN_UMAP::const_iterator Iter ;
|
||||
GdbNode* pGdbNode ;
|
||||
INTPGDBO_UMAP::const_iterator Iter ;
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// non si può cancellare il gruppo radice (escludo anche Id non validi)
|
||||
@@ -569,18 +568,18 @@ GeomDB::Erase( int nId)
|
||||
return false ;
|
||||
|
||||
// recupero l'oggetto
|
||||
pGdbNode = m_IdManager.FindNode( nId) ;
|
||||
if ( pGdbNode == nullptr)
|
||||
pGdbObj = m_IdManager.FindObj( nId) ;
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// elimino da mappa dei nomi
|
||||
m_IdManager.RemoveNode( nId) ;
|
||||
m_IdManager.RemoveObj( nId) ;
|
||||
|
||||
// lo tolgo dalla lista
|
||||
pGdbNode->Remove() ;
|
||||
pGdbObj->Remove() ;
|
||||
|
||||
// lo disalloco (distruttore virtuale)
|
||||
delete pGdbNode ;
|
||||
delete pGdbObj ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -590,11 +589,11 @@ bool
|
||||
GeomDB::Translate( int nId, const Vector3d& vtMove)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// eseguo la traslazione
|
||||
return pGdbNode->Translate( vtMove) ;
|
||||
return pGdbObj->Translate( vtMove) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -602,8 +601,8 @@ bool
|
||||
GeomDB::TranslateGlob( int nId, const Vector3d& vtMove)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frObj ;
|
||||
@@ -614,7 +613,7 @@ GeomDB::TranslateGlob( int nId, const Vector3d& vtMove)
|
||||
if ( ! vtMoveLoc.ToLoc( frObj))
|
||||
return false ;
|
||||
// eseguo la traslazione
|
||||
return pGdbNode->Translate( vtMoveLoc) ;
|
||||
return pGdbObj->Translate( vtMoveLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -622,11 +621,11 @@ bool
|
||||
GeomDB::Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// eseguo la rotazione
|
||||
return pGdbNode->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
return pGdbObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -634,8 +633,8 @@ bool
|
||||
GeomDB::RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frObj ;
|
||||
@@ -649,7 +648,7 @@ GeomDB::RotateGlob( int nId, const Point3d& ptAx, const Vector3d& vtAx, double d
|
||||
if ( ! vtAxLoc.ToLoc( frObj))
|
||||
return false ;
|
||||
// eseguo la rotazione
|
||||
return pGdbNode->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
||||
return pGdbObj->Rotate( ptAxLoc, vtAxLoc, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -657,11 +656,11 @@ bool
|
||||
GeomDB::Scale( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// eseguo la scalatura
|
||||
return pGdbNode->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
return pGdbObj->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -669,8 +668,8 @@ bool
|
||||
GeomDB::ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frObj ;
|
||||
@@ -681,7 +680,7 @@ GeomDB::ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY
|
||||
if ( ! frRefLoc.ToLoc( frObj))
|
||||
return false ;
|
||||
// eseguo la scalatura
|
||||
return pGdbNode->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
return pGdbObj->Scale( frRefLoc, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -689,11 +688,11 @@ bool
|
||||
GeomDB::Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
return pGdbNode->Mirror( ptOn, vtNorm) ;
|
||||
return pGdbObj->Mirror( ptOn, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -701,8 +700,8 @@ bool
|
||||
GeomDB::MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbNode* pGdbNode ;
|
||||
if ( ( pGdbNode = GetGdbNode( nId)) == nullptr)
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento in cui è immerso
|
||||
Frame3d frObj ;
|
||||
@@ -716,5 +715,64 @@ GeomDB::MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
if ( ! vtNormLoc.ToLoc( frObj))
|
||||
return false ;
|
||||
// eseguo l'operazione
|
||||
return pGdbNode->Mirror( ptOnLoc, vtNormLoc) ;
|
||||
return pGdbObj->Mirror( ptOnLoc, vtNormLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Attributes
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::DumpAttributes( int nId, string& sOut, const char* szNewLine) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*>(this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// eseguo il dump
|
||||
if ( pGdbObj->m_pAttribs != nullptr)
|
||||
return pGdbObj->m_pAttribs->Dump( sOut, szNewLine) ;
|
||||
else {
|
||||
Attribs attr ;
|
||||
return attr.Dump( sOut, szNewLine) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SetDefaultColor( Color cCol)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( GDB_ID_ROOT)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno il colore
|
||||
return pGdbObj->SetColor( cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SetColor( int nId, Color cCol)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno il colore
|
||||
return pGdbObj->SetColor( cCol) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::GetColor( int nId, Color& cCol) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*>(this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero il colore
|
||||
return pGdbObj->GetColor( cCol) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user