File indexing completed on 2024-04-28 15:16:16

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
0004 // SPDX-FileCopyrightText: 2008 Jens-Michael Hoffmann <jensmh@gmx.de>
0005 //
0006 
0007 
0008 #include "ViewParams.h"
0009 
0010 namespace Marble
0011 {
0012 
0013 class ViewParamsPrivate
0014 {
0015 public:
0016     ViewParamsPrivate();
0017     ~ViewParamsPrivate();
0018 
0019     MapQuality      m_stillQuality;
0020     MapQuality      m_animationQuality;
0021 
0022     // The context that is active now.
0023     ViewContext     m_viewContext;
0024 
0025     // The quality that we are painting right now.
0026     MapQuality           m_mapQuality;
0027 
0028 
0029     // Parameters that determine the painting
0030     // Show/don't show options
0031 
0032     bool        m_showAtmosphere;
0033 
0034     bool        m_showClouds;
0035 };
0036 
0037 ViewParamsPrivate::ViewParamsPrivate()
0038     : m_stillQuality( HighQuality ),
0039       m_animationQuality( LowQuality ),
0040       m_viewContext( Still ),
0041       m_mapQuality( m_stillQuality ),
0042       // Show / don't show parameters
0043       m_showAtmosphere( true ),
0044       m_showClouds( false )
0045 {
0046 }
0047 
0048 ViewParamsPrivate::~ViewParamsPrivate()
0049 {
0050 }
0051 
0052 
0053 ViewParams::ViewParams()
0054     : d( new ViewParamsPrivate )
0055 {
0056 }
0057 
0058 ViewParams::~ViewParams()
0059 {
0060     delete d;
0061 }
0062 
0063 MapQuality ViewParams::mapQuality( ViewContext viewContext ) const
0064 {
0065     if ( viewContext == Still )
0066         return d->m_stillQuality;
0067 
0068     Q_ASSERT( viewContext == Animation );
0069     return d->m_animationQuality; 
0070 }
0071 
0072 MapQuality ViewParams::mapQuality() const
0073 {
0074     return d->m_mapQuality;
0075 }
0076 
0077 void ViewParams::setMapQualityForViewContext( MapQuality quality, ViewContext viewContext )
0078 {
0079     if ( viewContext == Still ) {
0080         d->m_stillQuality = quality;
0081     }
0082     else if ( viewContext == Animation ) {
0083         d->m_animationQuality = quality;
0084     }
0085 
0086     if ( d->m_viewContext == viewContext ) {
0087         d->m_mapQuality = quality;
0088     }
0089 }
0090 
0091 ViewContext ViewParams::viewContext() const
0092 {
0093     return d->m_viewContext;
0094 }
0095 
0096 void ViewParams::setViewContext( ViewContext viewContext )
0097 {
0098     d->m_viewContext = viewContext;
0099 
0100     if ( viewContext == Still )
0101         d->m_mapQuality = d->m_stillQuality;
0102     if ( viewContext == Animation )
0103         d->m_mapQuality = d->m_animationQuality;
0104 }
0105 
0106 bool ViewParams::showAtmosphere() const
0107 {
0108     return d->m_showAtmosphere;
0109 }
0110 
0111 void ViewParams::setShowAtmosphere( bool showAtmosphere )
0112 {
0113     d->m_showAtmosphere = showAtmosphere;
0114 }
0115 
0116 bool ViewParams::showClouds() const
0117 {
0118     return d->m_showClouds;
0119 }
0120 
0121 void ViewParams::setShowClouds( bool const showClouds )
0122 {
0123     d->m_showClouds = showClouds;
0124 }
0125 
0126 }