void StelCore::moveObserverToSelected() { StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(objmgr); if (objmgr->getWasSelected()) { Planet* pl = dynamic_cast<Planet*>(objmgr->getSelectedObject()[0].data()); if (pl) { // We need to move to the selected planet. Try to generate a location from the current one StelLocation loc = getCurrentLocation(); if (loc.planetName != pl->getEnglishName()) { loc.planetName = pl->getEnglishName(); loc.name = "-"; loc.state = ""; moveObserverTo(loc); LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); if (pl->getEnglishName() == "Solar System Observer") { landscapeMgr->setFlagAtmosphere(false); landscapeMgr->setFlagFog(false); landscapeMgr->setFlagLandscape(false); } else { landscapeMgr->setFlagAtmosphere(pl->hasAtmosphere()); landscapeMgr->setFlagFog(pl->hasAtmosphere()); landscapeMgr->setFlagLandscape(true); } } } } StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); Q_ASSERT(mmgr); mmgr->setFlagTracking(false); }
void LocationDialog::setFieldsFromLocation(const StelLocation& loc) { // Deactivate edit signals disconnectEditSignals(); ui->cityNameLineEdit->setText(loc.name); int idx = ui->countryNameComboBox->findData(loc.country, Qt::UserRole, Qt::MatchCaseSensitive); if (idx==-1) { // Use France as default ui->countryNameComboBox->findData(QVariant("France"), Qt::UserRole, Qt::MatchCaseSensitive); } ui->countryNameComboBox->setCurrentIndex(idx); ui->longitudeSpinBox->setDegrees(loc.longitude); ui->latitudeSpinBox->setDegrees(loc.latitude); ui->altitudeSpinBox->setValue(loc.altitude); idx = ui->planetNameComboBox->findData(loc.planetName, Qt::UserRole, Qt::MatchCaseSensitive); if (idx==-1) { // Use Earth as default idx = ui->planetNameComboBox->findData(QVariant("Earth"), Qt::UserRole, Qt::MatchCaseSensitive); } ui->planetNameComboBox->setCurrentIndex(idx); setMapForLocation(loc); // Set pointer position ui->mapLabel->setCursorPos(loc.longitude, loc.latitude); ui->deleteLocationFromListPushButton->setEnabled(StelApp::getInstance().getLocationMgr().canDeleteUserLocation(loc.getID())); SolarSystem* ssm = GETSTELMODULE(SolarSystem); PlanetP p = ssm->searchByEnglishName(loc.planetName); LandscapeMgr* ls = GETSTELMODULE(LandscapeMgr); if (ls->getFlagAtmosphereAutoEnable()) { if (loc.planetName != StelApp::getInstance().getCore()->getCurrentLocation().planetName) { QSettings* conf = StelApp::getInstance().getSettings(); ls->setFlagAtmosphere(p->hasAtmosphere() & conf->value("landscape/flag_atmosphere", true).toBool()); ls->setFlagFog(p->hasAtmosphere() & conf->value("landscape/flag_fog", true).toBool()); } } // Reactivate edit signals connectEditSignals(); }
void StelCore::returnToHome() { // Using returnToDefaultLocation() and getCurrentLocation() introduce issue, because for flying // between planets using SpaceShip and second method give does not exist data StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr(); bool ok = false; StelLocation loc = locationMgr.locationForString(defaultLocationID, &ok); if (ok) moveObserverTo(loc, 0.); PlanetP p = GETSTELMODULE(SolarSystem)->searchByEnglishName(loc.planetName); LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); landscapeMgr->setCurrentLandscapeID(landscapeMgr->getDefaultLandscapeID()); landscapeMgr->setFlagAtmosphere(p->hasAtmosphere()); landscapeMgr->setFlagFog(p->hasAtmosphere()); GETSTELMODULE(StelObjectMgr)->unSelect(); StelMovementMgr* smmgr = getMovementMgr(); smmgr->setViewDirectionJ2000(altAzToJ2000(smmgr->getInitViewingDirection(), StelCore::RefractionOff)); }