#ifndef _SCREENSHAPE_H_ #define _SCREENSHAPE_H_ #include #include #include #include #pragma warning(disable: 4003) #include "gmtl/gmtl.h" namespace projection { class Screen; /** * Screen shape base class. */ class ScreenShape : public QObject { Q_OBJECT public: /** * Constructor. * * @param pScreen Screen data. */ ScreenShape(Screen* pScreen); /** * Destructor. */ virtual ~ScreenShape(); /** * Draw a screen with dislay list cache. * * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. */ void draw(bool bFrame); /** * Retrieve name of the sceen shape. * * @return Name of the screen shape. */ virtual QString getName() const = 0; /** * Retrieve bounding box of the screen shape. * * @param min One corner of the screen shape. * @param max Another corner of the screen shape. */ virtual void getBoundingBox(gmtl::Vec3f& min, gmtl::Vec3f& max) = 0; /** * Check whether the shape needs clipping for projection image. * * @return True if the projection requires clipping. */ virtual bool isClippingRequired() const { return true; } /** * Restore the screen shape from XML data. * * @param element Parent XML element of the screen shape data. */ virtual bool initFromDOMElement(const QDomElement& element) = 0; /** * Store the current screen shape as XML data. * * @param name XML node name of the data. * @param doc XML document to store the data. * @return Current screen shape data as XML data. */ virtual QDomElement domElement(const QString& name, QDomDocument& doc) const = 0; protected: /** * Draw the shape model in inherited class. * * @param bFrame True to draw a wire frame mesh. False to draw as a polygon model. */ virtual void drawShape(bool bFrame) = 0; /** * Notify to redraw the screen shape. */ void notifyRedraw(); protected: Screen* m_pScreen; //!< Screen data. unsigned int m_dlIndex; //!< Display list index. bool m_bDirty; //!< Dirty flag. True to redraw the screen shape. }; }; // projection #endif // _SCREENSHAPE_H_