Antares Simulator
Power System Simulator
addtools.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_TOOLBOX_MAP_CONTROLS_ADD_TOOLS_H__
22 #define __ANTARES_TOOLBOX_MAP_CONTROLS_ADD_TOOLS_H__
23 
24 #include "../tools/tool.h"
25 #include "../manager.h"
26 
27 namespace Antares::Map::Private
28 {
29 class AddingToolsHelper final
30 {
31 public:
32  AddingToolsHelper(Manager& manager,
33  Tool::List& list,
34  const int selectedCount,
35  const int connectionSelectedCount,
36  const wxPoint& top,
37  const wxPoint& bottom);
38 
39  Tool::Tool* operator()();
40 
41 private:
42  template<class T>
43  T* createInstance()
44  {
45  T* t = new T(pManager);
46  pList.push_back(t);
47  return t;
48  }
49 
50  template<class T>
51  T* createToolToTheLeft()
52  {
53  T* t = createInstance<T>();
54  t->x(pTop.x - t->width());
55  t->y(pTop.y);
56  pTop.y += t->height();
57  return t;
58  }
59 
60  template<class T>
61  T* createToolToTheBottom()
62  {
63  T* t = createInstance<T>();
64  t->x(pBottom.x);
65  t->y(pBottom.y);
66  pBottom.x += t->width();
67  return t;
68  }
69 
70  void createToolsForRealNodes();
71  void createToolsForConnections();
72  Tool::Tool* createCommonTools(const bool haveRealNodes, const bool haveConnections);
73 
74 private:
75  Manager& pManager;
76  Tool::List& pList;
77  const int pSelectedCount;
78  const int pConnectionsSelectedCount;
79  wxPoint pTop;
80  wxPoint pBottom;
81 };
82 
83 } // namespace Antares::Map::Private
84 
85 #endif // __ANTARES_TOOLBOX_MAP_CONTROLS_ADD_TOOLS_H__
A convenient container for nodes on the graph.
Definition: manager.h:44
Visual component to make an action on the selected items.
Definition: tool.h:48