Horizon
tool_draw_arc.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_line_width_setting.hpp"
4 
5 namespace horizon {
6 
8 public:
9  using ToolHelperLineWidthSetting::ToolHelperLineWidthSetting;
10  ToolResponse begin(const ToolArgs &args) override;
11  ToolResponse update(const ToolArgs &args) override;
12  bool can_begin() override;
13  void apply_settings() override;
14  std::set<InToolActionID> get_actions() const override
15  {
16  using I = InToolActionID;
17  return {
18  I::LMB, I::CANCEL, I::RMB, I::ENTER_WIDTH, I::FLIP_ARC, I::ARC_MODE,
19  };
20  }
21  ~ToolDrawArc();
22 
23 private:
24  enum class State { FROM, TO, CENTER, CENTER_START, RADIUS, START_ANGLE, END_ANGLE };
25  State state;
26  class Junction *temp_junc = 0;
27  Junction *from_junc = 0;
28  Junction *to_junc = 0;
29  class Arc *temp_arc = 0;
30  Junction *make_junction(const Coordd &coords);
31  void update_tip();
32  double radius = 0;
33  double start_angle = 0;
34  void set_radius_angle(double r, double a, double b);
35  void update_end_angle(const Coordi &c);
36  bool flipped = false;
37  class CanvasAnnotation *annotation = nullptr;
38 };
39 } // namespace horizon
Graphical arc.
Definition: arc.hpp:20
Definition: annotation.hpp:7
A Junction is a point in 2D-Space.
Definition: junction.hpp:20
This is what a Tool receives when the user did something.
Definition: tool_pub.hpp:23
Definition: tool_draw_arc.hpp:7
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_draw_arc.cpp:113
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_draw_arc.cpp:30
bool can_begin() override
Definition: tool_draw_arc.cpp:15
Definition: tool_helper_line_width_setting.hpp:6
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool_pub.hpp:40