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:
authorMaksim Andrianov <maksimandrianov1@gmail.com>2019-03-22 17:40:38 +0300
committerTatiana Yan <tatiana.kondakova@gmail.com>2019-04-09 20:52:09 +0300
commit4c858a1d1d5943310e155c0efb1265b640727697 (patch)
tree3141beaac3cd2d7a3a37bf3d553dfbfaf0385f52 /indexer
parent14bf63e03275b4ff6c19685592d0ea3387668f0f (diff)
[generator] Added CollectionBase class.
[generator] Added TypeHelper class. [generator] Added filters. [generator] Added collectors. [generator] Changed interfaces of some classes. [generator] Added the feature maker. [generator] Added the city boundary processor. [generator] Added relation tags enricher. [generator] Added processing layers. [generator] Changed emitters. [generator] Changed translators. [generator] Some changes related to refactoring. [generator] Removed EmitterPlanet, TranslatorPlanet and TranslatorGeocoderBase. [generator] Changed cmake list. Review fixes
Diffstat (limited to 'indexer')
-rw-r--r--indexer/feature_data.hpp1
-rw-r--r--indexer/feature_visibility.cpp55
-rw-r--r--indexer/feature_visibility.hpp6
-rw-r--r--indexer/ftypes_matcher.cpp36
-rw-r--r--indexer/ftypes_matcher.hpp25
5 files changed, 102 insertions, 21 deletions
diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp
index 8db386ddab..97dbf92bd7 100644
--- a/indexer/feature_data.hpp
+++ b/indexer/feature_data.hpp
@@ -256,6 +256,7 @@ public:
m_types = rhs.m_types;
m_addrTags = rhs.m_addrTags;
m_metadata = rhs.m_metadata;
+ m_reverseGeometry = rhs.m_reverseGeometry;
}
bool IsValid() const { return !m_types.empty(); }
diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp
index 51077d6a85..d7480d3cdd 100644
--- a/indexer/feature_visibility.cpp
+++ b/indexer/feature_visibility.cpp
@@ -8,6 +8,7 @@
#include "base/assert.hpp"
+#include <algorithm>
#include <array>
using namespace std;
@@ -348,30 +349,44 @@ bool IsDrawableForIndexClassifOnly(TypesHolder const & types, int level)
return false;
}
-bool RemoveUselessTypes(vector<uint32_t> & types, EGeomType geomType, bool emptyName)
+bool IsUsefulType(uint32_t t, EGeomType geomType, bool emptyName)
{
Classificator const & c = classif();
- types.erase(remove_if(types.begin(), types.end(), [&] (uint32_t t)
+ if (IsUsefulNondrawableType(t, geomType))
+ return true;
+
+ IsDrawableLikeChecker doCheck(geomType, emptyName);
+ if (c.ProcessObjects(t, doCheck))
+ return true;
+
+ // IsDrawableLikeChecker checks only unique area styles,
+ // so we need to take into account point styles too.
+ if (geomType == GEOM_AREA)
{
- if (IsUsefulNondrawableType(t, geomType))
- return false;
-
- IsDrawableLikeChecker doCheck(geomType, emptyName);
- if (c.ProcessObjects(t, doCheck))
- return false;
-
- // IsDrawableLikeChecker checks only unique area styles,
- // so we need to take into account point styles too.
- if (geomType == GEOM_AREA)
- {
- IsDrawableLikeChecker doCheck(GEOM_POINT, emptyName);
- if (c.ProcessObjects(t, doCheck))
- return false;
- }
-
- return true;
- }), types.end());
+ IsDrawableLikeChecker doCheck(GEOM_POINT, emptyName);
+ if (c.ProcessObjects(t, doCheck))
+ return true;
+ }
+
+ return false;
+}
+
+bool HasUsefulType(vector<uint32_t> const & types, EGeomType geomType, bool emptyName)
+{
+ if (types.empty())
+ return false;
+
+ return any_of(types.begin(), types.end(), [&](uint32_t t) {
+ return IsUsefulType(t, geomType, emptyName);
+ });
+}
+
+bool RemoveUselessTypes(vector<uint32_t> & types, EGeomType geomType, bool emptyName)
+{
+ base::EraseIf(types, [&] (uint32_t t) {
+ return !IsUsefulType(t, geomType, emptyName);
+ });
return !types.empty();
}
diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp
index 57db612238..400ee5b0e1 100644
--- a/indexer/feature_visibility.hpp
+++ b/indexer/feature_visibility.hpp
@@ -6,6 +6,7 @@
#include "base/base.hpp"
+#include <cstdint>
#include <initializer_list>
#include <string>
#include <utility>
@@ -34,7 +35,10 @@ namespace feature
/// For FEATURE_TYPE_AREA removes line-drawing only types.
bool RemoveUselessTypes(std::vector<uint32_t> & types, EGeomType geomType,
bool emptyName = false);
- //@}
+
+ // Returns true, if there is at least one type that is needed for the application.
+ // This can be specified either by the drawing rule or by other rules.
+ bool HasUsefulType(std::vector<uint32_t> const & types, EGeomType geomType, bool emptyName = false);
int GetMinDrawableScale(FeatureType & ft);
int GetMinDrawableScale(TypesHolder const & types, m2::RectD limitRect);
diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp
index b141bc6096..276e963994 100644
--- a/indexer/ftypes_matcher.cpp
+++ b/indexer/ftypes_matcher.cpp
@@ -476,6 +476,42 @@ IsPopularityPlaceChecker::IsPopularityPlaceChecker()
m_types.push_back(c.GetTypeByPath({t.first, t.second}));
}
+IsIslandChecker::IsIslandChecker()
+{
+ vector<pair<string, string>> const types = {
+ {"place", "island"},
+ {"place", "islet"},
+ };
+
+ Classificator const & c = classif();
+ for (auto const & t : types)
+ m_types.push_back(c.GetTypeByPath({t.first, t.second}));
+}
+
+IsLandChecker::IsLandChecker()
+{
+ Classificator const & c = classif();
+ m_types.push_back(c.GetTypeByPath({"natural", "land"}));
+}
+
+uint32_t IsLandChecker::GetLandType() const
+{
+ CHECK_EQUAL(m_types.size(), 1, ());
+ return m_types[0];
+}
+
+IsCoastlineChecker::IsCoastlineChecker()
+{
+ Classificator const & c = classif();
+ m_types.push_back(c.GetTypeByPath({"natural", "coastline"}));
+}
+
+uint32_t IsCoastlineChecker::GetCoastlineType() const
+{
+ CHECK_EQUAL(m_types.size(), 1, ());
+ return m_types[0];
+}
+
boost::optional<IsHotelChecker::Type> IsHotelChecker::GetHotelType(FeatureType & ft) const
{
feature::TypesHolder types(ft);
diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp
index 5747d91786..f9261f3140 100644
--- a/indexer/ftypes_matcher.hpp
+++ b/indexer/ftypes_matcher.hpp
@@ -243,6 +243,31 @@ public:
DECLARE_CHECKER_INSTANCE(IsPopularityPlaceChecker);
};
+class IsIslandChecker : public BaseChecker
+{
+ IsIslandChecker();
+public:
+ DECLARE_CHECKER_INSTANCE(IsIslandChecker);
+};
+
+class IsLandChecker : public BaseChecker
+{
+ IsLandChecker();
+public:
+ DECLARE_CHECKER_INSTANCE(IsLandChecker);
+
+ uint32_t GetLandType() const;
+};
+
+class IsCoastlineChecker : public BaseChecker
+{
+ IsCoastlineChecker();
+public:
+ DECLARE_CHECKER_INSTANCE(IsCoastlineChecker);
+
+ uint32_t GetCoastlineType() const;
+};
+
class IsHotelChecker : public BaseChecker
{
public: