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: ece891102eab0c2b26895ca4da84d639a4049746 (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
#pragma once

#include "map/bookmark.hpp"

#include "storage/index.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
{
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 IsSponsoredHotel() const;
  bool IsHotel() 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;

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

  string const & GetSponsoredBookingUrl() 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;

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

  /// Comes from API, shared links etc.
  string m_customName;
  /// If not empty, bookmark is bound to this place page.
  BookmarkAndCategory m_bac = MakeEmptyBookmarkAndCategory();
  /// Bookmark category name. Empty, if it's not bookmark;
  string m_bookmarkCategoryName;
  /// 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;
  /// Feature is a hotel.
  bool m_isHotel = false;
  /// Feature is a sponsored hotel.
  bool m_isSponsoredHotel = false;
  /// Sponsored feature urls.
  string m_sponsoredBookingUrl;
  string m_sponsoredDescriptionUrl;

  /// 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