Horizon
Loading...
Searching...
No Matches
plane.hpp
1#pragma once
2#include "block/net.hpp"
3#include "clipper/clipper.hpp"
4#include "common/polygon.hpp"
5
6namespace horizon {
7using json = nlohmann::json;
8
10public:
12 {
13 }
14
15 ThermalSettings(const json &j);
16
17 enum class ConnectStyle { SOLID, THERMAL, FROM_PLANE };
18 ConnectStyle connect_style = ConnectStyle::SOLID;
19
20 uint64_t thermal_gap_width = 0.2_mm;
21 uint64_t thermal_spoke_width = 0.2_mm;
22 unsigned int n_spokes = 4;
23 int angle = 0;
24
25 void serialize(json &j) const;
26};
27
29public:
30 PlaneSettings(const json &j);
32 {
33 }
34 enum class Style { ROUND, SQUARE, MITER };
35 uint64_t min_width = 0.2_mm;
36 Style style = Style::ROUND;
37 uint64_t extra_clearance = 0;
38 bool keep_orphans = false;
39
40 ThermalSettings thermal_settings;
41
42 enum class TextStyle { EXPAND, BBOX };
43 TextStyle text_style = TextStyle::EXPAND;
44
45 enum class FillStyle { SOLID, HATCH };
46 FillStyle fill_style = FillStyle::SOLID;
47 uint64_t hatch_border_width = 0.5_mm;
48 uint64_t hatch_line_width = 0.2_mm;
49 uint64_t hatch_line_spacing = 0.5_mm;
50
51 json serialize() const;
52};
53
54class Plane : public PolygonUsage {
55public:
56 class Fragment {
57 public:
58 Fragment()
59 {
60 }
61 Fragment(const json &j);
62 bool orphan = false;
63 ClipperLib::Paths paths; // first path is outline, others are holes
64 bool contains(const Coordi &c) const; // checks if point is in area defined by paths
65 int64_t get_area() const;
66 json serialize() const;
67 };
68
69 Plane(const UUID &uu, const json &j, class Board *brd);
70 Plane(const UUID &uu);
71 UUID uuid;
72 uuid_ptr<Net> net;
73 uuid_ptr<Polygon> polygon;
74 bool from_rules = true;
75 int priority = 0;
76 PlaneSettings settings;
77
78 std::deque<Fragment> fragments;
79 void clear();
80 unsigned int get_revision() const
81 {
82 return revision;
83 }
84 void load_fragments(const json &j);
85
86 Type get_type() const override;
87 UUID get_uuid() const override;
88 std::string get_name() const;
89
90 json serialize() const;
91 json serialize_fragments() const;
92
93private:
94 unsigned int revision = 0;
95};
96} // namespace horizon
Definition board.hpp:47
Definition plane.hpp:28
Definition plane.hpp:56
Definition plane.hpp:54
Definition polygon.hpp:13
Definition plane.hpp:9
This class encapsulates a UUID and allows it to be uses as a value type.
Definition uuid.hpp:16
Definition uuid_ptr.hpp:8
a class to store JSON values
Definition json.hpp:177
basic_json<> json
default JSON class
Definition json_fwd.hpp:62