2 #include "common/common.hpp"
3 #include "common/text.hpp"
4 #include "layer_display.hpp"
5 #include "selectables.hpp"
6 #include "selection_filter.hpp"
8 #include "triangle.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>
32 void update(
const class Sheet &sheet);
33 void update(
const class Padstack &padstack,
bool edit =
true);
34 void update(
const class Package &pkg,
bool edit =
true);
36 enum class PanelMode { INCLUDE, SKIP };
37 void update(
const class Board &brd, PanelMode mode = PanelMode::INCLUDE);
38 void update(
const class Frame &fr,
bool edit =
true);
40 ObjectRef add_line(
const std::deque<Coordi> &pts,
int64_t width, ColorP color,
int layer);
49 virtual void update_markers()
54 void set_layer_display(
int index,
const LayerDisplay &ld);
57 void set_layer_color(
int layer,
const Color &color);
59 bool layer_is_visible(
int layer)
const;
61 bool show_all_junctions_in_schematic =
false;
62 bool show_text_in_tracks =
false;
63 bool fast_draw =
false;
65 virtual bool get_flip_view()
const
70 std::pair<Coordf, Coordf> get_bbox(
bool visible_only =
true)
const;
77 static const int first_overlay_layer = 30000;
80 std::map<int, std::vector<Triangle>> triangles;
83 std::map<ObjectRef, std::map<int, std::pair<size_t, size_t>>> object_refs;
84 std::vector<ObjectRef> object_refs_current;
85 void render(
const class Symbol &sym,
bool on_sheet =
false,
bool smashed =
false, ColorP co = ColorP::FROM_LAYER);
86 void render(
const class Junction &junc,
bool interactive =
true, ObjectType mode = ObjectType::INVALID);
87 void render(
const class Line &line,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
88 void render(
const class SymbolPin &pin,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
89 void render(
const class Arc &arc,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
90 void render(
const class Sheet &sheet);
92 void render(
const class LineNet &line);
93 void render(
const class NetLabel &label);
94 void render(
const class BusLabel &label);
95 void render(
const class Warning &warn);
97 void render(
const class BusRipper &ripper);
98 void render(
const class Text &text,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
99 void render(
const class Padstack &padstack,
bool interactive =
true);
100 void render(
const class Polygon &polygon,
bool interactive =
true, ColorP co = ColorP::FROM_LAYER);
101 void render(
const class Shape &shape,
bool interactive =
true);
102 void render(
const class Hole &hole,
bool interactive =
true);
103 void render(
const class Package &package,
bool interactive =
true,
bool smashed =
false,
104 bool omit_silkscreen =
false,
bool omit_outline =
false);
105 void render_pad_overlay(
const class Pad &pad);
106 void render(
const class Pad &pad);
107 void render(
const class Buffer &buf);
108 enum class OutlineMode { INCLUDE, OMIT };
109 void render(
const class Board &brd,
bool interactive =
true, PanelMode mode = PanelMode::INCLUDE,
110 OutlineMode outline_mode = OutlineMode::INCLUDE);
111 void render(
const class BoardPackage &pkg,
bool interactive =
true);
112 void render(
const class BoardHole &hole,
bool interactive =
true);
113 void render(
const class Track &track,
bool interactive =
true);
114 void render(
const class Via &via,
bool interactive =
true);
116 void render(
const class Frame &frame,
bool on_sheet =
false);
118 void render(
const class Airwire &airwire);
121 bool needs_push =
true;
122 virtual void request_push() = 0;
123 virtual void push() = 0;
125 void set_lod_size(
float size);
128 bool tr =
true,
uint64_t width = 0);
129 void draw_cross(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
130 bool tr =
true,
uint64_t width = 0);
131 void draw_plus(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
132 bool tr =
true,
uint64_t width = 0);
133 void draw_box(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
134 bool tr =
true,
uint64_t width = 0);
135 void draw_arc(
const Coord<float> ¢er,
float radius,
float a0,
float a1, ColorP color = ColorP::FROM_LAYER,
136 int layer = 10000,
bool tr =
true,
uint64_t width = 0);
137 std::pair<Coordf, Coordf> draw_arc2(
const Coord<float> ¢er,
float radius0,
float a0,
float radius1,
float a1,
138 ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
bool tr =
true,
140 std::pair<Coordf, Coordf> draw_text0(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
141 TextOrigin origin, ColorP color,
int layer = 10000,
uint64_t width = 0,
142 bool draw =
true, TextData::Font font = TextData::Font::SIMPLEX,
143 bool center =
false,
bool mirror =
false);
145 virtual void draw_bitmap_text(
const Coordf &p,
float scale,
const std::string &rtext,
int angle, ColorP color,
150 virtual std::pair<Coordf, Coordf> measure_bitmap_text(
const std::string &text)
const
152 return {{0, 0}, {0, 0}};
155 enum class TextBoxMode { FULL, LOWER, UPPER };
157 virtual void draw_bitmap_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
158 int layer, TextBoxMode mode)
162 void draw_error(
const Coordf ¢er,
float scale,
const std::string &text,
bool tr =
true);
163 std::tuple<Coordf, Coordf, Coordi> draw_flag(
const Coordf &position,
const std::string &txt,
int64_t size,
164 Orientation orientation, ColorP color = ColorP::FROM_LAYER);
165 void draw_lock(
const Coordf ¢er,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
168 virtual void img_net(
const class Net *net)
171 virtual void img_polygon(
const Polygon &poly,
bool tr =
true)
174 virtual void img_padstack(
const Padstack &ps)
177 virtual void img_set_padstack(
bool v)
180 virtual void img_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
int layer = 10000,
bool tr =
true);
181 virtual void img_hole(
const Hole &hole)
184 virtual void img_patch_type(PatchType type)
187 virtual void img_text(
const Text &txt, std::pair<Coordf, Coordf> &extents)
190 virtual void img_draw_text(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
191 TextOrigin origin,
int layer = 10000,
uint64_t width = 0,
192 TextData::Font font = TextData::Font::SIMPLEX,
bool center =
false,
bool mirror =
false)
195 bool img_mode =
false;
196 bool img_auto_line =
false;
199 void transform_save();
200 void transform_restore();
201 std::list<Placement> transforms;
204 std::vector<Target> targets;
208 std::map<int, Color> layer_colors;
209 Color get_layer_color(
int layer)
const;
211 std::map<int, LayerDisplay> layer_display;
213 UUID sheet_current_uuid;
215 Triangle::Type triangle_type_current = Triangle::Type::NONE;
217 std::map<std::pair<int, bool>,
int> overlay_layers;
218 int overlay_layer_current = first_overlay_layer;
219 int get_overlay_layer(
int layer,
bool ignore_flip =
false);