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-24 17:27:58 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:43:41 +0300
commitb4952df726bd2b7e020739f3746b73c088c68983 (patch)
treefe3ed5530d6e2e9859c7fb1e8e544b169f0dc52f /indexer
parente8bd221f5e7dafc95099a952ba044ac2968b3624 (diff)
Get AddressInfo for feature with visible texts or symbols.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/feature_utils.cpp4
-rw-r--r--indexer/feature_visibility.cpp26
-rw-r--r--indexer/feature_visibility.hpp12
3 files changed, 27 insertions, 15 deletions
diff --git a/indexer/feature_utils.cpp b/indexer/feature_utils.cpp
index a1220968b3..8c14d3999a 100644
--- a/indexer/feature_utils.cpp
+++ b/indexer/feature_utils.cpp
@@ -53,7 +53,7 @@ public:
void CorrectScaleForVisibility(TypesHolder const & types, int & scale) const
{
- pair<int, int> const scaleR = feature::GetDrawableScaleRangeForText(types);
+ pair<int, int> const scaleR = GetDrawableScaleRangeForRules(types, RULE_TEXT);
ASSERT_LESS_OR_EQUAL ( scaleR.first, scaleR.second, () );
// Result types can be without visible texts (matched by category).
@@ -77,7 +77,7 @@ public:
m2::RectD GetViewport(TypesHolder const & types, m2::RectD const & limitRect) const
{
- if (types.GetGeoType() != feature::GEOM_POINT)
+ if (types.GetGeoType() != GEOM_POINT)
return CorrectRectForScales(types, limitRect);
int const upperScale = scales::GetUpperScale();
diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp
index 78fad1f28a..a32f9b13b9 100644
--- a/indexer/feature_visibility.cpp
+++ b/indexer/feature_visibility.cpp
@@ -189,15 +189,18 @@ namespace
}
};
- class TextRulesChecker
+ class IsDrawableRulesChecker
{
int m_scale;
ClassifObject::FeatureGeoType m_ft;
+ bool m_arr[2];
public:
- TextRulesChecker(int scale, feature::EGeomType ft)
+ IsDrawableRulesChecker(int scale, feature::EGeomType ft, int rules)
: m_scale(scale), m_ft(ClassifObject::FeatureGeoType(ft))
{
+ m_arr[0] = rules & RULE_TEXT;
+ m_arr[1] = rules & RULE_SYMBOL;
}
typedef bool ResultType;
@@ -209,11 +212,14 @@ namespace
p->GetSuitable(m_scale, m_ft, keys);
for (size_t i = 0; i < keys.size(); ++i)
- if (keys[i].m_type == drule::caption || keys[i].m_type == drule::pathtext)
+ {
+ if ((m_arr[0] && (keys[i].m_type == drule::caption || keys[i].m_type == drule::pathtext)) ||
+ (m_arr[1] && keys[i].m_type == drule::symbol))
{
res = true;
return true;
}
+ }
return false;
}
@@ -351,11 +357,11 @@ pair<int, int> GetDrawableScaleRange(TypesHolder const & types)
namespace
{
- bool IsDrawableText(feature::TypesHolder const & types, int level)
+ bool IsDrawableForRules(feature::TypesHolder const & types, int level, int rules)
{
Classificator const & c = classif();
- TextRulesChecker doCheck(level, types.GetGeoType());
+ IsDrawableRulesChecker doCheck(level, types.GetGeoType(), rules);
for (size_t i = 0; i < types.Size(); ++i)
if (c.ProcessObjects(types[i], doCheck))
return true;
@@ -364,13 +370,13 @@ namespace
}
}
-pair<int, int> GetDrawableScaleRangeForText(feature::TypesHolder const & types)
+pair<int, int> GetDrawableScaleRangeForRules(feature::TypesHolder const & types, int rules)
{
int const upBound = scales::GetUpperScale();
int lowL = -1;
for (int level = 0; level <= upBound; ++level)
{
- if (IsDrawableText(types, level))
+ if (IsDrawableForRules(types, level, rules))
{
lowL = level;
break;
@@ -383,7 +389,7 @@ pair<int, int> GetDrawableScaleRangeForText(feature::TypesHolder const & types)
int highL = lowL;
for (int level = upBound; level > lowL; --level)
{
- if (IsDrawableText(types, level))
+ if (IsDrawableForRules(types, level, rules))
{
highL = level;
break;
@@ -393,9 +399,9 @@ pair<int, int> GetDrawableScaleRangeForText(feature::TypesHolder const & types)
return make_pair(lowL, highL);
}
-pair<int, int> GetDrawableScaleRangeForText(FeatureBase const & f)
+pair<int, int> GetDrawableScaleRangeForRules(FeatureBase const & f, int rules)
{
- return GetDrawableScaleRangeForText(TypesHolder(f));
+ return GetDrawableScaleRangeForRules(TypesHolder(f), rules);
}
bool IsHighway(vector<uint32_t> const & types)
diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp
index 081a38ba43..65d28220e7 100644
--- a/indexer/feature_visibility.hpp
+++ b/indexer/feature_visibility.hpp
@@ -18,7 +18,8 @@ namespace feature
/// @note do not change this values. Should be equal with EGeomType.
/// Used for checking visibility (by drawing style) for feature's geometry type
/// (for Area - check only area type, but can draw symbol or caption).
- enum FeatureGeoType {
+ enum FeatureGeoType
+ {
FEATURE_TYPE_POINT = 0,
FEATURE_TYPE_LINE = 1,
FEATURE_TYPE_AREA = 2
@@ -43,8 +44,13 @@ namespace feature
pair<int, int> GetDrawableScaleRange(TypesHolder const & types);
/// @name Get scale range when feature's text is visible.
- pair<int, int> GetDrawableScaleRangeForText(TypesHolder const & types);
- pair<int, int> GetDrawableScaleRangeForText(FeatureBase const & f);
+ enum
+ {
+ RULE_TEXT = 1, RULE_SYMBOL = 2
+ };
+
+ pair<int, int> GetDrawableScaleRangeForRules(TypesHolder const & types, int rules);
+ pair<int, int> GetDrawableScaleRangeForRules(FeatureBase const & f, int rules);
//@}
/// @return (geometry type, is coastline)