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:
-rw-r--r--generator/feature_builder.cpp17
-rw-r--r--generator/feature_builder.hpp7
-rw-r--r--generator/feature_generator.cpp7
-rw-r--r--generator/feature_merger.hpp1
-rw-r--r--indexer/feature_data.hpp1
-rw-r--r--indexer/feature_visibility.hpp7
6 files changed, 37 insertions, 3 deletions
diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp
index dad16f1cd3..0dc2293395 100644
--- a/generator/feature_builder.cpp
+++ b/generator/feature_builder.cpp
@@ -75,6 +75,23 @@ void FeatureBuilder1::AddPolygon(vector<m2::PointD> & poly)
m_Polygons.back().swap(poly);
}
+void FeatureBuilder1::DoCorrectForType(EGeomType type)
+{
+ if (m_Params.GetGeomType() == type &&
+ !IsDrawableLike(m_Params.m_Types, static_cast<FeatureGeoType>(type)))
+ {
+ m_Params.RemoveGeomType(type);
+ }
+}
+
+bool FeatureBuilder1::DoCorrect()
+{
+ DoCorrectForType(GEOM_AREA);
+ DoCorrectForType(GEOM_LINE);
+
+ return (m_Params.GetGeomType() != GEOM_UNDEFINED);
+}
+
FeatureBase FeatureBuilder1::GetFeatureBase() const
{
CHECK ( CheckValid(), (*this) );
diff --git a/generator/feature_builder.hpp b/generator/feature_builder.hpp
index 7bb871d803..019c1268c4 100644
--- a/generator/feature_builder.hpp
+++ b/generator/feature_builder.hpp
@@ -43,6 +43,13 @@ public:
inline void AddType(uint32_t type) { m_Params.AddType(type); }
inline bool HasType(uint32_t t) const { return m_Params.IsTypeExist(t); }
inline bool PopExactType(uint32_t type) { return m_Params.PopExactType(type); }
+ inline void SetType(uint32_t type) { m_Params.SetType(type); }
+
+ /// Check for feature visibility according to it's types.
+ /// If feature is invisible, it's not correct.
+ /// This fuction is called after it's classificator types manipulating.
+ void DoCorrectForType(feature::EGeomType type);
+ bool DoCorrect();
typedef vector<char> buffer_t;
diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp
index 434634d32c..a941cbfd45 100644
--- a/generator/feature_generator.cpp
+++ b/generator/feature_generator.cpp
@@ -282,10 +282,15 @@ public:
if (m_coasts)
{
if (fb.HasType(m_coastType))
+ {
+ // leave only coastline type
+ fb.SetType(m_coastType);
(*m_coasts)(fb);
+ }
}
- if (!fb.PopExactType(m_coastType))
+ // remove coastline type
+ if (!fb.PopExactType(m_coastType) && fb.DoCorrect())
{
if (m_world)
(*m_world)(fb);
diff --git a/generator/feature_merger.hpp b/generator/feature_merger.hpp
index 54030beaee..f98029f819 100644
--- a/generator/feature_merger.hpp
+++ b/generator/feature_merger.hpp
@@ -31,7 +31,6 @@ public:
inline m2::PointD FirstPoint() const { return GetGeometry().front(); }
inline m2::PointD LastPoint() const { return GetGeometry().back(); }
- inline void SetType(uint32_t type) { m_Params.SetType(type); }
inline bool PopAnyType(uint32_t & type) { return m_Params.PopAnyType(type); }
template <class ToDo> void ForEachChangeTypes(ToDo toDo)
diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp
index 1c319eb684..3a1fe60b2d 100644
--- a/indexer/feature_data.hpp
+++ b/indexer/feature_data.hpp
@@ -14,6 +14,7 @@ namespace feature
enum EGeomType
{
GEOM_UNDEFINED = -1,
+ // Note! do not change this values. Should be equal with FeatureGeoType.
GEOM_POINT = 0,
GEOM_LINE = 1,
GEOM_AREA = 2
diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp
index 208f5430ea..9a1f5a34fd 100644
--- a/indexer/feature_visibility.hpp
+++ b/indexer/feature_visibility.hpp
@@ -13,7 +13,12 @@ class FeatureBase;
namespace feature
{
- enum FeatureGeoType { FEATURE_TYPE_POINT = 0, FEATURE_TYPE_LINE, FEATURE_TYPE_AREA };
+ // Note! do not change this values. Should be equal with EGeomType.
+ enum FeatureGeoType {
+ FEATURE_TYPE_POINT = 0,
+ FEATURE_TYPE_LINE = 1,
+ FEATURE_TYPE_AREA = 2
+ };
bool IsDrawableAny(uint32_t type);
bool IsDrawableLike(vector<uint32_t> const & type, FeatureGeoType ft);