diff options
author | vng <viktor.govako@gmail.com> | 2011-11-14 23:44:13 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:27:52 +0300 |
commit | 6d4e795f01a7235be2df68babcf968f72dd95694 (patch) | |
tree | 9520453ec69d1e45714de290be6ee2da77796898 /indexer/classificator_loader.cpp | |
parent | 6f31774ce443b05026ab1e7a335ba65820bbba67 (diff) |
- Writing and Reading of proto drawing rules.
- New rules file: drules_proto.txt
Diffstat (limited to 'indexer/classificator_loader.cpp')
-rw-r--r-- | indexer/classificator_loader.cpp | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/indexer/classificator_loader.cpp b/indexer/classificator_loader.cpp index 4c6f325496..47050454c8 100644 --- a/indexer/classificator_loader.cpp +++ b/indexer/classificator_loader.cpp @@ -1,6 +1,7 @@ #include "classificator_loader.hpp" #include "classificator.hpp" #include "drawing_rules.hpp" +#include "drules_struct.pb.h" #include "../../platform/platform.hpp" @@ -12,33 +13,26 @@ namespace classificator { - void Read(ReaderType const & rules, - ReaderType const & classificator, - ReaderType const & visibility, - ReaderType const & types) + void ReadCommon(ReaderType const & classificator, + ReaderType const & visibility, + ReaderType const & types) { -// LOG(LINFO, ("Reading drawing rules")); - ReaderPtrStream rulesS(rules); - drule::ReadRules(rulesS); - string buffer; Classificator & c = classif(); c.Clear(); -// LOG(LINFO, ("Reading classificator")); + //LOG(LINFO, ("Reading classificator")); classificator.ReadAsString(buffer); c.ReadClassificator(buffer); -// LOG(LINFO, ("Reading visibility")); + //LOG(LINFO, ("Reading visibility")); visibility.ReadAsString(buffer); c.ReadVisibility(buffer); -// LOG(LINFO, ("Reading types mapping")); + //LOG(LINFO, ("Reading types mapping")); types.ReadAsString(buffer); c.ReadTypesMapping(buffer); - -// LOG(LINFO, ("Reading of classificator done")); } void ReadVisibility(string const & fPath) @@ -50,11 +44,25 @@ namespace classificator void Load() { + LOG(LINFO, ("Reading of classificator started")); + Platform & p = GetPlatform(); - Read(p.GetReader("drawing_rules.bin"), - p.GetReader("classificator.txt"), - p.GetReader("visibility.txt"), - p.GetReader("types.txt")); + ReadCommon(p.GetReader("classificator.txt"), + p.GetReader("visibility.txt"), + p.GetReader("types.txt")); + + //LOG(LINFO, ("Reading of drawing rules")); +#ifdef USE_PROTO_STYLES + // Load from protobuffer text file. + string buffer; + ReaderType(p.GetReader("drules_proto.txt")).ReadAsString(buffer); + drule::rules().LoadFromProto(buffer); +#else + ReaderPtrStream rulesS(p.GetReader("drawing_rules.bin")); + drule::ReadRules(rulesS); +#endif + + LOG(LINFO, ("Reading of classificator done")); } } |