Antares Simulator
Power System Simulator
spotlight-provider.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_WINDOWS_OUTPUT_SPOTLIGHT_PROVIDER_H__
22 #define __ANTARES_WINDOWS_OUTPUT_SPOTLIGHT_PROVIDER_H__
23 
24 #include <ui/common/component/spotlight.h>
25 #include "fwd.h"
26 #include "layer.h"
27 #include <wx/bitmap.h>
28 
29 namespace Antares::Window::OutputViewer
30 {
31 class SpotlightProvider final: public Antares::Component::Spotlight::IProvider
32 {
33 public:
36 
37 public:
39 
40 
43  SpotlightProvider(Component* com, Layer* layer);
45  virtual ~SpotlightProvider();
47 
51  virtual void search(Spotlight::IItem::Vector& out,
52  const Spotlight::SearchToken::Vector& tokens,
53  const Yuni::String& text = "") override;
54 
58  virtual bool onSelect(Spotlight::IItem::Ptr& item) override;
59 
60 private:
61  void appendAreaName(Spotlight::IItem::Vector& out, const Yuni::String& name);
62  void appendLinkName(Spotlight::IItem::Vector& out, const Yuni::String& name);
63 
64 private:
66  Component* pComponent;
68  Layer* pLayer;
69 
71  wxBitmap* pBmpReattach;
73  wxBitmap* pBmpArea;
75  wxBitmap* pBmpGroup;
77  wxBitmap* pBmpLink;
78 
79 }; // class Layer
80 
81 class SpotlightProviderGlobalSelection: public Antares::Component::Spotlight::IProvider
82 {
83 public:
86 
87 public:
89 
90 
97 
98  size_t getSelectedLayerID(const Yuni::String& layerName);
99 
103  virtual void search(Spotlight::IItem::Vector& out,
104  const Spotlight::SearchToken::Vector& tokens,
105  const Yuni::String& text = "");
106 
107  virtual void search(Spotlight::IItem::Vector& out,
108  const Spotlight::SearchToken::Vector& tokens,
109  Spotlight::IItem::Vector& in);
110 
114  virtual bool onSelect(Spotlight::IItem::Ptr& item);
115 
116  void addEconomy();
117  void addAdequacy();
118  void addNoCommonItem();
119 
120  void addText(const Yuni::String& name);
121  void addAreaName(const Yuni::String& name);
122  void addSetName(const Yuni::String& name);
123  void addLinkName(const Yuni::String& name);
124 
125  void addUncommonAreaName(const Yuni::String& name);
126  void addUncommonLinkName(const Yuni::String& name);
127 
128 public:
129  Spotlight::IItem::Vector items;
130 
131 private:
132  void appendSetName(Spotlight::IItem::Vector& out,
133  const Yuni::String& name,
134  const char* grp = "DISTRICTS");
135  void appendAreaName(Spotlight::IItem::Vector& out,
136  const Yuni::String& name,
137  const char* grp = "AREAS");
138  void appendLinkName(Spotlight::IItem::Vector& out,
139  const Yuni::String& name,
140  const char* grp = "LINKS");
141 
142 private:
144  Component* pComponent;
145 
147  wxBitmap* pBmpReattach;
149  wxBitmap* pBmpArea;
151  wxBitmap* pBmpGroup;
153  wxBitmap* pBmpLink;
154 
155  Spotlight::IItem::Ptr pCurrentAreaOrLink;
156 
157 }; // class SpotlightProviderGlobalSelection
158 
159 class SpotlightProviderMCAll: public Antares::Component::Spotlight::IProvider
160 {
161 public:
164 
165 public:
167 
168 
173  virtual ~SpotlightProviderMCAll();
175 
179  virtual void search(Spotlight::IItem::Vector& out,
180  const Spotlight::SearchToken::Vector& tokens,
181  const Yuni::String& text = "");
182 
186  virtual bool onSelect(Spotlight::IItem::Ptr& item);
187 
188 private:
190  Component* pComponent;
191 
193  wxBitmap* pBmpReattach;
195  wxBitmap* pBmpVariable;
196 
197 }; // class SpotlightProviderMCAll
198 
199 } // namespace Antares::Window::OutputViewer
200 
201 #endif // __ANTARES_WINDOWS_OUTPUT_SPOTLIGHT_PROVIDER_H__
Definition: spotlight.h:38
Component: Viewer for simulation results.
Definition: output.h:45
virtual ~SpotlightProviderGlobalSelection()
Destructor.
Definition: spotlight-provider.cpp:84
virtual bool onSelect(Spotlight::IItem::Ptr &item)
An item has been selected.
Definition: spotlight-provider.cpp:613
virtual void search(Spotlight::IItem::Vector &out, const Spotlight::SearchToken::Vector &tokens, const Yuni::String &text="")
Perform a new search.
Definition: spotlight-provider.cpp:397
SpotlightProviderGlobalSelection(Component *com)
Default constructor.
Definition: spotlight-provider.cpp:72
Definition: spotlight-provider.h:160
virtual bool onSelect(Spotlight::IItem::Ptr &item)
An item has been selected.
Definition: spotlight-provider.cpp:745
virtual void search(Spotlight::IItem::Vector &out, const Spotlight::SearchToken::Vector &tokens, const Yuni::String &text="")
Perform a new search.
Definition: spotlight-provider.cpp:692
SpotlightProviderMCAll(Component *com)
Default constructor.
Definition: spotlight-provider.cpp:93
virtual ~SpotlightProviderMCAll()
Destructor.
Definition: spotlight-provider.cpp:102
Definition: spotlight-provider.h:32
virtual bool onSelect(Spotlight::IItem::Ptr &item) override
An item has been selected.
Definition: spotlight-provider.cpp:312
virtual void search(Spotlight::IItem::Vector &out, const Spotlight::SearchToken::Vector &tokens, const Yuni::String &text="") override
Perform a new search.
Definition: spotlight-provider.cpp:129
SpotlightProvider(Component *com, Layer *layer)
Default constructor.
Definition: spotlight-provider.cpp:108
virtual ~SpotlightProvider()
Destructor.
Definition: spotlight-provider.cpp:121