-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoly_strip_dialog.py
73 lines (62 loc) · 2.41 KB
/
poly_strip_dialog.py
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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
PolyStripDialog
A QGIS plugin
Polygons along lines
-------------------
begin : 2017-07-29
git sha : $Format:%H$
copyright : (C) 2017 by Werner Macho
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
"""
import os
from qgis.PyQt import (
uic
)
from qgis.PyQt.QtWidgets import (
QDialog
)
from qgis.gui import (
QgsProjectionSelectionTreeWidget
)
from .poly_strip_alg import get_all_pages
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'poly_strip_dialog_base.ui'))
class PolyStripDialog(QDialog, FORM_CLASS):
def __init__(self, parent=None):
"""Constructor."""
super(PolyStripDialog, self).__init__(parent)
self.setupUi(self)
def polystrip(self, layer):
if self.crsBoxSelect.isChecked():
srid = PolyStripDialog().crsselectauto(layer)
else:
srid = PolyStripDialog().crsselect
width = self.widthSpinBox.value()
height = self.heightSpinBox.value()
coverage = self.coverSpinBox.value()
covstart = self.coverSpinBoxStart.value()
get_all_pages(layer, width, height, srid, coverage, covstart)
def labelwriter(self, unitstr):
unit = unitstr
self.label_unit.setText(unit)
@staticmethod
def crsselect():
proj_selector = QgsProjectionSelectionTreeWidget()
proj_selector.exec_()
srid = proj_selector.crs()
return srid
@staticmethod
def crsselectauto(layer):
srid = layer.crs().authid()
return srid