File indexing completed on 2024-05-05 03:49:48

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Cezar Mocan <mocancezar@gmail.com>
0004 //
0005 
0006 #include "GroundLayer.h"
0007 
0008 #include "GeoPainter.h"
0009 #include "ViewportParams.h"
0010 #include "RenderState.h"
0011 
0012 namespace Marble
0013 {
0014 
0015 GroundLayer::GroundLayer()
0016         : m_color( QColor( 153, 179, 204 ) )
0017 {
0018 }
0019 
0020 GroundLayer::~GroundLayer()
0021 {
0022 }
0023 
0024 QStringList GroundLayer::renderPosition() const
0025 {
0026     return QStringList(QStringLiteral("SURFACE"));
0027 }
0028 
0029 bool GroundLayer::render( GeoPainter *painter,
0030                               ViewportParams *viewParams,
0031                               const QString &renderPos,
0032                               GeoSceneLayer *layer )
0033 {
0034     Q_UNUSED( renderPos )
0035     Q_UNUSED( layer )
0036 
0037     QBrush backgroundBrush( m_color );
0038     QPen backgroundPen( Qt::NoPen );
0039 
0040     painter->setBrush( backgroundBrush );
0041     painter->setPen( backgroundPen );
0042     painter->drawPath( viewParams->mapShape() );
0043 
0044     return true;
0045 }
0046 
0047 qreal GroundLayer::zValue() const
0048 {
0049     return -50.0;
0050 }
0051 
0052 void GroundLayer::setColor( const QColor &color )
0053 {   
0054     m_color = color;
0055 }
0056 
0057 QColor GroundLayer::color() const
0058 {
0059     return m_color;
0060 }
0061 
0062 RenderState GroundLayer::renderState() const
0063 {
0064     return RenderState(QStringLiteral("Ground"));
0065 }
0066 
0067 }