forked from organicmaps/organicmaps
[generator] Parse multiple aerodrome types. Use mapcss selectors instead of replaced_tags for multiple rules support.
This commit is contained in:
parent
940a538227
commit
71f06aba05
4 changed files with 33 additions and 3 deletions
|
@ -1007,7 +1007,7 @@ place|city|capital|11;[place=city][capital=11],[place=city][capital?][admin_leve
|
|||
hwtag|yesfoot;1007;
|
||||
public_transport|platform;1008;
|
||||
deprecated|deprecated;1009;x
|
||||
aeroway|aerodrome|international;[aeroway=aerodrome][aerodrome=international];;name;int_name;1010;
|
||||
aeroway|aerodrome|international;[aeroway=aerodrome][aerodrome=international],[aeroway=aerodrome][aerodrome:type=international];;name;int_name;1010;
|
||||
railway|station|light_rail;[railway=station][station=light_rail],[railway=station][transport=light_rail];;name;int_name;1011;
|
||||
railway|station|monorail;[railway=station][station=monorail],[railway=station][transport=monorail];;name;int_name;1012;
|
||||
railway|station|subway|london;[railway=station][transport=subway][city=london],[railway=station][station=subway][city=london];;name;int_name;1013;
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 11.
|
|
@ -50,8 +50,6 @@ diet:vegan=yes : cuisine=vegan
|
|||
diet:vegan=only : cuisine=vegan
|
||||
diet=vegan : cuisine=vegan
|
||||
|
||||
aerodrome:type=international : aerodrome=international
|
||||
|
||||
amenity=parking_entrance : amenity=parking
|
||||
|
||||
historic=cannon : historic=memorial
|
||||
|
|
|
@ -937,6 +937,19 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_DoNotMergeTags)
|
|||
}
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(TestWithClassificator, OsmType_AerodromeType)
|
||||
{
|
||||
Tags const tags = {
|
||||
{"aeroway", "aerodrome"},
|
||||
{"aerodrome:type", "international ; public"},
|
||||
};
|
||||
|
||||
auto const params = GetFeatureBuilderParams(tags);
|
||||
|
||||
TEST_EQUAL(params.m_types.size(), 1, (params));
|
||||
TEST(params.IsTypeExist(GetType({"aeroway", "aerodrome", "international"})), (params));
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(TestWithClassificator, OsmType_SimpleTypesSmoke)
|
||||
{
|
||||
Tags const simpleTypes = {
|
||||
|
|
|
@ -580,6 +580,25 @@ void PreprocessElement(OsmElement * p)
|
|||
}
|
||||
}
|
||||
|
||||
string const kAerodromeTypeKey = "aerodrome:type";
|
||||
auto aerodromeTypes = p->GetTag(kAerodromeTypeKey);
|
||||
if (!aerodromeTypes.empty())
|
||||
{
|
||||
strings::MakeLowerCaseInplace(aerodromeTypes);
|
||||
bool first = true;
|
||||
for (auto type : strings::Tokenize(aerodromeTypes, ",;"))
|
||||
{
|
||||
strings::Trim(type, " ");
|
||||
|
||||
if (first)
|
||||
p->UpdateTag(kAerodromeTypeKey, [&type](auto & value) { value = type; });
|
||||
else
|
||||
p->AddTag(kAerodromeTypeKey, type);
|
||||
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
// We replace a value of 'place' with a value of 'de: place' because most people regard
|
||||
// places names as 'de: place' defines it.
|
||||
// TODO(@m.andrianov): A better solution for the future is writing this rule in replaced_tags.txt
|
||||
|
|
Loading…
Add table
Reference in a new issue