Date: 25-10-2001
Subject: ModelViewer Documentation
Author: Sander Groenen
InhoudsOpgave 1
1. ModelViewer Technical Documentation 2
1.2 Introduction 2
1.3 Modelviewer Design 3
2 ModelViewer Package Collection explanation 4
2.1 Modelviewer 4
2.2 TabstrCanvas 4
2.2.1 TBorlandCanvas 4
2.3 TabstrLayoutEngine 4
2.3.1 TlayoutEngineSimple 5
2.4 TshapeList and TlineList 5
2.4.1 TabstrShape and TabstrLine 5
3 Shape library explanation 6
3.1 Tsquare, Tcircle and Tdiamond 6
3.2 Derived From Tsquare 6
3.3 Derived From Tcircle 6
3.4 Derived From Tdiamond 6
3.5 Derived from TLine 6
3.6 Tvector 7
The modelviewer component was constructed to be able to view all kinds of models that are created with the modelbuilder program. With the modelviewer one can put together any kind of model that is used within the kiss modelling language, like an object diagram or a kiss model. Basically the modelviewer consists of two elemental parts, namely the modelviewer package collection, which allows you to draw shapes on the canvas, search through your shapes and lines or set properties such as linewidth, color or penstyle, and second the shape library which consists of all the available shapes to use in the modelviewer such as a double dotted square or an kiss position coordinator symbol.
The figure in paragraph 1.3 below shows all separate components of the modelviewer package collection and the shape library and it also shows what kind of hierarchy is used. For more essential information on the individual components see chapter 2 and 3.
The modelviewer component is a composite that exists of a TabstrCanvas, a TshapeList, a TlineList, a TabstrLayoutEngine. It provides methods to draw all shapes, set line width , set filling color etc. In other words its methods, like any composite does, are written in terms of it’s composites. The only individual functionality it provides are events to respond to, such as an onpaint event handler or onmousemove event handler. These handlers are used to draw all the shapes and lines on the canvas and to drag a shape across the canvas.
The TabstrCanvas is a pure virtual abstract base class for a canvas class and it provides methods for drawing on a canvas such as lineto, circle, ellipse, text rectangle etc. Pure virtual means that the methods it provides are only declared but not defined. It only provides a base class from which other none pure virtual canvas classes can be derived and thereby defining the declared methods.
The TabstrLayout engine is a pure virtual abstract base class for a layout engine class and it provides method to rearrange the co-ordinates of al l currently present shapes so none of the shapes will overlap each other on the canvas. Again it only has methods that are declared but not defined.
The TlayoutEngineSimple class is derived from the TabstrLayoutEngine class and implements all the methods declared in TabstrLayoutEngine using a simple algorithm for placing all the shapes, namely: put all shapes under each other in the middle of the canvas, regardless of any interconnection by means of lines.
The two lists in the modelviewer component are used to store, add and delete all shapes and lines within the modelviewer. Both lists are composites because they both contain the template list type of the standard C++ library: std. Although slightly different, the two lists show great comparison; they both provide methods to go through, search, delete and add the elements(shapes,lines) .
TabstrShape and TabstrLine are two abstract base classes that are not pure virtual. They provide a basic functionality that all shapes and lines should have, such as setting their co-ordinates, width and height. All shapes derived from these classes extend their functionality by defining how they are drawn , the rest they retrieve from these two base classes.