Welcome to mirror list, hosted at ThFree Co, Russian Federation.

score_candidate_points_getter.hpp « openlr - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c8c964ec3c0a370667b9c99fa1d66d54652ddf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "openlr/graph.hpp"
#include "openlr/score_types.hpp"
#include "openlr/stats.hpp"

#include "indexer/data_source.hpp"

#include "geometry/point2d.hpp"

#include <cstdint>
#include <functional>
#include <vector>

namespace openlr
{
class ScoreCandidatePointsGetter
{
public:
  ScoreCandidatePointsGetter(size_t maxJunctionCandidates, size_t maxProjectionCandidates,
                             DataSource const & dataSource, Graph & graph)
    : m_maxJunctionCandidates(maxJunctionCandidates)
    , m_maxProjectionCandidates(maxProjectionCandidates)
    , m_dataSource(dataSource)
    , m_graph(graph)
  {
  }

  void GetEdgeCandidates(m2::PointD const & p, bool isLastPoint, ScoreEdgeVec & edges)
  {
    GetJunctionPointCandidates(p, isLastPoint, edges);
    EnrichWithProjectionPoints(p, edges);
  }

private:
  void GetJunctionPointCandidates(m2::PointD const & p, bool isLastPoint,
                                  ScoreEdgeVec & edgeCandidates);
  void EnrichWithProjectionPoints(m2::PointD const & p, ScoreEdgeVec & edgeCandidates);

  /// \returns true if |p| is a junction and false otherwise.
  bool IsJunction(m2::PointD const & p);
  Score GetScoreByDistance(m2::PointD const & point, m2::PointD const & candidate);

  size_t const m_maxJunctionCandidates;
  size_t const m_maxProjectionCandidates;

  DataSource const & m_dataSource;
  Graph & m_graph;
};
}  // namespace openlr