Horizon
core_decal.hpp
1 #pragma once
2 #include "pool/decal.hpp"
3 #include "core.hpp"
4 #include "nlohmann/json.hpp"
5 #include "document/idocument_decal.hpp"
6 
7 namespace horizon {
8 class CoreDecal : public Core, public IDocumentDecal {
9 public:
10  CoreDecal(const std::string &decal_filename, IPool &pool);
11  bool has_object_type(ObjectType ty) const override;
12 
13  Decal &get_decal() override;
14  const Decal &get_canvas_data() const;
15  class LayerProvider &get_layer_provider() override;
16 
17  std::pair<Coordi, Coordi> get_bbox() override;
18 
19  const std::string &get_filename() const override;
20 
21  ObjectType get_object_type() const override
22  {
23  return ObjectType::DECAL;
24  }
25 
26  const FileVersion &get_version() const override
27  {
28  return decal.version;
29  }
30 
31  void set_temp_mode();
32  void set_filename(const std::string &filename);
33 
34 private:
35  std::map<UUID, Polygon> *get_polygon_map() override;
36  std::map<UUID, Junction> *get_junction_map() override;
37  std::map<UUID, Text> *get_text_map() override;
38  std::map<UUID, Line> *get_line_map() override;
39  std::map<UUID, Arc> *get_arc_map() override;
40 
41  Decal decal;
42 
43  std::string m_decal_filename;
44 
45  class HistoryItem : public Core::HistoryItem {
46  public:
47  HistoryItem(const Decal &r, const std::string &cm);
48  Decal decal;
49  };
50  void rebuild_internal(bool from_undo, const std::string &comment) override;
51  void history_push(const std::string &comment) override;
52  void history_load(unsigned int i) override;
53  void save(const std::string &suffix) override;
54  void delete_autosave() override;
55 };
56 } // namespace horizon
Definition: core_decal.hpp:8
Definition: core.hpp:201
Where Tools and and documents meet.
Definition: core.hpp:42
Definition: decal.hpp:16
Definition: file_version.hpp:9
Definition: idocument_decal.hpp:5
Definition: ipool.hpp:14
Definition: layer_provider.hpp:7