doDefineProj_py.patch

Mikhail Titov, 2012-07-27 12:59 PM

Download (1.12 KB)

View differences:

c:/OSGeo4W/apps/qgis/python/plugins/fTools/tools/doVectorGrid.py 2012-07-27 14:53:01 -0500
153 153
        self.buttonOk.setEnabled( True )
154 154

  
155 155
    def compute( self, bound, xOffset, yOffset, polygon ):
156
        crs = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText())).crs()
157
        if not crs.isValid(): crs = None
156
        crs = None
157
        layer = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText()))
158
        if layer:
159
            crs = layer.crs()
160
        else:
161
            (id, ok) = QgsProject.instance().readNumEntry("SpatialRefSys", "/ProjectCRSID", -1)
162
            if ok:
163
                crs = QgsCoordinateReferenceSystem(id, QgsCoordinateReferenceSystem.InternalCrsId )
164
        if crs and not crs.isValid(): crs = None
158 165
        if polygon:
159 166
            fields = {0:QgsField("ID", QVariant.Int), 1:QgsField("XMIN", QVariant.Double), 2:QgsField("XMAX", QVariant.Double),
160 167
            3:QgsField("YMIN", QVariant.Double), 4:QgsField("YMAX", QVariant.Double)}