libosmscout 1.1.1
Loading...
Searching...
No Matches
TypeConfig.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_TYPECONFIG_H
2#define OSMSCOUT_TYPECONFIG_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 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 <list>
24#include <memory>
25#include <string>
26#include <unordered_map>
27#include <unordered_set>
28#include <vector>
29#include <array>
30
32
33#include <osmscout/ObjectRef.h>
35#include <osmscout/Tag.h>
37
40
43
45
47
48namespace osmscout {
49
57 static const TypeId typeIgnore = 0;
58
59 class TypeInfo;
60
61 using TypeInfoRef = std::shared_ptr<TypeInfo>;
62
63
71 class OSMSCOUT_API TypeInfo CLASS_FINAL
72 {
73 public:
74 static const uint8_t typeNode = 1u << 0u;
75 static const uint8_t typeWay = 1u << 1u;
76 static const uint8_t typeArea = 1u << 2u;
77 static const uint8_t typeRelation = 1u << 3u;
78
79 enum class SpecialType : uint8_t {
80 none = 0,
81 multipolygon = 1,
82 routeMaster = 2,
83 route = 3
84 };
85
86 public:
95 {
96 unsigned char types;
98 };
99
100 private:
101 TypeId nodeId=0;
102 TypeId wayId=0;
103 TypeId areaId=0;
104 TypeId routeId=0;
105 std::string name;
106 size_t index=0;
107
108 bool internal=false;
109
110 std::list<TypeCondition> conditions;
111 std::unordered_map<std::string,size_t> nameToFeatureMap;
112 std::vector<FeatureInstance> features;
113 size_t featureMaskBytes=0;
114 size_t specialFeatureMaskBytes=0;
115 size_t valueBufferSize=0;
116
117 bool canBeNode=false;
118 bool canBeWay=false;
119 bool canBeArea=false;
120 bool canBeRelation=false;
121 bool isPath=false;
122 bool canRouteFoot=false;
123 bool canRouteBicycle=false;
124 bool canRouteCar=false;
125 bool indexAsAddress=false;
126 bool indexAsLocation=false;
127 bool indexAsRegion=false;
128 bool indexAsPOI=false;
129 bool optimizeLowZoom=false;
130 SpecialType specialType=SpecialType::none;
131 bool pinWay=false;
132 bool mergeAreas=false;
133 bool ignoreSeaLand=false;
134 bool ignore=false;
135 uint8_t lanes=1;
136 uint8_t onewayLanes=1;
137
138 std::unordered_set<std::string> groups;
139 std::unordered_map<std::string,std::string> descriptions;
140
141 public:
142 explicit TypeInfo(const std::string& name);
143 ~TypeInfo() = default;
144
148 TypeInfo(const TypeInfo& other) = delete;
149 TypeInfo(TypeInfo&& other) = delete;
150
151 TypeInfo& operator=(const TypeInfo& other) = delete;
152 TypeInfo& operator=(const TypeInfo&& other) = delete;
153
158
163
168
173
177 TypeInfo& SetIndex(size_t index);
178
183
187 TypeInfo& SetType(const std::string& name);
188
189 TypeInfo& AddCondition(unsigned char types,
190 const TagConditionRef& condition);
191
196
200 TypeInfo& AddGroup(const std::string& groupName);
201
202 TypeInfo& AddDescription(const std::string& languageCode,
203 const std::string& description);
204
205 bool HasFeatures() const
206 {
207 return !features.empty();
208 }
209
214 bool HasFeature(const std::string& featureName) const;
215
219 bool GetFeature(const std::string& name,
220 size_t& index) const;
221
225 const FeatureInstance& GetFeature(size_t idx) const
226 {
227 return features[idx];
228 }
229
233 const std::vector<FeatureInstance>& GetFeatures() const
234 {
235 return features;
236 }
237
241 size_t GetFeatureCount() const
242 {
243 return features.size();
244 }
245
249 size_t GetFeatureMaskBytes() const
250 {
251 return featureMaskBytes;
252 }
253
259 {
260 return specialFeatureMaskBytes;
261 }
262
267 {
268 return valueBufferSize;
269 }
270
276 {
277 return nodeId;
278 }
279
285 {
286 return wayId;
287 }
288
293 {
294 return areaId;
295 }
296
301 {
302 return routeId;
303 }
304
308 size_t GetIndex() const
309 {
310 return index;
311 }
312
316 bool IsInternal() const
317 {
318 return internal;
319 }
320
324 std::string GetName() const
325 {
326 return name;
327 }
328
334 bool HasConditions() const
335 {
336 return !conditions.empty();
337 }
338
342 const std::list<TypeCondition>& GetConditions() const
343 {
344 return conditions;
345 }
346
350 TypeInfo& CanBeNode(bool canBeNode)
351 {
352 this->canBeNode=canBeNode;
353
354 return *this;
355 }
356
357 bool CanBeNode() const
358 {
359 return canBeNode;
360 }
361
365 TypeInfo& CanBeWay(bool canBeWay)
366 {
367 this->canBeWay=canBeWay;
368
369 return *this;
370 }
371
372 bool CanBeWay() const
373 {
374 return canBeWay;
375 }
376
380 TypeInfo& CanBeArea(bool canBeArea)
381 {
382 this->canBeArea=canBeArea;
383
384 return *this;
385 }
386
387 bool CanBeArea() const
388 {
389 return canBeArea;
390 }
391
395 TypeInfo& CanBeRelation(bool canBeRelation)
396 {
397 this->canBeRelation=canBeRelation;
398
399 return *this;
400 }
401
402 bool CanBeRelation() const
403 {
404 return canBeRelation;
405 }
406
410 TypeInfo& SetIsPath(bool isPath)
411 {
412 this->isPath=isPath;
413
414 return *this;
415 }
416
417 bool IsPath() const
418 {
419 return isPath;
420 }
421
425 TypeInfo& CanRouteFoot(bool canBeRoute)
426 {
427 this->canRouteFoot=canBeRoute;
428
429 return *this;
430 }
431
432 TypeInfo& CanRouteBicycle(bool canBeRoute)
433 {
434 this->canRouteBicycle=canBeRoute;
435
436 return *this;
437 }
438
442 TypeInfo& CanRouteCar(bool canBeRoute)
443 {
444 this->canRouteCar=canBeRoute;
445
446 return *this;
447 }
448
449 bool CanRoute() const
450 {
451 return canRouteFoot || canRouteBicycle || canRouteCar;
452 }
453
458 {
459 switch (vehicle)
460 {
461 case vehicleFoot:
462 return canRouteFoot;
463 case vehicleBicycle:
464 return canRouteBicycle;
465 case vehicleCar:
466 return canRouteCar;
467 }
468
469 return false;
470 }
471
472 bool CanRouteFoot() const
473 {
474 return canRouteFoot;
475 }
476
477 bool CanRouteBicycle() const
478 {
479 return canRouteBicycle;
480 }
481
482 bool CanRouteCar() const
483 {
484 return canRouteCar;
485 }
486
487 uint8_t GetDefaultAccess() const;
488
492 TypeInfo& SetIndexAsAddress(bool indexAsAddress)
493 {
494 this->indexAsAddress=indexAsAddress;
495
496 return *this;
497 }
498
499 bool GetIndexAsAddress() const
500 {
501 return indexAsAddress;
502 }
503
507 TypeInfo& SetIndexAsLocation(bool indexAsLocation)
508 {
509 this->indexAsLocation=indexAsLocation;
510
511 return *this;
512 }
513
515 {
516 return indexAsLocation;
517 }
518
522 TypeInfo& SetIndexAsRegion(bool indexAsRegion)
523 {
524 this->indexAsRegion=indexAsRegion;
525
526 return *this;
527 }
528
529 bool GetIndexAsRegion() const
530 {
531 return indexAsRegion;
532 }
533
537 TypeInfo& SetIndexAsPOI(bool indexAsPOI)
538 {
539 this->indexAsPOI=indexAsPOI;
540
541 return *this;
542 }
543
544 bool GetIndexAsPOI() const
545 {
546 return indexAsPOI;
547 }
548
553 {
554 this->optimizeLowZoom=optimize;
555
556 return *this;
557 }
558
560 {
561 return optimizeLowZoom;
562 }
563
565 this->specialType=specialType;
566
567 return *this;
568 }
569
571 {
572 return specialType;
573 }
574
579 {
580 this->specialType=SpecialType::multipolygon;
581
582 return *this;
583 }
584
589 {
590 this->specialType=SpecialType::routeMaster;
591
592 return *this;
593 }
594
599 {
600 this->specialType=SpecialType::route;
601
602 return *this;
603 }
604
605 bool IsMultipolygon() const
606 {
607 return specialType==SpecialType::multipolygon;
608 }
609
610 bool IsRouteMaster() const
611 {
612 return specialType==SpecialType::routeMaster;
613 }
614
615 bool IsRoute() const
616 {
617 return specialType==SpecialType::route;
618 }
619
620 TypeInfo& SetPinWay(bool pinWay)
621 {
622 this->pinWay=pinWay;
623
624 return *this;
625 }
626
627 bool GetPinWay() const
628 {
629 return pinWay;
630 }
631
635 TypeInfo& SetMergeAreas(bool mergeAreas)
636 {
637 this->mergeAreas=mergeAreas;
638
639 return *this;
640 }
641
642 bool GetMergeAreas() const
643 {
644 return mergeAreas;
645 }
646
650 TypeInfo& SetIgnoreSeaLand(bool ignoreSeaLand)
651 {
652 this->ignoreSeaLand=ignoreSeaLand;
653
654 return *this;
655 }
656
657 bool GetIgnoreSeaLand() const
658 {
659 return ignoreSeaLand;
660 }
661
666 TypeInfo& SetIgnore(bool ignore)
667 {
668 this->ignore=ignore;
669
670 return *this;
671 }
672
673 bool GetIgnore() const
674 {
675 return ignore;
676 }
677
678 TypeInfo& SetLanes(uint8_t lanes)
679 {
680 this->lanes=lanes;
681
682 return *this;
683 }
684
685 uint8_t GetLanes() const
686 {
687 return lanes;
688 }
689
690 TypeInfo& SetOnewayLanes(uint8_t lanes)
691 {
692 this->onewayLanes=lanes;
693
694 return *this;
695 }
696
697 uint8_t GetOnewayLanes() const
698 {
699 return onewayLanes;
700 }
701
705 const std::unordered_set<std::string>& GetGroups() const
706 {
707 return groups;
708 }
709
710 bool IsInGroup(const std::string& groupName) const
711 {
712 return groups.find(groupName)!=groups.end();
713 }
714
715 const std::unordered_map<std::string,std::string>& GetDescriptions() const
716 {
717 return descriptions;
718 };
719
720 std::string GetDescription(const std::string& languageCode) const;
721
722 static TypeInfoRef Read(FileScanner& scanner);
723 };
724
729 class OSMSCOUT_API FeatureValueBuffer CLASS_FINAL
730 {
731 private:
732 TypeInfoRef type;
733 uint8_t *featureBits=nullptr;
734 char *featureValueBuffer=nullptr;
735
736 private:
737 void DeleteData();
738 void AllocateBits();
739 void AllocateValueBufferLazy();
740
745 FeatureValue* GetValueAndAllocateBuffer(size_t idx)
746 {
747 AllocateValueBufferLazy();
748 return static_cast<FeatureValue*>(static_cast<void*>(&featureValueBuffer[type->GetFeature(idx).GetOffset()]));
749 }
750
751 public:
756
759
767 void Set(const FeatureValueBuffer& other);
768
783
788
790
792 {
793 return type;
794 }
795
799 size_t GetFeatureCount() const
800 {
801 return type->GetFeatureCount();
802 }
803
807 FeatureInstance GetFeature(size_t idx) const
808 {
809 return type->GetFeature(idx);
810 }
811
815 bool HasFeature(size_t idx) const
816 {
817 size_t featureBit=type->GetFeature(idx).GetFeatureBit();
818
819 return (featureBits[featureBit/8] & (1u << featureBit%8))!=0;
820 }
821
830 FeatureValue* GetValue(size_t idx) const
831 {
832 return featureValueBuffer==nullptr ? nullptr
833 : static_cast<FeatureValue*>(static_cast<void*>(&featureValueBuffer[type->GetFeature(idx).GetOffset()]));
834 }
835
837 void FreeValue(size_t idx);
838
839 void Parse(TagErrorReporter& errorReporter,
840 const TagRegistry& tagRegistry,
841 const ObjectOSMRef& object,
842 const TagMap& tags);
843
849 void Read(FileScanner& scanner);
850
857 void Read(FileScanner& scanner,
858 bool& specialFlag);
859
866 void Read(FileScanner& scanner,
867 bool& specialFlag1,
868 bool& specialFlag2);
869
876 void Read(FileScanner& scanner,
877 bool& specialFlag1,
878 bool& specialFlag2,
879 bool& specialFlag3);
880
886 void Write(FileWriter& writer) const;
887
895 void Write(FileWriter& writer,
896 bool specialFlag) const;
897
905 void Write(FileWriter& writer,
906 bool specialFlag1,
907 bool specialFlag2) const;
908
909
917 void Write(FileWriter& writer,
918 bool specialFlag1,
919 bool specialFlag2,
920 bool specialFlag3) const;
921
922 bool operator==(const FeatureValueBuffer& other) const;
923 bool operator!=(const FeatureValueBuffer& other) const;
924
931 template<std::size_t FlagCnt>
932 void Read(FileScanner& scanner, std::array<bool,FlagCnt> &specialFlags)
933 {
934 for (size_t i=0; i<type->GetFeatureMaskBytes(); i++) {
935 featureBits[i]=scanner.ReadUInt8();
936 }
937
938 if (!specialFlags.empty()) {
939 static_assert(FlagCnt <= 8);
940 uint8_t flagByte;
941 if (BitsToBytes(type->GetFeatureCount()) == BitsToBytes(type->GetFeatureCount() + specialFlags.size())) {
942 flagByte = featureBits[type->GetFeatureMaskBytes() - 1];
943 } else {
944 flagByte = scanner.ReadUInt8();
945 }
946 uint8_t mask=0x80;
947 for (bool &specialFlag: specialFlags) {
948 specialFlag = (flagByte & mask) != 0;
949 mask = mask >> 1;
950 }
951 }
952
953 for (const auto &feature : type->GetFeatures()) {
954 size_t idx=feature.GetIndex();
955
956 if (HasFeature(idx) &&
957 feature.GetFeature()->HasValue()) {
958 FeatureValue* value=feature.GetFeature()->AllocateValue(GetValueAndAllocateBuffer(idx));
959
960 value->Read(scanner);
961 }
962 }
963 }
964
972 template<std::size_t FlagCnt>
973 void Write(FileWriter& writer,
974 const std::array<bool,FlagCnt> &specialFlags) const
975 {
976 static_assert(FlagCnt <= 8u);
977 if (BitsToBytes(type->GetFeatureCount()) == BitsToBytes(type->GetFeatureCount() + specialFlags.size())) {
978 uint8_t mask=0x80u;
979 for (const bool &specialFlag: specialFlags) {
980 if (specialFlag) {
981 featureBits[type->GetFeatureMaskBytes() - 1u] |= mask;
982 } else {
983 featureBits[type->GetFeatureMaskBytes() - 1u] &= uint8_t(~mask);
984 }
985 mask = mask >> 1;
986 }
987
988 for (size_t i = 0; i < type->GetFeatureMaskBytes(); i++) {
989 writer.Write(featureBits[i]);
990 }
991 } else {
992 for (size_t i = 0; i < type->GetFeatureMaskBytes(); i++) {
993 writer.Write(featureBits[i]);
994 }
995
996 uint8_t flagByte=0u;
997 uint8_t mask=0x80u;
998 for (const bool &specialFlag: specialFlags) {
999 if (specialFlag) {
1000 flagByte |= mask;
1001 }
1002 mask = mask >> 1u;
1003 }
1004
1005 writer.Write(flagByte);
1006 }
1007
1008 for (const auto &feature : type->GetFeatures()) {
1009 size_t idx=feature.GetIndex();
1010
1011 if (HasFeature(idx) &&
1012 feature.GetFeature()->HasValue()) {
1013 FeatureValue* value=GetValue(idx);
1014
1015 value->Write(writer);
1016 }
1017 }
1018 }
1019
1020 template<class T> const T* findValue() const
1021 {
1022 for (const auto& featureInstance :GetType()->GetFeatures()) {
1023 if (HasFeature(featureInstance.GetIndex())) {
1024 osmscout::FeatureRef feature=featureInstance.GetFeature();
1025 if (feature->HasValue()) {
1026 const osmscout::FeatureValue* value=GetValue(featureInstance.GetIndex());
1027 const auto *v=dynamic_cast<const T*>(value);
1028 if (v!=nullptr) {
1029 return v;
1030 }
1031 }
1032 }
1033 }
1034
1035 return nullptr;
1036 }
1037 };
1038
1039 using FeatureValueBufferRef = std::shared_ptr<FeatureValueBuffer>;
1040
1041 // Forward declaration
1042 class TypeConfig;
1043
1044 static const uint32_t FILE_FORMAT_VERSION=25;
1045
1052 class OSMSCOUT_API TypeConfig CLASS_FINAL
1053 {
1054 public:
1055 static const char* FILE_TYPES_DAT;
1058
1059 private:
1060 // Tags
1061 TagRegistry tagRegistry;
1062
1063 // Types
1064
1065 std::vector<TypeInfoRef> types;
1066 std::vector<TypeInfoRef> nodeTypes;
1067 std::vector<TypeInfoRef> wayTypes;
1068 std::vector<TypeInfoRef> areaTypes;
1069 std::vector<TypeInfoRef> routeTypes;
1070
1071 uint8_t nodeTypeIdBytes=1;
1072 uint8_t wayTypeIdBytes=1;
1073 uint8_t areaTypeIdBits=1;
1074 uint8_t areaTypeIdBytes=1;
1075 uint8_t routeTypeIdBytes=1;
1076
1077 std::unordered_map<std::string,TypeInfoRef> nameToTypeMap;
1078
1079 // Features
1080
1081 std::vector<FeatureRef> features;
1082
1083 std::unordered_map<std::string,FeatureRef> nameToFeatureMap;
1084
1085 FeatureRef featureName;
1086 FeatureRef featureNameShort;
1087 FeatureRef featureRef;
1088 FeatureRef featureLocation;
1089 FeatureRef featureAddress;
1090 FeatureRef featurePostalCode;
1091 FeatureRef featureWebsite;
1092 FeatureRef featurePhone;
1093 FeatureRef featureAccess;
1094 FeatureRef featureAccessRestricted;
1095 FeatureRef featureLayer;
1096 FeatureRef featureWidth;
1097 FeatureRef featureMaxSpeed;
1098 FeatureRef featureGrade;
1099 FeatureRef featureBridge;
1100 FeatureRef featureTunnel;
1101 FeatureRef featureEmbankment;
1102 FeatureRef featureRoundabout;
1103 FeatureRef featureLanes;
1104 FeatureRef featureOpeningHours;
1105
1106 public:
1107 // Internal use (only available during preprocessing)
1114
1123
1124 public:
1127
1132 TagId GetTagId(const char* name) const
1133 {
1134 return tagRegistry.GetTagId(name);
1135 }
1136
1137 TagId GetTagId(const std::string& name) const
1138 {
1139 return tagRegistry.GetTagId(name);
1140 }
1141
1143 {
1144 return tagRegistry;
1145 }
1146
1148 {
1149 return tagRegistry;
1150 }
1151
1152
1157 void RegisterSurfaceToGradeMapping(const std::string& surface,
1158 size_t grade)
1159 {
1160 tagRegistry.RegisterSurfaceToGradeMapping(surface,
1161 grade);
1162 }
1163
1164
1169 void RegisterMaxSpeedAlias(const std::string& alias,
1170 uint8_t maxSpeed)
1171 {
1172 tagRegistry.RegisterMaxSpeedAlias(alias,
1173 maxSpeed);
1174 }
1175
1176
1182
1186 const std::vector<TypeInfoRef>& GetTypes() const
1187 {
1188 return types;
1189 }
1190
1194 const std::vector<TypeInfoRef>& GetNodeTypes() const
1195 {
1196 return nodeTypes;
1197 }
1198
1199 uint8_t GetNodeTypeIdBytes() const
1200 {
1201 return nodeTypeIdBytes;
1202 }
1203
1207 const std::vector<TypeInfoRef>& GetWayTypes() const
1208 {
1209 return wayTypes;
1210 }
1211
1212 uint8_t GetWayTypeIdBytes() const
1213 {
1214 return wayTypeIdBytes;
1215 }
1216
1220 const std::vector<TypeInfoRef>& GetAreaTypes() const
1221 {
1222 return areaTypes;
1223 }
1224
1225 uint8_t GetAreaTypeIdBits() const
1226 {
1227 return areaTypeIdBits;
1228 }
1229
1230 uint8_t GetAreaTypeIdBytes() const
1231 {
1232 return areaTypeIdBytes;
1233 }
1234
1238 const std::vector<TypeInfoRef>& GetRouteTypes() const
1239 {
1240 return routeTypes;
1241 }
1242
1243 uint8_t GetRouteTypeIdBytes() const
1244 {
1245 return routeTypeIdBytes;
1246 }
1247
1252 size_t GetTypeCount() const
1253 {
1254 return types.size();
1255 }
1256
1261
1265 TypeInfoRef GetTypeInfo(size_t index) const
1266 {
1267 assert(index<types.size());
1268
1269 return types[index];
1270 }
1271
1276 {
1277 assert(id<=nodeTypes.size());
1278
1279 if (id==typeIgnore) {
1280 return typeInfoIgnore;
1281 }
1282
1283 return nodeTypes[id-1];
1284 }
1285
1290 {
1291 assert(id<=wayTypes.size());
1292
1293 if (id==typeIgnore) {
1294 return typeInfoIgnore;
1295 }
1296
1297 return wayTypes[id-1];
1298 }
1299
1304 {
1305 assert(id<=areaTypes.size());
1306
1307 if (id==typeIgnore) {
1308 return typeInfoIgnore;
1309 }
1310
1311 return areaTypes[id-1];
1312 }
1313
1318 {
1319 assert(id<=routeTypes.size());
1320
1321 if (id==typeIgnore) {
1322 return typeInfoIgnore;
1323 }
1324
1325 return routeTypes[id-1];
1326 }
1327
1332 TypeInfoRef GetTypeInfo(const std::string& name) const;
1333
1340 TypeInfoRef GetNodeType(const TagMap& tagMap) const;
1341
1348 bool GetWayAreaType(const TagMap& tagMap,
1349 TypeInfoRef& wayType,
1350 TypeInfoRef& areaType) const;
1351
1358 TypeInfoRef GetRelationType(const TagMap& tagMap) const;
1360
1366 void RegisterFeature(const FeatureRef& feature);
1367
1372 FeatureRef GetFeature(const std::string& name) const;
1373
1377 const std::vector<FeatureRef>& GetFeatures() const
1378 {
1379 return features;
1380 }
1381
1382
1387 bool LoadFromOSTFile(const std::string& filename);
1388 bool LoadFromDataFile(const std::string& directory);
1389 bool StoreToDataFile(const std::string& directory) const;
1391 };
1392
1393
1396 using TypeConfigRef = std::shared_ptr<TypeConfig>;
1397
1401}
1402
1403#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
TypeInfo & SetAreaId(TypeId id)
bool GetIndexAsAddress() const
Definition TypeConfig.h:499
const T * findValue() const
Definition TypeConfig.h:1020
bool IsInGroup(const std::string &groupName) const
Definition TypeConfig.h:710
bool StoreToDataFile(const std::string &directory) const
TypeInfoRef GetType() const
Definition TypeConfig.h:791
size_t GetOffset() const
Definition TypeFeature.h:280
bool GetFeature(const std::string &name, size_t &index) const
bool CanBeArea() const
Definition TypeConfig.h:387
const TagRegistry & GetTagRegistry() const
Definition TypeConfig.h:1142
TypeInfoRef GetTypeInfo(const std::string &name) const
TypeInfoRef typeInfoIgnore
Definition TypeConfig.h:1115
bool GetIndexAsLocation() const
Definition TypeConfig.h:514
FeatureRef GetFeature(const std::string &name) const
std::string GetDescription(const std::string &languageCode) const
uint8_t GetAreaTypeIdBits() const
Definition TypeConfig.h:1225
TypeInfoRef GetAreaTypeInfo(TypeId id) const
Definition TypeConfig.h:1303
TypeInfo & SetIsPath(bool isPath)
Definition TypeConfig.h:410
uint8_t GetNodeTypeIdBytes() const
Definition TypeConfig.h:1199
bool HasFeature(const std::string &featureName) const
void Read(FileScanner &scanner)
bool IsRoute() const
Definition TypeConfig.h:615
const std::vector< FeatureInstance > & GetFeatures() const
Definition TypeConfig.h:233
bool GetMergeAreas() const
Definition TypeConfig.h:642
TagId tagDataPolygon
Definition TypeConfig.h:1110
static const uint8_t typeWay
Condition applies to ways.
Definition TypeConfig.h:75
TypeInfo & SetLanes(uint8_t lanes)
Definition TypeConfig.h:678
bool HasFeatures() const
Definition TypeConfig.h:205
FeatureValueBuffer & operator=(const FeatureValueBuffer &other)
FeatureValue * AllocateValue(size_t idx)
TypeInfo & SetRouteId(TypeId id)
void RegisterMaxSpeedAlias(const std::string &alias, uint8_t maxSpeed)
Definition TypeConfig.h:1169
const std::vector< TypeInfoRef > & GetRouteTypes() const
Definition TypeConfig.h:1238
static const uint8_t typeNode
Condition applies to nodes.
Definition TypeConfig.h:74
SpecialType
Definition TypeConfig.h:79
@ multipolygon
Definition TypeConfig.h:81
@ none
Definition TypeConfig.h:80
@ route
Definition TypeConfig.h:83
@ routeMaster
Definition TypeConfig.h:82
TypeInfo & SetSpecialType(SpecialType specialType)
Definition TypeConfig.h:564
bool GetPinWay() const
Definition TypeConfig.h:627
void Write(FileWriter &writer, const std::array< bool, FlagCnt > &specialFlags) const
Definition TypeConfig.h:973
FeatureValueBuffer & operator=(FeatureValueBuffer &&other) noexcept
void Write(FileWriter &writer, bool specialFlag1, bool specialFlag2, bool specialFlag3) const
void CopyMissingValues(const FeatureValueBuffer &other)
TypeInfoRef typeInfoCoastline
Internal type for coastlines.
Definition TypeConfig.h:1120
TypeInfo & SetMergeAreas(bool mergeAreas)
Definition TypeConfig.h:635
void Read(FileScanner &scanner, bool &specialFlag)
TypeInfo & CanBeNode(bool canBeNode)
Definition TypeConfig.h:350
static TypeInfoRef Read(FileScanner &scanner)
uint8_t GetAreaTypeIdBytes() const
Definition TypeConfig.h:1230
TypeInfo & SetIndexAsPOI(bool indexAsPOI)
Definition TypeConfig.h:537
TypeId GetRouteId() const
Definition TypeConfig.h:300
void Set(const FeatureValueBuffer &other)
TypeInfo & SetIndex(size_t index)
@ none
Definition Transformation.h:185
std::string GetName() const
Definition TypeConfig.h:324
TypeInfo & SetIgnoreSeaLand(bool ignoreSeaLand)
Definition TypeConfig.h:650
void Read(FileScanner &scanner, bool &specialFlag1, bool &specialFlag2, bool &specialFlag3)
TypeInfo & operator=(const TypeInfo &&other)=delete
uint8_t GetLanes() const
Definition TypeConfig.h:685
const std::vector< TypeInfoRef > & GetWayTypes() const
Definition TypeConfig.h:1207
TypeInfo & AddFeature(const FeatureRef &feature)
bool GetWayAreaType(const TagMap &tagMap, TypeInfoRef &wayType, TypeInfoRef &areaType) const
TypeInfoRef GetWayTypeInfo(TypeId id) const
Definition TypeConfig.h:1289
TypeInfoRef GetNodeTypeInfo(TypeId id) const
Definition TypeConfig.h:1275
TypeInfoRef typeInfoTileLand
Internal type for ground tiles of type "land".
Definition TypeConfig.h:1116
bool GetIndexAsPOI() const
Definition TypeConfig.h:544
static const uint32_t MAX_FORMAT_VERSION
Definition TypeConfig.h:1057
TypeInfoRef typeInfoTileSea
Internal type for ground tiles of type "sea".
Definition TypeConfig.h:1117
TypeInfo & CanBeRelation(bool canBeRelation)
Definition TypeConfig.h:395
uint8_t GetWayTypeIdBytes() const
Definition TypeConfig.h:1212
bool HasConditions() const
Definition TypeConfig.h:334
void Write(FileWriter &writer, bool specialFlag) const
TypeInfoRef typeInfoTileUnknown
Internal type for ground tiles of type "unknown".
Definition TypeConfig.h:1119
TypeInfo & CanBeWay(bool canBeWay)
Definition TypeConfig.h:365
size_t GetFeatureMaskBytes() const
Definition TypeConfig.h:249
bool CanRoute() const
Definition TypeConfig.h:449
SpecialType GetSpecialType() const
Definition TypeConfig.h:570
const std::unordered_set< std::string > & GetGroups() const
Definition TypeConfig.h:705
TypeInfo & SetMultipolygon()
Definition TypeConfig.h:578
bool CanRouteBicycle() const
Definition TypeConfig.h:477
FeatureValue * GetValue(const FeatureValueBuffer &buffer) const
TypeInfo & SetNodeId(TypeId id)
TypeInfo(const TypeInfo &other)=delete
TypeInfoRef typeInfoTileCoast
Internal type for ground tiles of type "coast".
Definition TypeConfig.h:1118
bool HasFeature(size_t idx) const
Definition TypeConfig.h:815
uint8_t GetOnewayLanes() const
Definition TypeConfig.h:697
TypeInfoRef RegisterType(const TypeInfoRef &typeInfo)
TypeInfo & SetIgnore(bool ignore)
Definition TypeConfig.h:666
TypeInfoRef typeInfoOSMTileBorder
Internal type for OSM tile borders.
Definition TypeConfig.h:1121
size_t GetIndex() const
Definition TypeConfig.h:308
TypeInfo & SetIndexAsAddress(bool indexAsAddress)
Definition TypeConfig.h:492
TypeInfo & SetIndexAsLocation(bool indexAsLocation)
Definition TypeConfig.h:507
TypeInfo & CanRouteCar(bool canBeRoute)
Definition TypeConfig.h:442
bool CanRouteFoot() const
Definition TypeConfig.h:472
TypeInfo & CanBeArea(bool canBeArea)
Definition TypeConfig.h:380
bool CanBeWay() const
Definition TypeConfig.h:372
TypeInfo & SetWayId(TypeId id)
TagId tagArea
Definition TypeConfig.h:1108
size_t GetFeatureValueBufferSize() const
Definition TypeConfig.h:266
bool GetOptimizeLowZoom() const
Definition TypeConfig.h:559
const std::vector< FeatureRef > & GetFeatures() const
Definition TypeConfig.h:1377
TypeInfoRef typeInfoOSMSubTileBorder
Internal type for OSM tile borders.
Definition TypeConfig.h:1122
void Read(FileScanner &scanner, bool &specialFlag1, bool &specialFlag2)
bool operator==(const FeatureValueBuffer &other) const
bool operator!=(const FeatureValueBuffer &other) const
TypeInfoRef GetRelationType(const TagMap &tagMap) const
TypeInfo & SetIndexAsRegion(bool indexAsRegion)
Definition TypeConfig.h:522
TypeId GetWayId() const
Definition TypeConfig.h:284
TagId tagJunction
Definition TypeConfig.h:1113
bool CanBeRelation() const
Definition TypeConfig.h:402
bool IsMultipolygon() const
Definition TypeConfig.h:605
bool IsRouteMaster() const
Definition TypeConfig.h:610
bool IsPath() const
Definition TypeConfig.h:417
bool CanRouteCar() const
Definition TypeConfig.h:482
static const uint32_t MIN_FORMAT_VERSION
Definition TypeConfig.h:1056
TypeInfo & SetPinWay(bool pinWay)
Definition TypeConfig.h:620
TagId GetTagId(const std::string &name) const
Definition TypeConfig.h:1137
static const uint8_t typeRelation
Condition applies to relations.
Definition TypeConfig.h:77
bool IsInternal() const
Definition TypeConfig.h:316
TypeInfo & CanRouteBicycle(bool canBeRoute)
Definition TypeConfig.h:432
TypeInfo & SetRoute()
Definition TypeConfig.h:598
static const uint8_t typeArea
Condition applies to areas.
Definition TypeConfig.h:76
bool LoadFromDataFile(const std::string &directory)
TypeInfoRef GetTypeInfo(size_t index) const
Definition TypeConfig.h:1265
FeatureInstance GetFeature(size_t idx) const
Definition TypeConfig.h:807
bool CanRoute(Vehicle vehicle) const
Definition TypeConfig.h:457
bool CanBeNode() const
Definition TypeConfig.h:357
void FreeValue(size_t idx)
bool LoadFromOSTFile(const std::string &filename)
TypeInfoRef GetNodeType(const TagMap &tagMap) const
Type type
The type of the cell.
Definition GroundTile.h:92
const std::unordered_map< std::string, std::string > & GetDescriptions() const
Definition TypeConfig.h:715
TagId tagNatural
Definition TypeConfig.h:1109
TypeInfoRef GetRouteTypeInfo(TypeId id) const
Definition TypeConfig.h:1317
bool GetIndexAsRegion() const
Definition TypeConfig.h:529
TypeInfo & CanRouteFoot(bool canBeRoute)
Definition TypeConfig.h:425
const std::vector< TypeInfoRef > & GetTypes() const
Definition TypeConfig.h:1186
TypeInfo & AddDescription(const std::string &languageCode, const std::string &description)
TypeInfo(TypeInfo &&other)=delete
TypeId GetAreaId() const
Definition TypeConfig.h:292
const std::list< TypeCondition > & GetConditions() const
Definition TypeConfig.h:342
const std::vector< TypeInfoRef > & GetNodeTypes() const
Definition TypeConfig.h:1194
TypeInfo & SetOnewayLanes(uint8_t lanes)
Definition TypeConfig.h:690
TypeInfo & SetOptimizeLowZoom(bool optimize)
Definition TypeConfig.h:552
TypeInfo & SetType(const std::string &name)
TypeInfo & SetInternal()
void RegisterSurfaceToGradeMapping(const std::string &surface, size_t grade)
Definition TypeConfig.h:1157
TypeId GetMaxTypeId() const
static const char * FILE_TYPES_DAT
Definition TypeConfig.h:1055
bool GetIgnore() const
Definition TypeConfig.h:673
uint8_t GetRouteTypeIdBytes() const
Definition TypeConfig.h:1243
TypeInfo(const std::string &name)
FeatureValue * GetValue(size_t idx) const
Definition TypeConfig.h:830
TypeInfo & SetRouteMaster()
Definition TypeConfig.h:588
uint8_t GetDefaultAccess() const
TypeInfo & AddGroup(const std::string &groupName)
void SetType(const TypeInfoRef &type)
TagId tagType
Definition TypeConfig.h:1111
TagRegistry & GetTagRegistry()
Definition TypeConfig.h:1147
void Write(FileWriter &writer, bool specialFlag1, bool specialFlag2) const
void Write(FileWriter &writer) const
bool GetIgnoreSeaLand() const
Definition TypeConfig.h:657
FeatureValueBuffer()=default
size_t GetSpecialFeatureMaskBytes() const
Definition TypeConfig.h:258
TagId tagRestriction
Definition TypeConfig.h:1112
TypeId GetNodeId() const
Definition TypeConfig.h:275
size_t GetTypeCount() const
Definition TypeConfig.h:1252
const std::vector< TypeInfoRef > & GetAreaTypes() const
Definition TypeConfig.h:1220
FeatureValueBuffer(FeatureValueBuffer &&other) noexcept
FeatureValueBuffer(const FeatureValueBuffer &other)
TypeInfo & operator=(const TypeInfo &other)=delete
void Parse(TagErrorReporter &errorReporter, const TagRegistry &tagRegistry, const ObjectOSMRef &object, const TagMap &tags)
TypeInfo & AddCondition(unsigned char types, const TagConditionRef &condition)
osmscout::Vehicle vehicle
Definition Agents.h:87
const FeatureInstance & GetFeature(size_t idx) const
Definition TypeConfig.h:225
void RegisterFeature(const FeatureRef &feature)
void Read(FileScanner &scanner, std::array< bool, FlagCnt > &specialFlags)
Definition TypeConfig.h:932
size_t GetFeatureCount() const
Definition TypeConfig.h:241
TagId GetTagId(const char *name) const
Definition TypeConfig.h:1132
Definition TypeFeature.h:41
virtual void Read(FileScanner &scanner)=0
N BitsToBytes(N bits)
Definition Number.h:306
uint16_t TypeId
Definition OSMScoutTypes.h:52
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
static const TypeId typeIgnore
Definition TypeConfig.h:57
std::shared_ptr< TagCondition > TagConditionRef
Definition Tag.h:68
Definition Area.h:39
std::unordered_map< TagId, std::string > TagMap
Definition Tag.h:41
Vehicle
Definition OSMScoutTypes.h:55
@ vehicleBicycle
Definition OSMScoutTypes.h:57
@ vehicleFoot
Definition OSMScoutTypes.h:56
@ vehicleCar
Definition OSMScoutTypes.h:58
std::shared_ptr< TypeInfo > TypeInfoRef
Definition TypeConfig.h:61
uint16_t TagId
Definition Tag.h:39
std::shared_ptr< Feature > FeatureRef
Definition TypeFeature.h:219
static const uint32_t FILE_FORMAT_VERSION
Definition TypeConfig.h:1044
std::shared_ptr< FeatureValueBuffer > FeatureValueBufferRef
Definition TypeConfig.h:1039
Definition TypeConfig.h:95
unsigned char types
Bitset of types the condition can be applied to.
Definition TypeConfig.h:96
TagConditionRef condition
The root condition.
Definition TypeConfig.h:97