• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataItemIcon.cpp
Go to the documentation of this file.
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 2012 Mohammed Nafees <nafees.technocool@gmail.com>
9 //
10 
11 #include "GeoDataItemIcon.h"
12 #include "GeoDataTypes.h"
13 
14 namespace Marble
15 {
16 
17 class GeoDataItemIconPrivate
18 {
19 public:
20  GeoDataItemIconPrivate();
21 
22  GeoDataItemIcon::ItemIconStates m_state;
23  QString m_iconPath;
24  QImage m_icon;
25 };
26 
27 GeoDataItemIconPrivate::GeoDataItemIconPrivate() :
28  m_state(),
29  m_iconPath(),
30  m_icon()
31 {
32 }
33 
34 GeoDataItemIcon::GeoDataItemIcon() :
35  d( new GeoDataItemIconPrivate )
36 {
37 }
38 
39 GeoDataItemIcon::GeoDataItemIcon( const Marble::GeoDataItemIcon &other ) :
40  GeoDataObject(), d( new GeoDataItemIconPrivate( *other.d ) )
41 {
42 }
43 
44 GeoDataItemIcon &GeoDataItemIcon::operator=( const GeoDataItemIcon &other )
45 {
46  GeoDataObject::operator=( other );
47  *d = *other.d;
48  return *this;
49 }
50 
51 bool GeoDataItemIcon::operator==( const GeoDataItemIcon& other ) const
52 {
53  return equals(other) &&
54  d->m_state == other.d->m_state &&
55  d->m_iconPath == other.d->m_iconPath &&
56  d->m_icon == other.d->m_icon;
57 }
58 
59 bool GeoDataItemIcon::operator!=( const GeoDataItemIcon& other ) const
60 {
61  return !this->operator==(other);
62 }
63 
64 GeoDataItemIcon::~GeoDataItemIcon()
65 {
66  delete d;
67 }
68 
69 const char *GeoDataItemIcon::nodeType() const
70 {
71  return GeoDataTypes::GeoDataItemIconType;
72 }
73 
74 GeoDataItemIcon::ItemIconStates GeoDataItemIcon::state() const
75 {
76  return d->m_state;
77 }
78 
79 void GeoDataItemIcon::setState( const ItemIconStates &state )
80 {
81  d->m_state = state;
82 }
83 
84 void GeoDataItemIcon::setIcon( const QImage &icon )
85 {
86  d->m_icon = icon;
87 }
88 
89 QString GeoDataItemIcon::iconPath() const
90 {
91  return d->m_iconPath;
92 }
93 
94 void GeoDataItemIcon::setIconPath( const QString &path )
95 {
96  d->m_iconPath = path;
97 }
98 
99 QImage GeoDataItemIcon::icon() const
100 {
101  if(!d->m_icon.isNull())
102  {
103  return d->m_icon;
104  }
105  else if(!d->m_iconPath.isEmpty())
106  {
107  d->m_icon = QImage(resolvePath(d->m_iconPath));
108  return d->m_icon;
109  }
110  else
111  {
112  return QImage();
113  }
114 }
115 
116 }
Marble::GeoDataTypes::GeoDataItemIconType
const char * GeoDataItemIconType
Definition: GeoDataTypes.cpp:91
Marble::GeoDataItemIcon::~GeoDataItemIcon
~GeoDataItemIcon()
Definition: GeoDataItemIcon.cpp:64
Marble::GeoDataItemIcon::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataItemIcon.cpp:69
Marble::GeoDataItemIcon
Definition: GeoDataItemIcon.h:24
Marble::GeoDataItemIcon::icon
QImage icon() const
Definition: GeoDataItemIcon.cpp:99
Marble::GeoDataObject
A base class for all geodata objects.
Definition: GeoDataObject.h:48
Marble::GeoDataObject::equals
virtual bool equals(const GeoDataObject &other) const
Compares the value of id and targetId of the two objects.
Definition: GeoDataObject.cpp:126
Marble::GeoDataItemIcon::setIcon
void setIcon(const QImage &icon)
Definition: GeoDataItemIcon.cpp:84
Marble::GeoDataItemIcon::operator==
bool operator==(const GeoDataItemIcon &other) const
Definition: GeoDataItemIcon.cpp:51
GeoDataItemIcon.h
Marble::GeoDataItemIcon::setIconPath
void setIconPath(const QString &path)
Definition: GeoDataItemIcon.cpp:94
QString
Marble::GeoDataItemIcon::GeoDataItemIcon
GeoDataItemIcon()
Definition: GeoDataItemIcon.cpp:34
Marble::GeoDataObject::resolvePath
QString resolvePath(const QString &relativePath) const
Definition: GeoDataObject.cpp:95
Marble::GeoDataItemIcon::setState
void setState(const ItemIconStates &state)
Definition: GeoDataItemIcon.cpp:79
QImage
Marble::GeoDataItemIcon::operator!=
bool operator!=(const GeoDataItemIcon &other) const
Definition: GeoDataItemIcon.cpp:59
Marble::GeoDataItemIcon::operator=
GeoDataItemIcon & operator=(const GeoDataItemIcon &other)
Definition: GeoDataItemIcon.cpp:44
Marble::GeoDataObject::operator=
GeoDataObject & operator=(const GeoDataObject &)
Definition: GeoDataObject.cpp:54
GeoDataTypes.h
Marble::GeoDataItemIcon::iconPath
QString iconPath() const
Definition: GeoDataItemIcon.cpp:89
Marble::GeoDataItemIcon::state
ItemIconStates state() const
Definition: GeoDataItemIcon.cpp:74
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal