Initial Commit
[HECS.git] / DwellingDimensions.cpp
blob77146d84bab96f66f3242db3073dcdfed09fed72
1 /***************************************************************************
2 * *
3 * DwellingDimensions.h.cpp Copyright (C) 2008 by Jon Rumble *
4 * j.w.rumble@reading.ac.uk *
5 * *
6 * This file is part of HECS, *
7 * *
8 * HECS is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation, either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * HECS is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
21 ***************************************************************************/
23 #include "DwellingDimensions.h"
25 // Constructors/Destructors
26 //
28 DwellingDimensions::DwellingDimensions (const ConfigParser& config)
30 cf = config;
31 initVars();
32 calcAll();
35 DwellingDimensions::~DwellingDimensions ( ) { }
37 //
38 // Methods
39 //
42 // Accessor methods
43 //
45 double DwellingDimensions::get_groundFloorArea()
47 return m_groundFloorArea;
50 double DwellingDimensions::get_groundFloorHeight()
52 return m_groundFloorHeight;
55 double DwellingDimensions::get_groundFloorVolume()
57 return m_groundFloorVolume;
60 double DwellingDimensions::get_firstFloorArea()
62 return m_firstFloorArea;
65 double DwellingDimensions::get_firstFloorHeight()
67 return m_firstFloorHeight;
70 double DwellingDimensions::get_firstFloorVolume()
72 return m_firstFloorVolume;
75 double DwellingDimensions::get_secondFloorArea()
77 return m_secondFloorArea;
80 double DwellingDimensions::get_secondFloorHeight()
82 return m_secondFloorHeight;
85 double DwellingDimensions::get_secondFloorVolume()
88 return m_secondFloorVolume;
91 double DwellingDimensions::get_thirdFloorArea()
93 return m_thirdFloorArea;
96 double DwellingDimensions::get_thirdFloorHeight()
98 return m_thirdFloorHeight;
101 double DwellingDimensions::get_thirdFloorVolume()
103 return m_thirdFloorVolume;
105 double DwellingDimensions::get_totalFloorArea()
107 return m_totalFloorArea;
110 double DwellingDimensions::get_livingRoomArea()
112 return m_livingRoomArea;
116 double DwellingDimensions::get_dwellingVolume()
118 return m_dwellingVolume;
121 double DwellingDimensions::get_avgStoreyHeight()
123 return m_avgStoreyHeight;
127 QString DwellingDimensions::get_houseNumber()
129 return m_houseNumber;
133 QString DwellingDimensions::get_address()
135 return m_address;
138 QString DwellingDimensions::get_town()
140 return m_town;
143 QString DwellingDimensions::get_postcode()
145 return m_postcode;
148 QString DwellingDimensions::get_county()
150 return m_county;
154 int DwellingDimensions::get_region()
156 return m_region;
159 int DwellingDimensions::get_ageBand()
161 return m_ageBand;
164 int DwellingDimensions::get_propertyType()
166 return m_propertyType;
169 int DwellingDimensions::get_archType()
171 return m_archType;
174 int DwellingDimensions::get_habitableRooms()
176 return m_habitableRooms;
179 void DwellingDimensions::set_groundFloorArea(double val_in)
181 m_groundFloorArea = val_in;
184 void DwellingDimensions::set_groundFloorHeight(double val_in)
186 m_groundFloorHeight = val_in;
190 void DwellingDimensions::set_groundFloorVolume(double val_in)
192 m_groundFloorVolume = val_in;
195 void DwellingDimensions::set_firstFloorArea (double val_in)
197 m_firstFloorArea = val_in;
200 void DwellingDimensions::set_firstFloorHeight (double val_in)
202 m_firstFloorHeight = val_in;
205 void DwellingDimensions::set_firstFloorVolume (double val_in)
207 m_firstFloorVolume = val_in;
210 void DwellingDimensions::set_secondFloorArea(double val_in)
212 m_secondFloorArea = val_in;
215 void DwellingDimensions::set_secondFloorHeight(double val_in)
217 m_secondFloorHeight = val_in;
219 void DwellingDimensions::set_thirdFloorArea (double val_in)
221 m_thirdFloorArea = val_in;
224 void DwellingDimensions::set_thirdFloorHeight (double val_in)
226 m_thirdFloorHeight = val_in;
228 void DwellingDimensions::set_thirdFloorVolume (double val_in)
230 m_thirdFloorVolume = val_in;
233 void DwellingDimensions::set_totalFloorArea (double val_in)
235 m_totalFloorArea = val_in;
237 void DwellingDimensions::set_dwellingVolume (double val_in)
239 m_dwellingVolume = val_in;
241 void DwellingDimensions::set_avgStoreyHeight(double val_in)
243 m_avgStoreyHeight = val_in;
246 void DwellingDimensions::set_livingRoomArea(double val_in)
248 m_livingRoomArea = val_in;
251 void DwellingDimensions::set_houseNumber(QString val_in)
253 m_houseNumber = val_in;
257 void DwellingDimensions::set_address(QString val_in)
259 m_address = val_in;
262 void DwellingDimensions::set_town(QString val_in)
264 m_town = val_in;
267 void DwellingDimensions::set_postcode(QString val_in)
269 m_postcode = val_in;
272 void DwellingDimensions::set_county(QString val_in)
274 m_county = val_in;
278 void DwellingDimensions::set_region(int val_in)
280 m_region = val_in;
283 void DwellingDimensions::set_ageBand(int val_in)
285 m_ageBand = val_in;
288 void DwellingDimensions::set_propertyType(int val_in)
290 m_propertyType = val_in;
293 void DwellingDimensions::set_archType(int val_in)
295 m_archType = val_in;
298 void DwellingDimensions::set_habitableRooms(int val_in)
300 m_habitableRooms = val_in;
303 // Other methods
307 void DwellingDimensions::calcAll()
309 calcTotalFloorArea();
310 calcDwellingVol();
313 void DwellingDimensions::calcTotalFloorArea()
315 m_totalFloorArea = m_groundFloorArea+
316 m_firstFloorArea+
317 m_secondFloorArea+
318 m_thirdFloorArea;
321 void DwellingDimensions::calcDwellingVol()
323 m_dwellingVolume = (m_groundFloorArea*m_groundFloorHeight)+
324 (m_firstFloorArea*m_firstFloorHeight)+
325 (m_secondFloorArea*m_secondFloorHeight)+
326 (m_thirdFloorArea*m_thirdFloorHeight);
329 void DwellingDimensions::initVars() {
332 m_groundFloorArea = cf.getValueDouble ("DwellingDimensions:groundFloorArea");
333 m_groundFloorHeight = cf.getValueDouble ("DwellingDimensions:groundFloorHeight");
334 m_groundFloorVolume = cf.getValueDouble ("DwellingDimensions:groundFloorVolume");
335 m_firstFloorArea = cf.getValueDouble ("DwellingDimensions:firstFloorArea");
336 m_firstFloorHeight = cf.getValueDouble ("DwellingDimensions:firstFloorHeight");
337 m_firstFloorVolume = cf.getValueDouble ("DwellingDimensions:firstFloorVolume");
338 m_secondFloorArea = cf.getValueDouble ("DwellingDimensions:secondFloorArea");
339 m_secondFloorHeight = cf.getValueDouble ("DwellingDimensions:secondFloorHeight");
340 m_secondFloorVolume = cf.getValueDouble ("DwellingDimensions:secondFloorVolume");
341 m_thirdFloorArea = cf.getValueDouble ("DwellingDimensions:thirdFloorArea");
342 m_thirdFloorHeight = cf.getValueDouble ("DwellingDimensions:thirdFloorHeight");
343 m_thirdFloorVolume = cf.getValueDouble ("DwellingDimensions:thirdFloorVolume");
344 m_avgStoreyHeight = cf.getValueDouble ("DwellingDimensions:avgStoreyHeight");
345 m_livingRoomArea = cf.getValueDouble ("DwellingDimensions:livingRoomArea");
346 m_houseNumber = cf.getValueString ("DwellingDimensions:houseNumber");
347 m_address = cf.getValueString ("DwellingDimensions:address");
348 m_postcode = cf.getValueString ("DwellingDimensions:postcode");
349 m_county = cf.getValueString ("DwellingDimensions:county");
350 m_region = cf.getValueInt ("DwellingDimensions:region");
351 m_ageBand = cf.getValueInt ("DwellingDimensions:ageBand");
352 m_propertyType = cf.getValueInt ("DwellingDimensions:propertyType");
353 m_archType = cf.getValueInt ("DwellingDimensions:archType");
354 m_totalFloorArea = 0.0;
355 m_dwellingVolume = 0.0;