Skip to content

Commit 098aa68

Browse files
committedJan 26, 2015
Merge pull request #1852 from radosuav/changes
[Processing] Small fixes and additions
2 parents 609db7d + b835f40 commit 098aa68

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed
 

‎python/plugins/processing/algs/gdal/warp.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def processAlgorithm(self, progress):
7979
arguments.append(str(self.getParameterValue(self.SOURCE_SRS)))
8080
arguments.append('-t_srs')
8181
crsId = self.getParameterValue(self.DEST_SRS)
82-
self.crs = QgsCoordinateReferenceSystem(crsId)
8382
arguments.append(str(crsId))
8483
arguments.append('-r')
8584
arguments.append(

‎python/plugins/processing/algs/qgis/PointsLayerFromTable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def processAlgorithm(self, progress):
5757
self.getParameterValue(self.YFIELD))
5858

5959
crsId = self.getParameterValue(self.TARGET_CRS)
60-
targetCrs = QgsCoordinateReferenceSystem(crsId)
60+
targetCrs = QgsCoordinateReferenceSystem()
61+
targetCrs.createFromUserInput(crsId)
6162
self.crs = targetCrs
6263

6364
outFeat = QgsFeature()

‎python/plugins/processing/algs/qgis/ReprojectLayer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def processAlgorithm(self, progress):
5555
layer = dataobjects.getObjectFromUri(
5656
self.getParameterValue(self.INPUT))
5757
crsId = self.getParameterValue(self.TARGET_CRS)
58-
targetCrs = QgsCoordinateReferenceSystem(crsId)
58+
targetCrs = QgsCoordinateReferenceSystem()
59+
targetCrs.createFromUserInput(crsId)
5960

6061
writer = self.getOutputFromName(
6162
self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),

‎python/plugins/processing/core/parameters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ def setValue(self, value):
117117
class ParameterCrs(Parameter):
118118

119119
def __init__(self, name='', description='', default='EPSG:4326'):
120-
'''The value is the auth id of the CRS'''
120+
'''The value is a string that uniquely identifies the
121+
coordinate reference system. Typically it is the auth id of the CRS
122+
(if the authority is EPSG) or proj4 string of the CRS (in case
123+
of other authorities or user defined projections).'''
121124
Parameter.__init__(self, name, description)
122125
self.value = None
123126
self.default = default

‎python/plugins/processing/gui/BatchPanel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ def getWidgetFromParameter(self, param, row, col):
142142
else:
143143
item = QLineEdit()
144144
try:
145-
item.setText(param.default)
145+
item.setText(str(param.default))
146146
except:
147+
item.setText("0")
147148
pass
148149

149150
return item

‎python/plugins/processing/gui/CrsSelectionPanel.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,29 @@ def __init__(self, default):
4141
self.leText.setEnabled(False)
4242

4343
self.btnSelect.clicked.connect(self.browseCRS)
44-
self.authId = QgsCoordinateReferenceSystem(default).authid()
44+
self.crs = QgsCoordinateReferenceSystem(default).authid()
4545
self.updateText()
4646

4747
def setAuthId(self, authid):
48-
self.authId = authid
48+
self.crs = authid
4949
self.updateText()
5050

5151
def browseCRS(self):
5252
selector = QgsGenericProjectionSelector()
53-
selector.setSelectedAuthId(self.authId)
53+
selector.setSelectedAuthId(self.crs)
5454
if selector.exec_():
55-
self.authId = selector.selectedAuthId()
55+
authId = selector.selectedAuthId()
56+
if authId.upper().startswith("EPSG:"):
57+
self.crs = authId
58+
else:
59+
proj = QgsCoordinateReferenceSystem()
60+
proj.createFromSrsId(selector.selectedCrsId())
61+
self.crs = proj.toProj4()
5662
self.updateText()
5763

5864
def updateText(self):
59-
if self.authId is not None:
60-
self.leText.setText(self.authId)
61-
65+
if self.crs is not None:
66+
self.leText.setText(self.crs)
67+
6268
def getValue(self):
63-
return self.authId
69+
return self.crs

‎python/plugins/processing/script/ScriptAlgorithm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def processAlgorithm(self, progress):
253253

254254
ns = {}
255255
ns['progress'] = progress
256+
ns['scriptDescriptionFile'] = self.descriptionFile
256257

257258
for param in self.parameters:
258259
ns[param.name] = param.value

0 commit comments

Comments
 (0)
Please sign in to comment.