MCPcopy Create free account
hub / github.com/comaps/comaps / PriorityToDepth

Method PriorityToDepth

libs/drape_frontend/apply_feature_functors.cpp:493–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493double BaseApplyFeature::PriorityToDepth(int priority, drule::TypeT ruleType, double areaDepth) const
494{
495 double depth = priority;
496
497 if (ruleType == drule::area || ruleType == drule::line)
498 {
499 if (depth < drule::kBasePriorityBgTop)
500 {
501 ASSERT(ruleType == drule::area, (m_f.DebugString()));
502 ASSERT_GREATER_OR_EQUAL(depth, drule::kBasePriorityBgBySize, (m_f.DebugString()));
503 // Prioritize BG-by-size areas by their bbox sizes instead of style-set priorities.
504 ASSERT_GREATER_OR_EQUAL(areaDepth, drule::kBaseDepthBgBySize, (m_f.DebugString()));
505 depth = areaDepth;
506 }
507 else if (depth < drule::kBasePriorityFg)
508 {
509 // Adjust BG-top features depth range so that it sits just above the BG-by-size range.
510 depth = drule::kBaseDepthBgTop + (depth - drule::kBasePriorityBgTop) * drule::kBgTopRangeFraction;
511 }
512
513 // Shift the depth according to layer=* value.
514 int8_t const layer = m_f.GetLayer();
515 if (layer != feature::LAYER_EMPTY)
516 depth += layer * drule::kLayerPriorityRange;
517 }
518 else
519 {
520 // Note we don't adjust priorities of "point-styles" according to layer=*,
521 // because their priorities are used for displacement logic only.
522 /// @todo(pastk) we might want to hide e.g. a trash bin under man_made=bridge or a bench on underground railway
523 /// station?
524
525 // Check overlays priorities range.
526 ASSERT(-drule::kOverlaysMaxPriority <= depth && depth < drule::kOverlaysMaxPriority, (depth, m_f.DebugString()));
527 }
528
529 // Check no features are clipped by the depth range constraints.
530 ASSERT(dp::kMinDepth <= depth && depth <= dp::kMaxDepth, (depth, m_f.DebugString()));
531 return depth;
532}
533
534ApplyPointFeature::ApplyPointFeature(TileKey const & tileKey, TInsertShapeFn const & insertShape, FeatureType & f,
535 CaptionDescription const & captions)

Callers

nothing calls this directly

Calls 3

ASSERTFunction · 0.85
DebugStringMethod · 0.45
GetLayerMethod · 0.45

Tested by

no test coverage detected