| 22 | using namespace std; |
| 23 | |
| 24 | void MapObject::SetFromFeatureType(FeatureType & ft) |
| 25 | { |
| 26 | m_mercator = feature::GetCenter(ft); |
| 27 | m_name = ft.GetNames(); |
| 28 | |
| 29 | Classificator const & cl = classif(); |
| 30 | m_types = feature::TypesHolder(ft); |
| 31 | m_types.RemoveIf([&cl](uint32_t t) { return !cl.IsTypeValid(t); }); |
| 32 | // Actually, we can't select object on map with invalid (non-drawable or deprecated) type. |
| 33 | // TODO: in android prod a user will see an "empty" PP if a spot is selected in old mwm |
| 34 | // where a deprecated feature was; and could crash if play with routing to it, bookmarking it.. |
| 35 | // A desktop/qt prod segfaults when trying to select such spots. |
| 36 | ASSERT(!m_types.Empty(), ()); |
| 37 | |
| 38 | m_metadata = ft.GetMetadata(); |
| 39 | m_houseNumber = ft.GetHouseNumber(); |
| 40 | m_roadShields = ftypes::GetRoadShieldsNames(ft); |
| 41 | m_featureID = ft.GetID(); |
| 42 | m_geomType = ft.GetGeomType(); |
| 43 | m_layer = ft.GetLayer(); |
| 44 | |
| 45 | // TODO: BEST_GEOMETRY is likely needed for some special cases only, |
| 46 | // i.e. matching an edited OSM feature, in other cases like opening |
| 47 | // a place page WORST_GEOMETRY is going to be enough? |
| 48 | if (m_geomType == feature::GeomType::Area) |
| 49 | assign_range(m_triangles, ft.GetTrianglesAsPoints(FeatureType::BEST_GEOMETRY)); |
| 50 | else if (m_geomType == feature::GeomType::Line) |
| 51 | assign_range(m_points, ft.GetPoints(FeatureType::BEST_GEOMETRY)); |
| 52 | |
| 53 | // Fill runtime metadata |
| 54 | m_metadata.Set(feature::Metadata::EType::FMD_WHEELCHAIR, feature::GetReadableWheelchairType(m_types)); |
| 55 | |
| 56 | #ifdef DEBUG |
| 57 | if (ftypes::IsWifiChecker::Instance()(ft)) |
| 58 | ASSERT(m_metadata.Has(MetadataID::FMD_INTERNET), ()); |
| 59 | #endif |
| 60 | } |
| 61 | |
| 62 | FeatureID const & MapObject::GetID() const |
| 63 | { |