ToolMap
Loading...
Searching...
No Matches
tmexportmanager.h
1/***************************************************************************
2 tmexportmanager.h
3 Main class for dealing with export process
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TM_EXPORTMANAGER_H_
20#define _TM_EXPORTMANAGER_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include <wx/busyinfo.h> // for busy info dialog, remove if no more needed
31#include <wx/progdlg.h> // the progress dialog
32#include <wx/wupdlock.h>
33
34#include "../database/database_tm.h" // for database access
35#include "projectdefmemory.h" // for PojectDefMemoryLayers definition
36#include "tmexportdatashp.h" // for exporting data in SHP
37
38const int tmFILENAME_MAX_SEARCH = 500; // number of search for a file name
39const int ID_EXPORTDLG_ALLBTN = 10375;
40const int ID_EXPORTDLG_NONEBTN = 10376;
41const int ID_EXPORTDLG_INVERTBTN = 10377;
42const int ID_EXPORTDLG_REPLACELAYERCHECK = 10378;
43
44class tmTOCCtrl;
45
46class tmExportManager : public wxObject {
47 private:
48 DataBaseTM* m_pDB;
49 wxWindow* m_Parent;
50 tmGISScale* m_Scale;
51 PRJDEF_EXPORT_TYPE m_ExportType;
52 wxFileName m_ExportPath;
53 tmExportData* m_ExportData;
54 bool m_UseFastExport;
55 bool m_ExportAttributeCode;
56 bool m_OverwriteFiles;
57 bool m_ExportEmpty;
58
59 PrjDefMemManage* m_ProjMem;
60
61 // init values
62 void InitMemberValues();
63
64 // export function
65 bool ExportLayers(PrjMemLayersArray* layers);
66
67 bool ExportLayer(ProjectDefMemoryLayers* layer, wxRealPoint* frame, const int& framevertex);
68
69 bool _CreateExportLayer(ProjectDefMemoryLayers* layer, bool ignore_default_fields = false);
70
71 bool _ExportSimple(ProjectDefMemoryLayers* layer);
72
73 bool _ExportPolyGIS(ProjectDefMemoryLayers* layer);
74
75 wxRealPoint* GetFrame(int& nbvertex);
76
77 // check path & file name
78 bool IsExportPathValid();
79
80 bool GetAvailableFileName(ProjectDefMemoryLayers* layer);
81
82 // check integrity
83 void _CorrectIntegrity(PrjMemLayersArray* layers);
84
85 // create tmExportData object
86 tmExportData* CreateExportData();
87
88 // progress function and variables
89 wxProgressDialog* m_ProgressDlg;
90 wxBusyInfo* m_ProgressBusy;
91 wxString m_ProgressText;
92
93 void CreateProgress(int iNbLayers, const wxString& layername);
94
95 bool UpdateProgress(int iActualLayer, const wxString& layername);
96
97 void DeleteProgress();
98
99 protected:
100 public:
101 // construction and destruction
103
105
106 tmExportManager(wxWindow* parent, DataBaseTM* database, tmGISScale* scale);
107
108 void Create(wxWindow* parent, DataBaseTM* database, tmGISScale* scale);
109
110 // Export public function
111 // bool ExportAll (PrjDefMemManage * localprojdef);
112 bool ExportSelected(PrjDefMemManage* localprojdef, tmLayerManager* layermanager);
113
114 bool ExportConcatenated(PrjDefMemManage* localprojdef, PRJDEF_LAYERS_TYPE type, bool useProgressDlg = true);
115};
116
117/*************************************************************************************/
122class tmExportSelected_DLG : public wxDialog {
123 private:
124 wxCheckListBox* m_ListLayersCtrl;
125 wxCheckBox* m_OverwriteFilesCtrl;
126 wxCheckBox* m_LayersAddCtrl;
127 wxCheckBox* m_LayersReplaceCtrl;
128 wxCheckBox* m_FastPolyExportCtrl;
129 wxCheckBox* m_ExportEmptyLayersCtrl;
130 wxRadioButton* m_ExportAttribDescCtrl;
131 wxRadioButton* m_ExportAttribCodeCtrl;
132
133 void OnBtnAll(wxCommandEvent& event);
134
135 void OnBtnNone(wxCommandEvent& event);
136
137 void OnBtnInvert(wxCommandEvent& event);
138
139 void OnUpdateUIBtnNone(wxUpdateUIEvent& event);
140
141 void OnUpdateUICheckReplace(wxUpdateUIEvent& event);
142
143 void OnUpdateUIOK(wxUpdateUIEvent& event);
144
145 void _CreateControls(const wxArrayString& layers);
146
147 void _SelectLastExported(const wxArrayString& selected);
148
149 DECLARE_EVENT_TABLE();
150
151 public:
152 tmExportSelected_DLG(wxWindow* parent, const wxArrayString& layers, const wxArrayString& selected,
153 wxWindowID id = wxID_ANY, const wxString& caption = _("Export Layer"),
154 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
155 long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
156
157 virtual ~tmExportSelected_DLG();
158
159 wxArrayInt GetSelectedLayersID();
160
161 bool DoOverwriteFiles();
162
163 bool DoLayerAdd();
164
165 bool DoLayerReplace();
166
167 bool DoExportEmptyLayers();
168
169 bool UseFastExport();
170
171 bool DoExportAttributeCode();
172};
173
174#endif
Definition database_tm.h:80
Definition prjdefmemmanage.h:54
Storing layers properties in memory.
Definition projectdefmemory.h:246
Parent class for exporting data.
Definition tmexportdata.h:48
Definition tmexportmanager.h:46
tmExportManager()
Default constructor.
Definition tmexportmanager.cpp:54
void Create(wxWindow *parent, DataBaseTM *database, tmGISScale *scale)
Create function for two step initialization.
Definition tmexportmanager.cpp:76
bool ExportSelected(PrjDefMemManage *localprojdef, tmLayerManager *layermanager)
Ask user which layer to export.
Definition tmexportmanager.cpp:103
~tmExportManager()
Destructor.
Definition tmexportmanager.cpp:63
Export selected layer Dialog.
Definition tmexportmanager.h:122
Definition tmgisscale.h:100
GIS class for dealing with layers.
Definition tmlayermanager.h:57
Storing project properties in memory.
PRJDEF_EXPORT_TYPE
Type of export we want.
Definition projectdefmemory.h:46