libosmscout  1.1.1
GroundTile.h
Go to the documentation of this file.
1 #ifndef OSMSCOUT_GROUNDTILE_H
2 #define OSMSCOUT_GROUNDTILE_H
3 
4 /*
5  This source is part of the libosmscout library
6  Copyright (C) 2010 Tim Teulings
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library 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 GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22 
23 #include <vector>
24 
25 #include <osmscout/OSMScoutTypes.h>
26 
28 
29 namespace osmscout {
30 
46  struct OSMSCOUT_API GroundTile CLASS_FINAL
47  {
48  enum Type {
49  unknown = 0,
50  land = 1, // left side of the coast
51  water = 2, // right side of the coast
52  coast = 3
53  };
54 
59  {
60  static const uint16_t CELL_MAX;
61 
62  uint16_t x;
63  uint16_t y;
64  bool coast;
65 
66  inline Coord() = default;
67 
68  inline Coord(uint16_t x,
69  uint16_t y,
70  bool coast)
71  : x(x),
72  y(y),
73  coast(coast)
74  {
75  }
76 
77  inline void Set(uint16_t x,
78  uint16_t y,
79  bool coast)
80  {
81  this->x=x;
82  this->y=y;
83  this->coast=coast;
84  }
85 
86  inline bool operator==(const Coord &coord) const
87  {
88  return x==coord.x && y==coord.y && coast==coord.coast;
89  }
90  };
91 
93  size_t xAbs;
94  size_t yAbs;
95  size_t xRel;
96  size_t yRel;
97  double cellWidth;
98  double cellHeight;
99  std::vector<Coord> coords;
100 
101  inline GroundTile() = default;
102 
103  inline explicit GroundTile(Type type)
104  : type(type)
105  {
106  // no code
107  }
108  };
109 }
110 
111 #endif
static const uint16_t CELL_MAX
Definition: GroundTile.h:60
Coord(uint16_t x, uint16_t y, bool coast)
Definition: GroundTile.h:68
bool coast
Definition: GroundTile.h:64
Definition: GroundTile.h:58
double cellHeight
Height of cell.
Definition: GroundTile.h:98
uint16_t y
Definition: GroundTile.h:63
size_t xRel
X coordinate of cell in relation to cell index of this level.
Definition: GroundTile.h:95
Type
Definition: GroundTile.h:48
void Set(uint16_t x, uint16_t y, bool coast)
Definition: GroundTile.h:77
Definition: Area.h:38
size_t yAbs
Absolute y coordinate of the cell in relation to level and cell size.
Definition: GroundTile.h:94
Type type
The type of the cell.
Definition: GroundTile.h:92
#define CLASS_FINAL
Definition: Compiler.h:26
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
size_t xAbs
Absolute x coordinate of the cell in relation to level and cell size.
Definition: GroundTile.h:93
std::vector< Coord > coords
Optional coordinates for coastline.
Definition: GroundTile.h:99
size_t yRel
Y coordinate of cell in relation to cell index of this level.
Definition: GroundTile.h:96
bool operator==(const Coord &coord) const
Definition: GroundTile.h:86
double cellWidth
Width of cell.
Definition: GroundTile.h:97
GroundTile(Type type)
Definition: GroundTile.h:103
uint16_t x
Definition: GroundTile.h:62