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

place_page_info.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ccfd66531e987b72e7232e398abbedf64e844ca8 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#pragma once

#include "map/bookmark.hpp"

#include "storage/index.hpp"

#include "indexer/banners.hpp"
#include "indexer/feature_data.hpp"
#include "indexer/feature_meta.hpp"
#include "indexer/map_object.hpp"

#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
#include "geometry/point2d.hpp"

#include "std/string.hpp"

namespace place_page
{
enum class SponsoredType
{
  None,
  Booking,
  Opentable,
  Geochat
};

class Info : public osm::MapObject
{
public:
  static char const * const kSubtitleSeparator;
  static char const * const kStarSymbol;
  static char const * const kMountainSymbol;
  static char const * const kEmptyRatingSymbol;
  static char const * const kPricingSymbol;

  bool IsFeature() const;
  bool IsBookmark() const;
  bool IsMyPosition() const;
  bool IsSponsored() const;

  bool ShouldShowAddPlace() const;
  bool ShouldShowAddBusiness() const;
  bool ShouldShowEditPlace() const;

  /// @returns true if Back API button should be displayed.
  bool HasApiUrl() const;

  /// TODO: Support all possible Internet types in UI. @See MapObject::GetInternet().
  bool HasWifi() const;

  string GetAddress() const { return m_address; }

  /// Should be used by UI code to generate cool name for new bookmarks.
  // TODO: Tune new bookmark name. May be add address or some other data.
  string FormatNewBookmarkName() const;

  /// Convenient wrapper for feature's name and custom name.
  string GetTitle() const;
  /// Convenient wrapper for type, cuisines, elevation, stars, wifi etc.
  string GetSubtitle() const;
  /// @returns empty string or GetStars() count of ★ symbol.
  string FormatStars() const;

  /// @returns coordinate in DMS format if isDMS is true
  string GetFormattedCoordinate(bool isDMS) const;

  string GetCustomName() const;
  BookmarkAndCategory GetBookmarkAndCategory() const;
  string GetBookmarkCategoryName() const;
  string const & GetApiUrl() const;

  string const & GetSponsoredUrl() const;
  string const & GetSponsoredDescriptionUrl() const;

  /// @returns formatted rating string for booking object, or empty if it isn't booking object
  string GetRatingFormatted() const;
  /// @returns string with |kPricingSymbol| signs or empty string if it isn't booking object
  string GetApproximatePricing() const;

  /// Returns true, if the current time is within the working range of the banner.
  bool HasBanner() const;
  string GetBannerTitleId() const;
  string GetBannerMessageId() const;
  string GetBannerIconId() const;
  string GetBannerUrl() const;

  bool IsReachableByTaxi() const;

  void SetMercator(m2::PointD const & mercator);

  vector<string> GetRawTypes() const;

  /// Comes from API, shared links etc.
  string m_customName;
  /// If not empty, bookmark is bound to this place page.
  BookmarkAndCategory m_bac;
  /// Bookmark category name. Empty, if it's not bookmark;
  string m_bookmarkCategoryName;
  /// Bookmark title. Empty, if it's not bookmark;
  string m_bookmarkTitle;
  /// Bookmark color name. Empty, if it's not bookmark;
  string m_bookmarkColorName;
  /// Bookmark description. Empty, if it's not bookmark;
  string m_bookmarkDescription;
  /// Api ID passed for the selected object. It's automatically included in api url below.
  string m_apiId;
  /// [Deep] link to open when "Back" button is pressed in a Place Page.
  string m_apiUrl;
  /// Formatted feature address.
  string m_address;
  /// Sponsored type or None.
  SponsoredType m_sponsoredType = SponsoredType::None;

  /// Sponsored feature urls.
  string m_sponsoredUrl;
  string m_sponsoredDescriptionUrl;

  /// A banner associated with the object.
  banner::Banner m_banner;

  /// Which country this MapObject is in.
  /// For a country point it will be set to topmost node for country.
  storage::TCountryId m_countryId = storage::kInvalidCountryId;

  bool m_isMyPosition = false;
  /// True if editing of a selected point is allowed by basic logic.
  /// See initialization in framework.
  bool m_canEditOrAdd = false;

  // TODO(AlexZ): Temporary solution. It's better to use a wifi icon in UI instead of text.
  string m_localizedWifiString;
  /// Booking rating string
  string m_localizedRatingString;
};
}  // namespace place_page