review fixes

This commit is contained in:
Konstantin Pastbin 2023-10-10 12:36:38 +03:00
parent 214aa559a9
commit de0ad7f755
7 changed files with 27 additions and 27 deletions

View file

@ -222,7 +222,7 @@ std::string GetRoadShieldSymbolName(ftypes::RoadShield const & shield, double fo
result = shield.m_name.size() <= 2 ? "shield-us-hw-thin" : "shield-us-hw-wide";
else
{
ASSERT(false, ());
ASSERT(false, ("This shield type doesn't support symbols:", shield.m_type));
}
if (fontScale > 1.0)
@ -366,8 +366,8 @@ void BaseApplyFeature::FillCommonParams(CommonOverlayViewParams & p) const
}
void ApplyPointFeature::ExtractCaptionParams(CaptionDefProto const * primaryProto,
CaptionDefProto const * secondaryProto,
TextViewParams & params) const
CaptionDefProto const * secondaryProto,
TextViewParams & params) const
{
FillCommonParams(params);
params.m_depthLayer = DepthLayer::OverlayLayer;
@ -380,7 +380,7 @@ void ApplyPointFeature::ExtractCaptionParams(CaptionDefProto const * primaryProt
CaptionDefProtoToFontDecl(primaryProto, decl);
titleDecl.m_primaryTextFont = decl;
titleDecl.m_anchor = GetAnchor(primaryProto->offset_x(), primaryProto->offset_y());
// TODO: remove offsets processing as de-facto "text-offset: *" is used to define anchors only.
// TODO(pastk) : remove offsets processing as de-facto "text-offset: *" is used to define anchors only.
titleDecl.m_primaryOffset = GetOffset(primaryProto->offset_x(), primaryProto->offset_y());
titleDecl.m_primaryOptional = primaryProto->is_optional();
@ -424,7 +424,7 @@ double BaseApplyFeature::PriorityToDepth(int priority, drule::rule_type_t ruleTy
{
// Note we don't adjust priorities of "point-styles" according to layer=*,
// because their priorities are used for displacement logic only.
/// @todo we might want to hide e.g. a trash bin under man_made=bridge or a bench on underground railway station?
/// @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()));
@ -564,7 +564,7 @@ void ApplyAreaFeature::operator()(m2::PointD const & p1, m2::PointD const & p2,
m2::PointD const v1 = p2 - p1;
m2::PointD const v2 = p3 - p1;
//TODO : degenerate triangles filtering should be done in the generator.
//TODO(pastk) : degenerate triangles filtering should be done in the generator.
// ASSERT(!v1.IsAlmostZero() && !v2.IsAlmostZero(), ());
if (v1.IsAlmostZero() || v2.IsAlmostZero())
return;
@ -572,7 +572,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)));
// TODO : e.g. a landuse-meadow has a following triangle with two identical points:
// TODO(pastk) : e.g. a landuse-meadow has a following triangle with two identical points:
// m2::Point<d>(8.5829683287662987823, 53.929641499591184584)
// m2::Point<d>(8.5830675705005887721, 53.930025055483156393)
// m2::Point<d>(8.5830675705005887721, 53.930025055483156393)
@ -597,7 +597,7 @@ void ApplyAreaFeature::ProcessBuildingPolygon(m2::PointD const & p1, m2::PointD
{
// For building we must filter degenerate polygons because now we have to reconstruct
// building outline by bunch of polygons.
// TODO : filter degenerates in the generator.(see a TODO above).
// TODO(pastk) : filter degenerates in the generator.(see a TODO above).
m2::PointD const v1 = p2 - p1;
m2::PointD const v2 = p3 - p1;
if (v1.IsAlmostZero() || v2.IsAlmostZero())
@ -636,7 +636,7 @@ int ApplyAreaFeature::GetIndex(m2::PointD const & pt)
{
for (size_t i = 0; i < m_points.size(); i++)
{
// TODO : should be possible to use exact match.
// TODO(pastk) : should be possible to use exact match.
if (pt.EqualDxDy(m_points[i], mercator::kPointEqualityEps))
return static_cast<int>(i);
}
@ -672,7 +672,7 @@ m2::PointD ApplyAreaFeature::CalculateNormal(m2::PointD const & p1, m2::PointD c
void ApplyAreaFeature::BuildEdges(int vertexIndex1, int vertexIndex2, int vertexIndex3, bool twoSide)
{
// Check if triangle is degenerate.
// TODO : filter degenerates in the generator.
// TODO(pastk) : filter degenerates in the generator.
if (vertexIndex1 == vertexIndex2 || vertexIndex2 == vertexIndex3 || vertexIndex1 == vertexIndex3)
return;
@ -779,7 +779,7 @@ ApplyLineFeatureGeometry::ApplyLineFeatureGeometry(TileKey const & tileKey, TIns
FeatureType & f, double currentScaleGtoP)
: TBase(tileKey, insertShape, f, CaptionDescription())
, m_currentScaleGtoP(currentScaleGtoP)
// TODO: calculate just once in the RuleDrawer.
// TODO(pastk) : calculate just once in the RuleDrawer.
, m_minSegmentSqrLength(base::Pow2(4.0 * df::VisualParams::Instance().GetVisualScale() / currentScaleGtoP))
, m_simplify(tileKey.m_zoomLevel >= 10 && tileKey.m_zoomLevel <= 12)
{
@ -821,7 +821,7 @@ void ApplyLineFeatureGeometry::ProcessLineRules(Stylist::LineRulesT const & line
if (!ftypes::IsIsolineChecker::Instance()(m_f))
{
// A line crossing the tile several times will be split in several parts.
// TODO : use feature's pre-calculated limitRect when possible.
// TODO(pastk) : use feature's pre-calculated limitRect when possible.
m_clippedSplines = m2::ClipSplineByRect(m_tileRect, m_spline);
}
else

View file

@ -446,7 +446,7 @@ void RuleDrawer::operator()(FeatureType & f)
size_t const index = shape->GetType();
ASSERT_LESS(index, m_mapShapes.size(), ());
// TODO: MinZoom was used for optimization in RenderGroup::UpdateCanBeDeletedStatus(), but is long time broken.
// TODO(pastk) : MinZoom was used for optimization in RenderGroup::UpdateCanBeDeletedStatus(), but is long time broken.
// See https://github.com/organicmaps/organicmaps/pull/5903 for details.
shape->SetFeatureMinZoom(0);
m_mapShapes[index].push_back(std::move(shape));

View file

@ -74,7 +74,7 @@ struct AreaViewParams : CommonViewParams
float m_posZ = 0.0f;
bool m_is3D = false;
bool m_hatching = false;
double m_baseGtoPScale = 1.0f;
double m_baseGtoPScale = 1.0;
};
struct LineViewParams : CommonViewParams
@ -85,7 +85,7 @@ struct LineViewParams : CommonViewParams
dp::LineCap m_cap;
dp::LineJoin m_join;
dp::PenPatternT m_pattern;
double m_baseGtoPScale = 1.0f;
double m_baseGtoPScale = 1.0;
int m_zoomLevel = -1;
};
@ -105,7 +105,7 @@ struct PathTextViewParams : CommonOverlayViewParams
dp::FontDecl m_textFont;
std::string m_mainText;
std::string m_auxText;
double m_baseGtoPScale = 1.0f;
double m_baseGtoPScale = 1.0;
};
struct PathSymbolViewParams : CommonViewParams
@ -113,7 +113,7 @@ struct PathSymbolViewParams : CommonViewParams
std::string m_symbolName;
float m_offset = 0.0f;
float m_step = 0.0f;
double m_baseGtoPScale = 1.0f;
double m_baseGtoPScale = 1.0;
};
struct ColoredSymbolViewParams : CommonOverlayViewParams

View file

@ -45,7 +45,7 @@ void CaptionDescription::Init(FeatureType & f, int8_t deviceLang, int zoomLevel,
feature::GeomType geomType, bool auxCaptionExists)
{
feature::NameParamsOut out;
// TODO: remove forced secondary text for all lines and set it via styles for major roads and rivers only.
// TODO(pastk) : remove forced secondary text for all lines and set it via styles for major roads and rivers only.
// ATM even minor paths/streams/etc use secondary which makes their pathtexts take much more space.
if (zoomLevel > scales::GetUpperWorldScale() && (auxCaptionExists || geomType == feature::GeomType::Line))
{
@ -75,13 +75,13 @@ void CaptionDescription::Init(FeatureType & f, int8_t deviceLang, int zoomLevel,
if (m_mainText.size() > kMaxTextSize)
m_mainText = m_mainText.substr(0, kMaxTextSize) + "...";
// TODO : its better to determine housenumbers minZoom once upon drules load and cache it,
// TODO(pastk) : its better to determine housenumbers minZoom once upon drules load and cache it,
// but it'd mean a lot of housenumbers-specific logic in otherwise generic RulesHolder..
uint8_t constexpr kHousenumbersMinZoom = 16;
if (geomType != feature::GeomType::Line && zoomLevel >= kHousenumbersMinZoom &&
(auxCaptionExists || m_mainText.empty()))
{
// TODO: its not obvious that a housenumber display is dependent on a secondary caption drule existance in styles.
// TODO(pastk) : its not obvious that a housenumber display is dependent on a secondary caption drule existance in styles.
m_houseNumberText = f.GetHouseNumber();
if (!m_houseNumberText.empty() && !m_mainText.empty() && m_houseNumberText.find(m_mainText) != std::string::npos)
m_mainText.clear();
@ -137,7 +137,7 @@ void Stylist::ProcessKey(FeatureType & f, drule::Key const & key)
m_areaRule = dRule->GetArea();
}
break;
// TODO : check if circle/waymarker support exists still (not used in styles ATM).
// TODO(pastk) : check if circle/waymarker support exists still (not used in styles ATM).
case drule::circle:
case drule::waymarker:
default:

View file

@ -73,9 +73,9 @@ private:
GlyphVisualParams m_glyphVisualParams;
uint32_t m_tileSize = 0;
double m_visualScale = 0.0f;
double m_poiExtendScale = 0.1f; // Found empirically.
std::atomic<double> m_fontScale = 1.0f;
double m_visualScale = 0.0;
double m_poiExtendScale = 0.1; // Found empirically.
std::atomic<double> m_fontScale = 1.0;
DISALLOW_COPY_AND_MOVE(VisualParams);
};

View file

@ -147,7 +147,7 @@ namespace
explicit Line(LineRuleProto const & r)
: m_line(r)
{
CHECK(r.has_pathsym() || r.width() > 0, ("Zero width line w/o path symbol)")); //pastk
ASSERT(r.has_pathsym() || r.width() > 0, ("Zero width line w/o path symbol)"));
}
virtual LineRuleProto const * GetLine() const { return &m_line; }
@ -178,7 +178,7 @@ namespace
explicit Caption(CaptionRuleProto const & r)
: m_caption(r)
{
CHECK(r.has_primary(),()); //pastk
ASSERT(r.has_primary(),());
}
virtual CaptionRuleProto const * GetCaption() const { return &m_caption; }

View file

@ -165,7 +165,7 @@ void ReadTransitTask::Do()
if (featureInfo.m_isGate)
{
//TODO: there should be a simpler way to just get a symbol name.
//TODO(pastk): there should be a simpler way to just get a symbol name.
df::Stylist stylist(ft, 19, 0);
if (stylist.m_symbolRule != nullptr)
featureInfo.m_gateSymbolName = stylist.m_symbolRule->name();