derive from TPrsStd_AISPresentation

I derived a class from TPrsStd_AISPresentation, and reimplemented AfterAddition and BeforeForget. Now, when I open a document, no presentations are displayed. What am I doing wrong here?

Svetlozar Kostadinov's picture

I suppose that simple deriving of TPrsStd_AISPresentation is not enough, because other class have to be derived also. I mean storage/retrieval drivers and maybe some other classes. According to OCAF documentation that I found, if you derive an attribute class, you must define your own file format, which is registered in RESOURCE and PLUGIN files. You can see by your own in the OCC FAQ http://www.filefactory.com/file/003744/n/96_FAQ_chm. Go to section "OCAF" -> "Getting started"
P.S. I tried this approach to derive TPrsStd_AISPresentation, but give up because of the lot of complexity related to defining new format. Maybe sometimes there's no other approach.

Dirk B's picture

Thanks for your reply and the nice FAQ. I'll try a little more to get my derived class to work. Actually I am trying to find out, which objects or presentations are redisplayed or removed after undo and redo. Do you have an idea how to do this?

Dirk

Dirk B's picture

I found a solution using TDocStd_Document::GetUndos() and ...GetRedos(). The "added" and "removed" labels are in the label list(TDF_Delta::Labels(...) of the last undo or the first redo. Just check out the dumps of the deltas.

Svetlozar Kostadinov's picture

Hi, I'm using GetUndos() and GetRedos() for my custom undo/redo operations. I set string name to each delta which is used to identify the exact command. Then after undo/redo I traverse the delta list and lookup the name of the first (or maybe last, I forgot) delta. Then I call the respective handler used to update the changes made to the OCAF structure. But the delta list traveral is tricky.