// Update the map for the given location. void LocationDialog::setMapForLocation(const StelLocation& loc) { // Avoids useless processing if (lastPlanet==loc.planetName) return; QPixmap pixmap; // Try to set the proper planet map image if (loc.planetName=="Earth") { // Special case for earth, we don't want to see the clouds pixmap = QPixmap(":/graphicGui/world.png"); } else { SolarSystem* ssm = GETSTELMODULE(SolarSystem); PlanetP p = ssm->searchByEnglishName(loc.planetName); if (p) { QString path = StelFileMgr::findFile("textures/"+p->getTextMapName()); if (path.isEmpty()) { qWarning() << "ERROR - could not find planet map for " << loc.planetName; return; } pixmap = QPixmap(path); } } ui->mapLabel->setPixmap(pixmap); // For caching lastPlanet = loc.planetName; }
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(); }
// Update the map for the given location. void LocationDialog::setMapForLocation(const StelLocation& loc) { // Avoids usless processing if (lastPlanet==loc.planetName && lastVisionMode==StelApp::getInstance().getVisionModeNight()) return; QPixmap pixmap; // Try to set the proper planet map image if (loc.planetName=="Earth") { // Special case for earth, we don't want to see the clouds pixmap = QPixmap(":/graphicGui/world.png"); } else { SolarSystem* ssm = GETSTELMODULE(SolarSystem); PlanetP p = ssm->searchByEnglishName(loc.planetName); QString path; if (p) { try { path = StelFileMgr::findFile("textures/"+p->getTextMapName()); } catch (std::runtime_error& e) { qWarning() << "ERROR - could not find planet map for " << loc.planetName << e.what(); return; } pixmap = QPixmap(path); } } if (StelApp::getInstance().getVisionModeNight()) { ui->mapLabel->setPixmap(StelButton::makeRed(pixmap)); } else { ui->mapLabel->setPixmap(pixmap); } // For caching lastPlanet = loc.planetName; lastVisionMode = StelApp::getInstance().getVisionModeNight(); }
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)); }