~ubuntu-branches/debian/wheezy/stellarium/wheezy

« back to all changes in this revision

Viewing changes to src/core/modules/LandscapeMgr.cpp

  • Committer: Package Import Robot
  • Author(s): Tomasz Buchert
  • Date: 2012-05-18 13:26:18 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20120518132618-3uso09fo68c218cx
Tags: 0.11.2-1
* Imported Upstream version 0.11.1 and then 0.11.2 (Closes: #658431)
* Change maintainer (Closes: #668916)
* Machine-readable copyright file
* Bump Standards-Version to 3.9.3
* Update debhelper compat to 9
* Fix lintian duplicate-font-file warning
* Fix copyright-refers-to-symlink-license lintian tag
* Add lintian override for embedded-library error

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * Copyright (C) 2006 Fabien Chereau
4
4
 * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
5
5
 * Copyright (C) 2011 Alexander Wolf
 
6
 * Copyright (C) 2012 Timothy Reaves
6
7
 *
7
8
 * This program is free software; you can redistribute it and/or
8
9
 * modify it under the terms of the GNU General Public License
16
17
 *
17
18
 * You should have received a copy of the GNU General Public License
18
19
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
20
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
20
21
 */
21
22
 
22
23
#include <QDebug>
239
240
        else
240
241
                landscapeBrightness = (0.01 + 1.5*(sinSunAngleRad+0.1/1.5));
241
242
        if (moonPos[2] > -0.1/1.5)
242
 
                landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core),0.)*moonPos[2];
 
243
                landscapeBrightness += qMax(0.2/-12.*ssystem->getMoon()->getVMagnitude(core, true),0.)*moonPos[2];
243
244
 
244
245
        // TODO make this more generic for non-atmosphere planets
245
246
        if(atmosphere->getFadeIntensity() == 1)
344
345
 
345
346
                if (landscape->getDefaultFogSetting() >-1)
346
347
                  {
347
 
                    setFlagFog((bool) landscape->getDefaultFogSetting());
348
 
                    landscape->setFlagShowFog((bool) landscape->getDefaultFogSetting());
 
348
                        setFlagFog((bool) landscape->getDefaultFogSetting());
 
349
                        landscape->setFlagShowFog((bool) landscape->getDefaultFogSetting());
349
350
                  }
350
351
                if (landscape->getDefaultBortleIndex() > 0)
351
352
                  {
411
412
        if (cardinalsPoints) cardinalsPoints->updateI18n();
412
413
}
413
414
 
414
 
void LandscapeMgr::setFlagLandscape(bool b)
 
415
void LandscapeMgr::setFlagLandscape(const bool displayed)
415
416
{
416
 
        landscape->setFlagShow(b);
 
417
        if(landscape->getFlagShow() != displayed) {
 
418
                landscape->setFlagShow(displayed);
 
419
                emit landscapeDisplayedChanged(displayed);
 
420
        }
417
421
}
418
422
 
419
423
bool LandscapeMgr::getFlagLandscape() const
421
425
        return landscape->getFlagShow();
422
426
}
423
427
 
424
 
void LandscapeMgr::setFlagFog(bool b)
 
428
void LandscapeMgr::setFlagFog(const bool displayed)
425
429
{
426
 
        landscape->setFlagShowFog(b);
 
430
        if (landscape->getFlagShowFog() != displayed) {
 
431
                landscape->setFlagShowFog(displayed);
 
432
                emit fogDisplayedChanged(displayed);
 
433
        }
427
434
}
428
435
 
429
436
bool LandscapeMgr::getFlagFog() const
481
488
 
482
489
QString LandscapeMgr::getCurrentLandscapeHtmlDescription() const
483
490
{
484
 
        SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
485
 
        QString planetName = ssmgr->searchByEnglishName(landscape->getLocation().planetName)->getNameI18n();
486
491
        QString desc = getDescription();
487
492
        desc+="<p>";
488
493
        desc+="<b>"+q_("Author: ")+"</b>";
494
499
                desc += StelUtils::radToDmsStrAdapt(landscape->getLocation().longitude * M_PI/180.);
495
500
                desc += "/" + StelUtils::radToDmsStrAdapt(landscape->getLocation().latitude *M_PI/180.);
496
501
                desc += QString(q_(", %1 m")).arg(landscape->getLocation().altitude);
497
 
                if (planetName!="")
 
502
                QString planetName = landscape->getLocation().planetName;
 
503
                if (!planetName.isEmpty())
498
504
                {
499
 
                        desc += "<br><b>"+q_("Planet: ")+"</b>"+planetName;
 
505
                        desc += "<br><b>"+q_("Planet: ")+"</b>"+ q_(planetName);
500
506
                }
501
507
                desc += "<br><br>";
502
508
        }
504
510
}
505
511
 
506
512
//! Set flag for displaying Cardinals Points
507
 
void LandscapeMgr::setFlagCardinalsPoints(bool b)
 
513
void LandscapeMgr::setFlagCardinalsPoints(const bool displayed)
508
514
{
509
 
        cardinalsPoints->setFlagShow(b);
 
515
        if (cardinalsPoints->getFlagShow() != displayed) {
 
516
                cardinalsPoints->setFlagShow(displayed);
 
517
                emit cardinalsPointsDisplayedChanged(displayed);
 
518
        }
510
519
}
511
520
 
512
521
//! Get flag for displaying Cardinals Points
530
539
///////////////////////////////////////////////////////////////////////////////////////
531
540
// Atmosphere
532
541
//! Set flag for displaying Atmosphere
533
 
void LandscapeMgr::setFlagAtmosphere(bool b)
 
542
void LandscapeMgr::setFlagAtmosphere(const bool displayed)
534
543
{
535
 
        atmosphere->setFlagShow(b);
536
 
        StelApp::getInstance().getCore()->getSkyDrawer()->setFlagHasAtmosphere(b);
 
544
        if (atmosphere->getFlagShow() != displayed) {
 
545
                atmosphere->setFlagShow(displayed);
 
546
                StelApp::getInstance().getCore()->getSkyDrawer()->setFlagHasAtmosphere(displayed);
 
547
                emit atmosphereDisplayedChanged(displayed);
 
548
        }
537
549
}
538
550
 
539
551
//! Get flag for displaying Atmosphere
963
975
 
964
976
QString LandscapeMgr::getDescription() const
965
977
{
966
 
        QString lang = StelApp::getInstance().getLocaleMgr().getAppLanguage();
 
978
        QString lang = StelApp::getInstance().getLocaleMgr().getAppLanguage();
 
979
        if (!QString("pt_BR zh_CN zh_HK zh_TW").contains(lang))
 
980
        {
 
981
                lang = lang.split("_").at(0);
 
982
        }
967
983
        QString descriptionFile = StelFileMgr::findFile("landscapes/" + getCurrentLandscapeID(), StelFileMgr::Directory) + "/description." + lang + ".utf8";
968
984
        QString desc;
969
985