[4] | 1 | #ifndef _SCREENSHAPE_H_ |
---|
| 2 | #define _SCREENSHAPE_H_ |
---|
| 3 | |
---|
| 4 | #include <QtGui> |
---|
| 5 | #include <QObject> |
---|
| 6 | #include <QtXml> |
---|
| 7 | #include <QtOpenGL> |
---|
| 8 | |
---|
| 9 | #pragma warning(disable: 4003) |
---|
| 10 | #include "gmtl/gmtl.h" |
---|
| 11 | |
---|
| 12 | namespace projection |
---|
| 13 | { |
---|
| 14 | class Screen; |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * Screen shape base class. |
---|
| 18 | */ |
---|
| 19 | class ScreenShape : public QObject |
---|
| 20 | { |
---|
| 21 | Q_OBJECT |
---|
| 22 | public: |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * Constructor. |
---|
| 26 | * |
---|
| 27 | * @param pScreen Screen data. |
---|
| 28 | */ |
---|
| 29 | ScreenShape(Screen* pScreen); |
---|
| 30 | |
---|
| 31 | /** |
---|
| 32 | * Destructor. |
---|
| 33 | */ |
---|
| 34 | virtual ~ScreenShape(); |
---|
| 35 | |
---|
| 36 | /** |
---|
| 37 | * Draw a screen with dislay list cache. |
---|
| 38 | * |
---|
| 39 | * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. |
---|
| 40 | */ |
---|
| 41 | void draw(bool bFrame); |
---|
| 42 | |
---|
| 43 | /** |
---|
| 44 | * Retrieve name of the sceen shape. |
---|
| 45 | * |
---|
| 46 | * @return Name of the screen shape. |
---|
| 47 | */ |
---|
| 48 | virtual QString getName() const = 0; |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * Retrieve bounding box of the screen shape. |
---|
| 52 | * |
---|
| 53 | * @param min One corner of the screen shape. |
---|
| 54 | * @param max Another corner of the screen shape. |
---|
| 55 | */ |
---|
| 56 | virtual void getBoundingBox(gmtl::Vec3f& min, gmtl::Vec3f& max) = 0; |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * Check whether the shape needs clipping for projection image. |
---|
| 60 | * |
---|
| 61 | * @return True if the projection requires clipping. |
---|
| 62 | */ |
---|
| 63 | virtual bool isClippingRequired() const { return true; } |
---|
| 64 | |
---|
| 65 | /** |
---|
| 66 | * Restore the screen shape from XML data. |
---|
| 67 | * |
---|
| 68 | * @param element Parent XML element of the screen shape data. |
---|
| 69 | */ |
---|
| 70 | virtual bool initFromDOMElement(const QDomElement& element) = 0; |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Store the current screen shape as XML data. |
---|
| 74 | * |
---|
| 75 | * @param name XML node name of the data. |
---|
| 76 | * @param doc XML document to store the data. |
---|
| 77 | * @return Current screen shape data as XML data. |
---|
| 78 | */ |
---|
| 79 | virtual QDomElement domElement(const QString& name, QDomDocument& doc) const = 0; |
---|
| 80 | |
---|
| 81 | protected: |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * Draw the shape model in inherited class. |
---|
| 85 | * |
---|
| 86 | * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. |
---|
| 87 | */ |
---|
| 88 | virtual void drawShape(bool bFrame) = 0; |
---|
| 89 | |
---|
| 90 | /** |
---|
| 91 | * Notify to redraw the screen shape. |
---|
| 92 | */ |
---|
| 93 | void notifyRedraw(); |
---|
| 94 | |
---|
| 95 | protected: |
---|
| 96 | |
---|
| 97 | Screen* m_pScreen; //!< Screen data. |
---|
| 98 | |
---|
| 99 | unsigned int m_dlIndex; //!< Display list index. |
---|
| 100 | bool m_bDirty; //!< Dirty flag. True to redraw the screen shape. |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | }; // projection |
---|
| 104 | |
---|
| 105 | #endif // _SCREENSHAPE_H_ |
---|