| 691 | } |
| 692 | |
| 693 | void Processor::SearchPlusCode() |
| 694 | { |
| 695 | // Create a copy of the query to trim it in-place. |
| 696 | string query(m_query.m_query); |
| 697 | strings::Trim(query); |
| 698 | |
| 699 | if (openlocationcode::IsFull(query)) |
| 700 | { |
| 701 | openlocationcode::CodeArea const area = openlocationcode::Decode(query); |
| 702 | m_emitter.AddResultNoChecks(m_ranker.MakeResult(RankerResult(area.GetCenter().latitude, area.GetCenter().longitude), |
| 703 | true /* needAddress */, false /* needHighlighting */)); |
| 704 | } |
| 705 | else if (openlocationcode::IsShort(query)) |
| 706 | { |
| 707 | string codeFromPos; |
| 708 | |
| 709 | if (m_position) |
| 710 | { |
| 711 | ms::LatLon const latLonFromPos = mercator::ToLatLon(*m_position); |
| 712 | codeFromPos = openlocationcode::RecoverNearest(query, {latLonFromPos.m_lat, latLonFromPos.m_lon}); |
| 713 | openlocationcode::CodeArea const areaFromPos = openlocationcode::Decode(codeFromPos); |
| 714 | |
| 715 | m_emitter.AddResultNoChecks( |
| 716 | m_ranker.MakeResult(RankerResult(areaFromPos.GetCenter().latitude, areaFromPos.GetCenter().longitude), |
| 717 | true /* needAddress */, false /* needHighlighting */)); |
| 718 | } |
| 719 | |
| 720 | ms::LatLon const latLonFromView = mercator::ToLatLon(m_viewport.Center()); |
| 721 | string codeFromView = openlocationcode::RecoverNearest(query, {latLonFromView.m_lat, latLonFromView.m_lon}); |
| 722 | |
| 723 | if (codeFromView != codeFromPos) |
| 724 | { |
| 725 | openlocationcode::CodeArea const areaFromView = openlocationcode::Decode(codeFromView); |
| 726 | |
| 727 | m_emitter.AddResultNoChecks( |
| 728 | m_ranker.MakeResult(RankerResult(areaFromView.GetCenter().latitude, areaFromView.GetCenter().longitude), |
| 729 | true /* needAddress */, false /* needHighlighting */)); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | m_emitter.Emit(); |
| 734 | } |
| 735 | |
| 736 | void Processor::SearchPostcode() |
| 737 | { |
nothing calls this directly
no test coverage detected