LandscapeMgr.cpp   LandscapeMgr.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2006 Fabien Chereau * Copyright (C) 2006 Fabien Chereau
* Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature) * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
* Copyright (C) 2011 Alexander Wolf * Copyright (C) 2011 Alexander Wolf
* Copyright (C) 2012 Timothy Reaves
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QTemporaryFile> #include <QTemporaryFile>
#ifdef USE_OPENGL_ES2 #ifdef USE_OPENGL_ES2
skipping to change at line 240 skipping to change at line 241
moonPos.normalize(); moonPos.normalize();
// We define the brigthness zero when the sun is 8 degrees below the horizon. // We define the brigthness zero when the sun is 8 degrees below the horizon.
float sinSunAngleRad = sin(qMin(M_PI_2, asin(sunPos[2])+8.*M_PI/180. )); float sinSunAngleRad = sin(qMin(M_PI_2, asin(sunPos[2])+8.*M_PI/180. ));
if(sinSunAngleRad < -0.1/1.5 ) if(sinSunAngleRad < -0.1/1.5 )
landscapeBrightness = 0.01; landscapeBrightness = 0.01;
else else
landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5)); landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5));
if (moonPos[2] > -0.1/1.5) if (moonPos[2] > -0.1/1.5)
landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->get VMagnitude(core),0.)*moonPos[2]; landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->get VMagnitude(core, true),0.)*moonPos[2];
// TODO make this more generic for non-atmosphere planets // TODO make this more generic for non-atmosphere planets
if(atmosphere->getFadeIntensity() == 1) if(atmosphere->getFadeIntensity() == 1)
{ {
// If the atmosphere is on, a solar eclipse might darken the sky // If the atmosphere is on, a solar eclipse might darken the sky
// otherwise we just use the sun position calculation above // otherwise we just use the sun position calculation above
landscapeBrightness *= (atmosphere->getRealDisplayIntensityF actor()+0.1); landscapeBrightness *= (atmosphere->getRealDisplayIntensityF actor()+0.1);
} }
// TODO: should calculate dimming with solar eclipse even without at mosphere on // TODO: should calculate dimming with solar eclipse even without at mosphere on
skipping to change at line 345 skipping to change at line 346
if (getFlagLandscapeSetsLocation()) if (getFlagLandscapeSetsLocation())
{ {
StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation()); StelApp::getInstance().getCore()->moveObserverTo(landscape-> getLocation());
// GZ Patch: allow change in fog, extinction, refraction par ameters and light pollution // GZ Patch: allow change in fog, extinction, refraction par ameters and light pollution
//QSettings* conf = StelApp::getInstance().getSettings(); //QSettings* conf = StelApp::getInstance().getSettings();
//Q_ASSERT(conf); //Q_ASSERT(conf);
StelSkyDrawer* drawer=StelApp::getInstance().getCore()->getS kyDrawer(); StelSkyDrawer* drawer=StelApp::getInstance().getCore()->getS kyDrawer();
if (landscape->getDefaultFogSetting() >-1) if (landscape->getDefaultFogSetting() >-1)
{ {
setFlagFog((bool) landscape->getDefaultFogSetting()); setFlagFog((bool) landscape->getDefaultFogSetting())
landscape->setFlagShowFog((bool) landscape->getDefaultFo ;
gSetting()); landscape->setFlagShowFog((bool) landscape->getDefau
ltFogSetting());
} }
if (landscape->getDefaultBortleIndex() > 0) if (landscape->getDefaultBortleIndex() > 0)
{ {
setAtmosphereBortleLightPollution(landscape->getDefaultB ortleIndex()); setAtmosphereBortleLightPollution(landscape->getDefaultB ortleIndex());
// TODO: HOWTO make the GUI aware of the new value? // TODO: HOWTO make the GUI aware of the new value?
// conf->setValue("landscape/init_bortle_scale", landsca pe->getDefaultBortleIndex()); // conf->setValue("landscape/init_bortle_scale", landsca pe->getDefaultBortleIndex());
} }
if (landscape->getDefaultAtmosphericExtinction() >= 0.0) if (landscape->getDefaultAtmosphericExtinction() >= 0.0)
{ {
drawer->setExtinctionCoefficient(landscape->getDefaultAt mosphericExtinction()); drawer->setExtinctionCoefficient(landscape->getDefaultAt mosphericExtinction());
skipping to change at line 412 skipping to change at line 413
conf->setValue("init_location/landscape_name", id); conf->setValue("init_location/landscape_name", id);
return true; return true;
} }
void LandscapeMgr::updateI18n() void LandscapeMgr::updateI18n()
{ {
// Translate all labels with the new language // Translate all labels with the new language
if (cardinalsPoints) cardinalsPoints->updateI18n(); if (cardinalsPoints) cardinalsPoints->updateI18n();
} }
void LandscapeMgr::setFlagLandscape(bool b) void LandscapeMgr::setFlagLandscape(const bool displayed)
{ {
landscape->setFlagShow(b); if(landscape->getFlagShow() != displayed) {
landscape->setFlagShow(displayed);
emit landscapeDisplayedChanged(displayed);
}
} }
bool LandscapeMgr::getFlagLandscape() const bool LandscapeMgr::getFlagLandscape() const
{ {
return landscape->getFlagShow(); return landscape->getFlagShow();
} }
void LandscapeMgr::setFlagFog(bool b) void LandscapeMgr::setFlagFog(const bool displayed)
{ {
landscape->setFlagShowFog(b); if (landscape->getFlagShowFog() != displayed) {
landscape->setFlagShowFog(displayed);
emit fogDisplayedChanged(displayed);
}
} }
bool LandscapeMgr::getFlagFog() const bool LandscapeMgr::getFlagFog() const
{ {
return landscape->getFlagShowFog(); return landscape->getFlagShowFog();
} }
/********************************************************************* /*********************************************************************
Retrieve list of the names of all the available landscapes Retrieve list of the names of all the available landscapes
*********************************************************************/ *********************************************************************/
skipping to change at line 504 skipping to change at line 511
if (!planetName.isEmpty()) if (!planetName.isEmpty())
{ {
desc += "<br><b>"+q_("Planet: ")+"</b>"+ q_(planetNa me); desc += "<br><b>"+q_("Planet: ")+"</b>"+ q_(planetNa me);
} }
desc += "<br><br>"; desc += "<br><br>";
} }
return desc; return desc;
} }
//! Set flag for displaying Cardinals Points //! Set flag for displaying Cardinals Points
void LandscapeMgr::setFlagCardinalsPoints(bool b) void LandscapeMgr::setFlagCardinalsPoints(const bool displayed)
{ {
cardinalsPoints->setFlagShow(b); if (cardinalsPoints->getFlagShow() != displayed) {
cardinalsPoints->setFlagShow(displayed);
emit cardinalsPointsDisplayedChanged(displayed);
}
} }
//! Get flag for displaying Cardinals Points //! Get flag for displaying Cardinals Points
bool LandscapeMgr::getFlagCardinalsPoints() const bool LandscapeMgr::getFlagCardinalsPoints() const
{ {
return cardinalsPoints->getFlagShow(); return cardinalsPoints->getFlagShow();
} }
//! Set Cardinals Points color //! Set Cardinals Points color
void LandscapeMgr::setColorCardinalPoints(const Vec3f& v) void LandscapeMgr::setColorCardinalPoints(const Vec3f& v)
skipping to change at line 530 skipping to change at line 540
//! Get Cardinals Points color //! Get Cardinals Points color
Vec3f LandscapeMgr::getColorCardinalPoints() const Vec3f LandscapeMgr::getColorCardinalPoints() const
{ {
return cardinalsPoints->get_color(); return cardinalsPoints->get_color();
} }
/////////////////////////////////////////////////////////////////////////// //////////// /////////////////////////////////////////////////////////////////////////// ////////////
// Atmosphere // Atmosphere
//! Set flag for displaying Atmosphere //! Set flag for displaying Atmosphere
void LandscapeMgr::setFlagAtmosphere(bool b) void LandscapeMgr::setFlagAtmosphere(const bool displayed)
{ {
atmosphere->setFlagShow(b); if (atmosphere->getFlagShow() != displayed) {
StelApp::getInstance().getCore()->getSkyDrawer()->setFlagHasAtmosphe atmosphere->setFlagShow(displayed);
re(b); StelApp::getInstance().getCore()->getSkyDrawer()->setFlagHas
Atmosphere(displayed);
emit atmosphereDisplayedChanged(displayed);
}
} }
//! Get flag for displaying Atmosphere //! Get flag for displaying Atmosphere
bool LandscapeMgr::getFlagAtmosphere() const bool LandscapeMgr::getFlagAtmosphere() const
{ {
return atmosphere->getFlagShow(); return atmosphere->getFlagShow();
} }
//! Set atmosphere fade duration in s //! Set atmosphere fade duration in s
void LandscapeMgr::setAtmosphereFadeDuration(float f) void LandscapeMgr::setAtmosphereFadeDuration(float f)
 End of changes. 12 change blocks. 
15 lines changed or deleted 29 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/