1 /*
2    This file is part of Qadastre.
3    Copyright (C)  2010 Pierre Ducroquet <pinaraf@pinaraf.info>
4 
5    Qadastre is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9 
10    Qadastre is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with Qadastre. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "city.h"
20 #include <QDebug>
21 
City()22 City::City()
23 {
24 }
25 
City(const QString & code)26 City::City(const QString &code) :
27     m_code(code)
28 {
29 }
30 
name() const31 QString City::name() const
32 {
33     return m_name;
34 }
35 
department() const36 QString City::department() const
37 {
38     return m_department;
39 }
40 
projection() const41 QString City::projection() const
42 {
43     return m_projection;
44 }
45 
code() const46 QString City::code() const
47 {
48     return m_code;
49 }
50 
geometry() const51 QRect City::geometry() const
52 {
53     return m_geometry;
54 }
55 
setName(const QString & name)56 void City::setName(const QString &name)
57 {
58     m_name = name;
59 }
60 
setDepartement(const QString & department)61 void City::setDepartement(const QString &department)
62 {
63     m_department = department;
64 }
65 
setProjection(const QString & projection)66 void City::setProjection(const QString &projection)
67 {
68     m_projection = projection;
69 }
70 
setGeometry(const QRect & geom)71 void City::setGeometry(const QRect &geom)
72 {
73     m_geometry = geom;
74 }
75 
76 // TODO: don't hardcode 100 meters here.
tileRows() const77 int City::tileRows() const
78 {
79     return m_geometry.height()/100 + 1;
80 }
81 
tileColumns() const82 int City::tileColumns() const
83 {
84     return m_geometry.width()/100 + 1;
85 }
86 
tileGeometry(int row,int column) const87 QRect City::tileGeometry(int row, int column) const
88 {
89     int left = m_geometry.left() / 100;
90     left = left * 100;
91     int top = m_geometry.top() / 100;
92     top = top * 100;
93     //top = top + 100;
94     return QRect(left + column * 100, top - row * 100, 101, 101);
95 }
96