Horizon
core_board.hpp
1 #pragma once
2 #include "block/block.hpp"
3 #include "board/board.hpp"
4 #include "core.hpp"
5 #include "nlohmann/json.hpp"
6 #include "document/document_board.hpp"
7 
8 namespace horizon {
9 class CoreBoard : public Core, public DocumentBoard {
10 public:
11  CoreBoard(const std::string &board_filename, const std::string &block_filename, const std::string &via_dir,
12  const std::string &pictures_dir, IPool &pool);
13 
14  class Block *get_block() override;
15  class LayerProvider &get_layer_provider() override;
16 
17  bool set_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
18  const class PropertyValue &value) override;
19  bool get_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
20  class PropertyValue &value) override;
21  bool get_property_meta(ObjectType type, const UUID &uu, ObjectProperty::ID property,
22  class PropertyMeta &meta) override;
23 
24  void rebuild(bool from_undo = false) override;
25  void reload_netlist();
26 
27  const Board *get_canvas_data();
28  Board *get_board() override;
29  const Board *get_board() const;
30 
31  ViaPadstackProvider &get_via_padstack_provider() override
32  {
33  return via_padstack_provider;
34  }
35 
36  class Rules *get_rules() override;
37  FabOutputSettings &get_fab_output_settings() override
38  {
39  return fab_output_settings;
40  }
41  PDFExportSettings &get_pdf_export_settings() override
42  {
43  return pdf_export_settings;
44  }
45  STEPExportSettings &get_step_export_settings() override
46  {
47  return step_export_settings;
48  }
49  PnPExportSettings &get_pnp_export_settings() override
50  {
51  return pnp_export_settings;
52  }
53 
54  BoardColors &get_colors() override
55  {
56  return colors;
57  }
58  void update_rules() override;
59 
60  std::pair<Coordi, Coordi> get_bbox() override;
61 
62  json get_meta() override;
63 
64  const std::string &get_filename() const override;
65 
66  ObjectType get_object_type() const override
67  {
68  return ObjectType::BOARD;
69  }
70 
71  const FileVersion &get_version() const override
72  {
73  return brd.version;
74  }
75 
76 private:
77  ViaPadstackProvider via_padstack_provider;
78 
79  Block block;
80  Board brd;
81 
82  BoardRules rules;
83  FabOutputSettings fab_output_settings;
84  PDFExportSettings pdf_export_settings;
85  STEPExportSettings step_export_settings;
86  PnPExportSettings pnp_export_settings;
87 
88  BoardColors colors;
89 
90  std::string m_board_filename;
91  std::string m_block_filename;
92  std::string m_pictures_dir;
93 
94  class HistoryItem : public Core::HistoryItem {
95  public:
96  HistoryItem(const Block &b, const Board &r);
97  Block block;
98  Board brd;
99  };
100  void history_push() override;
101  void history_load(unsigned int i) override;
102  void save(const std::string &suffix) override;
103  void delete_autosave() override;
104 };
105 } // namespace horizon
horizon::CoreBoard::get_meta
json get_meta() override
horizon::Rules
Definition: rules.hpp:48
horizon::Board
Definition: board.hpp:42
horizon::ViaPadstackProvider
Definition: via_padstack_provider.hpp:13
horizon::FileVersion
Definition: file_version.hpp:8
horizon::FabOutputSettings
Definition: fab_output_settings.hpp:10
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166
horizon::CoreBoard::rebuild
void rebuild(bool from_undo=false) override
Expands the non-working document.