occt 7.4.0 Doubts about using ocaf

Hello everyone, I don't know if you use OCAF framework. During use, I am full of confusion, can you please help me explain by referring to the attached picture?

Attachment picture 1 is the result of viewing the XmlOcaf file through DFBrowser. Attachment picture 2 is a code snippet of me.

1)Attachment picture 1 mark 1 and mark 2 are two different spheres, mark 3 is a new shape obtained by Boolean addition,

I am referring to the code written by the ocaf example program, and one of the code fragments is shown in the attached picture 2. Why use the code at mark 3

of attachment picture 2, what is the role here?

void Generated (const TopoDS_Shape& newShape); 

void Generated (const TopoDS_Shape& oldShape, 

const TopoDS_Shape& newShape);void Delete (const TopoDS_Shape& oldShape);

void Modify (const TopoDS_Shape& oldShape, const TopoDS_Shape& newShape);

void Select (const TopoDS_Shape& aShape, const TopoDS_Shape& inShape);

What are these 5 functions for?

2)After the code at the mark 3 of the attachment picture 2, a shape at the mark 3 of the attachment picture 1 is obtained. However, in V3d_Viewer, the two spheres at

the mark 1 and mark 2 of the attachment picture 1 are still displayed,What do I need to do to make it disappear?

That is to say, when I pass the Boolean addition operation, how to delete the two shapes before the Boolean addition?

3)In order to solve the problem in 2), I added the Erase process at the mark 4 of the attachment picture 2, so that in V3d_Viewer, the two spheres at the mark 1

of the attachment picture 1 and the mark 2 at the attachment picture 1 really disappeared, reaching my Purpose, is this correct?

4)What is the role of the last <shapes><shapes> in the XmlOcaf format file? What is the data in this tag used for? Attachment picture 1

mark 4 SOLID: MODIFY What is the use? I refer to occt's document about ocaf, and found no explanation about it.

5)Can you provide me a TFunction_Driver for (Move, Zoom, Rotate) model and undo (Move, Zoom, Rotate) model?I defined one, refer to the attached picture 3.

This TFunction_Driver is normal in some cases and will crash in some cases. I wonder if there is any problem with this TFunction_Driver?

Can every shape operation (delete a face, add a point, etc.) to a model use this TFunction_Driver to realize the undo redo function?

What effect does this operation have on memory and file size?

6)I refer to occt's documentation about ocaf and find that it assigns a label to each child of a Shape. Is this necessary? What is the use of doing this?

Thank you all.

Attachments: