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 "util/vector_pair.hpp"
34 void update(
const class Sheet &sheet);
35 void update(
const class Padstack &padstack,
bool edit =
true);
36 void update(
const class Package &pkg,
bool edit =
true);
38 enum class PanelMode { INCLUDE, SKIP };
39 void update(
const class Board &brd, PanelMode mode = PanelMode::INCLUDE);
40 void update(
const class Frame &fr,
bool edit =
true);
42 ObjectRef add_line(
const std::deque<Coordi> &pts,
int64_t width, ColorP color,
int layer);
54 virtual void update_markers()
59 void set_layer_display(
int index,
const LayerDisplay &ld);
60 void set_layer_color(
int layer,
const Color &color);
62 bool layer_is_visible(
int layer)
const;
64 bool show_all_junctions_in_schematic =
false;
65 bool show_text_in_tracks =
false;
66 bool show_text_in_vias =
false;
68 virtual bool get_flip_view()
const
73 std::pair<Coordf, Coordf> get_bbox(
bool visible_only =
true)
const;
75 static const int first_overlay_layer = 30000;
78 std::map<int, vector_pair<Triangle, TriangleInfo>> triangles;
79 std::list<CanvasPicture> pictures;
83 using ObjectRefIdx = std::map<int, std::pair<size_t, size_t>>;
84 std::unordered_map<ObjectRef, ObjectRefIdx> object_refs;
85 void begin_group(
int layer);
87 std::vector<ObjectRef> object_refs_current;
88 std::vector<ObjectRefIdx *> object_ref_idx;
89 void object_ref_push(
const ObjectRef &ref);
90 template <
typename... Args>
void object_ref_push(Args... args)
94 void object_ref_pop();
96 void render(
const class Symbol &sym,
bool on_sheet =
false,
bool smashed =
false, ColorP co = ColorP::FROM_LAYER);
97 void render(
const class Junction &junc,
bool interactive =
true, ObjectType mode = ObjectType::INVALID);
98 void render(
const class Line &line,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
99 void render(
const class SymbolPin &pin,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
100 void render(
const class Arc &arc,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
101 void render(
const class Sheet &sheet);
103 void render(
const class LineNet &line);
104 void render(
const class NetLabel &label);
105 void render(
const class BusLabel &label);
106 void render(
const class Warning &warn);
108 void render(
const class BusRipper &ripper);
109 void render(
const class Text &text,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
110 void render(
const class Padstack &padstack,
bool interactive =
true);
111 void render(
const class Polygon &polygon,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
112 void render(
const class Shape &shape,
bool interactive =
true);
113 void render(
const class Hole &hole,
bool interactive =
true);
114 void render(
const class Package &package,
bool interactive =
true,
bool smashed =
false,
115 bool omit_silkscreen =
false,
bool omit_outline =
false);
116 void render_pad_overlay(
const class Pad &pad);
117 void render(
const class Pad &pad);
118 void render(
const class Buffer &buf);
119 enum class OutlineMode { INCLUDE, OMIT };
120 void render(
const class Board &brd,
bool interactive =
true, PanelMode mode = PanelMode::INCLUDE,
121 OutlineMode outline_mode = OutlineMode::INCLUDE);
122 void render(
const class BoardPackage &pkg,
bool interactive =
true);
123 void render(
const class BoardHole &hole,
bool interactive =
true);
124 void render(
const class Track &track,
bool interactive =
true);
125 void render(
const class Via &via,
bool interactive =
true);
127 void render(
const class Frame &frame,
bool on_sheet =
false);
130 void render(
const class Picture &pic);
132 bool needs_push =
true;
133 virtual void request_push() = 0;
134 virtual void push() = 0;
136 void set_lod_size(
float size);
139 bool tr =
true,
uint64_t width = 0);
140 void draw_cross(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
141 bool tr =
true,
uint64_t width = 0);
142 void draw_plus(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
143 bool tr =
true,
uint64_t width = 0);
144 void draw_box(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
145 bool tr =
true,
uint64_t width = 0);
146 void draw_arc(
const Coord<float> ¢er,
float radius,
float a0,
float a1, ColorP color = ColorP::FROM_LAYER,
147 int layer = 10000,
bool tr =
true,
uint64_t width = 0);
148 std::pair<Coordf, Coordf> draw_arc2(
const Coord<float> ¢er,
float radius0,
float a0,
float radius1,
float a1,
149 ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
bool tr =
true,
151 std::pair<Coordf, Coordf> draw_text0(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
152 TextOrigin origin, ColorP color,
int layer = 10000,
uint64_t width = 0,
153 bool draw =
true, TextData::Font font = TextData::Font::SIMPLEX,
154 bool center =
false,
bool mirror =
false);
156 virtual void draw_bitmap_text(
const Coordf &p,
float scale,
const std::string &rtext,
int angle, ColorP color,
161 virtual std::pair<Coordf, Coordf> measure_bitmap_text(
const std::string &text)
const
163 return {{0, 0}, {0, 0}};
166 enum class TextBoxMode { FULL, LOWER, UPPER };
168 virtual void draw_bitmap_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
169 int layer, TextBoxMode mode)
173 void draw_error(
const Coordf ¢er,
float scale,
const std::string &text,
bool tr =
true);
174 std::tuple<Coordf, Coordf, Coordi> draw_flag(
const Coordf &position,
const std::string &txt,
int64_t size,
175 Orientation orientation, ColorP color = ColorP::FROM_LAYER);
176 void draw_lock(
const Coordf ¢er,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
179 virtual void img_net(
const class Net *net)
182 virtual void img_polygon(
const Polygon &poly,
bool tr =
true)
185 virtual void img_padstack(
const Padstack &ps)
188 virtual void img_set_padstack(
bool v)
191 virtual void img_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
int layer = 10000,
bool tr =
true);
192 virtual void img_hole(
const Hole &hole)
195 virtual void img_patch_type(PatchType type)
198 virtual void img_text(
const Text &txt, std::pair<Coordf, Coordf> &extents)
201 virtual void img_draw_text(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
202 TextOrigin origin,
int layer = 10000,
uint64_t width = 0,
203 TextData::Font font = TextData::Font::SIMPLEX,
bool center =
false,
bool mirror =
false)
206 bool img_mode =
false;
207 bool img_auto_line =
false;
210 void transform_save();
211 void transform_restore();
212 std::list<Placement> transforms;
215 std::vector<Target> targets;
219 std::map<int, Color> layer_colors;
220 Color get_layer_color(
int layer)
const;
222 std::map<int, LayerDisplay> layer_display;
224 UUID sheet_current_uuid;
226 TriangleInfo::Type triangle_type_current = TriangleInfo::Type::NONE;
228 std::map<std::pair<int, bool>,
int> overlay_layers;
229 int overlay_layer_current = first_overlay_layer;
230 int get_overlay_layer(
int layer,
bool ignore_flip =
false);
231 bool is_overlay_layer(
int overlay_layer,
int layer)
const;
240 size_t group_size = 0;