Horizon
Loading...
Searching...
No Matches
tool_draw_polygon_rectangle.hpp
1#pragma once
2#include "core/tool.hpp"
3#include "tool_settings_rectangle_mode.hpp"
4
5namespace horizon {
6
8public:
9 using ToolBase::ToolBase;
10 ToolResponse begin(const ToolArgs &args) override;
11 ToolResponse update(const ToolArgs &args) override;
12 bool can_begin() override;
13
14 ToolSettings *get_settings() override
15 {
16 return &settings;
17 }
18
19 void apply_settings() override;
20
21 std::set<InToolActionID> get_actions() const override
22 {
23 using I = InToolActionID;
24 return {
25 I::LMB,
26 I::CANCEL,
27 I::RMB,
28 I::RECTANGLE_MODE,
29 I::POLYGON_CORNER_RADIUS,
30 I::POLYGON_DECORATION_POSITION,
31 I::POLYGON_DECORATION_SIZE,
32 I::POLYGON_DECORATION_STYLE,
33 };
34 }
35
36private:
38 using Mode = ToolSettingsRectangleMode::Mode;
39
40 enum class Decoration { NONE, CHAMFER, NOTCH };
41
42 Decoration decoration = Decoration::NONE;
43 int decoration_pos = 0;
44 Coordi first_pos;
45 Coordi second_pos;
46 int step = 0;
47 uint64_t decoration_size = 1.2_mm;
48 int64_t corner_radius = 0;
49
50 class Polygon *temp = nullptr;
51
52 void update_polygon();
53 void update_tip();
54};
55} // namespace horizon
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition polygon.hpp:25
This is what a Tool receives when the user did something.
Definition tool_pub.hpp:23
Common interface for all Tools.
Definition tool_pub.hpp:94
Definition tool_draw_polygon_rectangle.hpp:7
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_draw_polygon_rectangle.cpp:154
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition tool_draw_polygon_rectangle.cpp:208
bool can_begin() override
Definition tool_draw_polygon_rectangle.cpp:11
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40
Definition tool_settings_rectangle_mode.hpp:5
Definition tool_pub.hpp:82