2 #include "common/common.hpp"
3 #include "common/text.hpp"
4 #include "layer_display.hpp"
5 #include "selectables.hpp"
7 #include "triangle.hpp"
8 #include "object_ref.hpp"
9 #include "fragment_cache.hpp"
10 #include "util/placement.hpp"
11 #include "util/text_data.hpp"
12 #include "color_palette.hpp"
15 #include <unordered_map>
18 #include "picture.hpp"
19 #include "pool/unit.hpp"
20 #include "util/vector_pair.hpp"
21 #include "text_renderer.hpp"
36 enum class SymbolMode { SHEET, EDIT, EDIT_PREVIEW };
38 void update(
const class Sheet &sheet);
39 void update(
const class Padstack &padstack,
bool edit =
true);
40 void update(
const class Package &pkg,
bool edit =
true);
41 enum class PanelMode { INCLUDE, SKIP };
42 void update(
const class Board &brd, PanelMode mode = PanelMode::INCLUDE);
43 void update(
const class Frame &fr,
bool edit =
true);
44 void update(
const class Decal &dec,
bool edit =
true);
45 void update(
const class BlockSymbol &sym,
bool edit =
true);
47 ObjectRef add_line(
const std::deque<Coordi> &pts, int64_t width, ColorP color,
int layer);
51 void set_flags(
const ObjectRef &r, uint8_t mask_set, uint8_t mask_clear);
52 void set_flags_all(uint8_t mask_set, uint8_t mask_clear);
55 void set_color2(
const ObjectRef &r, uint8_t color);
59 virtual void update_markers()
64 void set_layer_display(
int index,
const LayerDisplay &ld);
65 void set_layer_color(
int layer,
const Color &color);
67 bool layer_is_visible(
int layer)
const;
70 bool show_all_junctions_in_schematic =
false;
71 bool show_text_in_tracks =
false;
72 bool show_text_in_vias =
false;
74 virtual bool get_flip_view()
const
79 virtual float get_view_angle()
const
84 std::pair<Coordf, Coordf> get_bbox(
bool visible_only =
true)
const;
86 static const int first_overlay_layer = 30000;
89 std::map<int, vector_pair<Triangle, TriangleInfo>> triangles;
90 std::list<CanvasPicture> pictures;
91 void add_triangle(
int layer,
const Coordf &p0,
const Coordf &p1,
const Coordf &p2, ColorP co, uint8_t flg = 0,
94 using ObjectRefIdx = std::map<int, std::pair<size_t, size_t>>;
95 std::unordered_map<ObjectRef, ObjectRefIdx> object_refs;
96 void begin_group(
int layer);
98 std::vector<ObjectRef> object_refs_current;
99 std::vector<ObjectRefIdx *> object_ref_idx;
100 void object_ref_push(
const ObjectRef &ref);
101 template <
typename... Args>
void object_ref_push(Args... args)
105 void object_ref_pop();
107 void render(
const class Symbol &sym, SymbolMode mode = SymbolMode::SHEET,
bool smashed =
false,
108 ColorP co = ColorP::FROM_LAYER);
109 void render(
const class Junction &junc,
bool interactive =
true, ObjectType mode = ObjectType::INVALID);
111 void render(
const class Line &line,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
112 void render(
const class SymbolPin &pin, SymbolMode mode = SymbolMode::EDIT, ColorP co = ColorP::FROM_LAYER);
113 void render(
const class Arc &arc,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
114 void render(
const class Sheet &sheet);
116 void render(
const class LineNet &line);
117 void render(
const class NetLabel &label);
118 void render(
const class BusLabel &label);
119 void render(
const class Warning &warn);
121 void render(
const class BusRipper &ripper);
122 void render(
const class Text &text,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
123 void render(
const class Padstack &padstack,
bool interactive =
true);
124 void render(
const class Polygon &polygon,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
125 void render(
const class Shape &shape,
bool interactive =
true);
126 void render(
const class Hole &hole,
bool interactive =
true);
127 void render(
const class Package &package,
bool interactive =
true,
bool smashed =
false,
128 bool omit_silkscreen =
false,
bool omit_outline =
false,
bool on_panel =
false);
129 void render_pad_overlay(
const class Pad &pad,
bool interactive);
130 void render(
const class Pad &pad);
131 enum class OutlineMode { INCLUDE, OMIT };
132 void render(
const class Board &brd,
bool interactive =
true, PanelMode mode = PanelMode::INCLUDE,
133 OutlineMode outline_mode = OutlineMode::INCLUDE);
134 void render(
const class BoardPackage &pkg,
bool interactive =
true);
135 void render(
const class BoardHole &hole,
bool interactive =
true);
136 void render(
const class Track &track,
bool interactive =
true);
137 void render(
const class Via &via,
bool interactive =
true);
139 void render(
const class Frame &frame,
bool on_sheet =
false);
142 void render(
const class Picture &pic,
bool interactive =
true);
143 void render(
const class Decal &decal,
bool interactive =
true);
145 void render(
const class BlockSymbol &sym,
bool on_sheet =
false);
146 void render(
const class BlockSymbolPort &port,
bool interactive =
true);
149 void render(
const class BoardNetTie &tie,
bool interactive =
true);
151 bool needs_push =
true;
152 virtual void request_push() = 0;
153 virtual void push() = 0;
155 void set_lod_size(
float size);
158 bool tr =
true, uint64_t width = 0);
159 void draw_cross(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
160 bool tr =
true, uint64_t width = 0);
161 void draw_plus(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
162 bool tr =
true, uint64_t width = 0);
163 void draw_box(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
164 bool tr =
true, uint64_t width = 0);
165 void draw_arc(
const Coord<float> ¢er,
float radius,
float a0,
float a1, ColorP color = ColorP::FROM_LAYER,
167 void draw_circle(
const Coord<float> ¢er,
float radius, ColorP color = ColorP::FROM_LAYER,
int layer = 10000);
168 void draw_arc2(
const Coord<float> ¢er,
float radius0,
float a0,
float a1, ColorP color,
int layer,
170 void draw_arc0(
const Coord<float> ¢er,
float radius0,
float a0,
float a1, ColorP color,
int layer,
174 std::pair<Coordf, Coordf> draw_text(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
177 virtual void draw_bitmap_text(
const Coordf &p,
float scale,
const std::string &rtext,
int angle, ColorP color,
182 virtual std::pair<Coordf, Coordf> measure_bitmap_text(
const std::string &text)
const
184 return {{0, 0}, {0, 0}};
187 enum class TextBoxMode { FULL, LOWER, UPPER };
189 virtual void draw_bitmap_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
190 int layer, TextBoxMode mode)
194 void draw_error(
const Coordf ¢er,
float scale,
const std::string &text,
bool tr =
true);
195 std::tuple<Coordf, Coordf, Coordi> draw_flag(
const Coordf &position,
const std::string &txt, int64_t size,
196 Orientation orientation, ColorP color = ColorP::FROM_LAYER);
197 void draw_lock(
const Coordf ¢er,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
200 virtual bool img_layer_is_visible(
int layer)
const
204 virtual void img_net(
const class Net *net)
207 virtual void img_polygon(
const Polygon &poly,
bool tr =
true)
210 virtual void img_padstack(
const Padstack &ps)
213 virtual void img_set_padstack(
bool v)
216 virtual void img_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
int layer = 10000,
bool tr =
true);
217 virtual void img_arc(
const Arc &arc);
218 virtual bool img_supports_arc()
const
222 virtual void img_hole(
const Hole &hole)
225 virtual void img_text(
const Text *text)
228 virtual void img_patch_type(PatchType type)
231 virtual void img_draw_text(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
232 TextOrigin origin,
int layer = 10000, uint64_t width = 0,
233 TextData::Font font = TextData::Font::SIMPLEX,
bool center =
false,
bool mirror =
false)
236 bool img_mode =
false;
237 bool img_auto_line =
false;
240 void transform_save();
241 void transform_restore();
242 std::vector<Placement> transforms;
245 std::vector<Target> targets;
249 std::map<int, Color> layer_colors;
250 Color get_layer_color(
int layer)
const;
252 std::map<int, LayerDisplay> layer_display;
254 TriangleInfo::Type triangle_type_current = TriangleInfo::Type::NONE;
256 std::map<std::pair<LayerRange, bool>,
int> overlay_layers;
257 int overlay_layer_current = first_overlay_layer;
258 int get_overlay_layer(
const LayerRange &layer,
bool ignore_flip =
false);
259 bool is_overlay_layer(
int overlay_layer,
int layer)
const;
264 uint8_t lod_current = 0;
268 size_t group_size = 0;
270 void draw_direction(Pin::Direction dir, ColorP color);
Graphical arc.
Definition: arc.hpp:17
Definition: block_symbol.hpp:20
Definition: block_symbol.hpp:51
Definition: board_decal.hpp:11
Definition: board_hole.hpp:12
Definition: board_net_tie.hpp:9
Definition: board_package.hpp:13
Definition: board_panel.hpp:7
Makes a Bus available on the schematic.
Definition: bus_label.hpp:16
Make a Bus member's Net available on the schematic.
Definition: bus_ripper.hpp:15
Definition: annotation.hpp:7
Definition: text_renderer.hpp:5
Definition: canvas.hpp:24
Definition: common.hpp:270
Definition: connection_line.hpp:12
Definition: dimension.hpp:9
Definition: fragment_cache.hpp:7
A hole with diameter and position, that's it.
Definition: hole.hpp:15
A Junction is a point in 2D-Space.
Definition: junction.hpp:20
Definition: layer_display.hpp:5
Definition: layer_provider.hpp:7
Definition: layer_range.hpp:7
LineNet is similar to Line, except it denotes electrical connection.
Definition: line_net.hpp:17
Graphical line.
Definition: line.hpp:16
Displays the junction's Net name it is attached to.
Definition: net_label.hpp:16
Definition: object_ref.hpp:7
Definition: package.hpp:29
Definition: padstack.hpp:19
Definition: picture.hpp:10
Definition: placement.hpp:8
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:25
GND symbols and the like.
Definition: power_symbol.hpp:16
Definition: schematic_block_symbol.hpp:12
Definition: schematic_junction.hpp:6
Definition: schematic_net_tie.hpp:10
Definition: schematic_symbol.hpp:15
Definition: selectables.hpp:66
Definition: selection_filter.hpp:6
For commonly used Pad shapes.
Definition: shape.hpp:15
Definition: symbol.hpp:20
Definition: symbol.hpp:72
Used wherever a user-editable text is needed.
Definition: text.hpp:15
Definition: warning.hpp:6
Definition: vector_pair.hpp:8
Definition: text_renderer.hpp:10