Horizon
tool_round_off_vertex.hpp
1 #pragma once
2 #include "common/polygon.hpp"
3 #include "core/tool.hpp"
4 #include <forward_list>
5 
6 namespace horizon {
7 
8 class ToolRoundOffVertex : public ToolBase {
9 public:
10  ToolRoundOffVertex(IDocument *c, ToolID tid);
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14  bool is_specific() override
15  {
16  return true;
17  }
18  std::set<InToolActionID> get_actions() const override
19  {
20  using I = InToolActionID;
21  return {
22  I::LMB, I::CANCEL, I::RMB, I::ENTER_DATUM, I::FLIP_ARC,
23  };
24  }
25 
26 private:
27  Polygon *poly = nullptr;
28  int wrap_index(int i) const;
29 
30  Polygon::Vertex *vxn = nullptr;
31  Polygon::Vertex *vxp = nullptr;
32 
33  Coord<double> p0;
34  Coord<double> vp;
35  Coord<double> vn;
36  Coord<double> vh;
37  double delta_max = 0;
38  double r_max = 0;
39  double alpha = 0;
40  double radius_current = 0;
41 
42  void update_poly(double r);
43  void update_cursor(const Coordi &c);
44  void update_tip();
45 
46  bool orientation = false;
47 };
48 } // namespace horizon
horizon::IDocument
Definition: idocument.hpp:5
horizon::ToolRoundOffVertex::is_specific
bool is_specific() override
Definition: tool_round_off_vertex.hpp:14
horizon::ToolRoundOffVertex::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_round_off_vertex.cpp:41
horizon::ToolRoundOffVertex
Definition: tool_round_off_vertex.hpp:8
horizon::ToolRoundOffVertex::can_begin
bool can_begin() override
Definition: tool_round_off_vertex.cpp:16
horizon::ToolBase
Common interface for all Tools.
Definition: tool.hpp:121
horizon::ToolResponse
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42
horizon::ToolArgs
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
horizon::ToolRoundOffVertex::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_round_off_vertex.cpp:136