Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1852 from radosuav/changes
[Processing] Small fixes and additions
  • Loading branch information
volaya committed Jan 26, 2015
2 parents 609db7d + b835f40 commit 098aa68
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 deletions.
1 change: 0 additions & 1 deletion python/plugins/processing/algs/gdal/warp.py
Expand Up @@ -79,7 +79,6 @@ def processAlgorithm(self, progress):
arguments.append(str(self.getParameterValue(self.SOURCE_SRS)))
arguments.append('-t_srs')
crsId = self.getParameterValue(self.DEST_SRS)
self.crs = QgsCoordinateReferenceSystem(crsId)
arguments.append(str(crsId))
arguments.append('-r')
arguments.append(
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/PointsLayerFromTable.py
Expand Up @@ -57,7 +57,8 @@ def processAlgorithm(self, progress):
self.getParameterValue(self.YFIELD))

crsId = self.getParameterValue(self.TARGET_CRS)
targetCrs = QgsCoordinateReferenceSystem(crsId)
targetCrs = QgsCoordinateReferenceSystem()
targetCrs.createFromUserInput(crsId)
self.crs = targetCrs

outFeat = QgsFeature()
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/qgis/ReprojectLayer.py
Expand Up @@ -55,7 +55,8 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
self.getParameterValue(self.INPUT))
crsId = self.getParameterValue(self.TARGET_CRS)
targetCrs = QgsCoordinateReferenceSystem(crsId)
targetCrs = QgsCoordinateReferenceSystem()
targetCrs.createFromUserInput(crsId)

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/core/parameters.py
Expand Up @@ -117,7 +117,10 @@ def setValue(self, value):
class ParameterCrs(Parameter):

def __init__(self, name='', description='', default='EPSG:4326'):
'''The value is the auth id of the CRS'''
'''The value is a string that uniquely identifies the
coordinate reference system. Typically it is the auth id of the CRS
(if the authority is EPSG) or proj4 string of the CRS (in case
of other authorities or user defined projections).'''
Parameter.__init__(self, name, description)
self.value = None
self.default = default
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/gui/BatchPanel.py
Expand Up @@ -142,8 +142,9 @@ def getWidgetFromParameter(self, param, row, col):
else:
item = QLineEdit()
try:
item.setText(param.default)
item.setText(str(param.default))
except:
item.setText("0")
pass

return item
Expand Down
22 changes: 14 additions & 8 deletions python/plugins/processing/gui/CrsSelectionPanel.py
Expand Up @@ -41,23 +41,29 @@ def __init__(self, default):
self.leText.setEnabled(False)

self.btnSelect.clicked.connect(self.browseCRS)
self.authId = QgsCoordinateReferenceSystem(default).authid()
self.crs = QgsCoordinateReferenceSystem(default).authid()
self.updateText()

def setAuthId(self, authid):
self.authId = authid
self.crs = authid
self.updateText()

def browseCRS(self):
selector = QgsGenericProjectionSelector()
selector.setSelectedAuthId(self.authId)
selector.setSelectedAuthId(self.crs)
if selector.exec_():
self.authId = selector.selectedAuthId()
authId = selector.selectedAuthId()
if authId.upper().startswith("EPSG:"):
self.crs = authId
else:
proj = QgsCoordinateReferenceSystem()
proj.createFromSrsId(selector.selectedCrsId())
self.crs = proj.toProj4()
self.updateText()

def updateText(self):
if self.authId is not None:
self.leText.setText(self.authId)

if self.crs is not None:
self.leText.setText(self.crs)
def getValue(self):
return self.authId
return self.crs
1 change: 1 addition & 0 deletions python/plugins/processing/script/ScriptAlgorithm.py
Expand Up @@ -253,6 +253,7 @@ def processAlgorithm(self, progress):

ns = {}
ns['progress'] = progress
ns['scriptDescriptionFile'] = self.descriptionFile

for param in self.parameters:
ns[param.name] = param.value
Expand Down

0 comments on commit 098aa68

Please sign in to comment.