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

fake_vertex.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d52b28fad4be119d3cb5f4eabce8e390b13bae7c (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once

#include "routing/road_graph.hpp"

#include "geometry/point2d.hpp"

#include "base/visitor.hpp"

#include <sstream>
#include <string>
#include <utility>

namespace routing
{
class FakeVertex final
{
public:
  enum class Type
  {
    PureFake,
    PartOfReal,
  };

  FakeVertex(Junction const & from, Junction const & to, Type type)
    : m_from(from), m_to(to), m_type(type)
  {
  }

  FakeVertex() = default;

  bool operator==(FakeVertex const & rhs) const
  {
    return m_from == rhs.m_from && m_to == rhs.m_to && m_type == rhs.m_type;
  }

  bool operator<(FakeVertex const & rhs) const
  {
    if (m_from != rhs.m_from)
      return m_from < rhs.m_from;
    if (m_to != rhs.m_to)
      return m_to < rhs.m_to;
    return m_type < rhs.m_type;
  }

  Junction const & GetJunctionFrom() const { return m_from; }
  m2::PointD const & GetPointFrom() const { return m_from.GetPoint(); }
  Junction const & GetJunctionTo() const { return m_to; }
  m2::PointD const & GetPointTo() const { return m_to.GetPoint(); }
  Type GetType() const { return m_type; }

  DECLARE_VISITOR(visitor(m_from, "m_from"), visitor(m_to, "m_to"), visitor(m_type, "m_type"))
  DECLARE_DEBUG_PRINT(FakeVertex)

private:
  Junction m_from;
  Junction m_to;
  Type m_type = Type::PureFake;
};

inline std::string DebugPrint(FakeVertex::Type type)
{
  switch (type)
  {
  case FakeVertex::Type::PureFake: return "PureFake";
  case FakeVertex::Type::PartOfReal: return "PartOfReal";
  }
}
}  // namespace routing