MCPcopy Create free account
hub / github.com/comaps/comaps / SetFromFeatureType

Method SetFromFeatureType

libs/indexer/map_object.cpp:24–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22using namespace std;
23
24void 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
62FeatureID const & MapObject::GetID() const
63{

Callers 6

ProcessMethod · 0.45
GetOriginalMapObjectMethod · 0.45
UNIT_TESTFunction · 0.45
FillEditableMapObjectFunction · 0.45
SaveTransactionTestMethod · 0.45
EditFeatureFunction · 0.45

Calls 15

GetCenterFunction · 0.85
ASSERTFunction · 0.85
GetRoadShieldsNamesFunction · 0.85
assign_rangeFunction · 0.85
RemoveIfMethod · 0.80
IsTypeValidMethod · 0.80
GetHouseNumberMethod · 0.80
TypesHolderClass · 0.70
GetNamesMethod · 0.45
EmptyMethod · 0.45
GetMetadataMethod · 0.45

Tested by 3

UNIT_TESTFunction · 0.36
FillEditableMapObjectFunction · 0.36
SaveTransactionTestMethod · 0.36