Horizon
tool_map_pin.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 
4 namespace horizon {
5 class ToolMapPin : public ToolBase {
6 public:
7  ToolMapPin(IDocument *c, ToolID tid);
8  ToolResponse begin(const ToolArgs &args) override;
9  ToolResponse update(const ToolArgs &args) override;
10  bool can_begin() override;
11  ~ToolMapPin();
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 
20 private:
21  std::vector<std::pair<const class Pin *, bool>> pins;
22  unsigned int pin_index = 0;
23  class SymbolPin *pin = nullptr;
24  SymbolPin *pin_last = nullptr;
25  SymbolPin *pin_last2 = nullptr;
26  void create_pin(const UUID &uu);
27  bool can_autoplace() const;
28  void update_tip();
29  class CanvasAnnotation *annotation = nullptr;
30  void update_annotation();
31 };
32 } // namespace horizon
horizon::IDocument
Definition: idocument.hpp:5
horizon::CanvasAnnotation
Definition: annotation.hpp:7
horizon::ToolMapPin::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_map_pin.cpp:150
horizon::SymbolPin
Definition: symbol.hpp:19
horizon::ToolMapPin::can_begin
bool can_begin() override
Definition: tool_map_pin.cpp:15
horizon::ToolBase
Common interface for all Tools.
Definition: tool.hpp:121
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
horizon::ToolMapPin::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_map_pin.cpp:36
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::ToolMapPin
Definition: tool_map_pin.hpp:5