Horizon
Loading...
Searching...
No Matches
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,
17 I::CANCEL,
18 I::RMB,
19 I::ROTATE,
20 I::MIRROR,
21 I::EDIT,
22 I::AUTOPLACE_ALL_PINS,
23 I::AUTOPLACE_NEXT_PIN,
24 I::TOGGLE_NAME_ORIENTATION,
25 };
26 }
27
28 class Settings : public ToolSettings {
29 public:
30 json serialize() const override;
31 void load_from_json(const json &j) override;
32 Orientation orientation = Orientation::RIGHT;
33 };
34
35 ToolSettings *get_settings() override
36 {
37 return &settings;
38 }
39
40private:
41 Settings settings;
42
43 std::vector<std::pair<const class Pin *, bool>> pins;
44 std::optional<UUID> map_pin_dialog();
45 unsigned int pin_index = 0;
46 class SymbolPin *pin = nullptr;
47 SymbolPin *pin_last = nullptr;
48 SymbolPin *pin_last2 = nullptr;
49 void create_pin(const UUID &uu);
50 bool can_autoplace() const;
51 void update_tip();
52 class CanvasAnnotation *annotation = nullptr;
53 void update_annotation();
54};
55} // 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:28
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:157
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_map_pin.cpp:42
bool can_begin() override
Definition tool_map_pin.cpp:13
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40
Definition tool_pub.hpp:82
This class encapsulates a UUID and allows it to be uses as a value type.
Definition uuid.hpp:16
a class to store JSON values
Definition json.hpp:177