/
importshp.h
115 lines (97 loc) · 3.07 KB
/
importshp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*****************************************************************************/
/* importshp.h - shape file importer */
/* */
/* Copyright (C) 2011 Rallaz, rallazz@gmail.com */
/* */
/* This library is free software, licensed under the terms of the GNU */
/* General Public License as published by the Free Software Foundation, */
/* either version 2 of the License, or (at your option) any later version. */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*****************************************************************************/
#ifndef IMPORTSHP_H
#define IMPORTSHP_H
#include <QLabel>
#include <QGroupBox>
#include <QLineEdit>
#include <QComboBox>
#include <QDialog>
#include <QRadioButton>
#include "qc_plugininterface.h"
#include "document_interface.h"
#include "shapefil.h"
class ImportShp : public QObject, QC_PluginInterface
{
Q_OBJECT
Q_INTERFACES(QC_PluginInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.librecad.importshp" FILE "importshp.json")
#endif
public:
virtual PluginCapabilities getCapabilities() const;
virtual QString name() const;
virtual void execComm(Document_Interface *doc,
QWidget *parent, QString cmd);
};
/*namespace DPT {
enum txtposition {N, S, E, O, NE, SE, SO, NO};
}*/
/***********/
class AttribData
{
public:
AttribData(){
layer = "0";
color = -1; //-1 == BYLAYER
lineType = "BYLAYER";
width = "BYLAYER";
}
QString layer;
QString lineType;
QString width;
int color;
// QColor color;
};
/***********/
class dibSHP : public QDialog
{
Q_OBJECT
public:
explicit dibSHP(QWidget *parent = 0);
~dibSHP();
void procesFile(Document_Interface *doc);
public slots:
void getFile();
void checkAccept();
void updateFile();
private:
void readSettings();
void writeSettings();
void readPoint(DBFHandle dh, int i);
void readPolyline(DBFHandle dh, int i);
void readPolylineC(DBFHandle dh, int i);
void readMultiPolyline(DBFHandle dh, int i);
// void readText(SHPHandle sh, DBFHandle dh, int i, Plug_Entity *ent);
void readAttributes(DBFHandle dh, int i);
private:
QLineEdit *fileedit;
QComboBox *layerdata;
QComboBox *colordata;
QComboBox *ltypedata;
QComboBox *lwidthdata;
QComboBox *pointdata;
QGroupBox *pointbox;
QRadioButton *radiolay1;
QRadioButton *radiocol1;
QRadioButton *radioltype1;
QRadioButton *radiolwidth1;
QRadioButton *radiopoint1;
QLabel *formattype;
int layerF, colorF, ltypeF, lwidthF, pointF;
int layerT, colorT, ltypeT, lwidthT, pointT;
AttribData attdata;
SHPObject *sobject;
QString currlayer;
Document_Interface *currDoc;
};
#endif // IMPORTSHP_H