Horizon
tool_map_pin.hpp
1#pragma once
2#include "core/tool.hpp"
3
4namespace horizon {
5class ToolMapPin : 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;
12 std::set<InToolActionID> get_actions() const override
13 {
14 using I = InToolActionID;
15 return {
16 I::LMB, I::CANCEL, I::RMB, I::ROTATE, I::MIRROR, I::EDIT, I::AUTOPLACE_ALL_PINS, I::AUTOPLACE_NEXT_PIN,
17 };
18 }
19
20private:
21 std::vector<std::pair<const class Pin *, bool>> pins;
22 std::optional<UUID> map_pin_dialog();
23 unsigned int pin_index = 0;
24 class SymbolPin *pin = nullptr;
25 SymbolPin *pin_last = nullptr;
26 SymbolPin *pin_last2 = nullptr;
27 void create_pin(const UUID &uu);
28 bool can_autoplace() const;
29 void update_tip();
30 class CanvasAnnotation *annotation = nullptr;
31 void update_annotation();
32};
33} // namespace horizon
Definition: annotation.hpp:7
Definition: symbol.hpp:20
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_map_pin.hpp:5
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_map_pin.cpp:147
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_map_pin.cpp:33
bool can_begin() override
Definition: tool_map_pin.cpp:12
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool_pub.hpp:40
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16