Home Page > Programming Samples and Tutorials > Overview > Turbine
Turbine C++ Sample
Turbine Sample
Source code for Turbine sample is available in Samples\VC
folder of the installation directory. If you are going to compile
the project we suggest to
copy whole VC directory to location outside of the installation folder.
Turbine is an MFC dialog-based application which
displays simplified model of a turbine using KernelCAD ActiveX control and allows to modify geometrical parameters of the
model.
Turbine sample demonstrates usage of three-tier design of an application which
incorporates 3D simulation.. In addition to GUI and KernelCAD software tiers
presented in the previous samples Turbine sample adds layer of classes which encapsulates
business or rather geometrical logic of the simulated process.
Implementation
Specifics of this sample is that the application uses two additional classes
which isolate geometrical relations of the model into separate classes, namely
Turbine and Blade classes. This separations helps isolate essential business
logic of the process, which helps with maintenance of the application and makes
it more reusable and less dependant on both User Interface side and 3D graphical
component (KernelCAD software).
Roles of classes:
CTubnineDlg - implements the GUI layer. CTubnineDlg does not know
anything about the geometry of the model. It just displays parameters, takes
their new values and passes it to the Geometry layer. This work is done in
CTurbineDlg::UpdateModel() method. It also takes display parameters from the
geometrical layer and updates the dialog. This is done by
CTurbineDlg::UpdatePage().
Turbine class. The highest level class in the geometrical layer is Turbine
class. It keeps most important parameters of the geometry, which are familiar
and useful to the End User . It also knows how to converts these parameters into
calls to KernelCAD software interfaces. Another role of the geometry layer is to
validate and handle invalid user input.
Blade class handles jobs related to a particular part of the model.
This separation and delegation of roles employs benefits of Object Oriented
approach, which is especially important in case of complicated processes and
geometries.
See also Visual C++ Samples, All samples
|