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 
8 namespace horizon {
9 class CoreFrame : public Core {
10 public:
11  CoreFrame(const std::string &frame_filename);
12  bool has_object_type(ObjectType ty) const override;
13 
14  Frame *get_frame();
15  const Frame *get_canvas_data() const;
16  class LayerProvider *get_layer_provider() override;
17 
18  void rebuild(bool from_undo = false) override;
19  void commit() override;
20  void revert() override;
21 
22  std::pair<Coordi, Coordi> get_bbox() override;
23 
24  const std::string &get_filename() const override;
25 
26 private:
27  std::map<UUID, Polygon> *get_polygon_map(bool work = true) override;
28  std::map<UUID, Junction> *get_junction_map(bool work = true) override;
29  std::map<UUID, Text> *get_text_map(bool work = true) override;
30  std::map<UUID, Line> *get_line_map(bool work = true) override;
31  std::map<UUID, Arc> *get_arc_map(bool work = true) override;
32 
33  Frame frame;
34 
35  std::string m_frame_filename;
36 
37  class HistoryItem : public Core::HistoryItem {
38  public:
39  HistoryItem(const Frame &r);
40  Frame frame;
41  };
42  void history_push() override;
43  void history_load(unsigned int i) override;
44  void save(const std::string &suffix) override;
45  void delete_autosave() override;
46 };
47 } // namespace horizon
horizon::LayerProvider
Definition: layer_provider.hpp:7
horizon::CoreFrame
Definition: core_frame.hpp:9
horizon::Core
Where Tools and and documents meet.
Definition: core.hpp:240
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::Core::HistoryItem
Definition: core.hpp:498