I am using OCAF and I am creating documents with attributes of our own types and our own presentation drivers. Some of these presentations are very costly to compute. Therefore the user may decide to hide them when storing the document. It is expected that during retrieval the presentations of hidden attributes are not computed.
Hiding attributes is implemented here as getting the TPrsStd_AISPresentation attribute that is attached to the same label and calling its Erase() method with Standard_False as argument.
This has worked well with OCCT versions < 7.0.0. With OCCT 7.3.0 I have realized that the presentations are computed even when attributes are hidden. I have checked with my debugger why this happens. It seems as if the following was the reason:
- There are no TPrsStd_AISPresentation attributes stored anymore. Instead there are TDataXtd_Presentation attributes in the document that is being retrieved.
- The command TPrsStd_AISViewer::New(rootLabel, viewer) visits all labels and checks whether there is a TDataXtd_Presentation attribute. If such an attribute is found, it creates a TPrsStd_AISPresentation at the same label.
- The method AfterResume() of TPrsStd_AISPresentation that is called during presentation attribute creation calls AISUpdate() of the presentation attribute instance. AISUpdate() causes the presentation driver to compute an updated presentation.
This is unexpected and annoying. Am I doing something wrong? How can I hide an attribute such that its presentation is not updated during document retrieval? Or is this an OCCT bug? Thank you very much for any hint.