Rev | Line | |
---|
[4] | 1 | #ifndef _WARP_H_ |
---|
| 2 | #define _EARP_H_ |
---|
| 3 | |
---|
| 4 | #include <QGLWidget> |
---|
| 5 | #include <QtXml> |
---|
| 6 | |
---|
| 7 | namespace projection |
---|
| 8 | { |
---|
| 9 | class Warp : public QObject |
---|
| 10 | { |
---|
| 11 | public: |
---|
| 12 | |
---|
| 13 | Warp(); |
---|
| 14 | |
---|
| 15 | virtual ~Warp(); |
---|
| 16 | |
---|
| 17 | void draw(bool bForExport, bool bForBlend); |
---|
| 18 | void resize(int width, int height); |
---|
| 19 | |
---|
| 20 | bool pick(int x, int y); |
---|
| 21 | bool drag(int x, int y); |
---|
| 22 | |
---|
| 23 | void setEnabled(bool bEnabled); |
---|
| 24 | bool getEnabled() const; |
---|
| 25 | |
---|
| 26 | void setNumCtrlPoints(int num); |
---|
| 27 | int getNumCtrlPoints() const; |
---|
| 28 | |
---|
| 29 | void setZoom(float zoom); |
---|
| 30 | float getZoom() const; |
---|
| 31 | |
---|
| 32 | void setGridSize(int gridSize); |
---|
| 33 | int getGridSize() const; |
---|
| 34 | |
---|
| 35 | void setShowCtrlPoints(bool bShow); |
---|
| 36 | bool getShowCtrlPoints() const; |
---|
| 37 | |
---|
| 38 | void reset(); |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * Restore the warp data from XML data. |
---|
| 42 | * |
---|
| 43 | * @param element Parent XML element of the warp data. |
---|
| 44 | */ |
---|
| 45 | void initFromDOMElement(const QDomElement& element); |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * Store the current warp data as XML data. |
---|
| 49 | * |
---|
| 50 | * @param name XML node name of the data. |
---|
| 51 | * @param doc XML document to store the data. |
---|
| 52 | * @return Current warp data as XML data. |
---|
| 53 | */ |
---|
| 54 | QDomElement domElement(const QString& name, QDomDocument& doc) const; |
---|
| 55 | |
---|
| 56 | private: |
---|
| 57 | |
---|
| 58 | int pickCtrlPoint(float x, float y); |
---|
| 59 | |
---|
| 60 | private: |
---|
| 61 | |
---|
| 62 | bool m_bEnabled; |
---|
| 63 | |
---|
| 64 | int m_numCtrlPoints; |
---|
| 65 | float* m_pCtrlPoints; |
---|
| 66 | int m_gridSize; |
---|
| 67 | bool m_bShowCtrlPoints; |
---|
| 68 | int m_selectedCtrlPoint; |
---|
| 69 | |
---|
| 70 | GLint m_viewport[4]; |
---|
| 71 | GLdouble m_modelMatrix[16]; |
---|
| 72 | GLdouble m_projMatrix[16]; |
---|
| 73 | float m_zoom; |
---|
| 74 | int m_lastMouseX; |
---|
| 75 | int m_lastMouseY; |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | }; // projection |
---|
| 79 | |
---|
| 80 | #endif // _WARP_H_ |
---|
Note: See
TracBrowser
for help on using the repository browser.