~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to plasma/engines/weather/ions/weather_formula.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-31 19:16:54 UTC
  • Revision ID: james.westby@ubuntu.com-20071031191654-xuof6e1jg6uxqaze
Tags: 3.95.0-0ubuntu1~gutsy1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2007 by Shawn Starr <shawn.starr@rogers.com>            *
3
 
 *                                                                         *
4
 
 *   This program is free software; you can redistribute it and/or modify  *
5
 
 *   it under the terms of the GNU General Public License as published by  *
6
 
 *   the Free Software Foundation; either version 2 of the License, or     *
7
 
 *   (at your option) any later version.                                   *
8
 
 *                                                                         *
9
 
 *   This program is distributed in the hope that it will be useful,       *
10
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 
 *   GNU General Public License for more details.                          *
13
 
 *                                                                         *
14
 
 *   You should have received a copy of the GNU General Public License     *
15
 
 *   along with this program; if not, write to the                         *
16
 
 *   Free Software Foundation, Inc.,                                       *
17
 
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA          *
18
 
 ***************************************************************************/
19
 
 
20
 
#include <math.h>
21
 
#include "weather_formula.h"
22
 
 
23
 
WeatherFormula::WeatherFormula()
24
 
{
25
 
}
26
 
 
27
 
WeatherFormula::~WeatherFormula()
28
 
{
29
 
}
30
 
 
31
 
float WeatherFormula::celsiusToF(float temperature) const
32
 
{
33
 
    return (temperature * 9 / 5 + 32);
34
 
}
35
 
 
36
 
float WeatherFormula::fahrenheitToC(float temperature) const
37
 
{
38
 
    return (temperature - 32) * 5 / 9;
39
 
}
40
 
 
41
 
float WeatherFormula::milesToKM(float miles) const
42
 
{
43
 
    return (1.609344 * miles);
44
 
}
45
 
 
46
 
float WeatherFormula::kilometersToMI(float km) const
47
 
{
48
 
    return (0.621371192 * km);
49
 
}
50
 
 
51
 
float WeatherFormula::kilopascalsToInches(float kpa) const
52
 
{
53
 
    return ((0.02952997 * kpa) * 10);
54
 
}
55
 
 
56
 
float WeatherFormula::inchesToKilopascals(float inches) const
57
 
{
58
 
    return (inches * 3.386389);
59
 
}
60
 
 
61
 
float WeatherFormula::centimetersToIN(float cm) const 
62
 
{
63
 
    return (cm * 0.393700787);
64
 
}
65
 
 
66
 
float WeatherFormula::inchesToCM(float inch) const
67
 
{
68
 
    return (inch * 2.54);
69
 
}
70
 
 
71
 
float WeatherFormula::millimetersToIN(float mm) const
72
 
{
73
 
    return (mm * 0.0393700787);
74
 
}
75
 
 
76
 
float WeatherFormula::inchesToMM(float inch) const
77
 
{
78
 
    return (inch * 25.4);
79
 
}
80
 
 
81
 
float WeatherFormula::kilometersToMS(float km) const
82
 
{
83
 
    return (km * 0.277778);
84
 
}
85
 
 
86
 
float WeatherFormula::milesToMS(float miles) const
87
 
{
88
 
    return (miles * 0.44704);
89
 
}