diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index a69e1ce804..3b85a7917d 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -320,9 +320,10 @@ void ApplyPointFeature::Finish() } } -ApplyAreaFeature::ApplyAreaFeature(TInsertShapeFn const & insertShape, FeatureID const & id, float posZ, +ApplyAreaFeature::ApplyAreaFeature(TInsertShapeFn const & insertShape, FeatureID const & id, float minPosZ, float posZ, int minVisibleScale, uint8_t rank, CaptionDescription const & captions) : TBase(insertShape, id, minVisibleScale, rank, captions, posZ) + , m_minPosZ(minPosZ) , m_isBuilding(posZ > 0.0f) {} @@ -438,6 +439,7 @@ void ApplyAreaFeature::ProcessRule(Stylist::TRuleWrapper const & rule) params.m_color = ToDrapeColor(areaRule->color()); params.m_minVisibleScale = m_minVisibleScale; params.m_rank = m_rank; + params.m_minPosZ = m_minPosZ; params.m_posZ = m_posZ; vector edges; diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp index d864331693..8edaa36c86 100644 --- a/drape_frontend/apply_feature_functors.hpp +++ b/drape_frontend/apply_feature_functors.hpp @@ -78,7 +78,7 @@ class ApplyAreaFeature : public ApplyPointFeature using TBase = ApplyPointFeature; public: - ApplyAreaFeature(TInsertShapeFn const & insertShape, FeatureID const & id, float posZ, + ApplyAreaFeature(TInsertShapeFn const & insertShape, FeatureID const & id, float minPosZ, float posZ, int minVisibleScale, uint8_t rank, CaptionDescription const & captions); using TBase::operator (); @@ -100,6 +100,7 @@ private: unordered_map m_indices; vector> m_edges; + float const m_minPosZ; bool const m_isBuilding; }; diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp index 9d6695ee02..2599ed4f2c 100644 --- a/drape_frontend/area_shape.cpp +++ b/drape_frontend/area_shape.cpp @@ -37,16 +37,16 @@ void AreaShape::Draw(ref_ptr batcher, ref_ptr t for (auto const & edge : m_buildingEdges) { glsl::vec3 normal(glsl::ToVec2(edge.m_normal), 0.0f); - vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_startVertex), 0.0f), + vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_startVertex), -m_params.m_minPosZ), normal, colorPoint)); - vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_endVertex), 0.0f), + vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_endVertex), -m_params.m_minPosZ), normal, colorPoint)); vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_startVertex), -m_params.m_posZ), normal, colorPoint)); vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_startVertex), -m_params.m_posZ), normal, colorPoint)); - vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_endVertex), 0.0f), + vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_endVertex), -m_params.m_minPosZ), normal, colorPoint)); vertexes.push_back(gpu::Area3dVertex(glsl::vec3(glsl::ToVec2(edge.m_endVertex), -m_params.m_posZ), normal, colorPoint)); diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 21ca696732..b973eeeecb 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -137,25 +137,35 @@ void RuleDrawer::operator()(FeatureType const & f) bool const is3dBuilding = m_is3dBuidings ? (ftypes::IsBuildingChecker::Instance()(f) && f.GetLayer() >= 0) : false; float areaHeight = 0.0f; + float areaMinHeight = 0.0f; if (is3dBuilding) { f.ParseMetadata(); feature::Metadata const & md = f.GetMetadata(); - string const & height = md.Get(feature::Metadata::FMD_HEIGHT); + string value = md.Get(feature::Metadata::FMD_HEIGHT); double const kDefaultHeightInMeters = 0.0; double heightInMeters = kDefaultHeightInMeters; - if (!height.empty()) - strings::to_double(height, heightInMeters); + if (!value.empty()) + strings::to_double(value, heightInMeters); + + value = md.Get(feature::Metadata::FMD_MIN_HEIGHT); + double minHeigthInMeters = 0.0; + if (!value.empty()) + strings::to_double(value, minHeigthInMeters); m2::PointD const pt = feature::GetCenter(f, zoomLevel); - m2::RectD const rectMercator = MercatorBounds::MetresToXY(MercatorBounds::XToLon(pt.x), - MercatorBounds::YToLat(pt.y), - heightInMeters); + double const lon = MercatorBounds::XToLon(pt.x); + double const lat = MercatorBounds::YToLat(pt.y); + + m2::RectD rectMercator = MercatorBounds::MetresToXY(lon, lat, heightInMeters); areaHeight = m2::PointD(rectMercator.SizeX(), rectMercator.SizeY()).Length(); + + rectMercator = MercatorBounds::MetresToXY(lon, lat, minHeigthInMeters); + areaMinHeight = m2::PointD(rectMercator.SizeX(), rectMercator.SizeY()).Length(); } - ApplyAreaFeature apply(insertShape, f.GetID(), areaHeight, + ApplyAreaFeature apply(insertShape, f.GetID(), areaMinHeight, areaHeight, minVisibleScale, f.GetRank(), s.GetCaptionDescription()); f.ForEachTriangleRef(apply, zoomLevel); diff --git a/drape_frontend/shape_view_params.hpp b/drape_frontend/shape_view_params.hpp index 8c855196ef..6a7e857d6a 100644 --- a/drape_frontend/shape_view_params.hpp +++ b/drape_frontend/shape_view_params.hpp @@ -41,6 +41,7 @@ struct CircleViewParams : CommonViewParams struct AreaViewParams : CommonViewParams { dp::Color m_color; + float m_minPosZ; float m_posZ; }; diff --git a/indexer/ftypes_matcher.cpp b/indexer/ftypes_matcher.cpp index 2f65c2fc6c..65c6a150a9 100644 --- a/indexer/ftypes_matcher.cpp +++ b/indexer/ftypes_matcher.cpp @@ -172,6 +172,7 @@ IsBuildingChecker::IsBuildingChecker() Classificator const & c = classif(); m_types.push_back(c.GetTypeByPath({ "building" })); + m_types.push_back(c.GetTypeByPath({ "building:part" })); m_types.push_back(c.GetTypeByPath({ "building", "address" })); }