Debian Codegraph @

src/Navaids/poidb.hxx

raw symbols SCIP
1 /*
2 * SPDX-FileCopyrightText: (C) Christian Schmitt, March 2013
3 * SPDX_FileComment: points of interest management routines
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #pragma once
8
9 #include <map>
10
11 #include <simgear/compiler.h>
12
13 #include <simgear/math/SGGeod.hxx>
14 #include <Navaids/positioned.hxx>
15 #include <Navaids/NavDataCache.hxx>
16
17 // forward decls
18 class SGPath;
19 class sg_gzifstream;
20
21 // load and initialize the POI database
22 //bool poiDBInit(const SGPath& path);
23
24 namespace flightgear
25 {
26
27 class POILoader
28 {
29 public:
30 POILoader();
31 ~POILoader() = default;
32
33 // Load POIs from the specified poi.dat (or poi.dat.gz) file
34 void loadPOIs(const NavDataCache::SceneryLocation& sceneryLocation,
35 std::size_t bytesReadSoFar,
36 std::size_t totalSizeOfAllDatFiles);
37
38 private:
39 void throwExceptionIfStreamError(const sg_gzifstream& input_stream);
40
41
42 PositionedID readPOIFromStream(std::istream& aStream, unsigned int lineNumber,
43 FGPositioned::Type type = FGPositioned::INVALID);
44
45 NavDataCache* _cache = nullptr;
46 SGPath _path;
47
48 using POIKey = std::tuple<FGPositioned::Type, std::string>;
49 // Maps (type, ident, name) tuples already loaded to their locations.
50 std::multimap<POIKey, SGVec3d> _loadedPOIs;
51 };
52
53
54 } // of namespace flightgear
55