libosmscout 1.1.1
Loading...
Searching...
No Matches
TypeDistributionDataFile.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_TYPEDISTRIBUTIONDATAFILE_H
2#define OSMSCOUT_TYPEDISTRIBUTIONDATAFILE_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2016 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
24
25#include <memory>
26#include <vector>
27
28#include <osmscout/TypeConfig.h>
29
30namespace osmscout {
31
39 {
40 public:
41 static const char* const DISTRIBUTION_DAT;
42
43 public:
45 {
46 uint32_t nodeCount;
47 uint32_t wayCount;
48 uint32_t areaCount;
49
51 };
52
53 private:
54 bool isLoaded;
55 std::string filename;
56
57 std::vector<Distribution> distribution;
58
59 public:
61
62 bool Load(const TypeConfig& typeConfig,
63 const std::string& path);
64
65 inline bool IsLoaded() const
66 {
67 return isLoaded;
68 }
69
70 inline std::string GetFilename() const
71 {
72 return filename;
73 }
74
75 inline uint32_t GetNodeCount(const TypeInfo& type) const
76 {
77 return distribution[type.GetIndex()].nodeCount;
78 }
79
80 inline uint32_t GetWayCount(const TypeInfo& type) const
81 {
82 return distribution[type.GetIndex()].wayCount;
83 }
84
85 inline uint32_t GetAreaCount(const TypeInfo& type) const
86 {
87 return distribution[type.GetIndex()].areaCount;
88 }
89 };
90
91 using TypeDistributionDataFileRef = std::shared_ptr<TypeDistributionDataFile>;
92}
93
94#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
std::string GetFilename() const
Definition TypeDistributionDataFile.h:70
bool IsLoaded() const
Definition TypeDistributionDataFile.h:65
uint32_t GetAreaCount(const TypeInfo &type) const
Definition TypeDistributionDataFile.h:85
bool Load(const TypeConfig &typeConfig, const std::string &path)
static const char *const DISTRIBUTION_DAT
Definition TypeDistributionDataFile.h:41
uint32_t GetNodeCount(const TypeInfo &type) const
Definition TypeDistributionDataFile.h:75
uint32_t GetWayCount(const TypeInfo &type) const
Definition TypeDistributionDataFile.h:80
Definition Area.h:39
std::shared_ptr< TypeDistributionDataFile > TypeDistributionDataFileRef
Definition TypeDistributionDataFile.h:91
uint32_t nodeCount
Definition TypeDistributionDataFile.h:46
uint32_t wayCount
Definition TypeDistributionDataFile.h:47
uint32_t areaCount
Definition TypeDistributionDataFile.h:48