mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0031920: Application Framework - speed up methods of getting label by entry and vice versa
A table for fast access to the labels by entry is implemented in OCAF document. A method TDF_Data::SetAccessByEntries(true) fills-in a table for fast access to the labels. New labels, created later will be added to the table automatically. The method TDF_Tool::Label() will search the entry in the table and then, if not found, will call the old code. Disabling of usage of the table (by calling of TDF_Data::SetAccessByEntries(false)) cleans the internal table of entries - labels. By default, the table is not used. This improvement is useful for large documents with a lot of labels, and if the application uses entries to get labels. The application should call TDF_Data::SetAccessByEntries(true) for a document and then, the method TDF_Tool::Label() called inside OCAF and XCAF will use the fast access to the labels and speed-up the application. Also, the method TDF_Tool::Entry() is improved (by MPV). Modified files: - TDF_Data.hxx and cxx: the new methods SetAccessByEntries(bool), IsAccessByEntries() and GetLabel(entry) are implemented. No need to use the method GetLabel() directly. It is called in TDF_Tool::Label(). - TDF_Label.cxx: adding of a newly created label to the table of entries - labels. - TDF_Tool.cxx: the method Entry() is accelerated (by MPV) and Label() is improved to call TDF_Data::GetLabel(). - DDF_DataCommands.cxx: a new draw-command is added SetAccessByEntry, which sets or unsets usage of the table for fast access to the labels. Usage of the draw-command is illustrated in a new test "bugs caf bug31920". Tests: - bugs caf bug31920: a new simple test to check TDF_Tool::Label() when fast access to the labels is on. Doc: - dox\upgrade\upgrade.md is extended for new information
This commit is contained in:
@@ -345,6 +345,9 @@ TDF_LabelNode* TDF_Label::FindOrAddChild
|
||||
myLabelNode->myFirstChild = childLabelNode;
|
||||
else // ... somewhere.
|
||||
lastLnp->myBrother = childLabelNode;
|
||||
// Update table for fast access to the labels.
|
||||
if (myLabelNode->Data()->IsAccessByEntries())
|
||||
myLabelNode->Data()->RegisterLabel (childLabelNode);
|
||||
}
|
||||
|
||||
if (lastLnp) //agv 14.07.2010
|
||||
|
Reference in New Issue
Block a user