Spent the day thinking at the OpenCascade and NaroCAD architecture.
1. Reviewed the most important OpenCascade classes and their architecture:
- the V3d_Viewer that creates with the method CreateView a new V3d_View, the V3D_View to which it can be attached a window handle and the AIS_InteractiveCOntext that receives as parameter a V3d_Viewer,
- the same for 2D: the V2d_Viewer to which V2d_View can be attached, the AIS2D_InteractiveContext for managing the graphic behaviour,
- analyzed as data container the TDocStd_Document that has the methods NewCommand for starting an Undo operation, CommitCommand to close an Undo Operation, the Main() that returns the root Label to the data structure,
- looked how the commands are prepared for Undo using OCAF: the FunctionDriver class is initialized with the Root Label got from document. To implement a Rectangle drawing command a RectangleDriver that inherits from FunctionDriver is implemented and also it has to implement the MustExecute() and Execute() methods which adds the model as child Label to the root Label tree. This solution seems to be an Command design pattern the only difference being that the commands are identified by GUIDs,
- another important classes for the architecture are: the DriverTable that has the methods FindDriver, AddDriver used for retrieving command drivers, the AISViewer class used to define an interactive viewer attribute from a Label (with the methods New, Find and Get), the AISPresentation class that associates an AIS_InteractiveObject to a Label data structure.
All these classes will be used for creating Views, defining commands with Undo, store application data, connect application data with the Viewers.
2. Another area that was analyzed is implementing an Multiview architecture: the application has a main form that has child windows, each child can be split into one to four views. The implementation will be made using MDI forms, a TableLayoutPanel that holds 1-4 controls which will be set as rendering areas for OpenCascade. A solution with having a transparent Tree View over the OpenCascade model doesn't seem to work properly. For the moment the Tree View will be implemented on the left side of the Views.
3. Started also some development. Implemented a basic Controller class, implemented basic View, implemented a MultiView interface that will be inherited by the Forms to support Multiview. Next development steps to achieve the previously proposed tasks will be:
- add OpenCascade code to see if the engine can render on a custom control from the View,
- extend the Controller class to porcess Operations like Zoom, Pan, Rotate,
- implement the 3dView, 3dViewer from OpenCascade in the application,
- make the model loading from file code.
When these tasks will be made the design document will be extended with more explanations in order to create the big integration picture of all the components, OCAF integration will be analyzed and probably also some wrappers to this component will be needed.