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