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

Method SearchCoordinates

libs/search/processor.cpp:637–691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635}
636
637bool Processor::SearchCoordinates()
638{
639 bool coords_found = false;
640 buffer_vector<ms::LatLon, 3> results;
641 double lat, lon;
642
643 if (MatchLatLonDegree(m_query.m_query, lat, lon))
644 {
645 coords_found = true;
646 results.emplace_back(lat, lon);
647 }
648
649 auto ll = MatchUTMCoords(m_query.m_query);
650 if (ll)
651 {
652 coords_found = true;
653 results.emplace_back(ll->m_lat, ll->m_lon);
654 }
655
656 ll = MatchMGRSCoords(m_query.m_query);
657 if (ll)
658 {
659 coords_found = true;
660 results.emplace_back(ll->m_lat, ll->m_lon);
661 }
662
663 istringstream iss(m_query.m_query);
664 string token;
665 while (iss >> token)
666 {
667 ge0::Ge0Parser parser;
668 ge0::Ge0Parser::Result r;
669 if (parser.Parse(token, r))
670 {
671 coords_found = true;
672 results.emplace_back(r.m_lat, r.m_lon);
673 }
674
675 geo::GeoURLInfo info;
676 if (m_geoUrlParser.Parse(token, info))
677 {
678 coords_found = true;
679 results.emplace_back(info.m_lat, info.m_lon);
680 }
681 }
682
683 base::SortUnique(results);
684 for (auto const & r : results)
685 {
686 m_emitter.AddResultNoChecks(
687 m_ranker.MakeResult(RankerResult(r.m_lat, r.m_lon), true /* needAddress */, true /* needHighlighting */));
688 m_emitter.Emit();
689 }
690 return coords_found;
691}
692
693void Processor::SearchPlusCode()
694{

Callers

nothing calls this directly

Calls 10

MatchLatLonDegreeFunction · 0.85
MatchUTMCoordsFunction · 0.85
MatchMGRSCoordsFunction · 0.85
SortUniqueFunction · 0.85
RankerResultClass · 0.85
emplace_backMethod · 0.45
ParseMethod · 0.45
AddResultNoChecksMethod · 0.45
MakeResultMethod · 0.45
EmitMethod · 0.45

Tested by

no test coverage detected