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

marble

  • sources
  • kde-4.12
  • 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  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 = d->parseUnits( xunits );
44  d->m_yunit = d->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 GeoDataVec2::~GeoDataVec2()
74 {
75  delete d;
76 }
77 
78 GeoDataVec2::Unit GeoDataVec2::xunit() const
79 {
80  return d->m_xunit;
81 }
82 
83 void GeoDataVec2::setXunits(Unit xunit)
84 {
85  d->m_xunit = xunit;
86 }
87 
88 GeoDataVec2::Unit GeoDataVec2::yunit() const
89 {
90  return d->m_yunit;
91 }
92 
93 void GeoDataVec2::setYunits(Unit yunit)
94 {
95  d->m_yunit = yunit;
96 }
97 
98 }
Marble::GeoDataVec2::Fraction
Definition: GeoDataVec2.h:25
Marble::GeoDataVec2::Unit
Unit
Definition: GeoDataVec2.h:25
Marble::GeoDataVec2::xunit
Unit xunit() const
Definition: GeoDataVec2.cpp:78
Marble::GeoDataVec2::setYunits
void setYunits(Unit yunit)
Definition: GeoDataVec2.cpp:93
MarbleDebug.h
Marble::GeoDataVec2::~GeoDataVec2
~GeoDataVec2()
Definition: GeoDataVec2.cpp:73
Marble::GeoDataVec2
Definition: GeoDataVec2.h:22
Marble::GeoDataVec2::yunit
Unit yunit() const
Definition: GeoDataVec2.cpp:88
Marble::GeoDataVec2::GeoDataVec2
GeoDataVec2()
Definition: GeoDataVec2.cpp:33
Marble::GeoDataVec2::setXunits
void setXunits(Unit xunit)
Definition: GeoDataVec2.cpp:83
Marble::GeoDataVec2::InsetPixels
Definition: GeoDataVec2.h:25
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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