| 537 | {} |
| 538 | |
| 539 | void ApplyPointFeature::ProcessPointRules(SymbolRuleProto const * symbolRule, CaptionRuleProto const * captionRule, |
| 540 | CaptionRuleProto const * houseNumberRule, m2::PointD const & centerPoint, |
| 541 | ref_ptr<dp::TextureManager> texMng) |
| 542 | { |
| 543 | // TODO: This is only one place of cross-dependency with Editor. |
| 544 | auto const & editor = osm::Editor::Instance(); |
| 545 | auto const featureStatus = editor.GetFeatureStatus(m_f.GetID()); |
| 546 | bool const createdByEditor = featureStatus == FeatureStatus::Created; |
| 547 | bool const obsoleteInEditor = featureStatus == FeatureStatus::Obsolete; |
| 548 | |
| 549 | m2::PointF symbolSize(0.0f, 0.0f); |
| 550 | |
| 551 | if (symbolRule) |
| 552 | { |
| 553 | PoiSymbolViewParams params; |
| 554 | FillCommonParams(params); |
| 555 | if (ftypes::IsUnderBuildingChecker::Instance()(m_f)) |
| 556 | params.m_depthLayer = DepthLayer::OverlayUnderBuildingLayer; |
| 557 | else |
| 558 | params.m_depthLayer = DepthLayer::OverlayLayer; |
| 559 | params.m_depthTestEnabled = false; |
| 560 | params.m_depth = PriorityToDepth(symbolRule->priority(), drule::symbol, 0); |
| 561 | params.m_symbolName = symbolRule->name(); |
| 562 | ASSERT_GREATER_OR_EQUAL(symbolRule->min_distance(), 0, ()); |
| 563 | auto const & vp = df::VisualParams::Instance(); |
| 564 | params.m_extendingSize = |
| 565 | static_cast<uint32_t>(vp.GetVisualScale() * symbolRule->min_distance() * vp.GetPoiExtendScale()); |
| 566 | params.m_posZ = m_posZ; |
| 567 | params.m_hasArea = HasArea(); |
| 568 | params.m_prioritized = createdByEditor; |
| 569 | if (obsoleteInEditor) |
| 570 | params.m_maskColor = kPoiDeletedMaskColor; |
| 571 | |
| 572 | dp::TextureManager::SymbolRegion region; |
| 573 | texMng->GetSymbolRegion(params.m_symbolName, region); |
| 574 | symbolSize = region.GetPixelSize(); |
| 575 | |
| 576 | if (region.IsValid()) |
| 577 | m_insertShape(make_unique_dp<PoiSymbolShape>(centerPoint, params, m_tileKey, 0 /* textIndex */)); |
| 578 | else |
| 579 | LOG(LERROR, ("Style error. Symbol name must be valid for feature", m_f.GetID())); |
| 580 | } |
| 581 | |
| 582 | if (captionRule) |
| 583 | { |
| 584 | TextViewParams params; |
| 585 | CaptionDefProto const * capRule = &captionRule->primary(); |
| 586 | CaptionDefProto const * auxRule = captionRule->has_secondary() ? &captionRule->secondary() : nullptr; |
| 587 | |
| 588 | params.m_titleDecl.m_primaryText = m_captions.GetMainText(); |
| 589 | params.m_titleDecl.m_primaryTextLanguageIndex = m_captions.m_mainTextLanguageIndex; |
| 590 | if (auxRule) |
| 591 | { |
| 592 | params.m_titleDecl.m_secondaryText = m_captions.GetAuxText(); |
| 593 | params.m_titleDecl.m_secondaryTextLanguageIndex = m_captions.m_auxTextLanguageIndex; |
| 594 | } |
| 595 | ASSERT(!params.m_titleDecl.m_primaryText.empty(), ()); |
| 596 |
no test coverage detected