Horizon
sheet.hpp
1 #pragma once
2 #include "util/uuid.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include "pool/unit.hpp"
5 #include "block/block.hpp"
6 #include "schematic_symbol.hpp"
7 #include "line_net.hpp"
8 #include "common/text.hpp"
9 #include "net_label.hpp"
10 #include "bus_label.hpp"
11 #include "bus_ripper.hpp"
12 #include "power_symbol.hpp"
13 #include "frame.hpp"
14 #include "util/warning.hpp"
15 #include "common/layer_provider.hpp"
16 #include <vector>
17 #include <map>
18 #include <fstream>
19 
20 namespace horizon {
21 using json = nlohmann::json;
22 
24 public:
27  bool has_label = false;
28  bool has_power_sym = false;
29  Coordi position;
30  Net *net = nullptr;
31  Bus *bus = nullptr;
32  bool is_bus() const;
33 };
34 
35 class Sheet : public LayerProvider {
36 public:
37  Sheet(const UUID &uu, const json &, Block &Block, class Pool &pool);
38  Sheet(const UUID &uu);
39  UUID uuid;
40  std::string name;
41  unsigned int index;
42 
43  std::map<UUID, Junction> junctions;
44  std::map<UUID, SchematicSymbol> symbols;
45  // std::map<UUID, class JunctionPin> junction_pins;
46  std::map<UUID, class LineNet> net_lines;
47  std::map<UUID, class Text> texts;
48  std::map<UUID, NetLabel> net_labels;
49  std::map<UUID, PowerSymbol> power_symbols;
50  std::map<UUID, BusLabel> bus_labels;
51  std::map<UUID, BusRipper> bus_rippers;
52  std::vector<Warning> warnings;
53 
54  LineNet *split_line_net(LineNet *it, Junction *ju);
55  void merge_net_lines(LineNet *a, LineNet *b, Junction *ju);
56  void expand_symbols();
57  void simplify_net_lines(bool simplify);
58  void fix_junctions();
59  void delete_duplicate_net_lines();
60  void vacuum_junctions();
61  void delete_dependants();
62  void propagate_net_segments();
63  std::map<UUID, NetSegmentInfo> analyze_net_segments(bool place_warnings = false);
64  std::set<UUIDPath<3>> get_pins_connected_to_net_segment(const UUID &uu_segment);
65 
66  void replace_junction(Junction *j, SchematicSymbol *sym, SymbolPin *pin);
67  Junction *replace_bus_ripper(BusRipper *rip);
68 
69  void merge_junction(Junction *j, Junction *into); // merge junction j into "into" j will be deleted
70 
71  // void replace_junction(Junction *j, PowerSymbol *sym);
72  // void replace_power_symbol(PowerSymbol *sym, Junction *j);
73  // void connect(SchematicSymbol *sym, SymbolPin *pin, PowerSymbol
74  // *power_sym);
75 
76  Frame frame;
77 
78  json serialize() const;
79 };
80 } // namespace horizon
Definition: symbol.hpp:22
A Bus is used for grouping nets.
Definition: bus.hpp:21
Border around a sheet.
Definition: frame.hpp:16
a class to store JSON values
Definition: json.hpp:161
LineNet is similar to Line, except it denotes electrical connection.
Definition: line_net.hpp:24
Definition: sheet.hpp:23
Make a Bus member&#39;s Net available on the schematic.
Definition: bus_ripper.hpp:21
A block is one level of hierarchy in the netlist.
Definition: block.hpp:25
Definition: sheet.hpp:35
Definition: layer_provider.hpp:7
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
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
A Junction is a point in 2D-Space.
Definition: junction.hpp:25
Definition: schematic_symbol.hpp:19
Definition: net.hpp:16