#include <kdeapp.h>
Collaboration diagram for LongLatDialog:

Public Member Functions | |
| LongLatDialog (QWidget *parent, CelestiaCore *appCore) | |
Private Slots | |
| void | slotApply () |
| void | slotCancel () |
| void | slotOk () |
Private Attributes | |
| QLineEdit * | altEdit |
| CelestiaCore * | appCore |
| QLineEdit * | latEdit |
| QComboBox * | latSign |
| QLineEdit * | longEdit |
| QComboBox * | longSign |
| QLineEdit * | objEdit |
|
||||||||||||
|
Definition at line 1441 of file kdeapp.cpp. References altEdit, appCore, distance(), Selection::getName(), Simulation::getSelection(), Simulation::getSelectionLongLat(), CelestiaCore::getSimulation(), latEdit, latSign, longEdit, longSign, objEdit, and Selection::radius(). 01441 : 01442 KDialogBase(parent, "long_lat", true, "Go to Long/Lat"), appCore(appCore) 01443 { 01444 QGrid* grid = makeGridMainWidget(3, Qt::Horizontal); 01445 01446 01447 QLabel* objLab = new QLabel(i18n("Object: "), grid); 01448 objLab->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01449 objEdit = new QLineEdit(grid); 01450 new QLabel("", grid); 01451 01452 QLabel* longLab = new QLabel(i18n("Longitude: "), grid); 01453 longLab->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01454 longEdit = new QLineEdit(grid); 01455 longEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01456 longEdit->setValidator(new QDoubleValidator(0, 180, 3, longEdit)); 01457 longSign = new QComboBox( grid ); 01458 longSign->insertItem(i18n("East", "E")); 01459 longSign->insertItem(i18n("West", "W")); 01460 01461 QLabel* latLab = new QLabel(i18n("Latitude: "), grid); 01462 latLab->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01463 latEdit = new QLineEdit(grid); 01464 latEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01465 latEdit->setValidator(new QDoubleValidator(0, 90, 3, latEdit)); 01466 latSign = new QComboBox( grid ); 01467 latSign->insertItem(i18n("North", "N")); 01468 latSign->insertItem(i18n("South", "S")); 01469 01470 QLabel* altLab = new QLabel(i18n("Altitude: "), grid); 01471 altLab->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01472 altEdit = new QLineEdit(grid); 01473 altEdit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 01474 altEdit->setValidator(new QDoubleValidator(altEdit)); 01475 new QLabel(i18n("km"), grid); 01476 01477 double distance, longitude, latitude; 01478 appCore->getSimulation()->getSelectionLongLat(distance, longitude, latitude); 01479 01480 if (longitude < 0) { 01481 longitude = -longitude; 01482 longSign->setCurrentItem(1); 01483 } 01484 if (latitude < 0) { 01485 latitude = -latitude; 01486 latSign->setCurrentItem(1); 01487 } 01488 01489 Selection selection = appCore->getSimulation()->getSelection(); 01490 QString objName(selection.getName().c_str()); 01491 objEdit->setText(objName.mid(objName.findRev('/') + 1)); 01492 01493 latEdit->setText(QString("%1").arg(latitude, 0, 'f', 3)); 01494 longEdit->setText(QString("%1").arg(longitude, 0, 'f', 3)); 01495 altEdit->setText(QString("%1").arg(distance - selection.radius(), 0, 'f', 0)); 01496 01497 }
|
|
|
Definition at line 1509 of file kdeapp.cpp. References altEdit, appCore, degToRad(), distance(), Selection::empty(), Simulation::findObjectFromPath(), Simulation::follow(), CelestiaCore::getSimulation(), Simulation::gotoSelectionLongLat(), astro::kilometersToLightYears(), latEdit, latSign, longEdit, longSign, objEdit, Selection::radius(), and Simulation::setSelection(). Referenced by slotOk(). 01509 {
01510 Simulation* appSim = appCore->getSimulation();
01511 Selection sel = appSim->findObjectFromPath(objEdit->text().latin1());
01512 if (!sel.empty())
01513 {
01514 appSim->setSelection(sel);
01515 appSim->follow();
01516
01517 double altitude = altEdit->text().toDouble();
01518 if (altitude < 0.020) altitude = .020;
01519 double distance = altitude + sel.radius();
01520 distance = astro::kilometersToLightYears(distance);
01521
01522 double longitude = longEdit->text().toDouble();
01523 if (longSign->currentItem() == 1) {
01524 longitude = -longitude;
01525 }
01526
01527 double latitude = latEdit->text().toDouble();
01528 if (latSign->currentItem() == 1) {
01529 latitude = -latitude;
01530 }
01531
01532 appSim->gotoSelectionLongLat(5.0,
01533 distance,
01534 degToRad(longitude),
01535 degToRad(latitude),
01536 Vec3f(0, 1, 0));
01537 }
01538 }
|
|
|
Definition at line 1499 of file kdeapp.cpp. 01499 {
01500 reject();
01501 }
|
|
|
Definition at line 1503 of file kdeapp.cpp. References slotApply(). 01503 {
01504 slotApply();
01505 accept();
01506 }KdeAlerter alerter;
|
|
|
Definition at line 254 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 253 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 254 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 255 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 254 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 255 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
|
|
Definition at line 254 of file kdeapp.h. Referenced by LongLatDialog(), and slotApply(). |
1.4.1