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 private:
32  std::map<UUID, Polygon> *get_polygon_map() override;
33  std::map<UUID, Junction> *get_junction_map() override;
34  std::map<UUID, Text> *get_text_map() override;
35  std::map<UUID, Line> *get_line_map() override;
36  std::map<UUID, Arc> *get_arc_map() override;
37 
38  Decal decal;
39 
40  std::string m_decal_filename;
41 
42  class HistoryItem : public Core::HistoryItem {
43  public:
44  HistoryItem(const Decal &r, const std::string &cm);
45  Decal decal;
46  };
47  void rebuild_internal(bool from_undo, const std::string &comment) override;
48  void history_push(const std::string &comment) override;
49  void history_load(unsigned int i) override;
50  void save(const std::string &suffix) override;
51  void delete_autosave() override;
52 };
53 } // namespace horizon
Definition: core_decal.hpp:8
Definition: core.hpp:202
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