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

bookmark.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 640994958c5e1b8ffb5ab6b5a89f7e63da787641 (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/user_mark.hpp"
#include "map/user_mark_layer.hpp"

#include "kml/types.hpp"

#include <memory>
#include <string>
#include <vector>

class Bookmark : public UserMark
{
  using Base = UserMark;
public:
  explicit Bookmark(m2::PointD const & ptOrg);

  explicit Bookmark(kml::BookmarkData && data);

  void SetData(kml::BookmarkData const & data);
  kml::BookmarkData const & GetData() const;

  bool HasCreationAnimation() const override;

  std::string GetPreferredName() const;

  kml::LocalizableString GetName() const;
  void SetName(kml::LocalizableString const & name);
  void SetName(std::string const & name, int8_t langCode);

  std::string GetCustomName() const;
  void SetCustomName(std::string const & customName);

  kml::PredefinedColor GetColor() const;
  void SetColor(kml::PredefinedColor color);

  m2::RectD GetViewport() const;

  std::string GetDescription() const;
  void SetDescription(std::string const & description);

  kml::Timestamp GetTimeStamp() const;
  void SetTimeStamp(kml::Timestamp timeStamp);

  uint8_t GetScale() const;
  void SetScale(uint8_t scale);

  dp::Anchor GetAnchor() const override;
  drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override;

  df::ColorConstant GetColorConstant() const override;

  kml::MarkGroupId GetGroupId() const override;

  void Attach(kml::MarkGroupId groupId);
  void Detach();

private:
  kml::BookmarkData m_data;
  kml::MarkGroupId m_groupId;
};

class BookmarkCategory : public UserMarkLayer
{
  using Base = UserMarkLayer;

public:
  BookmarkCategory(std::string const & name, kml::MarkGroupId groupId, bool autoSave);
  BookmarkCategory(kml::CategoryData && data, bool autoSave);

  static kml::PredefinedColor GetDefaultColor();

  kml::MarkGroupId GetID() const { return m_data.m_id; }

  void SetIsVisible(bool isVisible) override;
  void SetName(std::string const & name);
  void SetDescription(std::string const & desc);
  void SetFileName(std::string const & fileName) { m_file = fileName; }
  std::string GetName() const;
  std::string const & GetFileName() const { return m_file; }

  void EnableAutoSave(bool enable) { m_autoSave = enable; }
  bool IsAutoSaveEnabled() const { return m_autoSave; }

  kml::CategoryData const & GetCategoryData() const { return m_data; }

  void SetServerId(std::string const & serverId);
  std::string const & GetServerId() const { return m_serverId; }

  bool IsCategoryFromCatalog() const;
  std::string GetCatalogDeeplink() const;

  void SetAuthor(std::string const & name, std::string const & id);
  void SetAccessRules(kml::AccessRules accessRules);
  void SetTags(std::vector<std::string> const & tags);
  void SetCustomProperty(std::string const & key, std::string const & value);

private:
  void SetDirty() override;

  // Stores file name from which bookmarks were loaded.
  std::string m_file;
  bool m_autoSave = true;
  kml::CategoryData m_data;
  std::string m_serverId;
};