Exemplo n.º 1
0
    def checkIfOpening(self):
        ver = str(QGis.QGIS_VERSION)
        if ver[0] == "0" and ((ver[2] != "1") or
                              (ver[3] != "1")):  #Check qgis version
            QMessageBox.warning(
                self.iface.mainWindow(), "Profile tool",
                "Quantum GIS version detected: " + ver +
                "\nProfile plugin requires version at least 0.11")
            return False
        if self.iface.mapCanvas().layerCount() == 0:  #Check a layer is opened
            QMessageBox.warning(self.iface.mainWindow(), "Profile",
                                "First open any raster layer, please")
            return False

        layer = self.iface.activeLayer()

        if layer == None or not isProfilable(
                layer):  #Check if a raster layer is opened and selectionned
            if self.mdl == None:
                QMessageBox.warning(self.iface.mainWindow(), "Profile Tool",
                                    "Please select one raster layer")
                return False
            if self.mdl.rowCount() == 0:
                QMessageBox.warning(self.iface.mainWindow(), "Profile Tool",
                                    "Please select one raster layer")
                return False

        return True
    def checkIfOpening(self):
        if self.iface.mapCanvas().layerCount() == 0:                    #Check a layer is opened
            QMessageBox.warning(self.iface.mainWindow(), "Profile", "First open a raster layer, please")
            return False

        layer = self.iface.activeLayer()
        
        if layer == None or not isProfilable(layer) :    #Check if a raster layer is opened and selected
            if self.mdl == None or self.mdl.rowCount() == 0:
                QMessageBox.warning(self.iface.mainWindow(), "Profile Tool", "Please select a raster layer")
                return False
                
        return True
    def checkIfOpening(self):
        if self.iface.mapCanvas().layerCount() == 0:  #Check a layer is opened
            QMessageBox.warning(self.iface.mainWindow(), "Profile",
                                "First open a raster layer, please")
            return False

        layer = self.iface.activeLayer()

        if layer == None or not isProfilable(
                layer):  #Check if a raster layer is opened and selected
            if self.mdl == None or self.mdl.rowCount() == 0:
                QMessageBox.warning(self.iface.mainWindow(), "Profile Tool",
                                    "Please select a raster layer")
                return False

        return True
Exemplo n.º 4
0
	def checkIfOpening(self):
		ver = str(QGis.QGIS_VERSION)
		if ver[0] == "0" and ((ver[2] != "1") or (ver[3] != "1")):		#Check qgis version
			QMessageBox.warning(self.iface.mainWindow(), "Profile tool", "Quantum GIS version detected: "+ver+"\nProfile plugin requires version at least 0.11")
			return False
		if self.iface.mapCanvas().layerCount() == 0:					#Check a layer is opened
			QMessageBox.warning(self.iface.mainWindow(), "Profile", "First open any raster layer, please")
			return False

		layer = self.iface.activeLayer()

		if layer == None or not isProfilable(layer) :	#Check if a raster layer is opened and selectionned
			if self.mdl == None:
				QMessageBox.warning(self.iface.mainWindow(), "Profile Tool", "Please select one raster layer")
				return False
			if self.mdl.rowCount() == 0:
				QMessageBox.warning(self.iface.mainWindow(), "Profile Tool", "Please select one raster layer")
				return False

		return True
 def addLayer(self):
     layer = self.iface.activeLayer()
     if isProfilable(layer):
         self.tableViewTool.addLayer(self.iface, self.mdl, layer)
 def addLayer(self):
     layer = self.iface.activeLayer()
     if isProfilable(layer):
         self.tableViewTool.addLayer(self.iface, self.mdl, layer)
 def addLayer(self, layer = None):
     if layer is None:
         layer = self.iface.activeLayer()
     if isProfilable(layer):
         self.tableViewTool.addLayer(self.iface, self.mdl, layer)
         layer.dataChanged.connect(self.refreshPlot)