Horizon
Loading...
Searching...
No Matches
tool_measure.hpp
1#pragma once
2#include "core/tool.hpp"
3
4namespace horizon {
5class ToolMeasure : public ToolBase {
6public:
7 using ToolBase::ToolBase;
8 ToolResponse begin(const ToolArgs &args) override;
9 ToolResponse update(const ToolArgs &args) override;
10 bool can_begin() override
11 {
12 return true;
13 }
14 bool is_specific() override
15 {
16 return false;
17 }
18 std::set<InToolActionID> get_actions() const override
19 {
20 using I = InToolActionID;
21 return {
22 I::LMB,
23 I::CANCEL,
24 I::RMB,
25 };
26 }
27 ~ToolMeasure();
28
29private:
30 class CanvasAnnotation *annotation = nullptr;
31
32 enum class State { FROM, TO, DONE };
33 State state = State::FROM;
34 void update_tip();
35
36 Coordi from;
37 Coordi to;
38
39 std::string s_from;
40 std::string s_to;
41};
42} // namespace horizon
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_measure.hpp:5
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition tool_measure.cpp:69
bool is_specific() override
Definition tool_measure.hpp:14
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_measure.cpp:12
bool can_begin() override
Definition tool_measure.hpp:10
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40