#include <eclipsefinderdlg.h>
Inheritance diagram for EclipseFinderDlg:


Public Slots | |
| void | gotoEclipse (QListViewItem *item, const QPoint &p, int col) |
| void | search () |
Public Member Functions | |
| EclipseFinderDlg (QWidget *parent=0, CelestiaCore *appCore=0) | |
| ~EclipseFinderDlg () | |
Public Attributes | |
| CelestiaCore * | appCore |
|
||||||||||||
|
Definition at line 19 of file eclipsefinderdlg.cpp. References appCore, CelestiaCore::getSimulation(), and Simulation::getTime(). 00020 : EclipseFinderDlgBase( parent, i18n("Eclipse Finder") ),appCore(appCore) 00021 { 00022 astro::Date date(appCore->getSimulation()->getTime()); 00023 fromYSpin->setValue(date.year); 00024 fromMSpin->setValue(date.month); 00025 fromDSpin->setValue(date.day); 00026 toYSpin->setValue(date.year); 00027 toMSpin->setValue(date.month); 00028 toDSpin->setValue(date.day); 00029 00030 00031 statusBar()->hide(); 00032 }
|
|
|
Definition at line 37 of file eclipsefinderdlg.cpp. 00038 {
00039 // no need to delete child widgets, Qt does it all for us
00040 }
|
|
||||||||||||||||
|
Reimplemented from EclipseFinderDlgBase. Definition at line 111 of file eclipsefinderdlg.cpp. References appCore, Selection::body(), distance(), Simulation::findObjectFromPath(), CelestiaCore::getSimulation(), PlanetarySystem::getStar(), Body::getSystem(), Simulation::gotoLocation(), astro::kilometersToMicroLightYears(), PI, Selection::radius(), RigidTransform::rotation, Simulation::setFrame(), Simulation::setTime(), RigidTransform::translation, Simulation::update(), and Quaternion< double >::yrotation(). 00111 {
00112 if (item->text(0) == "None") return;
00113
00114 KPopupMenu menu(this);
00115
00116 menu.insertTitle(item->text(col == 1));
00117 menu.insertItem(i18n("&Goto"), 1);
00118
00119 int id=menu.exec(p);
00120
00121 if (id == 1) {
00122 Selection target = appCore->getSimulation()->findObjectFromPath(std::string(item->text(col == 1).latin1()), true);
00123 Selection ref = target.body()->getSystem()->getStar();
00124 appCore->getSimulation()->setFrame(FrameOfReference(astro::PhaseLock, target, ref));
00125 QString date = item->text(2);
00126 int yearEnd = date.find('-', 1);
00127 astro::Date d(date.left(yearEnd).toInt(),
00128 date.mid(yearEnd + 1, 2).toInt(),
00129 date.mid(yearEnd + 4, 2).toInt());
00130 d.hour = item->text(3).left(2).toInt();
00131 d.minute = item->text(3).mid(3, 2).toInt();
00132 d.seconds = item->text(3).mid(6, 2).toDouble();
00133 appCore->getSimulation()->setTime((double)d);
00134 appCore->getSimulation()->update(0.0);
00135
00136 double distance = astro::kilometersToMicroLightYears(target.radius() * 4.0);
00137 RigidTransform to;
00138 to.rotation = Quatd::yrotation(PI);
00139 to.translation = Point3d(0, 0, -distance);
00140 appCore->getSimulation()->gotoLocation(to, 2.5);
00141 }
00142 }
|
|
|
Reimplemented from EclipseFinderDlgBase. Definition at line 45 of file eclipsefinderdlg.cpp. 00046 {
00047 std::string onBody = "";
00048
00049 switch(comboBody->currentItem()) {
00050 case 0:
00051 onBody = "Earth";
00052 break;
00053 case 1:
00054 onBody = "Jupiter";
00055 break;
00056 case 2:
00057 onBody = "Saturn";
00058 break;
00059 case 3:
00060 onBody = "Uranus";
00061 break;
00062 case 4:
00063 onBody = "Neptune";
00064 break;
00065 case 5:
00066 onBody = "Pluto";
00067 break;
00068 }
00069 EclipseFinder ef(appCore,
00070 onBody,
00071 (radioSolar->isChecked()?Eclipse::Solar:Eclipse::Moon),
00072 (double)(astro::Date(fromYSpin->value(),
00073 fromMSpin->value(),
00074 fromDSpin->value())),
00075 (double)(astro::Date(toYSpin->value(),
00076 toMSpin->value(),
00077 toDSpin->value())) + 1
00078 );
00079
00080 std::vector<Eclipse> eclipses = ef.getEclipses();
00081
00082 listEclipses->clear();
00083 for (std::vector<Eclipse>::iterator i = eclipses.begin();
00084 i != eclipses.end();
00085 i++) {
00086
00087 if ((*i).planete == "None") {
00088 new QListViewItem(listEclipses,
00089 QString((*i).planete.c_str()));
00090 continue;
00091 }
00092
00093 char d[12], strStart[10], strEnd[10];
00094 astro::Date start((*i).startTime);
00095 astro::Date end((*i).endTime);
00096
00097 sprintf(d, "%d-%02d-%02d", (*i).date->year, (*i).date->month, (*i).date->day);
00098 sprintf(strStart, "%02d:%02d:%02d", start.hour, start.minute, (int)start.seconds);
00099 sprintf(strEnd, "%02d:%02d:%02d", end.hour, end.minute, (int)end.seconds);
00100
00101 new QListViewItem(listEclipses,
00102 QString(_((*i).planete.c_str())),
00103 QString(_((*i).sattelite.c_str())),
00104 d,
00105 strStart,
00106 strEnd
00107 );
00108 }
00109 }
|
|
|
Definition at line 22 of file eclipsefinderdlg.h. Referenced by EclipseFinderDlg(), gotoEclipse(), and search(). |
1.4.1