source: projectionDesigner/trunk/projdesigner/include/Frustum.h @ 210

Last change on this file since 210 was 4, checked in by Torben Dannhauer, 15 years ago
File size: 4.0 KB
Line 
1#ifndef _FRUSTUM_H_
2#define _FRUSTUM_H_
3
4#include <QtXml>
5#include <QColor>
6
7#include "math/ProjectionMatrix.h"
8#include "math/TransformMatrix.h"
9
10namespace projection
11{
12/**
13 * Frustum data class to represent projection area and view frustum.
14 */
15class Frustum : public QObject
16{
17    Q_OBJECT
18
19public:
20
21    /**
22     * Constructor.
23     */
24    Frustum();
25
26    /**
27     * Destructor.
28     */
29    virtual ~Frustum();
30
31    /**
32     * Set projection matrix of the frustum.
33     *
34     * @param matrix Projection matrix of the frustum.
35     */
36    void setProjectionMatrix(const ProjectionMatrix& matrix);
37
38    /**
39     * Retrieve projection matrix of the frustum.
40     *
41     * @return Projection matrix of the frustum.
42     */
43    ProjectionMatrix getProjectionMatrix() const;
44
45    /**
46     * Set transform matrix of the frustum.
47     *
48     * @param matrix Transform matrix of the frustum.
49     */
50    void setTransformMatrix(const TransformMatrix& matrix);
51
52    /**
53     * Retrieve transform matrix of the frustum.
54     *
55     * @return Transform matrix of the frustum.
56     */
57    TransformMatrix getTransformMatrix() const;
58
59    /**
60     * Set color of the frustum shape object.
61     *
62     * @param color Color of the frustum shape object.
63     */
64        void setColor(const QColor& color);
65
66    /**
67     * Retrieve color of the frustum shape object.
68     *
69     * @return Color of the frustum shape object.
70     */
71    QColor getColor() const;
72
73    /**
74     * Show or hide the frustum shape object.
75     *
76     * @param bShow True to show the frustum shape object, false to hide.
77     */
78    void setShow(bool bShow);
79
80    /**
81     * Check whether the frustum shape object is shown or not.
82     *
83     * @return True if the frustum shape object is shown.
84     */
85    bool getShow() const;
86
87    /**
88     * Show or hide the frustum projected area.
89     *
90     * @param bShow True to show the frustum projected area, false to hide.
91     */
92    void setShowArea(bool bShow);
93
94    /**
95     * Check whether the frustum projected area is shown or not.
96     *
97     * @return True if the frustum projected area is shown.
98     */
99    bool getShowArea() const;
100
101    /**
102     * Set far clip plane distance of the frame shape object. It doesn't modify the frustum data.
103     *
104     * @param farDist Far clip plane distance of the frame shape object.
105     */
106    void setVisibleFar(float farDist);
107
108    /**
109     * Retrieve far clip plane distance of the frame shape object.
110     *
111     * @return Far clip plane distance of the frame shape object.
112     */
113    float getVisibleFar() const;
114
115    /**
116     * Draw frustum shape object.
117     *
118     * @param bSelected True to draw with selection highlight.
119     */
120        void draw(bool bSelected=false);
121
122    /**
123     * Assignment operator.
124     *
125     * @param frustum Assignment source frustum.
126     */
127    Frustum& operator=(const Frustum& frustum);
128
129    /**
130     * Restore the frustum data from XML data.
131     *
132     * @param element Parent XML element of the frustum data.
133     */
134    virtual void initFromDOMElement(const QDomElement& element);
135
136    /**
137     * Store the current frustum data as XML data.
138     *
139     * @param name XML node name of the data.
140     * @param doc XML document to store the data.
141     * @return Current frustum data as XML data.
142     */
143    virtual QDomElement domElement(const QString& name, QDomDocument& doc) const;
144
145signals:
146
147    /**
148     * Notify that the frustum data is changed.
149     */
150    void dataChanged();
151
152protected:
153
154    ProjectionMatrix m_projectionMatrix;    //!< Projection matrix of the frustum.
155    TransformMatrix m_transformMatrix;      //!< Transform matrix of the frustum.
156    bool m_bShow;                           //!< True if the frustum shape object is shown.
157    bool m_bShowArea;                       //!< True if the frustum projected area is shown.
158    float m_visibleFar;                     //!< Far clip plane distance of the frustum shape object.
159        QColor m_color;                         //!< Color of the frustum shape object.
160};
161
162}; // projection
163
164#endif // _FRUSTUM_H_
Note: See TracBrowser for help on using the repository browser.