From be773015f6f829b840d229bb85cc0d8809aa36f6 Mon Sep 17 00:00:00 2001 From: tatiana-yan Date: Wed, 20 Feb 2019 13:21:15 +0300 Subject: [PATCH] [indexer] Store geometry in MapObject. --- indexer/map_object.cpp | 12 ++++++++++++ indexer/map_object.hpp | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index bc21e6ee60..7476087f57 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -77,6 +77,17 @@ void MapObject::SetFromFeatureType(FeatureType & ft) m_featureID = ft.GetID(); ASSERT(m_featureID.IsValid(), ()); m_geomType = ft.GetFeatureType(); + if (m_geomType == feature::GEOM_AREA) + { + m_triangles = ft.GetTriangesAsPoints(FeatureType::BEST_GEOMETRY); + } + else if (m_geomType == feature::GEOM_LINE) + { + ft.ParseGeometry(FeatureType::BEST_GEOMETRY); + m_points.reserve(ft.GetPointsCount()); + ft.ForEachPoint([this](m2::PointD const & p) { m_points.push_back(p); }, + FeatureType::BEST_GEOMETRY); + } SetInetIfNeeded(ft, m_metadata); } @@ -84,6 +95,7 @@ void MapObject::SetFromFeatureType(FeatureType & ft) FeatureID const & MapObject::GetID() const { return m_featureID; } ms::LatLon MapObject::GetLatLon() const { return MercatorBounds::ToLatLon(m_mercator); } m2::PointD const & MapObject::GetMercator() const { return m_mercator; } +vector const & MapObject::GetTriangesAsPoints() const { return m_triangles; } feature::TypesHolder const & MapObject::GetTypes() const { return m_types; } string MapObject::GetDefaultName() const diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp index 92fba24246..6f8de6ab36 100644 --- a/indexer/map_object.hpp +++ b/indexer/map_object.hpp @@ -60,6 +60,7 @@ public: ms::LatLon GetLatLon() const; m2::PointD const & GetMercator() const; + std::vector const & GetTriangesAsPoints() const; feature::TypesHolder const & GetTypes() const; std::string GetDefaultName() const; @@ -107,6 +108,10 @@ protected: FeatureID m_featureID; m2::PointD m_mercator; + + std::vector m_points; + std::vector m_triangles; + StringUtf8Multilang m_name; feature::TypesHolder m_types; feature::Metadata m_metadata;