Skip to content
Permalink
Browse files

allow create grid without specifying base layer (fix #6109)

  • Loading branch information
alexbruy committed Jul 29, 2012
1 parent 540df9c commit ad9cb9d19440c8f95516f1bbeb10ddb03178d949
Showing with 11 additions and 4 deletions.
  1. +11 −4 python/plugins/fTools/tools/doVectorGrid.py
@@ -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 )
@@ -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),
@@ -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%

0 comments on commit ad9cb9d

Please sign in to comment.
You can’t perform that action at this time.