mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-22 18:45:38 +05:00
NPAL18604: Pb. of performance with MakeVertex. Fixed memory leak and improved OCAF data management for particular case.
This commit is contained in:
parent
c91537be6b
commit
e673545f08
@ -114,6 +114,7 @@ GEOM_Engine::GEOM_Engine()
|
|||||||
|
|
||||||
_OCAFApp = new GEOM_Application();
|
_OCAFApp = new GEOM_Application();
|
||||||
_UndoLimit = 10;
|
_UndoLimit = 10;
|
||||||
|
_lastObjectTag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -179,7 +180,23 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType)
|
|||||||
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
|
||||||
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
|
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
|
||||||
|
|
||||||
TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main());
|
//TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main());
|
||||||
|
// NPAL18604: use existing label to decrease memory usage,
|
||||||
|
// if this label has been freed (object deleted)
|
||||||
|
bool useExisting = false;
|
||||||
|
TDF_Label aChild;
|
||||||
|
if (_lastObjectTag > 0) {
|
||||||
|
aChild = aDoc->Main().FindChild(_lastObjectTag, Standard_False);
|
||||||
|
if (!aChild.IsAttribute(TDataStd_TreeNode::GetDefaultTreeID())) {
|
||||||
|
useExisting = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!useExisting) {
|
||||||
|
// create new label
|
||||||
|
aChild = TDF_TagSource::NewChild(aDoc->Main());
|
||||||
|
_lastObjectTag = aChild.Tag();
|
||||||
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, theType);
|
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, theType);
|
||||||
|
|
||||||
//Put an object in the map of created objects
|
//Put an object in the map of created objects
|
||||||
@ -204,7 +221,22 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
|||||||
Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID());
|
Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID());
|
||||||
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
|
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
|
||||||
|
|
||||||
TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main());
|
//TDF_Label aChild = TDF_TagSource::NewChild(aDoc->Main());
|
||||||
|
// NPAL18604: use existing label to decrease memory usage,
|
||||||
|
// if this label has been freed (object deleted)
|
||||||
|
bool useExisting = false;
|
||||||
|
TDF_Label aChild;
|
||||||
|
if (_lastObjectTag > 0) {
|
||||||
|
aChild = aDoc->Main().FindChild(_lastObjectTag, Standard_False);
|
||||||
|
if (!aChild.IsAttribute(TDataStd_TreeNode::GetDefaultTreeID())) {
|
||||||
|
useExisting = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!useExisting) {
|
||||||
|
// create new label
|
||||||
|
aChild = TDF_TagSource::NewChild(aDoc->Main());
|
||||||
|
_lastObjectTag = aChild.Tag();
|
||||||
|
}
|
||||||
|
|
||||||
Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction();
|
Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction();
|
||||||
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type
|
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type
|
||||||
|
@ -101,6 +101,8 @@ class GEOM_Engine
|
|||||||
GEOM_DataMapOfAsciiStringTransient _objects;
|
GEOM_DataMapOfAsciiStringTransient _objects;
|
||||||
|
|
||||||
Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
|
Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
|
||||||
|
|
||||||
|
int _lastObjectTag;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -114,7 +114,7 @@ void GEOM_IOperations_i::FinishOperation()
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* AboutOperation
|
* AbortOperation
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void GEOM_IOperations_i::AbortOperation()
|
void GEOM_IOperations_i::AbortOperation()
|
||||||
@ -132,6 +132,6 @@ GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObjec
|
|||||||
if(theObject.IsNull()) return NULL;
|
if(theObject.IsNull()) return NULL;
|
||||||
TCollection_AsciiString anEntry;
|
TCollection_AsciiString anEntry;
|
||||||
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
|
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
|
||||||
GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_duplicate(_engine->GetObject(theObject->GetDocID(), anEntry.ToCString()));
|
GEOM::GEOM_Object_var GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
|
||||||
return GO._retn();
|
return GO._retn();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user