Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
exportmap.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_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
41namespace Antares
42{
43namespace Window
44{
48class ExportMap final : public wxDialog
49{
50public:
58 static SaveResult Execute(wxFrame* parent, Data::Study::Ptr study);
59
60public:
61 enum
62 {
63 mnIDCollapsePanel = wxID_HIGHEST + 1,
64 mnIDEditMapName,
65 mnIDEditMapFolderName,
66 mnIDBrowse,
67 mnIDMapFormat,
68 };
69
70public:
71 // \name Constructors & Destructor
73
76 explicit ExportMap(wxFrame* parent);
80 ExportMap(wxFrame* parent, Data::Study::Ptr study);
82 virtual ~ExportMap();
84
86
87
88 Data::Study::Ptr study();
90 const Data::Study::Ptr study() const;
92
96 SaveResult result() const;
97
98private:
100 void internalCreateComponents();
101
103 void onCollapsePanel(wxCollapsiblePaneEvent& evt);
104 void onMapNameChanged(wxCommandEvent& evt);
105 void onMapFolderNameChanged(wxCommandEvent& evt);
106 void onBrowse(wxCommandEvent& evt);
107 void ensureUniqueFileName(Yuni::String folderPath);
108
109 void onMapFormatChanged(wxCommandEvent& evt);
110
111 void onUseBackgroundChanged(wxCommandEvent& evt);
112
114 void onCancel(void*);
116 void onExportMap(void*);
117
119 wxString getFormatAsString(Antares::Map::mapImageFormat format);
120 YString getFormatAsYString(Antares::Map::mapImageFormat format);
121
122 void propCaption(const wxString& text, bool bold = false);
123 wxTextCtrl* propEdit(const wxString& defaultValue = wxString(), int id = wxID_ANY);
124 wxWindow* propEdit(wxWindow* control);
125 wxTextCtrl* propEdit(const wxString& defaultValue,
126 const wxTextValidator& validator,
127 int id = wxID_ANY);
128
129private:
131 Data::Study::Ptr pStudy;
133 wxFlexGridSizer* pGridSizer;
135 wxWindow* pParentProperties;
137 wxTextCtrl* pMapName;
139 wxTextCtrl* pMapFolderName;
141 wxTextCtrl* pMapFolderPath;
143 bool pCustomMapFolderName;
144
146 wxChoice* pMapFormatChoice;
148 Antares::Map::mapImageFormat pMapFormat;
149
151 wxComboBox* pLayers;
153 wxCheckBox* pSplit;
155 wxChoice* pSplitNumberChoice;
157 wxCheckBox* pUseBackgroundColor;
159 wxColourPickerCtrl* pBackgroundColor;
160
162 SaveResult pResult;
163
164 static wxString defaultPath;
165
166 // Event Table
167 DECLARE_EVENT_TABLE()
168
169}; // class ExportMap
170
171} // namespace Window
172} // namespace Antares
173
174#include "exportmap.hxx"
175
176#endif // __ANTARES_APPLICATION_WINDOWS_EXPORTMAP_H__
Export Map Dialog
Definition exportmap.h:49
SaveResult result() const
Get if the study has been saved.
Definition exportmap.hxx:38
ExportMap(wxFrame *parent)
Constructor with a parent window and a study.
Definition exportmap.cpp:83
Data::Study::Ptr study()
Get the attached study.
Definition exportmap.hxx:28
virtual ~ExportMap()
Destructor.
Definition exportmap.cpp:135
static SaveResult Execute(wxFrame *parent, Data::Study::Ptr study)
Execute the ExportMap dialog and save the map accordingly.
Definition exportmap.cpp:75