~ubuntu-branches/ubuntu/quantal/marble/quantal

« back to all changes in this revision

Viewing changes to src/lib/geodata/data/GeoDataPolyStyle.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-11 15:43:02 UTC
  • Revision ID: james.westby@ubuntu.com-20110711154302-lq69ftcx125g1jx5
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// This file is part of the Marble Virtual Globe.
 
3
//
 
4
// This program is free software licensed under the GNU LGPL. You can
 
5
// find a copy of this license in LICENSE.txt in the top directory of
 
6
// the source code.
 
7
//
 
8
// Copyright 2008      Patrick Spendrin <ps_ml@gmx.de>
 
9
//
 
10
 
 
11
 
 
12
#include "GeoDataPolyStyle.h"
 
13
 
 
14
#include "GeoDataTypes.h"
 
15
 
 
16
namespace Marble
 
17
{
 
18
 
 
19
class GeoDataPolyStylePrivate
 
20
{
 
21
  public:
 
22
    GeoDataPolyStylePrivate()
 
23
     : m_fill( true ), m_outline( true )
 
24
    {
 
25
    }
 
26
 
 
27
    const char* nodeType() const
 
28
    {
 
29
        return GeoDataTypes::GeoDataPolyStyleType;
 
30
    }
 
31
 
 
32
    /// whether to fill the polygon
 
33
    bool  m_fill;
 
34
    /// whether to draw the outline
 
35
    bool  m_outline;
 
36
};
 
37
 
 
38
GeoDataPolyStyle::GeoDataPolyStyle()
 
39
    : d( new GeoDataPolyStylePrivate )
 
40
{
 
41
}
 
42
 
 
43
GeoDataPolyStyle::GeoDataPolyStyle( const GeoDataPolyStyle& other )
 
44
    : GeoDataColorStyle( other ), d( new GeoDataPolyStylePrivate( *other.d ) )
 
45
{
 
46
}
 
47
 
 
48
GeoDataPolyStyle::GeoDataPolyStyle( const QColor &color )
 
49
    : d( new GeoDataPolyStylePrivate )
 
50
{
 
51
    setColor( color );
 
52
}
 
53
 
 
54
GeoDataPolyStyle::~GeoDataPolyStyle()
 
55
{
 
56
    delete d;
 
57
}
 
58
 
 
59
GeoDataPolyStyle& GeoDataPolyStyle::operator=( const GeoDataPolyStyle& other )
 
60
{
 
61
    GeoDataColorStyle::operator=( other );
 
62
    *d = *other.d;
 
63
    return *this;
 
64
}
 
65
 
 
66
const char* GeoDataPolyStyle::nodeType() const
 
67
{
 
68
    return d->nodeType();
 
69
}
 
70
 
 
71
void GeoDataPolyStyle::setFill( const bool &fill )
 
72
{
 
73
    d->m_fill = fill;
 
74
}
 
75
 
 
76
bool GeoDataPolyStyle::fill() const
 
77
{
 
78
    return d->m_fill;
 
79
}
 
80
 
 
81
void GeoDataPolyStyle::setOutline( const bool &outline )
 
82
{
 
83
    d->m_outline = outline;
 
84
}
 
85
 
 
86
bool GeoDataPolyStyle::outline() const
 
87
{
 
88
    return d->m_outline;
 
89
}
 
90
 
 
91
void GeoDataPolyStyle::pack( QDataStream& stream ) const
 
92
{
 
93
    GeoDataColorStyle::pack( stream );
 
94
    
 
95
    stream << d->m_fill;
 
96
    stream << d->m_outline;
 
97
}
 
98
 
 
99
void GeoDataPolyStyle::unpack( QDataStream& stream )
 
100
{
 
101
    GeoDataColorStyle::unpack( stream );
 
102
    
 
103
    stream >> d->m_fill;
 
104
    stream >> d->m_outline;
 
105
}
 
106
 
 
107
}