Antares Simulator
Power System Simulator
exportmap.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_APPLICATION_WINDOWS_EXPORTMAP_H__
22 #define __ANTARES_APPLICATION_WINDOWS_EXPORTMAP_H__
23 
24 #include <antares/study/study.h>
25 #include <yuni/core/string.h>
26 #include "../application/study.h"
27 #include "../toolbox/components/map/settings.h"
28 
29 #include <wx/sizer.h>
30 #include <wx/textctrl.h>
31 #include <wx/checkbox.h>
32 #include <wx/choice.h>
33 #include <wx/clrpicker.h>
34 #include <wx/combobox.h>
35 #include <wx/collpane.h>
36 #include <wx/dialog.h>
37 #include <wx/textctrl.h>
38 #include <wx/collpane.h>
39 #include <wx/valtext.h>
40 
41 namespace Antares::Window
42 {
46 class ExportMap final: public wxDialog
47 {
48 public:
56  static SaveResult Execute(wxFrame* parent, Data::Study::Ptr study);
57 
58 public:
59  enum
60  {
61  mnIDCollapsePanel = wxID_HIGHEST + 1,
62  mnIDEditMapName,
63  mnIDEditMapFolderName,
64  mnIDBrowse,
65  mnIDMapFormat,
66  };
67 
68 public:
69  // \name Constructors & Destructor
71 
74  explicit ExportMap(wxFrame* parent);
78  ExportMap(wxFrame* parent, Data::Study::Ptr study);
80  virtual ~ExportMap();
82 
84 
85  Data::Study::Ptr study();
88  const Data::Study::Ptr study() const;
90 
94  SaveResult result() const;
95 
96 private:
98  void internalCreateComponents();
99 
101  void onCollapsePanel(wxCollapsiblePaneEvent& evt);
102  void onMapNameChanged(wxCommandEvent& evt);
103  void onMapFolderNameChanged(wxCommandEvent& evt);
104  void onBrowse(wxCommandEvent& evt);
105  void ensureUniqueFileName(Yuni::String folderPath);
106 
107  void onMapFormatChanged(wxCommandEvent& evt);
108 
109  void onUseBackgroundChanged(wxCommandEvent& evt);
110 
112  void onCancel(void*);
114  void onExportMap(void*);
115 
117  wxString getFormatAsString(Antares::Map::mapImageFormat format);
118  YString getFormatAsYString(Antares::Map::mapImageFormat format);
119 
120  void propCaption(const wxString& text, bool bold = false);
121  wxTextCtrl* propEdit(const wxString& defaultValue = wxString(), int id = wxID_ANY);
122  wxWindow* propEdit(wxWindow* control);
123  wxTextCtrl* propEdit(const wxString& defaultValue,
124  const wxTextValidator& validator,
125  int id = wxID_ANY);
126 
127 private:
129  Data::Study::Ptr pStudy;
131  wxFlexGridSizer* pGridSizer;
133  wxWindow* pParentProperties;
135  wxTextCtrl* pMapName;
137  wxTextCtrl* pMapFolderName;
139  wxTextCtrl* pMapFolderPath;
141  bool pCustomMapFolderName;
142 
144  wxChoice* pMapFormatChoice;
146  Antares::Map::mapImageFormat pMapFormat;
147 
149  wxComboBox* pLayers;
151  wxCheckBox* pSplit;
153  wxChoice* pSplitNumberChoice;
155  wxCheckBox* pUseBackgroundColor;
157  wxColourPickerCtrl* pBackgroundColor;
158 
160  SaveResult pResult;
161 
162  static wxString defaultPath;
163 
164  // Event Table
165  DECLARE_EVENT_TABLE()
166 
167 }; // class ExportMap
168 
169 } // namespace Antares::Window
170 
171 #include "exportmap.hxx"
172 
173 #endif // __ANTARES_APPLICATION_WINDOWS_EXPORTMAP_H__
Export Map Dialog
Definition: exportmap.h:47
SaveResult result() const
Get if the study has been saved.
Definition: exportmap.hxx:36
ExportMap(wxFrame *parent)
Constructor with a parent window and a study.
Definition: exportmap.cpp:81
Data::Study::Ptr study()
Get the attached study.
Definition: exportmap.hxx:26
virtual ~ExportMap()
Destructor.
Definition: exportmap.cpp:133
static SaveResult Execute(wxFrame *parent, Data::Study::Ptr study)
Execute the ExportMap dialog and save the map accordingly.
Definition: exportmap.cpp:73