diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp index 3c6231b6bd..2797f0c135 100644 --- a/drape_frontend/apply_feature_functors.cpp +++ b/drape_frontend/apply_feature_functors.cpp @@ -403,10 +403,10 @@ double BaseApplyFeature::PriorityToDepth(int priority, drule::rule_type_t ruleTy { if (depth < drule::kBasePriorityBgTop) { - ASSERT(ruleType == drule::area, (m_f.GetID())); - ASSERT_GREATER_OR_EQUAL(depth, drule::kBasePriorityBgBySize, (m_f.GetID())); + ASSERT(ruleType == drule::area, (m_f.DebugString())); + ASSERT_GREATER_OR_EQUAL(depth, drule::kBasePriorityBgBySize, (m_f.DebugString())); // Prioritize BG-by-size areas by their bbox sizes instead of style-set priorities. - ASSERT_GREATER_OR_EQUAL(areaDepth, drule::kBaseDepthBgBySize, (m_f.GetID())); + ASSERT_GREATER_OR_EQUAL(areaDepth, drule::kBaseDepthBgBySize, (m_f.DebugString())); depth = areaDepth; } else if (depth < drule::kBasePriorityFg) @@ -427,11 +427,11 @@ double BaseApplyFeature::PriorityToDepth(int priority, drule::rule_type_t ruleTy /// @todo(pastk) we might want to hide e.g. a trash bin under man_made=bridge or a bench on underground railway station? // Check overlays priorities range. - ASSERT(-drule::kOverlaysMaxPriority <= depth && depth < drule::kOverlaysMaxPriority, (depth, m_f.GetID())); + ASSERT(-drule::kOverlaysMaxPriority <= depth && depth < drule::kOverlaysMaxPriority, (depth, m_f.DebugString())); } // Check no features are clipped by the depth range constraints. - ASSERT(dp::kMinDepth <= depth && depth <= dp::kMaxDepth, (depth, m_f.GetID(), m_f.GetLayer())); + ASSERT(dp::kMinDepth <= depth && depth <= dp::kMaxDepth, (depth, m_f.DebugString())); return depth; } @@ -497,7 +497,7 @@ void ApplyPointFeature::ProcessPointRules(SymbolRuleProto const * symbolRule, Ca params.m_createdByEditor = createdByEditor; ASSERT(!(symbolRule && params.m_titleDecl.m_anchor == dp::Anchor::Center), - ("A `text-offset: *` is not set in styles.", m_f.GetID(), m_f.DebugString(m_tileKey.m_zoomLevel, true))); + ("A `text-offset: *` is not set in styles.", m_f.GetID(), m_f.DebugString())); if (houseNumberRule && params.m_titleDecl.m_anchor == dp::Anchor::Center) params.m_titleDecl.m_anchor = GetAnchor(0, 1); @@ -568,7 +568,7 @@ void ApplyAreaFeature::operator()(m2::PointD const & p1, m2::PointD const & p2, double const crossProduct = m2::CrossProduct(v1.Normalize(), v2.Normalize()); double constexpr kEps = 1e-7; - // ASSERT_GREATER_OR_EQUAL(fabs(crossProduct), kEps, (fabs(crossProduct), p1, p2, p3, m_f.DebugString(19, true))); + // ASSERT_GREATER_OR_EQUAL(fabs(crossProduct), kEps, (fabs(crossProduct), p1, p2, p3, m_f.DebugString())); // TODO(pastk) : e.g. a landuse-meadow has a following triangle with two identical points: // m2::Point(8.5829683287662987823, 53.929641499591184584) // m2::Point(8.5830675705005887721, 53.930025055483156393) @@ -727,7 +727,7 @@ void ApplyAreaFeature::ProcessAreaRules(AreaRuleProto const * areaRule, AreaRule if (hatchingRule) { - ASSERT_GREATER_OR_EQUAL(hatchingRule->priority(), drule::kBasePriorityFg, ()); + ASSERT_GREATER_OR_EQUAL(hatchingRule->priority(), drule::kBasePriorityFg, (m_f.DebugString())); ProcessRule(*hatchingRule, areaDepth, true); } diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 2bcb6c48a7..1663d408dd 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -431,8 +431,8 @@ void RuleDrawer::operator()(FeatureType & f) bool const hasArea = s.m_areaRule || s.m_hatchingRule; ASSERT(!((hasLine || hasLineAdd) && (hasPoint || hasArea)), - ("Line drules mixed with point/area ones", f.DebugString(m_zoomLevel, true))); - ASSERT(!hasLineAdd || hasLine, ("Pathtext/shield without a line drule", f.DebugString(m_zoomLevel, true))); + ("Line drules mixed with point/area ones", f.DebugString())); + ASSERT(!hasLineAdd || hasLine, ("Pathtext/shield without a line drule", f.DebugString())); #endif // FeatureType::GetLimitRect call invokes full geometry reading and decoding. diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp index b3c6d89a9e..b13eb6742e 100644 --- a/drape_frontend/stylist.cpp +++ b/drape_frontend/stylist.cpp @@ -100,40 +100,40 @@ void Stylist::ProcessKey(FeatureType & f, drule::Key const & key) case drule::symbol: ASSERT(dRule->GetSymbol() && !m_symbolRule && (geomType == GeomType::Point || geomType == GeomType::Area), - (m_symbolRule == nullptr, geomType, f.DebugString(19, true))); + (m_symbolRule == nullptr, geomType, f.DebugString())); m_symbolRule = dRule->GetSymbol(); break; case drule::caption: ASSERT(dRule->GetCaption() && dRule->GetCaption()->has_primary() && !m_captionRule && (geomType == GeomType::Point || geomType == GeomType::Area), - (m_captionRule == nullptr, f.DebugString(19, true))); + (m_captionRule == nullptr, f.DebugString())); m_captionRule = dRule->GetCaption(); break; case drule::pathtext: ASSERT(dRule->GetPathtext() && dRule->GetPathtext()->has_primary() && !m_pathtextRule && geomType == GeomType::Line, - (m_pathtextRule == nullptr, geomType, f.DebugString(19, true))); + (m_pathtextRule == nullptr, geomType, f.DebugString())); m_pathtextRule = dRule->GetPathtext(); break; case drule::shield: ASSERT(dRule->GetShield() && !m_shieldRule && geomType == GeomType::Line, - (m_shieldRule == nullptr, geomType, f.DebugString(19, true))); + (m_shieldRule == nullptr, geomType, f.DebugString())); m_shieldRule = dRule->GetShield(); break; case drule::line: - ASSERT(dRule->GetLine() && geomType == GeomType::Line, (geomType, f.DebugString(19, true))); + ASSERT(dRule->GetLine() && geomType == GeomType::Line, (geomType, f.DebugString())); m_lineRules.push_back(dRule->GetLine()); break; case drule::area: - ASSERT(dRule->GetArea() && geomType == GeomType::Area, (geomType, f.DebugString(19, true))); + ASSERT(dRule->GetArea() && geomType == GeomType::Area, (geomType, f.DebugString())); if (key.m_hatching) { - ASSERT(!m_hatchingRule, (f.DebugString(19, true))); + ASSERT(!m_hatchingRule, (f.DebugString())); m_hatchingRule = dRule->GetArea(); } else { - ASSERT(!m_areaRule, (f.DebugString(19, true))); + ASSERT(!m_areaRule, (f.DebugString())); m_areaRule = dRule->GetArea(); } break; @@ -141,7 +141,7 @@ void Stylist::ProcessKey(FeatureType & f, drule::Key const & key) case drule::circle: case drule::waymarker: default: - ASSERT(false, (key.m_type, f.DebugString(19, true))); + ASSERT(false, (key.m_type, f.DebugString())); return; } } diff --git a/indexer/feature.cpp b/indexer/feature.cpp index 5f6b959c1d..556bb3cd5a 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -650,29 +650,12 @@ StringUtf8Multilang const & FeatureType::GetNames() return m_params.name; } -string FeatureType::DebugString(int scale, bool includeKeyPoint) +std::string FeatureType::DebugString(int scale) { - ParseCommon(); - - Classificator const & c = classif(); - - string res = "Types"; - uint32_t const count = GetTypesCount(); - for (size_t i = 0; i < count; ++i) - res += (" : " + c.GetReadableObjectName(m_types[i])); - res += "\n"; - - auto const paramsStr = m_params.DebugString(); - if (!paramsStr.empty()) - { - res += paramsStr; - res += "\n"; - } - - if (!includeKeyPoint) - return res; - ParseGeometryAndTriangles(scale); + + string res = DebugPrint(m_id) + " " + DebugPrint(GetGeomType()); + m2::PointD keyPoint; switch (GetGeomType()) { @@ -682,14 +665,13 @@ string FeatureType::DebugString(int scale, bool includeKeyPoint) case GeomType::Line: if (m_points.empty()) - return res; + break; keyPoint = m_points.front(); break; case GeomType::Area: if (m_triangles.empty()) - return res; - + break; ASSERT_GREATER(m_triangles.size(), 2, ()); keyPoint = (m_triangles[0] + m_triangles[1] + m_triangles[2]) / 3.0; break; @@ -698,9 +680,21 @@ string FeatureType::DebugString(int scale, bool includeKeyPoint) ASSERT(false, ()); break; } - // Print coordinates in (lat,lon) for better investigation capabilities. - res += "Key point: " + DebugPrint(keyPoint) + "; " + DebugPrint(mercator::ToLatLon(keyPoint)); + res += ": " + DebugPrint(keyPoint) + "; " + DebugPrint(mercator::ToLatLon(keyPoint)) + "\n"; + + Classificator const & c = classif(); + + res += "Types"; + uint32_t const count = GetTypesCount(); + for (size_t i = 0; i < count; ++i) + res += (" : " + c.GetReadableObjectName(m_types[i])); + res += "\n"; + + auto const paramsStr = m_params.DebugString(); + if (!paramsStr.empty()) + res += paramsStr + "\n"; + return res; } diff --git a/indexer/feature.hpp b/indexer/feature.hpp index e55a278096..f8f0f1a8fc 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -142,7 +142,8 @@ public: } //@} - std::string DebugString(int scale, bool includeKeyPoint = true); + // No DebugPrint(f) as it requires its parameter to be const, but a feature is lazy loaded. + std::string DebugString(int scale = FeatureType::BEST_GEOMETRY); std::string const & GetHouseNumber(); diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 97c0b7bb26..b5910541ea 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -263,6 +263,7 @@ string FeatureParamsBase::DebugString() const { string const utf8name = DebugPrint(name); return ((!utf8name.empty() ? "Name:" + utf8name : "") + + (layer != LAYER_EMPTY ? " Layer:" + DebugPrint(layer) : "") + (rank != 0 ? " Rank:" + DebugPrint(rank) : "") + (!house.IsEmpty() ? " House:" + house.Get() : "") + (!ref.empty() ? " Ref:" + ref : ""));