Horizon
odb_util.hpp
1#pragma once
2#include "common/common.hpp"
3#include "util/placement.hpp"
4#include <ostream>
5
6namespace horizon::ODB {
7
8extern const char *endl;
9extern const char *drills_layer;
10
11std::ostream &operator<<(std::ostream &os, const Coordi &c);
12
13struct Angle {
14 explicit Angle(int a) : angle((((65536 - a) % 65536) * (360. / 65536.)))
15 {
16 }
17 explicit Angle(const Placement &pl) : Angle(pl.get_angle())
18 {
19 }
20 const double angle;
21};
22
23std::ostream &operator<<(std::ostream &os, Angle a);
24
25struct Dim {
26 explicit Dim(int64_t x) : dim(x / 1e6)
27 {
28 }
29 explicit Dim(uint64_t x) : dim(x / 1e6)
30 {
31 }
32 explicit Dim(double x) : dim(x / 1e6)
33 {
34 }
35 const double dim;
36};
37
38std::ostream &operator<<(std::ostream &os, Dim d);
39
40struct DimUm {
41 explicit DimUm(int64_t x) : dim(x / 1e3)
42 {
43 }
44 explicit DimUm(uint64_t x) : dim(x / 1e3)
45 {
46 }
47 const double dim;
48};
49
50std::ostream &operator<<(std::ostream &os, DimUm d);
51
52std::string utf8_to_ascii(const std::string &s);
53std::string make_legal_name(const std::string &n);
54std::string make_legal_entity_name(const std::string &s);
55std::string get_layer_name(int id);
56
57std::string make_symbol_circle(uint64_t diameter);
58std::string make_symbol_rect(uint64_t w, uint64_t h);
59std::string make_symbol_oval(uint64_t w, uint64_t h);
60
61
62} // namespace horizon::ODB
Definition: placement.hpp:8
Definition: odb_util.hpp:13
Definition: odb_util.hpp:40
Definition: odb_util.hpp:25