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