⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qglobe.h

📁 在linux系统下开发的GPS接收程序,具有良好的图形操作界面.
💻 H
字号:
//-----------------------------------------------------------------------------// qglobe.h : OpenGL window for position visualization on the Earth////	- programmed by Boyoon Jung (boyoon@robotics.usc.edu)//-----------------------------------------------------------------------------#ifndef __QGLOBE_H#define __QGLOBE_H// header files for Qt library#include <qgl.h>#include <qimage.h>#include <qcursor.h>// header files for math#include <cmath>// WGS84 Parameters#define GA	6378137#define GB	6356752.31424518#define GF	0.0033528107#define GE	0.0818191908#define GEP	0.0820944379class QGlobe : public QGLWidget{    Q_OBJECT    private:	GLuint model_globe;		// 3D model of a globe	QImage texture;			// texture	GLuint model_position;		// 3D model of a position indicator	GLfloat latitude, longitude, altitude, geoid;	// position	bool mb_pressed;		// rotation	int prev_x, prev_y;	GLfloat hrot, vrot;	bool flag_shown;			// is a position indicator is shown?	QCursor orig_cursor;		// original cursor    protected:	// override methods	void initializeGL();	void paintGL();	void resizeGL( int w, int h );	// construct a 3D model for a globe	GLuint buildGlobeModel(void);	// construct a 3D model for a position indicator	GLuint buildPositionModel(void);	// convert a ECEF position to a geodetic position	void ecef2geo(float x, float y, float z,		      float& latitude, float& longitude, float& altitude, float& geoid);	// re-implemented functions	void mousePressEvent(QMouseEvent* e);	void mouseMoveEvent(QMouseEvent* e);	void mouseReleaseEvent(QMouseEvent* e);    public:	// constructor	QGlobe( QWidget* parent, const char* name );	// destructor	~QGlobe();	// check if a position indicator is shown	bool isShown(void) { return flag_shown; }    public slots:	// set a position indicator        void setPosition(float latitude, float longitude, float altitude, float geoid=0.0f);	void setECEF(float x, float y, float z);	// show/hide a position indicator	void showPosition(void) { flag_shown = true; update(); }	void hidePosition(void) { flag_shown = false; update(); }};// set positioninline void QGlobe::setPosition(float lat, float lon, float alt, float geo){    // set position    latitude = lat;    longitude = lon;    altitude = alt;    geoid = geo;    // update the OpenGL window    flag_shown = true;    update();}// set ECEF positioninline void QGlobe::setECEF(float x, float y, float z){    // set position    ecef2geo(x, y, z, latitude, longitude, altitude, geoid);    // update the OpenGL window    flag_shown = true;    update();}#endif // __QGLOBE_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -