21 #ifndef __ANTARES_TOOLBOX_MAP_CONTROL_H__
22 #define __ANTARES_TOOLBOX_MAP_CONTROL_H__
24 #include <wx/scrolwin.h>
25 #include "nodes/node.h"
27 #include "tools/tool.h"
29 #include "../notebook/notebook.h"
31 #define DEFAULT_MAP_WIDTH 1680
32 #define DEFAULT_MAP_HEIGHT 1050
34 namespace Antares::Map
42 class Control final:
public wxScrolledWindow
94 void zoom(
const double v);
103 const wxColour& getBackgroundColor()
105 return pBackgroundColor;
108 void setBackgroundColor(
const wxColour& newColor)
110 pBackgroundColor = newColor;
120 void render(wxPaintEvent& evt);
137 void paintGraph(wxDC& dc,
bool inFile =
false);
146 void mouseMoved(wxMouseEvent& evt);
148 void mouseLeftDown(wxMouseEvent& evt);
150 void mouseWheelMoved(wxMouseEvent& evt);
152 void mouseLeftUp(wxMouseEvent& evt);
154 void rightClick(wxMouseEvent& evt);
156 void mouseLeftWindow(wxMouseEvent& evt);
158 void keyPressed(wxKeyEvent& evt);
160 void keyReleased(wxKeyEvent& evt);
162 void keyChar(wxKeyEvent& evt);
164 void mouseDblClick(wxMouseEvent& evt);
171 void setpInfosAreaCount(wxStaticText* infosAreaCount)
173 pInfosAreaCount = infosAreaCount;
176 wxStaticText* getpInfosAreaCount()
178 return pInfosAreaCount;
186 void setpInfosConnxCount(wxStaticText* infosConnxCount)
188 pInfosConnxCount = infosConnxCount;
191 wxStaticText* getpInfosConnxCount()
193 return pInfosConnxCount;
196 void setPointX(wxTextCtrl* textCtrl)
201 wxTextCtrl* getPointX()
206 void setPointY(wxTextCtrl* textCtrl)
211 wxTextCtrl* getPointY()
216 void addNewNode(uint count = 1);
217 void addNewNodeWhereTheMouseIs();
218 void addNewLoadNodeWhereTheMouseIs();
219 void addNewThermalNodeWhereTheMouseIs();
220 void addNewNuclearNodeWhereTheMouseIs();
221 void addNewCCGTNodeWhereTheMouseIs();
222 void addNewCoalNodeWhereTheMouseIs();
223 void addNewOilNodeWhereTheMouseIs();
224 void addNewHydroNodeWhereTheMouseIs();
225 void addNewPSPPNodeWhereTheMouseIs();
226 void addNewRENWNodeWhereTheMouseIs();
227 void addNewWindNodeWhereTheMouseIs();
228 void addNewSolarNodeWhereTheMouseIs();
229 void addNewBioMNodeWhereTheMouseIs();
230 void addNewVoidNodeWhereTheMouseIs();
231 void addNewVirtualNodeWhereTheMouseIs();
236 void computeBoundingBoxOfSelectedNodes();
263 void updateMouseInfosFromEvent(wxMouseEvent& evt);
269 void drawGrid(wxDC& dc);
274 void drawSelectionBox(wxDC& dc);
282 void preDrawBoundingBoxOfSelectedNodes(wxDC& dc,
const BoundingBox& bb);
284 void drawSingleNode(wxDC& dc,
Node* node);
287 void removeTools(
const Tool::LifeSpan filter);
288 Tool::Tool* findTool(
const int x,
const int y);
290 void performActionForSelectedTool();
292 void addToolsForCurrentSelection();
294 void onScroll(wxScrollWinEvent& evt);
296 void onSize(wxSizeEvent& evt);
302 mouseActionSelectionBox,
303 mouseActionMoveSelection,
309 bool pInvalidated =
true;
310 bool pInvalidatedInnerCacheSize =
true;
312 wxTextCtrl* pointX =
nullptr;
313 wxTextCtrl* pointY =
nullptr;
314 wxStaticText* pInfosAreaCount =
nullptr;
315 wxStaticText* pInfosConnxCount =
nullptr;
318 wxColour pBackgroundColor = Settings::background;
320 wxPoint pCachedRealSize;
321 wxPoint pCachedBoxSize;
322 wxPoint pCachedOrigin;
323 wxPoint pOffsetForSelectedNodes;
324 wxPoint pBottomRight;
326 bool pKeyShift =
false;
327 bool pKeyCtrl =
false;
328 wxPoint pCurrentScroll;
329 wxPoint pCurrentMousePosition;
330 wxPoint pCurrentMousePositionGraph;
331 wxPoint pCurrentClientSize;
332 wxPoint pLastMousePosition;
336 MouseAction pMouseAction = mouseActionNone;
337 BoundingBox pSelectionBox;
341 int previousMaxSizeX = -1;
342 int previousMaxSizeY = -1;
348 bool wasDrawn =
false;
351 DECLARE_EVENT_TABLE()
Definition: notebook.h:61
Standard study MAP.
Definition: component.h:40
Sub-Component for drawing the map and handle user-events.
Definition: control.h:43
Antares::Component::Button * pBtnSelectionArea
The toggle button for selecting areas with the mouse.
Definition: control.h:243
Yuni::Event< void(int, int)> onPopupEvent
Popup event.
Definition: control.h:252
static size_t newUID
Control id management.
Definition: control.h:255
wxBitmap getRenderedMapImage(const MapRenderOptions &mapOptions)
Renders the map in an image object for further on-disk storage.
Definition: control.cpp:172
Control(wxWindow *parent, Component &component)
Default Constructor.
Definition: control.cpp:67
virtual ~Control()
Destructor.
Definition: control.cpp:122
void render(wxPaintEvent &evt)
Renders the map on screen.
Definition: control.cpp:152
uint areasCount() const
Get how many area we have.
Definition: control.cpp:1440
Manager & nodes
All nodes.
Definition: control.h:240
Antares::Component::Button * pBtnSelectionLink
The toggle button for selecting links with the mouse.
Definition: control.h:245
uint connectionsCount() const
Get how many connections we have.
Definition: control.cpp:1445
const size_t & getUid() const
get Control id
Definition: control.h:82
void recenter()
Definition: control.cpp:1102
Antares::Component::Button * pBtnSelectionConstraint
The toggle button for selecting clusters with the mouse.
Definition: control.h:249
void paintGraph(wxDC &dc, bool inFile=false)
Paints the.
Definition: control.cpp:293
Drawing Context.
Definition: drawingcontext.h:41
A convenient container for nodes on the graph.
Definition: manager.h:44
A node in a map.
Definition: node.h:39