kstars
planetviewer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef PLANETVIEWER_H
00018 #define PLANETVIEWER_H
00019
00020 #include <kdialogbase.h>
00021 #include <kpushbutton.h>
00022 #include <qtimer.h>
00023
00024 #include "kstarsplotwidget.h"
00025 #include "planetviewerui.h"
00026 #include "kstarsdatetime.h"
00027 #include "planetcatalog.h"
00028
00034 class PlanetViewer : public KDialogBase
00035 {
00036 Q_OBJECT
00037 public:
00038 PlanetViewer(QWidget *parent = 0, const char *name = 0);
00039 ~PlanetViewer();
00040
00041 QString centerPlanet() const { return CenterPlanet; }
00042 void setCenterPlanet( const QString &cp ) { CenterPlanet = cp; }
00043
00044 KPlotObject* planetObject(uint i) const { return planet[i]; }
00045 QString planetName(uint i) const { return pName[i]; }
00046
00047 protected:
00048 virtual void keyPressEvent( QKeyEvent *e );
00049 virtual void paintEvent( QPaintEvent* );
00050
00051 private slots:
00052 void initPlotObjects();
00053 void tick();
00054 void setTimeScale(float);
00055 void slotChangeDate( const ExtDate &d );
00056 void slotRunClock();
00057 void slotToday();
00058
00059 private:
00060 void updatePlanets();
00061
00062 PlanetViewerUI *pw;
00063 KStarsDateTime ut;
00064 PlanetCatalog PCat;
00065 double scale;
00066 bool isClockRunning;
00067 QTimer tmr;
00068 int UpdateInterval[9], LastUpdate[9];
00069 QString pName[9], pColor[9];
00070 QString CenterPlanet;
00071
00072 KPlotObject *ksun;
00073 KPlotObject *planet[9];
00074 KPlotObject *planetLabel[9];
00075 };
00076
00077 class PVPlotWidget : public KStarsPlotWidget
00078 {
00079 Q_OBJECT
00080 public:
00081 PVPlotWidget( double x1, double x2, double y1, double y2,
00082 QWidget *parent=0, const char *name=0 );
00083 PVPlotWidget( QWidget *parent=0, const char *name=0 );
00084 ~PVPlotWidget();
00085
00086 public slots:
00087 void slotZoomIn();
00088 void slotZoomOut();
00089
00090 signals:
00091 void doubleClicked( double, double );
00092
00093 protected:
00094 virtual void keyPressEvent( QKeyEvent *e );
00095 virtual void mousePressEvent( QMouseEvent *e );
00096 virtual void mouseMoveEvent( QMouseEvent *e );
00097 virtual void mouseReleaseEvent( QMouseEvent * );
00098 virtual void mouseDoubleClickEvent( QMouseEvent *e );
00099 virtual void wheelEvent( QWheelEvent *e );
00100
00101 private:
00102 bool mouseButtonDown;
00103 int oldx, oldy;
00104 PlanetViewer *pv;
00105 };
00106
00107 #endif