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:
authorvng <viktor.govako@gmail.com>2012-09-19 17:33:23 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:43:21 +0300
commit5b1b472957a72620f4ab1e2aa488f67c983dbc06 (patch)
tree6b96bd7016845efb8e6ec83497944682eea90499 /indexer
parentac18079c373264ce6f3d11a448165ae06d67b463 (diff)
Fix feature's types while generating. Do not include non-drawable types for POINT, LINEAR and AREA geometry types.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/feature_visibility.cpp41
-rw-r--r--indexer/feature_visibility.hpp7
2 files changed, 46 insertions, 2 deletions
diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp
index ee96d55a33..db0c5cc953 100644
--- a/indexer/feature_visibility.cpp
+++ b/indexer/feature_visibility.cpp
@@ -254,6 +254,47 @@ bool IsDrawableForIndex(FeatureBase const & f, int level)
return false;
}
+namespace
+{
+ class CheckNonDrawableType
+ {
+ Classificator & m_c;
+ FeatureGeoType m_arr[3];
+ size_t m_count;
+
+ public:
+ CheckNonDrawableType(FeatureGeoType ft)
+ : m_c(classif()), m_count(0)
+ {
+ if (ft < FEATURE_TYPE_LINE_AREA)
+ m_arr[m_count++] = ft;
+ else
+ {
+ ASSERT_EQUAL ( ft, FEATURE_TYPE_LINE_AREA, () );
+ m_arr[m_count++] = FEATURE_TYPE_LINE;
+ m_arr[m_count++] = FEATURE_TYPE_AREA;
+ }
+ }
+
+ bool operator() (uint32_t t)
+ {
+ for (size_t i = 0; i < m_count; ++i)
+ {
+ IsDrawableLikeChecker doCheck(m_arr[i]);
+ if (m_c.ProcessObjects(t, doCheck))
+ return false;
+ }
+ return true;
+ }
+ };
+}
+
+bool RemoveNoDrawableTypes(vector<uint32_t> & types, FeatureGeoType ft)
+{
+ types.erase(remove_if(types.begin(), types.end(), CheckNonDrawableType(ft)), types.end());
+ return !types.empty();
+}
+
int GetMinDrawableScale(FeatureBase const & f)
{
int const upBound = scales::GetUpperScale();
diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp
index b4ba4c5f77..6f3fea925c 100644
--- a/indexer/feature_visibility.hpp
+++ b/indexer/feature_visibility.hpp
@@ -19,13 +19,16 @@ namespace feature
enum FeatureGeoType {
FEATURE_TYPE_POINT = 0,
FEATURE_TYPE_LINE = 1,
- FEATURE_TYPE_AREA = 2
+ FEATURE_TYPE_AREA = 2,
+ FEATURE_TYPE_LINE_AREA = 3
};
bool IsDrawableAny(uint32_t type);
- bool IsDrawableLike(vector<uint32_t> const & type, FeatureGeoType ft);
+ bool IsDrawableLike(vector<uint32_t> const & types, FeatureGeoType ft);
bool IsDrawableForIndex(FeatureBase const & f, int level);
+ bool RemoveNoDrawableTypes(vector<uint32_t> & types, FeatureGeoType ft);
+
int GetMinDrawableScale(FeatureBase const & f);
/// @return [-1, -1] if no any text exists