Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
bindingconstraint.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_BINDING_CONSTRAINT_H__
22#define __ANTARES_TOOLBOX_MAP_BINDING_CONSTRAINT_H__
23
24#include "item.h"
25
26namespace Antares
27{
28namespace Map
29{
30class BindingConstraint final : public Item
31{
32public:
34
35
42 virtual ~BindingConstraint();
44
48 virtual Type type() const
49 {
50 return tyBindingConstraint;
51 }
52
54
55 virtual bool selected() const
56 {
57 return pSelected;
58 }
59 virtual void selected(bool v);
61
63
64
67 virtual void refreshCache(wxDC& dc);
69
71
72
75 virtual bool contains(const int, const int, double& /* distance */)
76 {
77 return false;
78 }
79
85 virtual bool isContained(const int, const int, const int, const int) const
86 {
87 return false;
88 }
89
93 virtual void draw(DrawingContext& dc);
94 virtual void drawExternalDrawer(DrawingContext& dc);
96
100 virtual void extendBoundingBox(wxPoint&, wxPoint&)
101 {
102 }
103
104 void clear();
105
106 bool empty() const
107 {
108 return pConnections.empty();
109 }
110 uint count() const
111 {
112 return (uint)pConnections.size();
113 }
114
115 void add(Item* item);
116
117 bool remove(Item* item);
118
119private:
120 struct Infos
121 {
122 public:
123 Infos() : weight(1.), selected(false)
124 {
125 }
126 Infos(const Infos& c) : weight(c.weight), selected(false)
127 {
128 }
129 double weight;
130 bool selected;
131 };
132
133 using Connections = std::map<Connection*, Infos>;
134 Connections pConnections;
135
136 struct TextPart
137 {
138 TextPart() : text(), color(0, 0, 0), size(0, 0)
139 {
140 }
141 TextPart(const wxString& s, const int r, const int g, const int b) : text(s), color(r, g, b)
142 {
143 }
144 wxString text;
145 wxColour color;
146 wxSize size;
147
148 void refreshCache(wxDC& dc);
149 };
150
151 std::vector<TextPart> pTextParts;
152
153}; // class BindingConstraint
154
155} // namespace Map
156} // namespace Antares
157
158#endif // __ANTARES_TOOLBOX_MAP_BINDING_CONSTRAINT_H__
Definition bindingconstraint.h:31
virtual void extendBoundingBox(wxPoint &, wxPoint &)
Extends the bounding box.
Definition bindingconstraint.h:100
virtual void refreshCache(wxDC &dc)
Refresh the cache (even if not invalidated)
Definition bindingconstraint.cpp:125
virtual ~BindingConstraint()
Destructor.
Definition bindingconstraint.cpp:34
virtual Type type() const
Type.
Definition bindingconstraint.h:48
virtual bool isContained(const int, const int, const int, const int) const
Get if the drawing representation of the node is contained inside a bounding box.
Definition bindingconstraint.h:85
virtual void draw(DrawingContext &dc)
Draw the node.
Definition bindingconstraint.cpp:44
virtual bool contains(const int, const int, double &)
Get if the drawing representation of the node contains the point (x,y)
Definition bindingconstraint.h:75
Drawing Context.
Definition drawingcontext.h:43
Definition item.h:41
Manager & manager()
Get the manager.
Definition item.h:91
bool pSelected
Selected.
Definition item.h:267
Item(Manager &manager, const int zPos=0)
Constructor.
Definition item.cpp:30
A convenient container for nodes on the graph.
Definition manager.h:46