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

mwm_url.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a0e71ee9dd240ae6e36b42bae035c1eb1b42a635 (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 "api_mark_container.hpp"

#include "geometry/rect2d.hpp"

#include "std/string.hpp"

class ScalesProcessor;

namespace url_scheme
{

struct ApiPoint
{
  double m_lat;
  double m_lon;
  string m_name;
  string m_id;
  string m_style;
};

class Uri;

/// Handles [mapswithme|mwm]://map?params - everything related to displaying info on a map
class ParsedMapApi
{
public:
  ParsedMapApi();

  void SetController(UserMarkContainer::Controller * controller);

  bool SetUriAndParse(string const & url);
  bool IsValid() const;
  string const & GetGlobalBackUrl() const { return m_globalBackUrl; }
  string const & GetAppTitle() const { return m_appTitle; }
  int GetApiVersion() const { return m_version; }
  void Reset();
  bool GoBackOnBalloonClick() const { return m_goBackOnBalloonClick; }

  /// @name Used in settings map viewport after invoking API.
  bool GetViewportRect(ScalesProcessor const & scales, m2::RectD & rect) const;
  UserMark const * GetSinglePoint() const;

private:
  bool Parse(Uri const & uri);
  void AddKeyValue(string key, string const & value, vector<ApiPoint> & points);

  UserMarkContainer::Controller * m_controller;
  string m_globalBackUrl;
  string m_appTitle;
  int m_version;
  /// Zoom level in OSM format (e.g. from 1.0 to 20.0)
  /// Taken into an account when calculating viewport rect, but only if points count is == 1
  double m_zoomLevel;
  bool m_goBackOnBalloonClick;
};

}