summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/tools/planetviewer.h
blob: 315621e0dea321a1fc261feab56460c66e43ddcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/***************************************************************************
                          planetviewer.h  -  Display overhead view of the solar system
                             -------------------
    begin                : Sun May 25 2003
    copyright            : (C) 2003 by Jason Harris
    email                : jharris@30doradus.org
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PLANETVIEWER_H
#define PLANETVIEWER_H

#include <kdialogbase.h>
#include <kpushbutton.h>
#include <tqtimer.h>

#include "kstarsplotwidget.h"
#include "planetviewerui.h"
#include "kstarsdatetime.h"
#include "planetcatalog.h"

/**@class PlanetViewer
	*@short Display an overhead view of the solar system
	*@version 1.0
	*@author Jason Harris
	*/
class PlanetViewer : public KDialogBase
{
TQ_OBJECT
  
public:
	PlanetViewer(TQWidget *parent = 0, const char *name = 0);
	~PlanetViewer();

	TQString centerPlanet() const { return CenterPlanet; }
	void setCenterPlanet( const TQString &cp ) { CenterPlanet = cp; }
	
	KPlotObject* planetObject(uint i) const { return planet[i]; }
	TQString planetName(uint i) const { return pName[i]; }

protected:
	virtual void keyPressEvent( TQKeyEvent *e );
	virtual void paintEvent( TQPaintEvent* );

private slots:
	void initPlotObjects();
	void tick();
	void setTimeScale(float);
	void slotChangeDate( const ExtDate &d );
	void slotRunClock();
	void slotToday();

private:
	void updatePlanets();
	
	PlanetViewerUI *pw;
	KStarsDateTime ut;
	PlanetCatalog PCat;
	double scale;
	bool isClockRunning;
	TQTimer tmr;
	int UpdateInterval[9], LastUpdate[9];
	TQString pName[9], pColor[9];
	TQString CenterPlanet;

	KPlotObject *ksun;
	KPlotObject *planet[9];
	KPlotObject *planetLabel[9];
};

class PVPlotWidget : public KStarsPlotWidget
{
TQ_OBJECT
  
public:
	PVPlotWidget( double x1, double x2, double y1, double y2, 
			TQWidget *parent=0, const char *name=0 );
	PVPlotWidget( TQWidget *parent=0, const char *name=0 );
	~PVPlotWidget();

public slots:
	void slotZoomIn();
	void slotZoomOut();

signals:
	void doubleClicked( double, double );

protected:
	virtual void keyPressEvent( TQKeyEvent *e );
	virtual void mousePressEvent( TQMouseEvent *e );
	virtual void mouseMoveEvent( TQMouseEvent *e );
	virtual void mouseReleaseEvent( TQMouseEvent * );
	virtual void mouseDoubleClickEvent( TQMouseEvent *e );
	virtual void wheelEvent( TQWheelEvent *e );

private:
	bool mouseButtonDown;
	int oldx, oldy;
	PlanetViewer *pv;
};

#endif