1 #pragma once
2 #include "util/uuid.hpp"
3 #include "common.hpp"
4 #include "nlohmann/json_fwd.hpp"
5 #include "polygon.hpp"
6 #include <vector>
7 #include <map>
8 #include <fstream>
9 #include "util/placement.hpp"
10 
11 
12 namespace horizon {
13 using json = nlohmann::json;
14 
15 /**
16  * A hole with diameter and position, that's it.
17  */
18 class Hole {
19 public:
20     Hole(const UUID &uu, const json &j);
21     Hole(const UUID &uu);
22 
23     UUID uuid;
24     Placement placement;
25     uint64_t diameter = 0.5_mm;
26     uint64_t length = 0.5_mm;
27     std::string parameter_class;
28 
29     /**
30      * true if this hole is PTH, false if NPTH.
31      * Used by the gerber exporter.
32      */
33     bool plated = false;
34 
35     enum class Shape { ROUND, SLOT };
36     Shape shape = Shape::ROUND;
37 
38     Polygon to_polygon() const;
39 
40 
41     UUID get_uuid() const;
42 
43     // not stored
44     json serialize() const;
45 };
46 } // namespace horizon
47