Horizon
core_frame.hpp
1 #pragma once
2 #include "frame/frame.hpp"
3 #include "core.hpp"
4 #include <iostream>
5 #include <memory>
6 #include "nlohmann/json.hpp"
7 #include "document/idocument_frame.hpp"
8 
9 namespace horizon {
10 class CoreFrame : public Core, public IDocumentFrame {
11 public:
12  CoreFrame(const std::string &frame_filename);
13  bool has_object_type(ObjectType ty) const override;
14 
15  Frame *get_frame() override;
16  const Frame *get_canvas_data() const;
17  class LayerProvider *get_layer_provider() override;
18 
19  void rebuild(bool from_undo = false) override;
20 
21  std::pair<Coordi, Coordi> get_bbox() override;
22 
23  const std::string &get_filename() const override;
24 
25  ObjectType get_object_type() const override
26  {
27  return ObjectType::FRAME;
28  }
29 
30 private:
31  std::map<UUID, Polygon> *get_polygon_map() override;
32  std::map<UUID, Junction> *get_junction_map() override;
33  std::map<UUID, Text> *get_text_map() override;
34  std::map<UUID, Line> *get_line_map() override;
35  std::map<UUID, Arc> *get_arc_map() override;
36 
37  Frame frame;
38 
39  std::string m_frame_filename;
40 
41  class HistoryItem : public Core::HistoryItem {
42  public:
43  HistoryItem(const Frame &r);
44  Frame frame;
45  };
46  void history_push() override;
47  void history_load(unsigned int i) override;
48  void save(const std::string &suffix) override;
49  void delete_autosave() override;
50 };
51 } // namespace horizon
horizon::LayerProvider
Definition: layer_provider.hpp:7
horizon::CoreFrame
Definition: core_frame.hpp:10
horizon::Core
Where Tools and and documents meet.
Definition: core.hpp:47
horizon::Frame
Definition: frame.hpp:21
horizon::CoreFrame::rebuild
void rebuild(bool from_undo=false) override
Expands the non-working document.
Definition: core_frame.cpp:57
horizon::IDocumentFrame
Definition: idocument_frame.hpp:5
horizon::Core::HistoryItem
Definition: core.hpp:193