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);
73 * General rendering slots
76 /// Change the quality to adaptive.
77 void setQualityAdaptive();
79 /// Change the quality to full resolution.
80 void setQualityFull();
82 /// Change the polygon mode to normal.
83 void setPolygonModeNormal();
85 /// Change the polygon mode to wireframe.
86 void setPolygonModeWireframe();
88 /// Remove colour coding.
89 void setColourCodingNone();
91 /// Set colour coding to elevation sample alignment.
92 void setColourCodingElevationSampleAlignment();
94 /// Set colour mapping for an output channel to an input band.
95 void setColourMapping(int output
, int input
);
98 * Elevation modification slots
101 /// Go to flat elevation mode.
102 void setElevationFlat();
104 /// Go to raw SRTM elevation mode.
105 void setElevationRaw();
107 /// Go to corrected elevation mode.
108 void setElevationCorrected();
110 /// Set the level of correction applied to the elevation data.
111 void setElevationCorrection(int correction
);
113 /// Set the elevation data set name.
114 void setElevationDataSet(const QString
& name
);
122 /// Emitted when the mouse moves to a new position on the globe.
123 void mouseGeoChanged(const tcGeo
& geo
);
125 /** Emitted when the mouse moves to a new position on the globe.
126 * This has an int so it is compatible with QStatusBar::showMessage slot.
128 void mouseGeoTextChanged(const QString
& geo
);
137 virtual void initializeGL();
140 virtual void resizeGL(int w
, int h
);
143 virtual void paintGL();
150 virtual void mouseMoveEvent(QMouseEvent
* event
);
153 virtual void mousePressEvent(QMouseEvent
* event
);
156 virtual void mouseReleaseEvent(QMouseEvent
* event
);
159 virtual void wheelEvent(QWheelEvent
* event
);
167 /// Adaptive quality.
168 bool m_adaptiveQuality
;
170 /// OpenGL polygon mode.
171 GLenum m_polygonMode
;
178 tcObserver
* m_observer
;
180 /// Globe to display.
187 /// Are we currently interacting?
188 bool m_mouseInteracting
;
190 /// Previous mouse position.
193 /// Mouse intersecting globe?
194 bool m_mouseIntersecting
;
196 /// Current mouse coordinate.
199 /// Slicing with the mouse?
202 /// Start of mouse slicing action.
203 tcGeo m_mouseStartCoord
;
208 /// Coordinates of slice.