-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgsdxfexportdialog.h
114 lines (90 loc) · 4.08 KB
/
qgsdxfexportdialog.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
/***************************************************************************
qgsdxfexportdialog.h
--------------------
begin : September 2013
copyright : (C) 2013 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it 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. *
* *
***************************************************************************/
#ifndef QGSDXFEXPORTDIALOG_H
#define QGSDXFEXPORTDIALOG_H
#include "ui_qgsdxfexportdialogbase.h"
#include "qgslayertreemodel.h"
#include "qgsdxfexport.h"
#include <QList>
#include <QPair>
#include <QSet>
#include <QItemDelegate>
class QgsLayerTreeGroup;
class QgsLayerTreeNode;
class FieldSelectorDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit FieldSelectorDelegate( QObject *parent = nullptr );
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
};
class QgsVectorLayerAndAttributeModel : public QgsLayerTreeModel
{
Q_OBJECT
public:
QgsVectorLayerAndAttributeModel( QgsLayerTreeGroup *rootNode, QObject *parent = nullptr );
~QgsVectorLayerAndAttributeModel();
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
Qt::ItemFlags flags( const QModelIndex &index ) const override;
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
QList< QPair<QgsVectorLayer *, int> > layers() const;
QgsVectorLayer *vectorLayer( const QModelIndex &index ) const;
int attributeIndex( const QgsVectorLayer *vl ) const;
void applyVisibilityPreset( const QString &name );
void selectAll();
void deSelectAll();
private:
QHash<const QgsVectorLayer *, int> mAttributeIdx;
QSet<QModelIndex> mCheckedLeafs;
void applyVisibility( QSet<QString> &visibleLayers, QgsLayerTreeNode *node );
void retrieveAllLayers( QgsLayerTreeNode *node, QSet<QString> &layers );
};
class QgsDxfExportDialog : public QDialog, private Ui::QgsDxfExportDialogBase
{
Q_OBJECT
public:
QgsDxfExportDialog( QWidget *parent = nullptr, Qt::WindowFlags f = 0 );
~QgsDxfExportDialog();
QList< QPair<QgsVectorLayer *, int> > layers() const;
double symbologyScale() const;
QgsDxfExport::SymbologyExport symbologyMode() const;
QString saveFile() const;
bool exportMapExtent() const;
bool layerTitleAsName() const;
QString mapTheme() const;
QString encoding() const;
QgsCoordinateReferenceSystem crs() const;
public slots:
//! Change the selection of layers in the list
void selectAll();
void deSelectAll();
private slots:
void on_mFileSelectionButton_clicked();
void setOkEnabled();
void saveSettings();
void on_mVisibilityPresets_currentIndexChanged( int index );
void on_mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
private:
void cleanGroup( QgsLayerTreeNode *node );
QgsLayerTreeGroup *mLayerTreeGroup = nullptr;
FieldSelectorDelegate *mFieldSelectorDelegate = nullptr;
QgsCoordinateReferenceSystem mCRS;
};
#endif // QGSDXFEXPORTDIALOG_H