2 #include "annotation.hpp" 3 #include "common/common.hpp" 4 #include "common/text.hpp" 5 #include "layer_display.hpp" 6 #include "selectables.hpp" 7 #include "selection_filter.hpp" 9 #include "triangle.hpp" 10 #include "util/placement.hpp" 13 #include <sigc++/sigc++.h> 14 #include <unordered_map> 17 class Canvas :
public sigc::trackable {
29 void update(
const class Sheet &sheet);
30 void update(
const class Padstack &padstack);
31 void update(
const class Package &pkg);
33 void update(
const class Board &brd);
35 ObjectRef add_line(
const std::deque<Coordi> &pts, int64_t width, ColorP color,
int layer);
39 void set_flags(
const ObjectRef &r, uint8_t mask_set, uint8_t mask_clear);
40 void set_flags_all(uint8_t mask_set, uint8_t mask_clear);
47 virtual void update_markers()
52 void set_layer_display(
int index,
const LayerDisplay &ld);
55 bool layer_is_visible(
int layer)
const;
57 bool show_all_junctions_in_schematic =
false;
60 std::unordered_map<int, std::vector<Triangle>> triangles;
61 void add_triangle(
int layer,
const Coordf &p0,
const Coordf &p1,
const Coordf &p2, ColorP co, uint8_t flg = 0);
63 std::map<ObjectRef, std::map<int, std::deque<std::pair<size_t, size_t>>>> object_refs;
64 std::vector<ObjectRef> object_refs_current;
65 void render(
const class Symbol &sym,
bool on_sheet =
false,
bool smashed =
false);
66 void render(
const class Junction &junc,
bool interactive =
true, ObjectType mode = ObjectType::INVALID);
67 void render(
const class Line &line,
bool interactive =
true);
68 void render(
const class SymbolPin &pin,
bool interactive =
true);
69 void render(
const class Arc &arc,
bool interactive =
true);
70 void render(
const class Sheet &sheet);
72 void render(
const class LineNet &line);
73 void render(
const class NetLabel &label);
74 void render(
const class BusLabel &label);
75 void render(
const class Warning &warn);
77 void render(
const class BusRipper &ripper);
78 void render(
const class Frame &frame);
79 void render(
const class Text &text,
bool interactive =
true,
bool reorient =
true);
80 void render(
const class Padstack &padstack,
bool interactive =
true);
81 void render(
const class Polygon &polygon,
bool interactive =
true);
82 void render(
const class Shape &shape,
bool interactive =
true);
83 void render(
const class Hole &hole,
bool interactive =
true);
84 void render(
const class Package &package,
bool interactive =
true,
bool smashed =
false);
85 void render(
const class Pad &pad);
86 void render(
const class Buffer &buf);
87 void render(
const class Board &brd);
90 void render(
const class Track &track);
91 void render(
const class Via &via);
94 bool needs_push =
true;
95 virtual void request_push() = 0;
96 virtual void push() = 0;
98 void set_lod_size(
float size);
101 bool tr =
true, uint64_t width = 0);
102 void draw_cross(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
103 bool tr =
true, uint64_t width = 0);
104 void draw_plus(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
105 bool tr =
true, uint64_t width = 0);
106 void draw_box(
const Coord<float> &o,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
107 bool tr =
true, uint64_t width = 0);
108 void draw_arc(
const Coord<float> ¢er,
float radius,
float a0,
float a1, ColorP color = ColorP::FROM_LAYER,
109 int layer = 10000,
bool tr =
true, uint64_t width = 0);
110 void draw_arc2(
const Coord<float> ¢er,
float radius0,
float a0,
float radius1,
float a1,
111 ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
bool tr =
true, uint64_t width = 0);
112 std::pair<Coordf, Coordf> draw_text0(
const Coordf &p,
float size,
const std::string &rtext,
int angle,
bool flip,
113 TextOrigin origin, ColorP color,
int layer = 10000, uint64_t width = 0,
116 enum class TextBoxMode { FULL, LOWER, UPPER };
117 void draw_text_box(
const Placement &q,
float width,
float height,
const std::string &s, ColorP color,
int layer,
118 uint64_t text_width, TextBoxMode mode);
120 void draw_error(
const Coordf ¢er,
float scale,
const std::string &text,
bool tr =
true);
121 std::tuple<Coordf, Coordf, Coordi> draw_flag(
const Coordf &position,
const std::string &txt, int64_t size,
122 Orientation orientation, ColorP color = ColorP::FROM_LAYER);
123 void draw_lock(
const Coordf ¢er,
float size, ColorP color = ColorP::FROM_LAYER,
int layer = 10000,
126 virtual void img_net(
const class Net *net)
129 virtual void img_polygon(
const Polygon &poly,
bool tr =
true)
132 virtual void img_padstack(
const Padstack &ps)
135 virtual void img_set_padstack(
bool v)
138 virtual void img_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
int layer = 10000,
bool tr =
true);
139 virtual void img_hole(
const Hole &hole)
142 virtual void img_patch_type(PatchType type)
145 virtual void img_text(
const Text &txt, std::pair<Coordf, Coordf> &extents)
148 bool img_mode =
false;
151 void transform_save();
152 void transform_restore();
153 std::list<Placement> transforms;
156 std::set<Target> targets;
160 Color get_layer_color(
int layer);
162 std::map<int, LayerDisplay> layer_display;
169 std::array<std::array<float, 4>, 14> colors;
174 UUID sheet_current_uuid;
176 Triangle::Type triangle_type_current = Triangle::Type::NONE;
178 std::map<int, int> overlay_layers;
179 int overlay_layer_current = 30000;
180 int get_overlay_layer(
int layer);
183 void img_text_layer(
int l);
184 int img_text_last_layer = 10000;
185 void img_text_line(
const Coordi &p0,
const Coordi &p1,
const uint64_t width,
bool tr =
true);
187 int annotation_layer_current = 20000;
188 std::map<int, CanvasAnnotation> annotations;
190 uint8_t lod_current = 0;
Definition: annotation.hpp:7
Definition: symbol.hpp:22
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:27
GND symbols and the like.
Definition: power_symbol.hpp:23
Makes a Bus available on the schematic.
Definition: bus_label.hpp:22
Border around a sheet.
Definition: frame.hpp:16
Graphical line.
Definition: line.hpp:19
For commonly used Pad shapes.
Definition: shape.hpp:19
LineNet is similar to Line, except it denotes electrical connection.
Definition: line_net.hpp:24
Definition: placement.hpp:8
Definition: canvas.hpp:163
Make a Bus member's Net available on the schematic.
Definition: bus_ripper.hpp:21
Definition: package.hpp:25
Definition: canvas.hpp:17
Definition: buffer.hpp:24
Displays the junction's Net name it is attached to.
Definition: net_label.hpp:21
Definition: board_hole.hpp:16
Definition: padstack.hpp:20
Used wherever a user-editable text is needed.
Definition: text.hpp:18
Definition: warning.hpp:6
Definition: dimension.hpp:12
Definition: selection_filter.hpp:6
Definition: layer_provider.hpp:7
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: symbol.hpp:70
Definition: layer_display.hpp:5
Definition: selectables.hpp:61
A Junction is a point in 2D-Space.
Definition: junction.hpp:25
Definition: common.hpp:205
Definition: schematic_symbol.hpp:19
Graphical arc.
Definition: arc.hpp:20
Definition: triangle.hpp:27
Definition: board_package.hpp:17
A hole with diameter and position, that's it.
Definition: hole.hpp:19