Loading [MathJax]/extensions/tex2jax.js
Antares Simulator
Power System Simulator
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages Concepts
node.h
1/*
2** Copyright 2007-2024, 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_NODE_H__
22#define __ANTARES_TOOLBOX_MAP_NODE_H__
23
24#include <antares/study/study.h>
25#include <set>
26#include "item.h"
27#include "../drawingcontext.h"
28
29namespace Antares
30{
31namespace Map
32{
33// Forward declaration of the manager
34class Manager;
35class DrawingContext;
36
40class Node : public Item
41{
42public:
44
45
50
54 Node(Manager& manager, const wxString& id);
55
59 virtual ~Node();
60
62
64
65
68 bool isVisibleOnLayer(const size_t& layerID) const;
70
71 virtual Type type() const
72 {
73 return tyNode;
74 }
75
77
78 const wxString& id() const
79 {
80 return pId;
81 }
83
84 void position(const int x, const int y);
85
92 virtual void move(const int x, const int y);
93
95
96
100 virtual void refreshCache(wxDC& dc);
101
105 const wxPoint& cachedPosition() const
106 {
107 return pCachedPosition;
108 }
109
113 const wxPoint& cachedSize() const
114 {
115 return pCachedSize;
116 }
117
119
121
122
127 virtual bool contains(const int x, const int y, double& distance);
128
134 virtual bool isContained(const int x1, const int y1, const int x2, const int y2) const;
135
139 virtual void draw(DrawingContext& dc);
140
142
143 virtual void extendBoundingBox(wxPoint& topLeft, wxPoint& bottomRight);
144
145 Data::Area* attachedArea() const
146 {
147 return pAttachedArea;
148 }
149 void attachedArea(Data::Area* a)
150 {
151 pAttachedArea = a;
152 }
153
157 void addLayerVisibility(size_t id = 0);
158 void removeLayerVisibility(size_t id);
159
160protected:
161 virtual void captionHasChanged();
162 virtual void positionHasChanged();
163 virtual void colorHasChanged();
164
165 void createANewAreaIfNotAlreadyAttached();
166
167private:
169 wxString pId;
170
171 wxPoint pCachedPosition;
172 wxPoint pCachedSize;
173 wxColour pCachedColorGradientStart;
174 wxColour pCachedColorGradientEnd;
175 wxColour pCachedColorGradientStart2;
176 wxColour pCachedColorGradientEnd2;
177
178 wxColour pCachedColorText;
179 wxPen pBorderPen;
180 wxPen pShadowPen;
181
182 Data::Area* pAttachedArea;
183
184}; // class Node
185
186} // namespace Map
187} // namespace Antares
188
189#endif // __ANTARES_TOOLBOX_MAP_NODE_H__
Definition for a single area.
Definition area.h:52
Drawing Context.
Definition drawingcontext.h:43
Definition item.h:41
Manager & manager()
Get the manager.
Definition item.h:91
A convenient container for nodes on the graph.
Definition manager.h:46
A node in a map.
Definition node.h:41
virtual void refreshCache(wxDC &dc)
Refresh the cache (even if not invalidated)
Definition node.cpp:114
virtual Type type() const
Type.
Definition node.h:71
const wxPoint & cachedSize() const
Get the cached size.
Definition node.h:113
virtual ~Node()
Destructor.
Definition node.cpp:82
virtual bool contains(const int x, const int y, double &distance)
Get if the drawing representation of the node contains the point (x,y)
Definition node.cpp:234
virtual void draw(DrawingContext &dc)
Draw the node.
Definition node.cpp:265
void addLayerVisibility(size_t id=0)
make this node visible/invisible in a layer
Definition node.cpp:345
virtual void extendBoundingBox(wxPoint &topLeft, wxPoint &bottomRight)
Extends the bounding box.
Definition node.cpp:330
Node(Manager &manager)
Default constructor.
Definition node.cpp:56
virtual bool isContained(const int x1, const int y1, const int x2, const int y2) const
Get if the drawing representation of the node is contained inside a bounding box.
Definition node.cpp:221
bool isVisibleOnLayer(const size_t &layerID) const
Get the visivility for a layerId.
Definition node.cpp:106
const wxPoint & cachedPosition() const
Get the cached position.
Definition node.h:105
virtual void move(const int x, const int y)
Move the node.
Definition node.cpp:254