00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "astrocalc.h"
00019 #include "astrocalc.moc"
00020 #include "dms.h"
00021 #include "dmsbox.h"
00022 #include "modcalcjd.h"
00023 #include "modcalcgeodcoord.h"
00024 #include "modcalcgalcoord.h"
00025 #include "modcalcsidtime.h"
00026 #include "modcalcprec.h"
00027 #include "modcalcapcoord.h"
00028 #include "modcalcdaylength.h"
00029 #include "modcalcazel.h"
00030 #include "modcalcplanets.h"
00031 #include "modcalceclipticcoords.h"
00032 #include "modcalcangdist.h"
00033 #include "modcalcequinox.h"
00034 #include "modcalcvlsr.h"
00035
00036 #include <klocale.h>
00037 #include <qlistview.h>
00038 #include <qtextview.h>
00039
00040
00041 AstroCalc::AstroCalc( QWidget* parent ) :
00042 KDialogBase( parent, "starscalculator", true, i18n("Calculator"), Close ),
00043 JDFrame(0), GeodCoordFrame(0), GalFrame(0), SidFrame(0), PrecFrame(0),
00044 AppFrame(0), DayFrame(0), AzelFrame(0), PlanetsFrame(0), EquinoxFrame(0),
00045 EclFrame(0), AngDistFrame(0)
00046 {
00047 split = new QSplitter ( this );
00048 setMainWidget(split);
00049
00050 navigationPanel = new QListView (split,"NavigationPanel");
00051 splashScreen = new QTextView (i18n("<H2>KStars Astrocalculator</H2>"),"",split);
00052
00053 splashScreen->setMaximumWidth(550);
00054 splashScreen->setMinimumWidth(400);
00055
00056 rightPanel = GenText;
00057
00058 navigationPanel->addColumn("Section");
00059 navigationPanel->setRootIsDecorated(1);
00060
00061 QPixmap jdIcon = QPixmap ("jd.png");
00062 QPixmap geodIcon = QPixmap ("geodetic.png");
00063 QPixmap solarIcon = QPixmap ("geodetic.png");
00064 QPixmap sunsetIcon = QPixmap ("sunset.png");
00065 QPixmap timeIcon = QPixmap ("sunclock.png");
00066
00067 QListViewItem * timeItem = new QListViewItem(navigationPanel,i18n("Time Calculators"));
00068 timeItem->setPixmap(0,timeIcon);
00069
00070 QListViewItem * jdItem = new QListViewItem(timeItem,i18n("Julian Day"));
00071 jdItem->setPixmap(0,jdIcon);
00072
00073 new QListViewItem(timeItem,i18n("Sidereal Time"));
00074 new QListViewItem(timeItem,i18n("Day Duration"));
00075 new QListViewItem(timeItem,i18n("Equinoxes & Solstices"));
00076
00077
00078 QListViewItem * coordItem = new QListViewItem(navigationPanel,i18n("Celestial Coordinates"));
00079 new QListViewItem(coordItem,i18n("Galactic Coordinates"));
00080 new QListViewItem(coordItem,i18n("Precession"));
00081 new QListViewItem(coordItem,i18n("Apparent Coordinates"));
00082 new QListViewItem(coordItem,i18n("Horizontal Coordinates"));
00083 new QListViewItem(coordItem,i18n("Ecliptic Coordinates"));
00084 new QListViewItem(coordItem,i18n("Angular Distance"));
00085 new QListViewItem(coordItem,i18n("LSR Velocity"));
00086
00087 QListViewItem * geoItem = new QListViewItem(navigationPanel,i18n("Earth Coordinates"));
00088 geoItem->setPixmap(0,geodIcon);
00089 new QListViewItem(geoItem,i18n("Geodetic Coordinates"));
00090
00091 QListViewItem * solarItem = new QListViewItem(navigationPanel,i18n("Solar System"));
00092 solarItem->setPixmap(0,solarIcon);
00093 new QListViewItem(solarItem,i18n("Planets Coordinates"));
00094
00095 connect(navigationPanel, SIGNAL(clicked(QListViewItem *)), this,
00096 SLOT(slotItemSelection(QListViewItem *)));
00097 }
00098
00099 AstroCalc::~AstroCalc()
00100 {
00101 }
00102
00103 void AstroCalc::slotItemSelection(QListViewItem *item)
00104 {
00105 QString election;
00106
00107 if (item==0L) return;
00108
00109 election = item->text(0);
00110 if(!(election.compare(i18n("Time Calculators"))))
00111 genTimeText();
00112 if(!(election.compare(i18n("Sidereal Time"))))
00113 genSidFrame();
00114 if(!(election.compare(i18n("Celestial Coordinates"))))
00115 genCoordText();
00116 if(!(election.compare(i18n("Julian Day"))))
00117 genJdFrame();
00118 if(!(election.compare(i18n("Galactic Coordinates"))))
00119 genGalFrame();
00120 if(!(election.compare(i18n("Precession"))))
00121 genPrecFrame();
00122 if(!(election.compare(i18n("Apparent Coordinates"))))
00123 genAppFrame();
00124 if(!(election.compare(i18n("Horizontal Coordinates"))))
00125 genAzelFrame();
00126 if(!(election.compare(i18n("Ecliptic Coordinates"))))
00127 genEclFrame();
00128 if(!(election.compare(i18n("Earth Coordinates"))))
00129 genGeodText();
00130 if(!(election.compare(i18n("Geodetic Coordinates"))))
00131 genGeodCoordFrame();
00132 if(!(election.compare(i18n("Day Duration"))))
00133 genDayFrame();
00134 if(!(election.compare(i18n("Equinoxes & Solstices"))))
00135 genEquinoxFrame();
00136 if(!(election.compare(i18n("Solar System"))))
00137 genSolarText();
00138 if(!(election.compare(i18n("Planets Coordinates"))))
00139 genPlanetsFrame();
00140 if(!(election.compare(i18n("Angular Distance"))))
00141 genAngDistFrame();
00142 if(!(election.compare(i18n("LSR Velocity"))))
00143 genVlsrFrame();
00144
00145 previousElection = election;
00146
00147 }
00148
00149 void AstroCalc::genTimeText(void)
00150 {
00151
00152 delRightPanel();
00153 splashScreen = new QTextView ("","",split);
00154 splashScreen->setMaximumWidth(550);
00155 splashScreen->setMinimumWidth(400);
00156 splashScreen->show();
00157
00158 splashScreen->setText(i18n("<QT>"
00159 "Section for time-related astronomical calculations"
00160 "<UL><LI>"
00161 "<B>Julian Day:</B> Julian Day/Calendar conversion"
00162 "</LI><LI>"
00163 "<B>Sidereal Time:</B> Sidereal/Universal time conversion"
00164 "</LI><LI>"
00165 "<B>Day duration:</B> Sunrise, Sunset and noon time and "
00166 "positions for those events"
00167 "</LI><LI>"
00168 "<B>Equinoxes & Solstices:</B> Equinoxes, Solstices and duration of the "
00169 "seasons"
00170 "</LI></UL>"
00171 "</QT>"));
00172
00173 rightPanel=TimeText;
00174
00175 }
00176
00177 void AstroCalc::genCoordText(void)
00178 {
00179 delRightPanel();
00180 splashScreen = new QTextView ("","",split);
00181 splashScreen->setMaximumWidth(550);
00182 splashScreen->setMinimumWidth(400);
00183 splashScreen->show();
00184
00185 splashScreen->setText(i18n("<QT>"
00186 "Section with algorithms for the conversion of "
00187 "different astronomical systems of coordinates"
00188 "<UL><LI>"
00189 "<B>Precessor:</B> Precession of coordinates between epochs"
00190 "</LI><LI>"
00191 "<B>Galactic:</B> Galactic/Equatorial coordinates conversion"
00192 "</LI><LI>"
00193 "<B>Apparent:</B> Computation of current equatorial coordinates"
00194 " from a given epoch"
00195 "</LI><LI>"
00196 "<B>Ecliptic:</B> Ecliptic/Equatorial coordinates conversion"
00197 "</LI><LI>"
00198 "<B>Horizontal:</B> Computation of azimuth and elevation for a "
00199 "given source, time, and location on the Earth"
00200 "</LI><LI>"
00201 "<B>Angular Distance:</B> Computation of angular distance between "
00202 "two objects whose positions are given in equatorial coordinates"
00203 "</LI><LI>"
00204 "<B>LSR Velocity:</B> Computation of the heliocentric, geocentric "
00205 "and topocentric radial velocity of a source from its LSR velocity"
00206 "</LI></UL>"
00207 "</QT>"));
00208
00209 rightPanel=CoordText;
00210
00211 }
00212
00213 void AstroCalc::genGeodText(void)
00214 {
00215 delRightPanel();
00216 splashScreen = new QTextView ("","",split);
00217 splashScreen->setMaximumWidth(550);
00218 splashScreen->setMinimumWidth(400);
00219 splashScreen->show();
00220
00221 splashScreen->setText(i18n("<QT>"
00222 "Section with algorithms for the conversion of "
00223 "systems of coordinates for the Earth"
00224 "<UL><LI>"
00225 "<B>Geodetic Coordinates:</B> Geodetic/XYZ coordinate conversion"
00226 "</LI></UL>"
00227 "</QT>"));
00228
00229 rightPanel=GeoText;
00230 }
00231
00232 void AstroCalc::genSolarText(void)
00233 {
00234 delRightPanel();
00235 splashScreen = new QTextView ("","",split);
00236 splashScreen->setMaximumWidth(550);
00237 splashScreen->setMinimumWidth(400);
00238 splashScreen->show();
00239
00240 splashScreen->setText(i18n("<QT>"
00241 "Section with algorithms regarding information "
00242 "on solar system bodies coordinates and times"
00243 "<UL><LI>"
00244 "<B>Planets Coordinates:</B> Coordinates for the planets, moon and sun "
00245 " at a given time and from a given position on Earth "
00246 "</LI></UL>"
00247 "</QT>"));
00248
00249 rightPanel=SolarText;
00250 }
00251
00252
00253 void AstroCalc::delRightPanel(void)
00254 {
00255 if (rightPanel <= CoordText)
00256 delete splashScreen;
00257 else if (rightPanel == JD)
00258 delete JDFrame;
00259 else if (rightPanel == SidTime)
00260 delete SidFrame;
00261 else if (rightPanel == DayLength)
00262 delete DayFrame;
00263 else if (rightPanel == Equinox)
00264 delete EquinoxFrame;
00265 else if (rightPanel == GeoCoord)
00266 delete GeodCoordFrame;
00267 else if (rightPanel == Galactic)
00268 delete GalFrame;
00269 else if (rightPanel == Ecliptic)
00270 delete EclFrame;
00271 else if (rightPanel == Precessor)
00272 delete PrecFrame;
00273 else if (rightPanel == Apparent)
00274 delete AppFrame;
00275 else if (rightPanel == Azel)
00276 delete AzelFrame;
00277 else if (rightPanel == Planets)
00278 delete PlanetsFrame;
00279 else if (rightPanel == AngDist)
00280 delete AngDistFrame;
00281 else if (rightPanel == Vlsr)
00282 delete VlsrFrame;
00283
00284 }
00285
00286 void AstroCalc::genJdFrame(void)
00287 {
00288 delRightPanel();
00289 JDFrame = new modCalcJD(split,"JulianDay");
00290 rightPanel = JD;
00291 }
00292
00293 void AstroCalc::genSidFrame(void)
00294 {
00295 delRightPanel();
00296 SidFrame = new modCalcSidTime(split,"SiderealTime");
00297 rightPanel = SidTime;
00298 }
00299
00300 void AstroCalc::genDayFrame(void)
00301 {
00302 delRightPanel();
00303 DayFrame = new modCalcDayLength(split,"DayDuration");
00304 rightPanel = DayLength;
00305 }
00306
00307 void AstroCalc::genEquinoxFrame(void)
00308 {
00309 delRightPanel();
00310 EquinoxFrame = new modCalcEquinox(split,"Equinox");
00311 rightPanel = Equinox;
00312 }
00313
00314 void AstroCalc::genGeodCoordFrame(void)
00315 {
00316 delRightPanel();
00317 GeodCoordFrame = new modCalcGeodCoord(split,"GeoCoord");
00318 rightPanel = GeoCoord;
00319 }
00320
00321 void AstroCalc::genGalFrame(void)
00322 {
00323 delRightPanel();
00324 GalFrame = new modCalcGalCoord(split,"Galactic");
00325 rightPanel = Galactic;
00326 }
00327
00328 void AstroCalc::genEclFrame(void)
00329 {
00330 delRightPanel();
00331 EclFrame = new modCalcEclCoords(split,"Ecliptic");
00332 rightPanel = Ecliptic;
00333 }
00334
00335 void AstroCalc::genPrecFrame(void)
00336 {
00337 delRightPanel();
00338 PrecFrame = new modCalcPrec(split,"Precession");
00339 rightPanel = Precessor;
00340 }
00341
00342 void AstroCalc::genAppFrame(void)
00343 {
00344 delRightPanel();
00345 AppFrame = new modCalcApCoord(split,"Apparent");
00346 rightPanel = Apparent;
00347 }
00348
00349 void AstroCalc::genAzelFrame(void)
00350 {
00351 delRightPanel();
00352 AzelFrame = new modCalcAzel(split,"Horizontal");
00353 rightPanel = Azel;
00354 }
00355
00356 void AstroCalc::genPlanetsFrame(void)
00357 {
00358 delRightPanel();
00359 PlanetsFrame = new modCalcPlanets(split,"Planet");
00360 rightPanel = Planets;
00361 }
00362
00363 void AstroCalc::genAngDistFrame(void)
00364 {
00365 delRightPanel();
00366 AngDistFrame = new modCalcAngDist(split,"AngDist");
00367 rightPanel = AngDist;
00368 }
00369
00370 void AstroCalc::genVlsrFrame(void)
00371 {
00372 delRightPanel();
00373 VlsrFrame = new modCalcVlsr(split,"Vlsr");
00374 rightPanel = Vlsr;
00375 }
00376
00377 QSize AstroCalc::sizeHint() const
00378 {
00379 return QSize(640,430);
00380 }