2#include "attribute_util.hpp"
3#include "common/common.hpp"
4#include "util/placement.hpp"
5#include "surface_data.hpp"
12namespace horizon::ODB {
21 virtual void write(std::ostream &ost)
const;
23 const unsigned int index;
28 Feature(
unsigned int i) : index(i)
32 enum class Type { LINE, ARC, PAD, SURFACE };
33 virtual Type get_type()
const = 0;
34 virtual void write_feature(std::ostream &ost)
const = 0;
39 Type get_type()
const override
45 :
Feature(i), from(f), to(t), symbol(sym)
53 void write_feature(std::ostream &ost)
const override;
59 Type get_type()
const override
64 enum class Direction { CW, CCW };
67 :
Feature(i), from(f), to(t), center(c), symbol(sym), direction(d)
78 void write_feature(std::ostream &ost)
const override;
83 Type get_type()
const override
88 Pad(
unsigned int i,
const Placement &pl,
unsigned int sym) :
Feature(i), placement(pl), symbol(sym)
96 void write_feature(std::ostream &ost)
const override;
105 void write(std::ostream &ost)
const override;
106 Type get_type()
const override
108 return Type::SURFACE;
114 void write_feature(std::ostream &ost)
const override;
118 Arc &draw_arc(
const Coordi &from,
const Coordi &to,
const Coordi ¢er, uint64_t width, Arc::Direction direction);
123 Pad &draw_circle(
const Coordi &pos, uint64_t diameter);
124 Pad &draw_shape(
const Shape &shape);
127 void write(std::ostream &ost)
const;
130 unsigned int get_or_create_symbol_circle(uint64_t diameter);
131 unsigned int get_or_create_symbol_pad(
const std::string &name);
132 unsigned int get_or_create_symbol_rect(uint64_t width, uint64_t height);
133 unsigned int get_or_create_symbol_oval(uint64_t width, uint64_t height);
135 unsigned int symbol_n = 0;
137 template <
typename T>
unsigned int get_or_create_symbol(std::map<T, unsigned int> &syms,
const T &key)
139 if (syms.count(key)) {
144 syms.emplace(key, n);
149 std::map<uint64_t, unsigned int> symbols_circle;
150 std::map<std::string, unsigned int> symbols_pad;
151 std::map<std::pair<uint64_t, uint64_t>,
unsigned int> symbols_rect;
152 std::map<std::pair<uint64_t, uint64_t>,
unsigned int> symbols_oval;
154 template <
typename T,
typename... Args> T &add_feature(Args &&...args)
156 auto f = std::make_unique<T>(features.size(), std::forward<Args>(args)...);
158 features.push_back(std::move(f));
161 std::list<std::unique_ptr<Feature>> features;
Definition: attribute_util.hpp:10
Definition: features.hpp:57
Definition: features.hpp:16
Definition: features.hpp:37
Definition: features.hpp:81
Definition: features.hpp:99
Definition: features.hpp:14
Definition: attribute_util.hpp:56
Definition: surface_data.hpp:17
Definition: placement.hpp:8
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:25
For commonly used Pad shapes.
Definition: shape.hpp:15
Definition: attributes.hpp:51