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 
10 namespace horizon {
11 class CoreBoard : public Core {
12 public:
13  CoreBoard(const std::string &board_filename, const std::string &block_filename, const std::string &via_dir,
14  Pool &pool);
15  bool has_object_type(ObjectType ty) const override;
16 
17  class Block *get_block(bool work = true) 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  std::string get_display_name(ObjectType type, const UUID &uu) override;
28 
29  std::vector<Track *> get_tracks(bool work = true);
30  std::vector<Line *> get_lines(bool work = true) override;
31 
32  void rebuild(bool from_undo = false) override;
33  void commit() override;
34  void revert() override;
35  void reload_netlist();
36 
37  const Board *get_canvas_data();
38  Board *get_board(bool work = true);
39  const Board *get_board() const;
40  ViaPadstackProvider *get_via_padstack_provider();
41  class Rules *get_rules() override;
42  FabOutputSettings *get_fab_output_settings()
43  {
44  return &fab_output_settings;
45  }
46  PDFExportSettings *get_pdf_export_settings()
47  {
48  return &pdf_export_settings;
49  }
50 
51  Board::Colors *get_colors()
52  {
53  return &colors;
54  }
55  void update_rules() override;
56 
57  std::pair<Coordi, Coordi> get_bbox() override;
58 
59  bool can_search_for_object_type(ObjectType type) const override;
60  std::list<SearchResult> search(const SearchQuery &q) override;
61 
62  json get_meta() override;
63 
64  const std::string &get_filename() const override;
65 
66 private:
67  std::map<UUID, Polygon> *get_polygon_map(bool work = true) override;
68  std::map<UUID, Junction> *get_junction_map(bool work = true) override;
69  std::map<UUID, Text> *get_text_map(bool work = true) override;
70  std::map<UUID, Line> *get_line_map(bool work = true) override;
71  std::map<UUID, Dimension> *get_dimension_map() override;
72  std::map<UUID, Arc> *get_arc_map(bool work = true) override;
73  std::map<UUID, Keepout> *get_keepout_map() override;
74 
75  ViaPadstackProvider via_padstack_provider;
76 
77  Block block;
78  Board brd;
79 
80  BoardRules rules;
81  FabOutputSettings fab_output_settings;
82  PDFExportSettings pdf_export_settings;
83 
84  Board::Colors colors;
85 
86  std::string m_board_filename;
87  std::string m_block_filename;
88  std::string m_via_dir;
89 
90  class HistoryItem : public Core::HistoryItem {
91  public:
92  HistoryItem(const Block &b, const Board &r);
93  Block block;
94  json brd;
95  };
96  void history_push() override;
97  void history_load(unsigned int i) override;
98  void save(const std::string &suffix) override;
99  void delete_autosave() override;
100 };
101 } // namespace horizon
horizon::CoreBoard::get_meta
json get_meta() override
Definition: core_board.cpp:624
horizon::Rules
Definition: rules.hpp:44
horizon::BoardRules
Definition: board_rules.hpp:20
horizon::Board
Definition: board.hpp:31
horizon::CoreBoard
Definition: core_board.hpp:11
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::Board::Colors
Definition: board.hpp:104
horizon::Core
Where Tools and and documents meet.
Definition: core.hpp:240
horizon::FabOutputSettings
Definition: fab_output_settings.hpp:10
horizon::PropertyMeta
Definition: core_properties.hpp:77
horizon::Core::SearchQuery
Definition: core.hpp:351
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:161
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::CoreBoard::rebuild
void rebuild(bool from_undo=false) override
Expands the non-working document.
Definition: core_board.cpp:538
horizon::PDFExportSettings
Definition: pdf_export_settings.hpp:9
horizon::Core::HistoryItem
Definition: core.hpp:498
horizon::PropertyValue
Definition: core_properties.hpp:7