1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _tcViewportWidget_h_
21 #define _tcViewportWidget_h_
24 * @file tcViewportWidget.h
25 * @brief OpenGL viewport widget.
39 /// OpenGL viewport widget.
40 class tcViewportWidget
: public QGLWidget
47 * Constructors + destructor
50 /// Primary constructor.
51 tcViewportWidget(QWidget
* parent
);
54 virtual ~tcViewportWidget();
60 /// Set the globe object.
61 void setGlobe(tcGlobe
* globe
);
67 /// Find the coordinates under the mouse.
68 tcGeo
geoAt(float x
, float y
, bool* ok
= 0);
76 /// Change to sun view.
77 void sunView(int imagery
);
83 /// Enable navigation mode.
84 void navigationMode();
86 /// Enable texture point selection mode.
87 void texturePointMode(QObject
* receiver
, const char* member
);
90 * General rendering slots
93 /// Change the quality to adaptive.
94 void setQualityAdaptive();
96 /// Change the quality to full resolution.
97 void setQualityFull();
99 /// Change the polygon mode to normal.
100 void setPolygonModeNormal();
102 /// Change the polygon mode to wireframe.
103 void setPolygonModeWireframe();
105 /// Remove colour coding.
106 void setColourCodingNone();
108 /// Set colour coding to elevation sample alignment.
109 void setColourCodingElevationSampleAlignment();
111 /// Set colour mapping for an output channel to an input band.
112 void setColourMapping(int output
, int input
, int inputGroup
);
115 * Elevation modification slots
118 /// Go to flat elevation mode.
119 void setElevationFlat();
121 /// Go to raw SRTM elevation mode.
122 void setElevationRaw();
124 /// Go to corrected elevation mode.
125 void setElevationCorrected();
127 /// Set the level of correction applied to the elevation data.
128 void setElevationCorrection(int correction
);
130 /// Set the elevation data set name.
131 void setElevationDataSet(const QString
& name
);
139 /// Emitted when the mouse moves to a new position on the globe.
140 void mouseGeoChanged(const tcGeo
& geo
);
142 /** Emitted when the mouse moves to a new position on the globe.
143 * This has an int so it is compatible with QStatusBar::showMessage slot.
145 void mouseGeoTextChanged(const QString
& geo
);
147 /// Emitted when a texture point is selected.
148 void texturePointSelected(const maths::Vector
<2,float>& coord
);
157 virtual void initializeGL();
160 virtual void resizeGL(int w
, int h
);
163 virtual void paintGL();
170 virtual void mouseMoveEvent(QMouseEvent
* event
);
173 virtual void mousePressEvent(QMouseEvent
* event
);
176 virtual void mouseReleaseEvent(QMouseEvent
* event
);
179 virtual void wheelEvent(QWheelEvent
* event
);
187 /// Adaptive quality.
188 bool m_adaptiveQuality
;
190 /// OpenGL polygon mode.
191 GLenum m_polygonMode
;
198 tcObserver
* m_observer
;
200 /// Globe to display.
207 /// Interaction mode.
214 /// Are we currently interacting?
215 bool m_mouseInteracting
;
217 /// Previous mouse position.
220 /// Mouse intersecting globe?
221 bool m_mouseIntersecting
;
223 /// Current mouse coordinate.
226 /// Slicing with the mouse?
229 /// Start of mouse slicing action.
230 tcGeo m_mouseStartCoord
;
235 /// Coordinates of slice.
238 /// Texture point object.
239 QObject
* m_texturePointObject
;
241 /// Texture point slot/signal.
242 const char* m_texturePointMember
;