GL Studio Safety Critical Embedded C++ Runtime Library
gls_group.h
Go to the documentation of this file.
1 #ifndef _GLS_GROUP_H
2 #define _GLS_GROUP_H
3 
4 /*! \file gls_group.h
5 
6 \brief This header defines the GlsGroup class
7  in the GL Studio DO-178B Runtime Library.
8 
9 \par Copyright Information
10 Copyright (C) 1999-2012 The DiSTI Corporation<br>
11 Orlando, FL USA<br>
12 All rights reserved.<br>
13 
14  This file is copyrighted software and contains proprietary trade secrets of
15 DiSTI, and embodies substantial creative efforts as well as confidential
16 information, ideas, and expressions.
17 
18  Permission to use, and copy this software and its documentation for any
19 purpose is hereby granted per the Distribution Agreement and/or the Licensing
20 Agreement signed with DiSTI. This permission is granted provided that:
21  1. The above copyright notice appears in all copies.
22  2. That both the copyright notice and this permission notice appear in
23  the supporting documentation.
24  3. That the names DiSTI and GL Studio not be used in advertising or
25  publicity pertaining to distribution of the software without specific,
26  written prior permission of DiSTI.
27 
28  Permission to modify the software is granted, but not the right to
29 distribute the source code whether modified, or non-modified. Modifying the
30 software might invalidate the DO-178B certification package.
31 
32  Permission to distribute binaries produced by compiling source code, or
33 modified source code is granted, provided you:
34  1. Provide your name and address as the primary contact for the support
35  of your modified version.
36  2. Retain our contact information in regard to use of the base software.
37 
38  DiSTI does not provide warranty for this software or guarantee that it
39 satisfies any specification or requirement unless otherwise stated in a
40 specific contractual arrangement between the customer and DiSTI.
41 
42 */
43 
44 #include "gls_include.h"
45 #include "gls_composite_object.h"
47 #include "gls_class_invariant.h"
48 
49 /** This class implements a group of display objects.
50  * \invariant base class invariant, _objects.Invariant()
51  */
53 {
54 public:
56 
57  /** initialization parameters for a GlsGroup */
59  {
60  const GlsCompositeObject::InitParameters compositeInitParameters; /**< base class init parameters */
61 
62  GlsDisplayObjectArray::InitParameters objectArrayInitParameters; /**< init parameters for object array */
63 
64  /** create a copy of the init parameters with the object array init
65  * objects array replaced with the given array of objects
66  * \param newObjects new array of ojects
67  * \return copy of given init parameters with object array init objects array replaced
68  * \pre newObjects != GLS_NULL,
69  * newObjects array has initParameters.objectArrayInitParameters.numObjects elements
70  * \post none
71  */
72  InitParameters CopyWithObjectsArray( GlsDisplayObject* const *newObjects ) const;
73 
74  #if defined( GLS_DEBUG )
75  /** Determine if the initialization parameters are valid
76  * \return GLS_TRUE if valid else GLS_FALSE
77  * \pre none
78  * \post none
79  */
80  GlsBool IsValid( void ) const;
81  #endif // GLS_DEBUG
82  };
83 
84  /** Constructor - create an instance
85  * \param initParameters initialization parameters
86  * \param eventDispatcher event dispatcher for this object else GLS_NULL
87  * \pre initParameters.IsValid()
88  * \post instance created
89  */
90  GlsGroup( InitParameters &initParameters, GlsEventDispatcher* const eventDispatcher );
91 
92  /** Draws the objects in the group.
93  * \param gl GL State manager for OpenGL into which object is drawn
94  * \param time the elaspsed time in seconds since program start
95  * \pre time >= 0.0
96  * \post contained objects are drawn to OpenGL if visible and not blinked off
97  */
98  virtual void Draw( GlsStateManager &gl, const GlsFloat64 time );
99 
100  /** Provides a mechanism for performing regular calculations, separate
101  * from drawing.
102  * \param time The elaspsed time in seconds since program start
103  * \pre time >= 0.0
104  * \post calculations (if any) completed for all contained objects
105  */
106  virtual void Calculate( const GlsFloat64 time );
107 
108  /** Perform a pick test of the given point in window coordinates against this object
109  * \param windowCoord point in question
110  * \param inputManager input manager managing input for this object
111  * \param parentDrawMatrix draw matrix used when rendering parent object
112  * \return object that is picked by given window coordinate else GLS_NULL
113  * \pre windowCoord.IsValid(), GLMatrixAffineFIsValid( parentDrawMatrix )
114  * \post none
115  */
116  virtual GlsDisplayObject* PickTest( const GlsVector2D &windowCoord, GlsInputManager &inputManager,
117  const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix );
118 
119  /** Set the alpha mode of the contained objects
120  * \param alphaMode desired alpha mode
121  * \pre GlsAlphaModeIsValid( alphaMode )
122  * \post contained objects have new alpha mode
123  */
124  virtual void SetChildrenAlphaMode( const GlsAlphaMode alphaMode );
125 
126  /** Set the fill color of the contained objects
127  * \param fillColor desired fill color
128  * \pre fillColor.IsValid()
129  * \post contained objects have new fill color
130  */
131  virtual void SetChildrenFillColor( const GlsColor &fillColor );
132 
133  /** Set the line color of the contained objects
134  * \param lineColor desired line color
135  * \pre lineColor.IsValid()
136  * \post contained objects have new line color
137  */
138  virtual void SetChildrenLineColor( const GlsColor &lineColor );
139 
140  /** Set the line width of the contained objects
141  * \param lineWidth new line width, GlsRenderObject::LINE_WIDTH_MIN <= lineWidth <= GlsRenderObject::LINE_WIDTH_MAX
142  * \pre GlsLineWidthIsValid( lineWidth )
143  * \post contained objects have new line width
144  */
145  virtual void SetChildrenLineWidth( const GlsFloat32 lineWidth );
146 
147  /** Set the polygon mode of the contained objects
148  * \param polygonMode new polygon mode
149  * \pre GlsPolygonModeIsValid( polygonMode )
150  * \post contained objects have new polygon mode
151  */
152  virtual void SetChildrenPolygonMode( const GlsPolygonMode polygonMode );
153 
154 protected:
155  GlsDisplayObjectArray _objects; /**< array of display objects */
156 
157  /** Destructor - shall never be called
158  * \pre none
159  * \post none
160  */
161  virtual ~GlsGroup();
162 
163 private:
164  typedef GlsCompositeObject _BaseClass; /**< base class alias */
165 
166  // Disable implicit generated Members
167  GlsGroup& operator=( const GlsGroup &rhs );
168  GlsGroup( const GlsGroup &src );
169 };
170 
171 #endif // _GLS_GROUP_H
virtual void SetChildrenFillColor(const GlsColor &fillColor)
Definition: gls_color.h:47
bool GlsBool
Definition: gls_types.h:96
GlsDisplayObjectArray _objects
Definition: gls_group.h:155
Definition: gls_composite_object.h:58
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
Definition: gls_state_manager.h:63
Definition: gls_group.h:52
Definition: gls_input_manager.h:53
Definition: gls_group.h:58
virtual void Draw(GlsStateManager &gl, const GlsFloat64 time)
virtual void SetChildrenPolygonMode(const GlsPolygonMode polygonMode)
GlsAlphaMode
Definition: gls_render_settings.h:162
Definition: gls_event.h:304
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
virtual GlsDisplayObject * PickTest(const GlsVector2D &windowCoord, GlsInputManager &inputManager, const GlsMatrixAffineD::GLMatrixAffineF &parentDrawMatrix)
virtual ~GlsGroup()
GLfloat GLMatrixAffineF[DIMENSION *DIMENSION]
Definition: gls_matrix_affine_double.h:63
Definition: gls_composite_object.h:52
virtual void SetChildrenAlphaMode(const GlsAlphaMode alphaMode)
float GlsFloat32
Definition: gls_types.h:78
GlsDisplayObjectArray::InitParameters objectArrayInitParameters
Definition: gls_group.h:62
Definition: gls_display_object.h:64
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
This header defines the GlsCompositeObject class used in the GL Studio DO-178B Runtime Library...
double GlsFloat64
Definition: gls_types.h:87
Definition: gls_vertex.h:49
Definition: gls_display_object_array.h:58
virtual void SetChildrenLineWidth(const GlsFloat32 lineWidth)
GlsPolygonMode
Definition: gls_render_settings.h:131
const GlsCompositeObject::InitParameters compositeInitParameters
Definition: gls_group.h:60
virtual void Calculate(const GlsFloat64 time)
virtual void SetChildrenLineColor(const GlsColor &lineColor)
Definition: gls_display_object_array.h:64
GlsGroup(InitParameters &initParameters, GlsEventDispatcher *const eventDispatcher)
This header defines GlsDisplayObjectArray which encapsulates\ an array of display object pointers in ...