34
34
from processing .core .parameters import ParameterExtent
35
35
from processing .core .parameters import ParameterNumber
36
36
from processing .core .parameters import ParameterSelection
37
+ from processing .core .parameters import ParameterCrs
37
38
from processing .core .outputs import OutputVector
38
39
39
40
40
41
class Grid (GeoAlgorithm ):
41
42
TYPE = 'TYPE'
42
43
EXTENT = 'EXTENT'
43
- WIDTH = 'WIDTH'
44
- HEIGHT = 'HEIGHT'
45
44
HSPACING = 'HSPACING'
46
45
VSPACING = 'VSPACING'
47
- CENTERX = 'CENTERX'
48
- CENTERY = 'CENTERY'
49
46
CRS = 'CRS'
50
47
OUTPUT = 'OUTPUT'
51
48
@@ -67,14 +64,16 @@ def defineCharacteristics(self):
67
64
self .tr ('Horizontal spacing' ), default = 10.0 ))
68
65
self .addParameter (ParameterNumber (self .VSPACING ,
69
66
self .tr ('Vertical spacing' ), default = 10.0 ))
67
+ self .addParameter (ParameterCrs (self .CRS , 'Grid CRS' ))
70
68
71
- self .addOutput (OutputVector (self .OUTPUT , self .tr ('Output ' )))
69
+ self .addOutput (OutputVector (self .OUTPUT , self .tr ('Grid ' )))
72
70
73
71
def processAlgorithm (self , progress ):
74
72
idx = self .getParameterValue (self .TYPE )
75
73
extent = self .getParameterValue (self .EXTENT ).split (',' )
76
74
hSpacing = self .getParameterValue (self .HSPACING )
77
75
vSpacing = self .getParameterValue (self .VSPACING )
76
+ crs = QgsCoordinateReferenceSystem (self .getParameterValue (self .CRS ))
78
77
79
78
bbox = QgsRectangle (float (extent [0 ]), float (extent [2 ]),
80
79
float (extent [1 ]), float (extent [3 ]))
@@ -85,7 +84,6 @@ def processAlgorithm(self, progress):
85
84
centerY = bbox .center ().y ()
86
85
originX = centerX - width / 2.0
87
86
originY = centerY - height / 2.0
88
- crs = QgsCoordinateReferenceSystem (self .getParameterValue (self .CRS ))
89
87
90
88
if hSpacing <= 0 or vSpacing <= 0 :
91
89
raise GeoAlgorithmExecutionException (
0 commit comments