libosmscout 1.1.1
Loading...
Searching...
No Matches
CoverageIndex.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_COVERAGEINDEX_H
2#define OSMSCOUT_COVERAGEINDEX_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2018 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 <memory>
24#include <mutex>
25#include <vector>
26
27#include <osmscout/Pixel.h>
28
30
31namespace osmscout {
32
41 {
42 public:
43 static const char* const COVERAGE_IDX;
44
45 private:
46 std::string datafilename;
47 mutable FileScanner scanner;
48
49 uint32_t cellLevel;
50 double cellWidth;
51 double cellHeight;
52 Pixel minCell;
53 Pixel maxCell;
54 uint32_t width;
55 uint32_t height;
56 std::vector<uint8_t> bitmap;
57
58 public:
59 CoverageIndex() = default;
60
61 void Close();
62 bool Open(const std::string& path);
63
64 inline bool IsOpen() const
65 {
66 return scanner.IsOpen();
67 }
68
69 Pixel GetTile(const GeoCoord& coord) const;
70 bool IsCovered(const Pixel& tile) const;
71
72 bool IsCovered(const GeoCoord& coord) const;
73 };
74
75 using CoverageIndexRef = std::shared_ptr<CoverageIndex>;
76}
77
78#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
bool IsCovered(const Pixel &tile) const
Pixel GetTile(const GeoCoord &coord) const
static const char *const COVERAGE_IDX
Definition CoverageIndex.h:43
bool Open(const std::string &path)
bool IsOpen() const
Definition CoverageIndex.h:64
bool IsCovered(const GeoCoord &coord) const
Definition Area.h:39
std::shared_ptr< CoverageIndex > CoverageIndexRef
Definition CoverageIndex.h:75