fix bug with extents for raster layers

git-svn-id: http://svn.osgeo.org/qgis/trunk@10072 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
cfarmer 2009-01-31 19:47:19 +00:00
parent 9509fef117
commit 9e67c9d0db
2 changed files with 14 additions and 5 deletions

View File

@ -50,10 +50,9 @@ class Dialog(QDialog, Ui_Dialog):
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():
@ -62,7 +61,7 @@ class Dialog(QDialog, Ui_Dialog):
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 )

View File

@ -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 ):