• 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
GeoDataVec2.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 "GeoDataVec2.h"
12 
13 #include "MarbleDebug.h"
14 
15 namespace Marble {
16 
17 class GeoDataVec2Private
18 {
19 public:
20  GeoDataVec2Private();
21 
22  GeoDataVec2::Unit m_xunit;
23  GeoDataVec2::Unit m_yunit;
24 
25  static GeoDataVec2::Unit parseUnits( const QString &value );
26 };
27 
28 GeoDataVec2Private::GeoDataVec2Private() :
29  m_xunit(GeoDataVec2::Fraction), m_yunit(GeoDataVec2::Fraction)
30 {
31 }
32 
33 GeoDataVec2::GeoDataVec2() :
34  d( new GeoDataVec2Private )
35 {
36 }
37 
38 GeoDataVec2::GeoDataVec2(const qreal &x, const qreal &y, const QString &xunits, const QString &yunits) :
39  d( new GeoDataVec2Private )
40 {
41  setX( x );
42  setY( y );
43  d->m_xunit = GeoDataVec2Private::parseUnits( xunits );
44  d->m_yunit = GeoDataVec2Private::parseUnits( yunits );
45 }
46 
47 GeoDataVec2::Unit GeoDataVec2Private::parseUnits( const QString &value )
48 {
49  if ( value == "fraction" ) {
50  return GeoDataVec2::Fraction;
51  } else if ( value == "pixels" ) {
52  return GeoDataVec2::Pixels;
53  } else if ( value == "insetPixels" ) {
54  return GeoDataVec2::InsetPixels;
55  } else {
56  mDebug() << "Warning: Unknown units value " << value << " - falling back to default 'fraction'";
57  return GeoDataVec2::Fraction;
58  }
59 }
60 
61 GeoDataVec2::GeoDataVec2( const Marble::GeoDataVec2 &other ) :
62  QPointF(other), d( new GeoDataVec2Private( *other.d ) )
63 {
64 }
65 
66 GeoDataVec2 &GeoDataVec2::operator=( const GeoDataVec2 &other )
67 {
68  QPointF::operator=(other);
69  *d = *other.d;
70  return *this;
71 }
72 
73 bool GeoDataVec2::operator==(const GeoDataVec2& other) const
74 {
75  return x() == other.x() && y() == other.y() &&
76  d->m_xunit == other.d->m_xunit && d->m_yunit == other.d->m_yunit;
77 }
78 
79 bool GeoDataVec2::operator!=(const GeoDataVec2& other) const
80 {
81  return !this->operator==(other);
82 }
83 
84 GeoDataVec2::~GeoDataVec2()
85 {
86  delete d;
87 }
88 
89 GeoDataVec2::Unit GeoDataVec2::xunit() const
90 {
91  return d->m_xunit;
92 }
93 
94 void GeoDataVec2::setXunits(Unit xunit)
95 {
96  d->m_xunit = xunit;
97 }
98 
99 GeoDataVec2::Unit GeoDataVec2::yunit() const
100 {
101  return d->m_yunit;
102 }
103 
104 void GeoDataVec2::setYunits(Unit yunit)
105 {
106  d->m_yunit = yunit;
107 }
108 
109 }
Marble::GeoDataVec2::Fraction
Definition: GeoDataVec2.h:25
Marble::GeoDataVec2::Unit
Unit
Definition: GeoDataVec2.h:25
Marble::GeoDataVec2::xunit
Unit xunit() const
Definition: GeoDataVec2.cpp:89
Marble::GeoDataVec2::setYunits
void setYunits(Unit yunit)
Definition: GeoDataVec2.cpp:104
MarbleDebug.h
QPointF
Marble::GeoDataVec2::~GeoDataVec2
~GeoDataVec2()
Definition: GeoDataVec2.cpp:84
QPointF::x
qreal x() const
QPointF::y
qreal y() const
Marble::GeoDataVec2::operator==
bool operator==(const GeoDataVec2 &other) const
Definition: GeoDataVec2.cpp:73
QString
Marble::GeoDataVec2
Definition: GeoDataVec2.h:22
Marble::GeoDataVec2::yunit
Unit yunit() const
Definition: GeoDataVec2.cpp:99
Marble::GeoDataVec2::GeoDataVec2
GeoDataVec2()
Definition: GeoDataVec2.cpp:33
Marble::GeoDataVec2::setXunits
void setXunits(Unit xunit)
Definition: GeoDataVec2.cpp:94
QPointF::setX
void setX(qreal x)
QPointF::setY
void setY(qreal y)
Marble::GeoDataVec2::operator!=
bool operator!=(const GeoDataVec2 &other) const
Definition: GeoDataVec2.cpp:79
Marble::GeoDataVec2::InsetPixels
Definition: GeoDataVec2.h:25
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::GeoDataVec2::Pixels
Definition: GeoDataVec2.h:25
Marble::GeoDataVec2::operator=
GeoDataVec2 & operator=(const GeoDataVec2 &other)
Definition: GeoDataVec2.cpp:66
GeoDataVec2.h
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