Skip to content

Commit

Permalink
fix bug with extents for raster layers
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@10072 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
cfarmer committed Jan 31, 2009
1 parent 9509fef commit 9e67c9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/plugins/ftools/tools/doVectorGrid.py
Expand Up @@ -50,10 +50,9 @@ def __init__(self, iface):
self.xMax.setValidator(QDoubleValidator(self.xMax))
self.yMin.setValidator(QDoubleValidator(self.yMin))
self.yMax.setValidator(QDoubleValidator(self.yMax))
layers = ftools_utils.getLayerNames(
[ QGis.Point, QGis.Line, QGis.Polygon ] )
for layer in layers:
self.inShape.addItem( layer )
layermap = QgsMapLayerRegistry.instance().mapLayers()
for name, layer in layermap.iteritems():
self.inShape.addItem( unicode( layer.name() ) )

def offset(self, value):
if self.chkLock.isChecked():
Expand All @@ -62,7 +61,7 @@ def offset(self, value):
def updateLayer( self ):
mLayerName = self.inShape.currentText()
if not mLayerName == "":
mLayer = self.getMapLayerByName( unicode( mLayerName ) )
mLayer = ftools_utils.getMapLayerByName( unicode( mLayerName ) )
boundBox = mLayer.extent()
self.updateExtents( boundBox )

Expand Down
10 changes: 10 additions & 0 deletions python/plugins/ftools/tools/ftools_utils.py
Expand Up @@ -183,6 +183,16 @@ def getVectorLayerByName( myName ):
return layer
else:
return None

# Return QgsMapLayer from a layer name ( as string )
def getMapLayerByName( myName ):
layermap = QgsMapLayerRegistry.instance().mapLayers()
for name, layer in layermap.iteritems():
if layer.name() == myName:
if layer.isValid():
return layer
else:
return None

# Return the field list of a vector layer
def getFieldList( vlayer ):
Expand Down

0 comments on commit 9e67c9d

Please sign in to comment.