[classificator] Added new hospital types. Renamed entrance->building-entrance. Added barrier-entrance type.

This commit is contained in:
vng 2015-10-01 18:15:48 +03:00
parent 7bc1f8e46f
commit 02fe28ec79
6 changed files with 102 additions and 18 deletions

View file

@ -1477,7 +1477,7 @@ ro:cimitir
nb:gravplass
fi:hautausmaa
amenity-hospital|amenity-doctors
amenity-hospital|amenity-doctors|amenity-dentist|amenity-clinic
en:3hospital|clinic|3doctor|U+1F691|U+1F3E5|U+1F489|U+1F48A
ru:3больница|3госпиталь|врач|доктор
uk:3лікарня|клініка|лікар|травмпункт

View file

@ -1033,3 +1033,6 @@ railway|subway_entrance|madrid;[railway=subway_entrance][city=madrid];;name;int_
railway|subway_entrance|roma;[railway=subway_entrance][city=roma];;name;int_name;1033;
railway|subway_entrance|spb;[railway=subway_entrance][city=spb];;name;int_name;1034;
aerialway|drag_lift;[aerialway=drag_lift];;name;int_name;1035;
amenity|dentist;[amenity=dentist];;name;int_name;1037;
amenity|clinic;[amenity=clinic];;name;int_name;1038;
barrier|entrance;[barrier=entrance];;name;int_name;1040;

Can't render this file because it has a wrong number of fields in line 371.

View file

@ -81,7 +81,15 @@ node|z16[amenity=theatre], area|z16[amenity=theatre] { icon-image: theatre-m.svg
node|z16[amenity=kindergarten], area|z16[amenity=kindergarten] { icon-image: kindergarten-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z16[amenity=school], area|z16[amenity=school] { icon-image: school-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z16[amenity=college], area|z16[amenity=college] { icon-image: college-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z16[amenity=hospital], area|z16[amenity=hospital] { icon-image: hospital-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z16[amenity=hospital], area|z16[amenity=hospital],
node|z16[amenity=doctors], area|z16[amenity=doctors],
node|z16[amenity=dentist], area|z16[amenity=dentist],
node|z16[amenity=clinic], area|z16[amenity=clinic],
{
icon-image: hospital-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label;
}
node|z16[amenity=university], area|z16[amenity=university] { icon-image: college-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; z-index: 4; }
node|z16[amenity=fuel], area|z16[amenity=fuel] { icon-image: fuel-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z16-[natural=spring],area|z16-[natural=spring]{ icon-image: drinking-water-m.svg; z-index: 1000; text-offset:8; font-size: 10; text: name; text-color: @poi_label; z-index: 100; }
@ -92,7 +100,15 @@ node|z17[amenity=theatre], area|z17[amenity=theatre] { icon-image: theatre-l.svg
node|z17[amenity=kindergarten], area|z17[amenity=kindergarten] { icon-image: kindergarten-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z17[amenity=school], area|z17[amenity=school] { icon-image: school-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z17[amenity=college], area|z17[amenity=college] { icon-image: college-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z17[amenity=hospital], area|z17[amenity=hospital] { icon-image: hospital-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z17[amenity=hospital], area|z17[amenity=hospital],
node|z17[amenity=doctors], area|z17[amenity=doctors],
node|z17[amenity=dentist], area|z17[amenity=dentist],
node|z17[amenity=clinic], area|z17[amenity=clinic],
{
icon-image: hospital-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label;
}
node|z17[amenity=university], area|z17[amenity=university] { icon-image: college-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; z-index: 4; }
node|z17[amenity=cinema], area|z17[amenity=cinema] { icon-image: cinema-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
@ -114,7 +130,15 @@ node|z18-[amenity=theatre], area|z18-[amenity=theatre] { icon-image: theatre-l.s
node|z18-[amenity=kindergarten], area|z18-[amenity=kindergarten] { icon-image: kindergarten-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z18-[amenity=school], area|z18-[amenity=school] { icon-image: school-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z18-[amenity=college], area|z18-[amenity=college] { icon-image: college-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z18-[amenity=hospital], area|z18-[amenity=hospital] { icon-image: hospital-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z18-[amenity=hospital], area|z18-[amenity=hospital],
node|z18-[amenity=doctors], area|z18-[amenity=doctors],
node|z18-[amenity=dentist], area|z18-[amenity=dentist],
node|z18-[amenity=clinic], area|z18-[amenity=clinic],
{
icon-image: hospital-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label;
}
node|z18-[amenity=university], area|z18-[amenity=university] { icon-image: college-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; z-index: 5; }
node|z18-[amenity=cinema], area|z18-[amenity=cinema] { icon-image: cinema-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z18-[amenity=bank], area|z18-[amenity=bank] { z-index: 4500; icon-image: bank-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
@ -179,9 +203,6 @@ node|z18-[sport=gymnastics] { icon-image: pitch-l.svg; text-offset: 8; font-size
node|z16-[highway=speed_camera] { icon-image: speedcam-m.svg; z-index: 7000; }
node|z16[building=hospital], area|z16[building=hospital] { icon-image: hospital-m.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
node|z17-[building=hospital], area|z17-[building=hospital] { icon-image: hospital-l.svg; text-offset: 8; font-size: 10; text: name; text-color: @poi_label; }
/* PARKINGS */
area|z16-[amenity=parking] {fill-color: @parking;fill-oppacity:1;z-index: 0;}

View file

@ -1213,7 +1213,9 @@ node|z17-[tourism=information][office]
icon-image: information-office.svg;
}
area|z17-[barrier=gate],
node|z17-[barrier=gate]
node|z17-[barrier=gate],
area|z17-[barrier=entrance],
node|z17-[barrier=entrance],
{
icon-image: gate.svg;
}

View file

@ -728,3 +728,58 @@ UNIT_TEST(OsmType_Subway)
TEST(params.IsTypeExist(GetType({"railway", "station", "subway", "london"})), (params));
}
}
UNIT_TEST(OsmType_Hospital)
{
{
char const * arr[][2] = {
{ "building", "hospital" },
};
OsmElement e;
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
FeatureParams params;
ftype::GetNameAndType(&e, params);
TEST_EQUAL(params.m_Types.size(), 1, (params));
TEST(params.IsTypeExist(GetType({"building"})), (params));
}
{
char const * arr[][2] = {
{ "building", "yes" },
{ "amenity", "hospital" },
};
OsmElement e;
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
FeatureParams params;
ftype::GetNameAndType(&e, params);
TEST_EQUAL(params.m_Types.size(), 2, (params));
TEST(params.IsTypeExist(GetType({"building"})), (params));
TEST(params.IsTypeExist(GetType({"amenity", "hospital"})), (params));
}
}
UNIT_TEST(OsmType_Entrance)
{
{
char const * arr[][2] = {
{ "building", "entrance" },
{ "barrier", "entrance" },
};
OsmElement e;
FillXmlElement(arr, ARRAY_SIZE(arr), &e);
FeatureParams params;
ftype::GetNameAndType(&e, params);
TEST_EQUAL(params.m_Types.size(), 2, (params));
TEST(params.IsTypeExist(GetType({"entrance"})), (params));
TEST(params.IsTypeExist(GetType({"barrier", "entrance"})), (params));
}
}

View file

@ -302,10 +302,10 @@ namespace ftype
// Next objects trying to find by value first.
ClassifObjectPtr pObj =
ForEachTagEx<ClassifObjectPtr>(p, skipRows, [&](string const & k, string const & v)
ForEachTagEx<ClassifObjectPtr>(p, skipRows, [&current](string const & k, string const & v)
{
if (!NeedMatchValue(k, v))
return ClassifObjectPtr(0, 0);
return ClassifObjectPtr();
return current->BinaryFind(v);
});
@ -389,7 +389,7 @@ namespace ftype
return string();
}
void PreprocessElement(OsmElement * p, FeatureParams & params)
void PreprocessElement(OsmElement * p)
{
bool hasLayer = false;
char const * layer = nullptr;
@ -404,6 +404,9 @@ namespace ftype
{ "layer", "*", [&hasLayer] { hasLayer = true; }},
{ "railway", "subway_entrance", [&isSubwayEntrance] { isSubwayEntrance = true; }},
/// @todo Unfortunatelly, it's not working in many cases (route=subway, transport=subway).
/// Actually, it's better to process subways after feature types assignment.
{ "station", "subway", [&isSubwayStation] { isSubwayStation = true; }},
});
@ -507,7 +510,7 @@ namespace ftype
void GetNameAndType(OsmElement * p, FeatureParams & params)
{
// Stage1: Preprocess tags.
PreprocessElement(p, params);
PreprocessElement(p);
// Stage2: Process feature name on all languages.
ForEachTag<bool>(p, NamesExtractor(params));
@ -518,9 +521,10 @@ namespace ftype
{ "atm", "yes", [](string & k, string & v) { k.swap(v); k = "amenity"; }},
{ "restaurant", "yes", [](string & k, string & v) { k.swap(v); k = "amenity"; }},
{ "hotel", "yes", [](string & k, string & v) { k.swap(v); k = "tourism"; }},
{ "addr:housename", "*", [&params](string & k, string & v) { params.AddHouseName(v); k.clear(); v.clear();}},
{ "addr:street", "*", [&params](string & k, string & v) { params.AddStreetAddress(v); k.clear(); v.clear();}},
{ "addr:flats", "*", [&params](string & k, string & v) { params.flats = v; k.clear(); v.clear();}},
{ "building", "entrance", [](string & k, string & v) { k.swap(v); v = "yes"; }},
{ "addr:housename", "*", [&params](string & k, string & v) { params.AddHouseName(v); k.clear(); v.clear(); }},
{ "addr:street", "*", [&params](string & k, string & v) { params.AddStreetAddress(v); k.clear(); v.clear(); }},
{ "addr:flats", "*", [&params](string & k, string & v) { params.flats = v; k.clear(); v.clear(); }},
{ "addr:housenumber", "*", [&params](string & k, string & v)
{
// Treat "numbers" like names if it's not an actual number.
@ -535,8 +539,7 @@ namespace ftype
uint64_t n;
if (strings::to_uint64(v, n))
params.rank = static_cast<uint8_t>(log(double(n)) / log(1.1));
k.clear();
v.clear();
k.clear(); v.clear();
}},
{ "ref", "*", [&params](string & k, string & v)
{
@ -556,7 +559,7 @@ namespace ftype
}},
});
// Stage4: Match tags to classificator for find feature types.
// Stage4: Match tags in classificator to find feature types.
MatchTypes(p, params);
// Stage5: Postprocess feature types.