Skip to content

Commit

Permalink
allow create grid without specifying base layer (fix #6109)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jul 29, 2012
1 parent 540df9c commit ad9cb9d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions python/plugins/fTools/tools/doVectorGrid.py
Expand Up @@ -139,8 +139,10 @@ def accept(self):
QMessageBox.information(self, self.tr("Vector grid"), self.tr("Invalid extent coordinates entered"))
xSpace = self.spnX.value()
ySpace = self.spnY.value()
if self.rdoPolygons.isChecked(): polygon = True
else: polygon = False
if self.rdoPolygons.isChecked():
polygon = True
else:
polygon = False
self.outShape.clear()
QApplication.setOverrideCursor(Qt.WaitCursor)
self.compute( boundBox, xSpace, ySpace, polygon )
Expand All @@ -153,7 +155,13 @@ def accept(self):
self.buttonOk.setEnabled( True )

def compute( self, bound, xOffset, yOffset, polygon ):
crs = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText())).crs()
crs = None
layer = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText()))

if layer is None:
crs = self.iface.mapCanvas().mapRenderer().destinationCrs()
else:
crs = layer.crs()
if not crs.isValid(): crs = None
if polygon:
fields = {0:QgsField("ID", QVariant.Int), 1:QgsField("XMIN", QVariant.Double), 2:QgsField("XMAX", QVariant.Double),
Expand All @@ -173,7 +181,6 @@ def compute( self, bound, xOffset, yOffset, polygon ):
outFeat = QgsFeature()
outGeom = QgsGeometry()
idVar = 0
# self.progressBar.setRange( 0, 0 )
self.progressBar.setValue( 0 )
if not polygon:
# counters for progressbar - update every 5%
Expand Down

0 comments on commit ad9cb9d

Please sign in to comment.