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 void update(
const class Board &brd);
37 void update(
const class Frame &fr,
bool edit =
true);
39 ObjectRef add_line(
const std::deque<Coordi> &pts,
int64_t width, ColorP color,
int layer);
48 virtual void update_markers()
53 void set_layer_display(
int index,
const LayerDisplay &ld);
56 void set_layer_color(
int layer,
const Color &color);
58 bool layer_is_visible(
int layer)
const;
60 bool show_all_junctions_in_schematic =
false;
61 bool show_text_in_tracks =
false;
62 bool fast_draw =
false;
64 virtual bool get_flip_view()
const
69 std::pair<Coordf, Coordf> get_bbox(
bool visible_only =
true)
const;
73 std::map<int, std::vector<Triangle>> triangles;
76 std::map<ObjectRef, std::map<int, std::pair<size_t, size_t>>> object_refs;
77 std::vector<ObjectRef> object_refs_current;
78 void render(
const class Symbol &sym,
bool on_sheet =
false,
bool smashed =
false);
79 void render(
const class Junction &junc,
bool interactive =
true, ObjectType mode = ObjectType::INVALID);
80 void render(
const class Line &line,
bool interactive =
true);
81 void render(
const class SymbolPin &pin,
bool interactive =
true);
82 void render(
const class Arc &arc,
bool interactive =
true);
83 void render(
const class Sheet &sheet);
85 void render(
const class LineNet &line);
86 void render(
const class NetLabel &label);
87 void render(
const class BusLabel &label);
88 void render(
const class Warning &warn);
90 void render(
const class BusRipper &ripper);
91 void render(
const class Text &text,
bool interactive =
true);
92 void render(
const class Padstack &padstack,
bool interactive =
true);
93 void render(
const class Polygon &polygon,
bool interactive =
true);
94 void render(
const class Shape &shape,
bool interactive =
true);
95 void render(
const class Hole &hole,
bool interactive =
true);
96 void render(
const class Package &package,
bool interactive =
true,
bool smashed =
false,
97 bool omit_silkscreen =
false);
98 void render_pad_overlay(
const class Pad &pad);
99 void render(
const class Pad &pad);
100 void render(
const class Buffer &buf);
101 void render(
const class Board &brd);
103 void render(
const class BoardHole &hole);
104 void render(
const class Track &track);
105 void render(
const class Via &via);
107 void render(
const class Frame &frame,
bool on_sheet =
false);
110 bool needs_push =
true;
111 virtual void request_push() = 0;
112 virtual void push() = 0;
114 void set_lod_size(
float size);
117 bool tr =
true,
uint64_t width = 0);
118 void draw_cross(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
119 bool tr =
true,
uint64_t width = 0);
120 void draw_plus(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
121 bool tr =
true,
uint64_t width = 0);
122 void draw_box(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
123 bool tr =
true,
uint64_t width = 0);
124 void draw_arc(
const Coord<float> ¢er,
float radius,
float a0,
float a1, ColorP color = ColorP::FROM_LAYER,
125 int layer = 10000,
bool tr =
true,
uint64_t width = 0);
126 std::pair<Coordf, Coordf> draw_arc2(
const Coord<float> ¢er,
float radius0,
float a0,
float radius1,
float a1,
127 ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
bool tr =
true,
129 std::pair<Coordf, Coordf> draw_text0(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
130 TextOrigin origin, ColorP color,
int layer = 10000,
uint64_t width = 0,
131 bool draw =
true, TextData::Font font = TextData::Font::SIMPLEX,
132 bool center =
false,
bool mirror =
false);
134 virtual void draw_bitmap_text(
const Coordf &p,
float scale,
const std::string &rtext,
int angle, ColorP color,
139 virtual std::pair<Coordf, Coordf> measure_bitmap_text(
const std::string &text)
const
141 return {{0, 0}, {0, 0}};
144 enum class TextBoxMode { FULL, LOWER, UPPER };
146 virtual void draw_bitmap_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
147 int layer, TextBoxMode mode)
151 void draw_error(
const Coordf ¢er,
float scale,
const std::string &text,
bool tr =
true);
152 std::tuple<Coordf, Coordf, Coordi> draw_flag(
const Coordf &position,
const std::string &txt,
int64_t size,
153 Orientation orientation, ColorP color = ColorP::FROM_LAYER);
154 void draw_lock(
const Coordf ¢er,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
157 virtual void img_net(
const class Net *net)
160 virtual void img_polygon(
const Polygon &poly,
bool tr =
true)
163 virtual void img_padstack(
const Padstack &ps)
166 virtual void img_set_padstack(
bool v)
169 virtual void img_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
int layer = 10000,
bool tr =
true);
170 virtual void img_hole(
const Hole &hole)
173 virtual void img_patch_type(PatchType type)
176 virtual void img_text(
const Text &txt, std::pair<Coordf, Coordf> &extents)
179 virtual void img_draw_text(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
180 TextOrigin origin,
int layer = 10000,
uint64_t width = 0,
181 TextData::Font font = TextData::Font::SIMPLEX,
bool center =
false,
bool mirror =
false)
184 bool img_mode =
false;
185 bool img_auto_line =
false;
188 void transform_save();
189 void transform_restore();
190 std::list<Placement> transforms;
193 std::vector<Target> targets;
197 std::map<int, Color> layer_colors;
198 Color get_layer_color(
int layer)
const;
200 std::map<int, LayerDisplay> layer_display;
202 UUID sheet_current_uuid;
204 Triangle::Type triangle_type_current = Triangle::Type::NONE;
206 std::map<std::pair<int, bool>,
int> overlay_layers;
207 int overlay_layer_current = 30000;
208 int get_overlay_layer(
int layer,
bool ignore_flip =
false);