diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp index 9f01c3f77d..b2214933fe 100644 --- a/indexer/editable_map_object.cpp +++ b/indexer/editable_map_object.cpp @@ -181,5 +181,5 @@ void EditableMapObject::SetOpeningHours(string const & openingHours) m_metadata.Set(feature::Metadata::FMD_OPEN_HOURS, openingHours); } -//feature::Metadata const & EditableMapObject::GetMetadata() const { return m_metadata; } +void EditableMapObject::SetPointType() { m_geomType = feature::EGeomType::GEOM_POINT; } } // namespace osm diff --git a/indexer/editable_map_object.hpp b/indexer/editable_map_object.hpp index d5bdc92a14..3331097e7c 100644 --- a/indexer/editable_map_object.hpp +++ b/indexer/editable_map_object.hpp @@ -90,6 +90,9 @@ public: void SetRawOSMCuisines(string const & cuisine); void SetOpeningHours(string const & openingHours); + /// Special mark that it's a point feature, not area or line. + void SetPointType(); + private: string m_houseNumber; string m_street; diff --git a/indexer/feature.cpp b/indexer/feature.cpp index c6f3ca66a0..fdaffe5d2d 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -68,16 +68,20 @@ void FeatureType::ApplyPatch(editor::XMLFeature const & xml) void FeatureType::ReplaceBy(osm::EditableMapObject const & emo) { - uint8_t geoType = Header() & HEADER_GEOTYPE_MASK; - // Patching new, not initialized feature. - if (!m_bCommonParsed || feature::GEOM_POINT == GetFeatureType()) + uint8_t geoType; + if (emo.IsPointType()) { + // We are here for existing point features and for newly created point features. m_center = emo.GetMercator(); m_limitRect.MakeEmpty(); m_limitRect.Add(m_center); m_bPointsParsed = m_bTrianglesParsed = true; geoType = feature::GEOM_POINT; } + else + { + geoType = Header() & HEADER_GEOTYPE_MASK; + } m_params.name = emo.GetName(); string const & house = emo.GetHouseNumber(); diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index a84bad7526..9d956ab7f2 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -64,6 +64,7 @@ void MapObject::SetFromFeatureType(FeatureType const & ft) m_metadata = ft.GetMetadata(); m_featureID = ft.GetID(); ASSERT(m_featureID.IsValid(), ()); + m_geomType = ft.GetFeatureType(); } FeatureID const & MapObject::GetID() const { return m_featureID; } @@ -175,4 +176,5 @@ string MapObject::GetBuildingLevels() const } feature::Metadata const & MapObject::GetMetadata() const { return m_metadata; } +bool MapObject::IsPointType() const { return m_geomType == feature::EGeomType::GEOM_POINT; } } // namespace osm diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp index 21d64530ae..1cb6ef933e 100644 --- a/indexer/map_object.hpp +++ b/indexer/map_object.hpp @@ -91,12 +91,16 @@ public: // TODO: Remove this method. feature::Metadata const & GetMetadata() const; + bool IsPointType() const; + protected: FeatureID m_featureID; m2::PointD m_mercator; StringUtf8Multilang m_name; feature::TypesHolder m_types; feature::Metadata m_metadata; + + feature::EGeomType m_geomType = feature::EGeomType::GEOM_UNDEFINED; }; /// Helper to convert internal feature::Metadata::FMD_* enum into a users-visible one. diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index f84acf853e..f92996e297 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -368,8 +368,9 @@ Editor::SaveResult Editor::SaveEditedFeature(EditableMapObject const & emo) { FeatureID const & fid = emo.GetID(); FeatureTypeInfo fti; + bool const isCreated = IsCreatedFeature(fid); fti.m_feature.ReplaceBy(emo); - if (IsCreatedFeature(fid)) + if (isCreated) { fti.m_status = FeatureStatus::Created; } @@ -759,6 +760,8 @@ bool Editor::CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::Mwm outFeature.SetID(GenerateNewFeatureId(id)); outFeature.SetType(type); outFeature.SetEditableProperties(GetEditablePropertiesForTypes(outFeature.GetTypes())); + // Only point type features can be created at the moment. + outFeature.SetPointType(); return true; }