• 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
  • tools
  • osm-sisyphus
region.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 2011 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #include "region.h"
12 
13 #include <QFileInfo>
14 
15 Region::Region()
16 {
17  // nothing to do
18 }
19 
20 QString Region::name() const
21 {
22  return m_name;
23 }
24 
25 QString Region::continent() const
26 {
27  return m_continent;
28 }
29 
30 QString Region::country() const
31 {
32  return m_country;
33 }
34 
35 void Region::setName(QString arg)
36 {
37  m_name = arg;
38 }
39 
40 void Region::setContinent(QString arg)
41 {
42  m_continent = arg;
43 }
44 
45 void Region::setCountry(QString arg)
46 {
47  m_country = arg;
48 }
49 
50 QString Region::id() const
51 {
52  return m_id;
53 }
54 
55 void Region::setId(const QString &id)
56 {
57  m_id = id;
58 }
59 
60 QString Region::pbfFile() const
61 {
62  return m_pbfFile;
63 }
64 
65 void Region::setPbfFile(const QString &pbfFile)
66 {
67  m_pbfFile = pbfFile;
68 }
69 
70 QString Region::path() const
71 {
72  return m_path;
73 }
74 
75 void Region::setPath(const QString &path)
76 {
77  m_path = path;
78 }
79 
80 bool Region::operator ==(const Region &other) const
81 {
82  return m_continent == other.m_continent &&
83  m_country == other.m_country &&
84  m_name == other.m_name &&
85  m_id == other.m_id &&
86  m_path == other.m_path &&
87  m_pbfFile == other.m_pbfFile;
88 }
89 
90 QString Region::fileSize(const QFileInfo &file)
91 {
92  qint64 size = file.size();
93  if (size < 1000) {
94  return QString("%1 Byte").arg(size);
95  }
96 
97  int dec = 0;
98  double value = size / 1000.0;
99  while (value >= 1000.0 && dec<7) {
100  value /= 1000.0;
101  ++dec;
102  }
103 
104  QString unit = "kB";
105  switch (dec) {
106  case 0: unit = "kB"; break;
107  case 1: unit = "MB"; break;
108  case 2: unit = "GB"; break;
109  case 3: unit = "TB"; break;
110  case 4: unit = "PB"; break;
111  case 5: unit = "EB"; break;
112  case 6: unit = "ZB"; break;
113  case 7: unit = "YB"; break;
114  default: Q_ASSERT(false);
115  }
116 
117  return QString("%1 %2").arg(value, 0, 'f', 1).arg(unit);
118 }
Region::pbfFile
QString pbfFile() const
Region::operator==
bool operator==(const Region &other) const
Definition: region.cpp:80
Region::setName
void setName(QString arg)
Definition: region.cpp:35
Region::setPbfFile
void setPbfFile(const QString &pbfFile)
Definition: region.cpp:65
Region::path
QString path() const
Region
Definition: region.h:18
Region::continent
QString continent() const
Region::setPath
void setPath(const QString &path)
Definition: region.cpp:75
Region::country
QString country() const
Region::setCountry
void setCountry(QString arg)
Definition: region.cpp:45
Region::name
QString name() const
Region::setId
void setId(const QString &id)
Definition: region.cpp:55
Region::id
QString id() const
region.h
Region::setContinent
void setContinent(QString arg)
Definition: region.cpp:40
Region::fileSize
static QString fileSize(const QFileInfo &file)
Definition: region.cpp:90
Region::Region
Region()
Definition: region.cpp:15
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 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