moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / tools / planetviewer.h
blobe071d262a13ec73caecf0ed618c4870ec0983a20
1 /***************************************************************************
2 planetviewer.h - Display overhead view of the solar system
3 -------------------
4 begin : Sun May 25 2003
5 copyright : (C) 2003 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17 #ifndef PLANETVIEWER_H
18 #define PLANETVIEWER_H
20 #include <kdialogbase.h>
21 #include <kpushbutton.h>
22 #include <qtimer.h>
24 #include "kstarsplotwidget.h"
25 #include "planetviewerui.h"
26 #include "kstarsdatetime.h"
27 #include "planetcatalog.h"
29 /**@class PlanetViewer
30 *@short Display an overhead view of the solar system
31 *@version 1.0
32 *@author Jason Harris
34 class PlanetViewer : public KDialogBase
36 Q_OBJECT
37 public:
38 PlanetViewer(QWidget *parent = 0, const char *name = 0);
39 ~PlanetViewer();
41 QString centerPlanet() const { return CenterPlanet; }
42 void setCenterPlanet( const QString &cp ) { CenterPlanet = cp; }
44 KPlotObject* planetObject(uint i) const { return planet[i]; }
45 QString planetName(uint i) const { return pName[i]; }
47 protected:
48 virtual void keyPressEvent( QKeyEvent *e );
49 virtual void paintEvent( QPaintEvent* );
51 private slots:
52 void initPlotObjects();
53 void tick();
54 void setTimeScale(float);
55 void slotChangeDate( const ExtDate &d );
56 void slotRunClock();
58 private:
59 void updatePlanets();
61 PlanetViewerUI *pw;
62 KStarsDateTime ut;
63 PlanetCatalog PCat;
64 double scale;
65 bool isClockRunning;
66 QTimer tmr;
67 int UpdateInterval[9], LastUpdate[9];
68 QString pName[9], pColor[9];
69 QString CenterPlanet;
71 KPlotObject *ksun;
72 KPlotObject *planet[9];
73 KPlotObject *planetLabel[9];
76 class PVPlotWidget : public KStarsPlotWidget
78 Q_OBJECT
79 public:
80 PVPlotWidget( double x1, double x2, double y1, double y2,
81 QWidget *parent=0, const char *name=0 );
82 PVPlotWidget( QWidget *parent=0, const char *name=0 );
83 ~PVPlotWidget();
85 public slots:
86 void slotZoomIn();
87 void slotZoomOut();
89 signals:
90 void doubleClicked( double, double );
92 protected:
93 virtual void keyPressEvent( QKeyEvent *e );
94 virtual void mousePressEvent( QMouseEvent *e );
95 virtual void mouseMoveEvent( QMouseEvent *e );
96 virtual void mouseReleaseEvent( QMouseEvent * );
97 virtual void mouseDoubleClickEvent( QMouseEvent *e );
98 virtual void wheelEvent( QWheelEvent *e );
100 private:
101 bool mouseButtonDown;
102 int oldx, oldy;
103 PlanetViewer *pv;
106 #endif