-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <TDataStd_UAttribute.hxx>
#include <TDocStd_Document.hxx>
#include <TDocStd_Owner.hxx>
-#include <TFunction_Driver.hxx>
#include <TFunction_DriverTable.hxx>
#include "utilities.h"
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theLabel, anEntry);
- Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theLabel.Data());
- if(aDoc.IsNull()) return NULL;
-
- Handle(TDataStd_Integer) anID;
- if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return NULL;
-
GEOM_Engine* anEngine = GEOM_Engine::GetEngine();
if(anEngine == NULL) return NULL;
- return anEngine->GetObject(anID->Get(), anEntry.ToCString());
+ return anEngine->GetObject(anEntry.ToCString());
}
//=============================================================================
*/
//=============================================================================
GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry)
- : _label(theEntry), _ior(""), _docID(-1)
+ : _label(theEntry), _ior("")
{
- Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data());
- if(!aDoc.IsNull()) {
- Handle(TDataStd_Integer) anID;
- if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get();
- }
-
if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
_root = TDataStd_TreeNode::Set(theEntry);
}
*/
//=============================================================================
GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry, int theType)
-: _label(theEntry), _ior(""), _docID(-1)
+: _label(theEntry), _ior("")
{
- Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data());
- if(!aDoc.IsNull()) {
- Handle(TDataStd_Integer) anID;
- if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get();
- }
-
theEntry.ForgetAllAttributes(Standard_True);
if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
//=============================================================================
GEOM_BaseObject::~GEOM_BaseObject()
{
- MESSAGE("GEOM_BaseObject::~GEOM_BaseObject()");
+ //MESSAGE("GEOM_BaseObject::~GEOM_BaseObject()");
}
//=============================================================================
//=============================================================================
int GEOM_BaseObject::GetType()
{
+ int type = -1;
Handle(TDataStd_Integer) aType;
- if(!_label.FindChild(TYPE_LABEL).FindAttribute(TDataStd_Integer::GetID(), aType)) return -1;
+ if(_label.FindChild(TYPE_LABEL).FindAttribute(TDataStd_Integer::GetID(), aType))
+ type = aType->Get();
- return aType->Get();
+ return type;
}
//=============================================================================
TDataStd_Integer::Set(aTicLabel, aTic + 1);
}
-
-//=============================================================================
-/*!
- * GetDocID
- */
-//=============================================================================
-int GEOM_BaseObject::GetDocID()
-{
- return _docID;
-}
-
//=============================================================================
/*!
* SetName
aName = aNameAttr->Get();
// do not return pointer of local variable
// return aName.ToCString();
- // the following code could lead to memory leak, so take care about recieved pointer
+ // the following code could lead to memory leak, so take care about received pointer
return aName;
}
*/
//================================================================================
-Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver()
+Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver(int funNb)
{
- Handle(TFunction_Driver) aDriver;
-
- Handle(GEOM_Function) function = GetFunction(1);
+ Handle(TFunction_Driver) driver;
+ Handle(GEOM_Function) function = GetFunction(funNb);
if ( !function.IsNull() )
{
Standard_GUID aGUID = function->GetDriverGUID();
- if ( TFunction_DriverTable::Get()->FindDriver(aGUID, aDriver))
- aDriver->Init( function->GetEntry() );
+ if ( TFunction_DriverTable::Get()->FindDriver(aGUID, driver ))
+ driver->Init( function->GetEntry() );
}
- return aDriver;
+ return driver;
}
//=============================================================================
return _label.FindChild(FREE_LABEL);
}
-IMPLEMENT_STANDARD_HANDLE (GEOM_BaseObject, Standard_Transient );
-IMPLEMENT_STANDARD_RTTIEXT(GEOM_BaseObject, Standard_Transient );
+IMPLEMENT_STANDARD_RTTIEXT(GEOM_BaseObject, Standard_Transient )