ToolMap
Loading...
Searching...
No Matches
tmimportcsv.h
1/***************************************************************************
2 tmimportcsv.h
3 -------------------
4 copyright : (C) 2010 CREALP Lucien Schreiber
5 ***************************************************************************/
6
7/***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef _TMIMPORTCSV_H
17#define _TMIMPORTCSV_H
18
19#include <wx/wxprec.h>
20
21#ifndef WX_PRECOMP
22#include <wx/wx.h>
23#endif
24
25#include <wx/txtstrm.h>
26#include <wx/wfstream.h>
27
28#include "../core/prjdefmemmanage.h"
29#include "tmimport.h"
30
31class tmImportCSV : public tmImport {
32 private:
33 int m_Xcolumn;
34 int m_Ycolumn;
35 wxFileInputStream* m_FileStream;
36 wxTextInputStream* m_TextStream;
37 wxArrayString m_Fields;
38
39 bool _ResetReading();
40
41 bool _GetNextData(wxArrayString& tokenArray);
42
43 bool _GetCoordinates(const wxArrayString& tokenArray, double& x, double& y);
44
45 bool _ImportToPointLayer(DataBaseTM* database, PrjDefMemManage* prj, wxProgressDialog* progress = nullptr);
46
47 public:
49
50 virtual ~tmImportCSV();
51
52 virtual bool Open(const wxFileName& filename);
53
54 virtual bool Import(DataBaseTM* database, PrjDefMemManage* prj, wxProgressDialog* progress = nullptr);
55
56 virtual bool GetExistingAttributeValues(const wxString& attName, wxArrayString& values);
57
58 virtual bool IsOk();
59
60 void ListFields();
61
62 wxArrayString GetFieldsList();
63
64 void GuessXYfields();
65
66 virtual bool GetFieldNames(wxArrayString& Fields);
67
68 int GetColumnX() {
69 return m_Xcolumn;
70 }
71
72 int GetColumnY() {
73 return m_Ycolumn;
74 }
75
76 void SetXYColumn(int x, int y);
77
78 virtual wxArrayInt GetTargetSupported();
79};
80
81#endif
Definition database_tm.h:80
Definition prjdefmemmanage.h:54
Definition tmimportcsv.h:31
Definition tmimport.h:39