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--data/styles/include/base_landuse.mapcss16
-rw-r--r--data/styles/ink.mapcss2
-rw-r--r--generator/feature_builder.cpp3
-rw-r--r--generator/feature_generator.cpp84
-rw-r--r--generator/feature_merger.cpp3
-rw-r--r--indexer/feature_data.cpp5
-rw-r--r--indexer/feature_data.hpp2
7 files changed, 65 insertions, 50 deletions
diff --git a/data/styles/include/base_landuse.mapcss b/data/styles/include/base_landuse.mapcss
index f83d5c40d4..0aa783cf1b 100644
--- a/data/styles/include/base_landuse.mapcss
+++ b/data/styles/include/base_landuse.mapcss
@@ -1,8 +1,6 @@
area[landuse],
area[natural],
-area[leisure],
-area[place=island],
-area[place=islet]
+area[leisure]
{
fill-position: background;
}
@@ -13,18 +11,14 @@ area[natural=coastline]
z-index: -10;
}
-area|z6-11[natural=land],
-area|z6-11[place=island],
-area|z6-11[place=islet]
+area|z6-11[natural=land]
{
- fill-color: #f1eee8;
+ fill-color: #EEEEDD;
z-index: -9;
}
-area|z12-[natural=land],
-area|z12-[place=island],
-area|z12-[place=islet]
+area|z12-[natural=land]
{
- fill-color: #f8f8f8;
+ fill-color: #EEEEDD;
z-index: -9;
}
diff --git a/data/styles/ink.mapcss b/data/styles/ink.mapcss
index a000b3a4e1..e312710263 100644
--- a/data/styles/ink.mapcss
+++ b/data/styles/ink.mapcss
@@ -3869,8 +3869,6 @@ line[boundary=administrative][admin_level!=2][admin_level!=3][admin_level!=4]
}
area|z6-[natural=land]
-area|z6-[place=island]
-area|z6-[place=islet]
{
fill-color: #ffffff;
z-index: -5;
diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp
index 3381b5affa..404fc25eef 100644
--- a/generator/feature_builder.cpp
+++ b/generator/feature_builder.cpp
@@ -106,6 +106,9 @@ void FeatureBuilder1::DoCorrectForType(EGeomType type)
bool FeatureBuilder1::DoCorrect()
{
+ if (!m_Params.FinishAddingTypes())
+ return false;
+
DoCorrectForType(GEOM_AREA);
DoCorrectForType(GEOM_LINE);
diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp
index 9f627eed20..8813c848e1 100644
--- a/generator/feature_generator.cpp
+++ b/generator/feature_generator.cpp
@@ -263,21 +263,6 @@ class MainFeaturesEmitter
scoped_ptr<FeaturesCollector> m_coastsHolder;
string m_srcCoastsFile;
- uint32_t m_coastType;
- vector<uint32_t> m_islandTypes;
-
- // Treat islands as coastlines, because they don't have fill area draw style.
- bool IsIsland(FeatureBuilder1 const & fb) const
- {
- if (!fb.IsGeometryClosed())
- return false;
-
- for (size_t i = 0; i < m_islandTypes.size(); ++i)
- if (fb.HasType(m_islandTypes[i]))
- return true;
-
- return false;
- }
template <class T1, class T2> class CombinedEmitter
{
@@ -292,14 +277,40 @@ class MainFeaturesEmitter
}
};
+ enum TypeIndex
+ {
+ NATURAL_COASTLINE,
+ NATURAL_LAND,
+ PLACE_ISLAND,
+ PLACE_ISLET,
+
+ TYPES_COUNT
+ };
+ uint32_t m_types[TYPES_COUNT];
+
+ inline uint32_t Type(TypeIndex i) const { return m_types[i]; }
+
public:
MainFeaturesEmitter(GenerateInfo const & info)
{
Classificator const & c = classif();
- m_coastType = c.GetCoastType();
+
+ char const * arr[][2] = {
+ { "natural", "coastline" },
+ { "natural", "land" },
+ { "place", "island" },
+ { "place", "islet" }
+ };
+ STATIC_ASSERT(ARRAY_SIZE(arr) == TYPES_COUNT);
+
+ for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
+ m_types[i] = c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2));
m_srcCoastsFile = info.m_tmpDir + WORLD_COASTS_FILE_NAME + info.m_datFileSuffix;
+ CHECK(!info.m_makeCoasts || !info.m_createWorld,
+ ("We can't do make_coasts and generate_world at the same time"));
+
if (!info.m_makeCoasts)
{
m_countries.reset(new Polygonizer<FeaturesCollector>(info));
@@ -312,17 +323,9 @@ public:
}
else
{
- char const * arr[][2] = {
- { "place", "island" },
- { "place", "islet" }
- };
-
- for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
- m_islandTypes.push_back(c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2)));
-
// 4-10 - level range for cells
// 20000 - max points count per feature
- m_coasts.reset(new CoastlineFeaturesGenerator(m_coastType, 4, 10, 20000));
+ m_coasts.reset(new CoastlineFeaturesGenerator(Type(NATURAL_COASTLINE), 4, 10, 20000));
m_coastsHolder.reset(new FeaturesCollector(m_srcCoastsFile));
}
@@ -335,28 +338,41 @@ public:
void operator() (FeatureBuilder1 fb)
{
+ uint32_t const coastType = Type(NATURAL_COASTLINE);
+ bool const hasCoast = fb.HasType(coastType);
+
if (m_coasts)
{
- if (fb.HasType(m_coastType) || IsIsland(fb))
+ if (hasCoast)
{
CHECK ( fb.GetGeomType() != feature::GEOM_POINT, () );
// leave only coastline type
- fb.SetType(m_coastType);
+ fb.SetType(coastType);
(*m_coasts)(fb);
}
}
-
- // remove coastline type
- if (!fb.PopExactType(m_coastType) && fb.DoCorrect())
+ else
{
- if (m_world)
- (*m_world)(fb);
+ if (hasCoast)
+ {
+ fb.PopExactType(Type(NATURAL_LAND));
+ fb.PopExactType(coastType);
+ }
+ else if (fb.HasType(Type(PLACE_ISLAND)) || fb.HasType(Type(PLACE_ISLET)))
+ fb.AddType(Type(NATURAL_LAND));
+
+ if (fb.DoCorrect())
+ {
+ if (m_world)
+ (*m_world)(fb);
- if (m_countries)
- (*m_countries)(fb);
+ if (m_countries)
+ (*m_countries)(fb);
+ }
}
}
+
/// @return false if coasts are not merged and FLAG_fail_on_coasts is set
bool Finish()
{
diff --git a/generator/feature_merger.cpp b/generator/feature_merger.cpp
index 55d12e030f..06c83b0193 100644
--- a/generator/feature_merger.cpp
+++ b/generator/feature_merger.cpp
@@ -253,7 +253,8 @@ void FeatureMergeProcessor::DoMerge(FeatureEmitterIFace & emitter)
if (m_last.NotEmpty() && m_last.EqualGeometry(curr))
{
// curr is equal with m_last by geometry - just add new type to m_last
- m_last.AddType(type);
+ if (!m_last.HasType(type))
+ m_last.AddType(type);
}
else
{
diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp
index bb6f6cc429..fbc98bd3ff 100644
--- a/indexer/feature_data.cpp
+++ b/indexer/feature_data.cpp
@@ -163,12 +163,15 @@ void FeatureParams::AddTypes(FeatureParams const & rhs, uint32_t skipType2)
}
}
-void FeatureParams::FinishAddingTypes()
+bool FeatureParams::FinishAddingTypes()
{
sort(m_Types.begin(), m_Types.end());
m_Types.erase(unique(m_Types.begin(), m_Types.end()), m_Types.end());
+
if (m_Types.size() > max_types_count)
m_Types.resize(max_types_count);
+
+ return !m_Types.empty();
}
void FeatureParams::SetType(uint32_t t)
diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp
index 07128e59e1..26b9e83aa3 100644
--- a/indexer/feature_data.hpp
+++ b/indexer/feature_data.hpp
@@ -223,7 +223,7 @@ public:
m_Types.assign(b, e);
}
- void FinishAddingTypes();
+ bool FinishAddingTypes();
void SetType(uint32_t t);
bool PopAnyType(uint32_t & t);