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 
9 namespace horizon {
10 class CoreBoard : public Core {
11 public:
12  CoreBoard(const std::string &board_filename, const std::string &block_filename, const std::string &via_dir,
13  Pool &pool);
14  bool has_object_type(ObjectType ty) override;
15 
16  class Block *get_block(bool work = true) override;
17  class LayerProvider *get_layer_provider() override;
18 
19  bool set_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
20  const class PropertyValue &value) override;
21  bool get_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
22  class PropertyValue &value) override;
23  bool get_property_meta(ObjectType type, const UUID &uu, ObjectProperty::ID property,
24  class PropertyMeta &meta) override;
25 
26  std::string get_display_name(ObjectType type, const UUID &uu) override;
27 
28  std::vector<Track *> get_tracks(bool work = true);
29  std::vector<Line *> get_lines(bool work = true) override;
30 
31  void rebuild(bool from_undo = false) override;
32  void commit() override;
33  void revert() override;
34  void save() override;
35  void reload_netlist();
36 
37  const Board *get_canvas_data();
38  Board *get_board(bool work = true);
39  ViaPadstackProvider *get_via_padstack_provider();
40  class Rules *get_rules() override;
41  FabOutputSettings *get_fab_output_settings()
42  {
43  return &fab_output_settings;
44  }
45  void update_rules() override;
46 
47  std::pair<Coordi, Coordi> get_bbox() override;
48 
49  json get_meta() override;
50 
51 private:
52  std::map<UUID, Polygon> *get_polygon_map(bool work = true) override;
53  std::map<UUID, Junction> *get_junction_map(bool work = true) override;
54  std::map<UUID, Text> *get_text_map(bool work = true) override;
55  std::map<UUID, Line> *get_line_map(bool work = true) override;
56  std::map<UUID, Dimension> *get_dimension_map() override;
57  std::map<UUID, Arc> *get_arc_map(bool work = true) override;
58 
59  ViaPadstackProvider via_padstack_provider;
60 
61  Block block;
62  Board brd;
63 
64  BoardRules rules;
65  FabOutputSettings fab_output_settings;
66 
67  std::string m_board_filename;
68  std::string m_block_filename;
69  std::string m_via_dir;
70 
71  class HistoryItem : public Core::HistoryItem {
72  public:
73  HistoryItem(const Block &b, const Board &r) : block(b), brd(r)
74  {
75  }
76  Block block;
77  Board brd;
78  };
79  void history_push() override;
80  void history_load(unsigned int i) override;
81 };
82 } // namespace horizon
a class to store JSON values
Definition: json.hpp:161
Definition: core_properties.hpp:7
json get_meta() override
Definition: core_board.cpp:566
Definition: rules.hpp:41
Definition: board.hpp:28
Definition: fab_output_settings.hpp:10
Definition: board_rules.hpp:18
Definition: via_padstack_provider.hpp:13
void rebuild(bool from_undo=false) override
Expands the non-working document.
Definition: core_board.cpp:497
A block is one level of hierarchy in the netlist.
Definition: block.hpp:25
Where Tools and and documents meet.
Definition: core.hpp:249
Definition: layer_provider.hpp:7
Definition: core_properties.hpp:77
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:18
Definition: block.cpp:7
Definition: core.hpp:439
Definition: core_board.hpp:10