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

route_track.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e7301992bce98288ad3e0f993611c833d2a2c981 (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
#pragma once

#include "map/track.hpp"

#include "routing/turns.hpp"

#include "platform/location.hpp"

class RouteTrack : public Track
{
  RouteTrack & operator=(RouteTrack const &) = delete;
  RouteTrack(RouteTrack const &) = delete;
public:
  RouteTrack() {}
  explicit RouteTrack(PolylineD const & polyline) : Track(polyline) {}
  virtual ~RouteTrack();
  virtual void CreateDisplayList(graphics::Screen * dlScreen, MatrixT const & matrix, bool isScaleChanged,
                                int drawScale, double visualScale, 
                                location::RouteMatchingInfo const & matchingInfo) const;
  virtual void Draw(graphics::Screen * pScreen, MatrixT const & matrix) const;
  virtual RouteTrack * CreatePersistent();
  virtual void CleanUp() const;
  virtual bool HasDisplayLists() const;

  void AddClosingSymbol(bool isBeginSymbol, string const & symbolName,
                        graphics::EPosition pos, double depth);

  void SetArrowColor(graphics::Color color) { m_arrowColor = color; }

private:
  void CreateDisplayListSymbols(graphics::Screen * dlScreen, PointContainerT const & pts) const;

  void CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT const & matrix, double visualScale) const;
  void DeleteClosestSegmentDisplayList() const;
  bool HasClosestSegmentDisplayList() const { return m_closestSegmentDL != nullptr; }
  void SetClosestSegmentDisplayList(graphics::DisplayList * dl) const { m_closestSegmentDL = dl; }
  void Swap(RouteTrack & rhs);

  struct ClosingSymbol
  {
    ClosingSymbol(string const & iconName, graphics::EPosition pos, double depth)
      : m_iconName(iconName), m_position(pos), m_depth(depth) {}
    string m_iconName;
    graphics::EPosition m_position;
    double m_depth;
  };

  vector<ClosingSymbol> m_beginSymbols;
  vector<ClosingSymbol> m_endSymbols;

  mutable location::RouteMatchingInfo m_relevantMatchedInfo;
  mutable graphics::DisplayList * m_closestSegmentDL = nullptr;

  graphics::Color m_arrowColor;
};

bool ClipArrowBodyAndGetArrowDirection(vector<m2::PointD> & ptsTurn, pair<m2::PointD, m2::PointD> & arrowDirection,
                                       size_t turnIndex, double beforeTurn, double afterTurn, double arrowLength);
bool MergeArrows(vector<m2::PointD> & ptsCurrentTurn, vector<m2::PointD> const & ptsNextTurn, double bodyLen, double arrowLen);