Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2018-08-10 13:30:22 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2018-08-21 15:01:31 +0300
commitfdebef29b0532388f2689d162971a43f379c0cf5 (patch)
treeb31dc8ec3cee3d9df339ecbf90cff633356f9225 /geocoder
parentecd47090ebfbbba80b1cca18b2621021ff75db50 (diff)
[base] Replacing osm::Id with GeoObjectId.
Diffstat (limited to 'geocoder')
-rw-r--r--geocoder/geocoder.cpp2
-rw-r--r--geocoder/geocoder.hpp6
-rw-r--r--geocoder/geocoder_tests/geocoder_tests.cpp6
-rw-r--r--geocoder/hierarchy.cpp4
-rw-r--r--geocoder/hierarchy.hpp6
-rw-r--r--geocoder/result.hpp8
6 files changed, 17 insertions, 15 deletions
diff --git a/geocoder/geocoder.cpp b/geocoder/geocoder.cpp
index e01c1fea22..a8c6e4d012 100644
--- a/geocoder/geocoder.cpp
+++ b/geocoder/geocoder.cpp
@@ -114,7 +114,7 @@ bool Geocoder::Context::IsTokenUsed(size_t id) const
bool Geocoder::Context::AllTokensUsed() const { return m_numUsedTokens == m_tokens.size(); }
-void Geocoder::Context::AddResult(osm::Id const & osmId, double certainty)
+void Geocoder::Context::AddResult(base::GeoObjectId const & osmId, double certainty)
{
m_results[osmId] = max(m_results[osmId], certainty);
}
diff --git a/geocoder/geocoder.hpp b/geocoder/geocoder.hpp
index 5dfec2450d..c2c7b29aaa 100644
--- a/geocoder/geocoder.hpp
+++ b/geocoder/geocoder.hpp
@@ -4,7 +4,7 @@
#include "geocoder/result.hpp"
#include "geocoder/types.hpp"
-#include "base/osm_id.hpp"
+#include "base/geo_object_id.hpp"
#include "base/string_utils.hpp"
#include <string>
@@ -63,7 +63,7 @@ public:
// Returns true iff all tokens are used.
bool AllTokensUsed() const;
- void AddResult(osm::Id const & osmId, double certainty);
+ void AddResult(base::GeoObjectId const & osmId, double certainty);
void FillResults(std::vector<Result> & results) const;
@@ -79,7 +79,7 @@ public:
size_t m_numUsedTokens = 0;
// The highest value of certainty for each retrieved osm id.
- std::unordered_map<osm::Id, double, osm::HashId> m_results;
+ std::unordered_map<base::GeoObjectId, double, base::HashGeoObjectId> m_results;
std::vector<Layer> m_layers;
};
diff --git a/geocoder/geocoder_tests/geocoder_tests.cpp b/geocoder/geocoder_tests/geocoder_tests.cpp
index bd232f4387..81e379635e 100644
--- a/geocoder/geocoder_tests/geocoder_tests.cpp
+++ b/geocoder/geocoder_tests/geocoder_tests.cpp
@@ -6,8 +6,8 @@
#include "platform/platform_tests_support/scoped_file.hpp"
+#include "base/geo_object_id.hpp"
#include "base/math.hpp"
-#include "base/osm_id.hpp"
#include "base/stl_helpers.hpp"
#include <algorithm>
@@ -57,8 +57,8 @@ UNIT_TEST(Geocoder_Smoke)
ScopedFile const regionsJsonFile("regions.jsonl", kRegionsData);
Geocoder geocoder(regionsJsonFile.GetFullPath());
- osm::Id const florenciaId(0xc00000000059d6b5);
- osm::Id const cubaId(0xc00000000004b279);
+ base::GeoObjectId const florenciaId(0xc00000000059d6b5);
+ base::GeoObjectId const cubaId(0xc00000000004b279);
TestGeocoder(geocoder, "florencia", {{florenciaId, 1.0}});
TestGeocoder(geocoder, "cuba florencia", {{florenciaId, 1.0}, {cubaId, 0.5}});
diff --git a/geocoder/hierarchy.cpp b/geocoder/hierarchy.cpp
index c6eb0c3851..4fbc8a2172 100644
--- a/geocoder/hierarchy.cpp
+++ b/geocoder/hierarchy.cpp
@@ -109,7 +109,7 @@ Hierarchy::Hierarchy(string const & pathToJsonHierarchy)
Entry entry;
// todo(@m) We should really write uints as uints.
- entry.m_osmId = osm::Id(static_cast<uint64_t>(encodedId));
+ entry.m_osmId = base::GeoObjectId(static_cast<uint64_t>(encodedId));
if (!entry.DeserializeFromJSON(line, stats))
continue;
@@ -125,7 +125,7 @@ Hierarchy::Hierarchy(string const & pathToJsonHierarchy)
LOG(LINFO, ("Finished reading the hierarchy. Stats:"));
LOG(LINFO, ("Corrupted json lines:", stats.m_badJsons));
- LOG(LINFO, ("Unreadable osm::Ids:", stats.m_badOsmIds));
+ LOG(LINFO, ("Unreadable base::GeoObjectIds:", stats.m_badOsmIds));
LOG(LINFO, ("Entries with duplicate address parts:", stats.m_duplicateAddresses));
LOG(LINFO, ("Entries without address:", stats.m_emptyAddresses));
LOG(LINFO, ("Entries without names:", stats.m_emptyNames));
diff --git a/geocoder/hierarchy.hpp b/geocoder/hierarchy.hpp
index f9a9358ee2..f9f45605ff 100644
--- a/geocoder/hierarchy.hpp
+++ b/geocoder/hierarchy.hpp
@@ -2,7 +2,7 @@
#include "geocoder/types.hpp"
-#include "base/osm_id.hpp"
+#include "base/geo_object_id.hpp"
#include "base/string_utils.hpp"
#include <array>
@@ -25,7 +25,7 @@ public:
// Number of corrupted json lines.
uint64_t m_badJsons = 0;
- // Number of entries with unreadable osm::Ids.
+ // Number of entries with unreadable base::GeoObjectIds.
uint64_t m_badOsmIds = 0;
// Number of entries with duplicate subfields in the address field.
@@ -54,7 +54,7 @@ public:
void DeserializeFromJSONImpl(json_t * const root, std::string const & jsonStr,
ParsingStats & stats);
- osm::Id m_osmId = osm::Id(osm::Id::kInvalid);
+ base::GeoObjectId m_osmId = base::GeoObjectId(base::GeoObjectId::kInvalid);
// Original name of the entry. Useful for debugging.
std::string m_name;
diff --git a/geocoder/result.hpp b/geocoder/result.hpp
index ae0904b595..ba04bad46d 100644
--- a/geocoder/result.hpp
+++ b/geocoder/result.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "base/osm_id.hpp"
+#include "base/geo_object_id.hpp"
#include <string>
@@ -8,10 +8,12 @@ namespace geocoder
{
struct Result
{
- Result(osm::Id const & osmId, double certainty) : m_osmId(osmId), m_certainty(certainty) {}
+ Result(base::GeoObjectId const & osmId, double certainty) : m_osmId(osmId), m_certainty(certainty)
+ {
+ }
// The encoded osm id of a node, way or relation.
- osm::Id m_osmId = osm::Id(osm::Id::kInvalid);
+ base::GeoObjectId m_osmId = base::GeoObjectId(base::GeoObjectId::kInvalid);
// A floating point number in the range [0.0, 1.0]
// describing the extent to which the result matches