本文整理汇总了Python中processing.gui.RectangleMapTool.RectangleMapTool类的典型用法代码示例。如果您正苦于以下问题:Python RectangleMapTool类的具体用法?Python RectangleMapTool怎么用?Python RectangleMapTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RectangleMapTool类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, dialog, param):
super(ExtentSelectionPanel, self).__init__(None)
self.setupUi(self)
self.dialog = dialog
self.param = param
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
if hasattr(self.leText, 'setPlaceholderText'):
self.leText.setPlaceholderText(
self.tr('[Leave blank to use min covering extent]'))
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
if param.defaultValue() is not None:
context = createContext()
rect = QgsProcessingParameters.parameterAsExtent(param, {param.name(): param.defaultValue()}, context)
if not rect.isNull():
try:
s = '{},{},{},{}'.format(
rect.xMinimum(), rect.xMaximum(), rect.yMinimum(), rect.yMaximum())
self.leText.setText(s)
except:
pass
示例2: __init__
def __init__(self, dialog, alg, default=None):
super(ExtentSelectionPanel, self).__init__(None)
self.setupUi(self)
self.dialog = dialog
self.params = alg.parameters
if self.canUseAutoExtent():
if hasattr(self.leText, "setPlaceholderText"):
self.leText.setPlaceholderText(self.tr("[Leave blank to use min covering extent]"))
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
if default:
tokens = unicode(default).split(",")
if len(tokens) == 4:
try:
float(tokens[0])
float(tokens[1])
float(tokens[2])
float(tokens[3])
self.leText.setText(unicode(default))
except:
pass
示例3: __init__
def __init__(self, parent=None):
super(BboxWidget, self).__init__(parent)
self.setupUi(self)
self.dialog = None
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
示例4: __init__
def __init__(self, dialog, alg, default):
QWidget.__init__(self)
self.setupUi(self)
self.dialog = dialog
self.params = alg.parameters
if self.canUseAutoExtent():
if hasattr(self.leText, "setPlaceholderText"):
self.leText.setPlaceholderText(self.tr("[Leave blank to use min covering extent]"))
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
示例5: __init__
def __init__(self, dialog, alg, default):
super(ExtentSelectionPanel, self).__init__(None)
self.dialog = dialog
self.params = alg.parameters
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QtGui.QLineEdit()
#self.text.setText(default)
self.text.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
if self.canUseAutoExtent():
if hasattr(self.text, 'setPlaceholderText'):
self.text.setPlaceholderText("[Leave blank to use min covering extent]")
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
self.pushButton.setText("...")
self.pushButton.clicked.connect(self.buttonPushed)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
canvas = QGisLayers.iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.connect(self.tool, SIGNAL("rectangleCreated()"), self.fillCoords)
示例6: ExtentSelectionPanel
class ExtentSelectionPanel(QWidget, Ui_Form):
def __init__(self, dialog, alg, default):
QWidget.__init__(self)
self.setupUi(self)
self.dialog = dialog
self.params = alg.parameters
if self.canUseAutoExtent():
if hasattr(self.leText, "setPlaceholderText"):
self.leText.setPlaceholderText(self.tr("[Leave blank to use min covering extent]"))
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
def canUseAutoExtent(self):
for param in self.params:
if isinstance(param, (ParameterRaster, ParameterVector)):
return True
if isinstance(param, ParameterMultipleInput):
return True
return False
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(self.tr("Use layer/canvas extent"), self.btnSelect)
selectOnCanvasAction = QAction(self.tr("Select extent on canvas"), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
if self.canUseAutoExtent():
useMincoveringExtentAction = QAction(self.tr("Use min covering extent from input layers"), self.btnSelect)
useMincoveringExtentAction.triggered.connect(self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
def useMinCoveringExtent(self):
self.leText.setText("")
def getMinCoveringExtent(self):
first = True
found = False
for param in self.params:
if param.value:
if isinstance(param, (ParameterRaster, ParameterVector)):
if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
layer = param.value
else:
layer = dataobjects.getObjectFromUri(param.value)
if layer:
found = True
self.addToRegion(layer, first)
first = False
elif isinstance(param, ParameterMultipleInput):
layers = param.value.split(";")
for layername in layers:
layer = dataobjects.getObjectFromUri(layername, first)
if layer:
found = True
self.addToRegion(layer, first)
first = False
if found:
return "{},{},{},{}".format(self.xmin, self.xmax, self.ymin, self.ymax)
else:
return None
def useNewAlg(self, alg):
self.params = alg.parameters
def addToRegion(self, layer, first):
if first:
self.xmin = layer.extent().xMinimum()
self.xmax = layer.extent().xMaximum()
self.ymin = layer.extent().yMinimum()
self.ymax = layer.extent().yMaximum()
else:
self.xmin = min(self.xmin, layer.extent().xMinimum())
self.xmax = max(self.xmax, layer.extent().xMaximum())
self.ymin = min(self.ymin, layer.extent().yMinimum())
self.ymax = max(self.ymax, layer.extent().yMaximum())
def useLayerExtent(self):
CANVAS_KEY = "Use canvas extent"
extentsDict = {}
extentsDict[CANVAS_KEY] = iface.mapCanvas().extent()
extents = [CANVAS_KEY]
layers = dataobjects.getAllLayers()
for layer in layers:
extents.append(layer.name())
extentsDict[layer.name()] = layer.extent()
(item, ok) = QInputDialog.getItem(self, self.tr("Select extent"), self.tr("Use extent from"), extents, False)
#.........这里部分代码省略.........
示例7: ExtentSelectionPanel
class ExtentSelectionPanel(BASE, WIDGET):
hasChanged = pyqtSignal()
def __init__(self, dialog, param):
super(ExtentSelectionPanel, self).__init__(None)
self.setupUi(self)
self.leText.textChanged.connect(lambda: self.hasChanged.emit())
self.dialog = dialog
self.param = param
self.crs = QgsProject.instance().crs()
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
if hasattr(self.leText, 'setPlaceholderText'):
self.leText.setPlaceholderText(
self.tr('[Leave blank to use min covering extent]'))
self.btnSelect.clicked.connect(self.selectExtent)
if iface is not None:
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
else:
self.prevMapTool = None
self.tool = None
if param.defaultValue() is not None:
context = createContext()
rect = QgsProcessingParameters.parameterAsExtent(param, {param.name(): param.defaultValue()}, context)
crs = QgsProcessingParameters.parameterAsExtentCrs(param, {param.name(): param.defaultValue()}, context)
if not rect.isNull():
try:
s = '{},{},{},{}'.format(
rect.xMinimum(), rect.xMaximum(), rect.yMinimum(), rect.yMaximum())
if crs.isValid():
s += ' [' + crs.authid() + ']'
self.crs = crs
self.leText.setText(s)
except:
pass
def selectExtent(self):
popupmenu = QMenu()
useCanvasExtentAction = QAction(
QCoreApplication.translate("ExtentSelectionPanel", 'Use Canvas Extent'),
self.btnSelect)
useLayerExtentAction = QAction(
QCoreApplication.translate("ExtentSelectionPanel", 'Use Layer Extent…'),
self.btnSelect)
selectOnCanvasAction = QAction(
self.tr('Select Extent on Canvas'), self.btnSelect)
popupmenu.addAction(useCanvasExtentAction)
popupmenu.addAction(selectOnCanvasAction)
popupmenu.addSeparator()
popupmenu.addAction(useLayerExtentAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
useCanvasExtentAction.triggered.connect(self.useCanvasExtent)
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
useMincoveringExtentAction = QAction(
self.tr('Use Min Covering Extent from Input Layers'),
self.btnSelect)
useMincoveringExtentAction.triggered.connect(
self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
def useMinCoveringExtent(self):
self.leText.setText('')
def useLayerExtent(self):
dlg = LayerSelectionDialog(self)
if dlg.exec_():
layer = dlg.selected_layer()
self.setValueFromRect(QgsReferencedRectangle(layer.extent(), layer.crs()))
def useCanvasExtent(self):
self.setValueFromRect(QgsReferencedRectangle(iface.mapCanvas().extent(),
iface.mapCanvas().mapSettings().destinationCrs()))
def selectOnCanvas(self):
canvas = iface.mapCanvas()
canvas.setMapTool(self.tool)
self.dialog.showMinimized()
def updateExtent(self):
r = self.tool.rectangle()
self.setValueFromRect(r)
def setValueFromRect(self, r):
s = '{},{},{},{}'.format(
r.xMinimum(), r.xMaximum(), r.yMinimum(), r.yMaximum())
#.........这里部分代码省略.........
示例8: ExtentSelectionPanel
class ExtentSelectionPanel(BASE, WIDGET):
def __init__(self, dialog, param):
super(ExtentSelectionPanel, self).__init__(None)
self.setupUi(self)
self.dialog = dialog
self.param = param
self.crs = QgsProject.instance().crs()
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
if hasattr(self.leText, 'setPlaceholderText'):
self.leText.setPlaceholderText(
self.tr('[Leave blank to use min covering extent]'))
self.btnSelect.clicked.connect(self.selectExtent)
if iface is not None:
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
else:
self.prevMapTool = None
self.tool = None
if param.defaultValue() is not None:
context = createContext()
rect = QgsProcessingParameters.parameterAsExtent(param, {param.name(): param.defaultValue()}, context)
crs = QgsProcessingParameters.parameterAsExtentCrs(param, {param.name(): param.defaultValue()}, context)
if not rect.isNull():
try:
s = '{},{},{},{}'.format(
rect.xMinimum(), rect.xMaximum(), rect.yMinimum(), rect.yMaximum())
if crs.isValid():
s += ' [' + crs.authid() + ']'
self.crs = crs
self.leText.setText(s)
except:
pass
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(
self.tr('Use layer/canvas extent'), self.btnSelect)
selectOnCanvasAction = QAction(
self.tr('Select extent on canvas'), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
if self.param.flags() & QgsProcessingParameterDefinition.FlagOptional:
useMincoveringExtentAction = QAction(
self.tr('Use min covering extent from input layers'),
self.btnSelect)
useMincoveringExtentAction.triggered.connect(
self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
def useMinCoveringExtent(self):
self.leText.setText('')
def useLayerExtent(self):
CANVAS_KEY = 'Use canvas extent'
extentsDict = {}
extentsDict[CANVAS_KEY] = {"extent": iface.mapCanvas().extent(),
"authid": iface.mapCanvas().mapSettings().destinationCrs().authid()}
extents = [CANVAS_KEY]
layers = QgsProcessingUtils.compatibleLayers(QgsProject.instance())
for layer in layers:
authid = layer.crs().authid()
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF) \
and authid is not None:
layerName = u'{} [{}]'.format(layer.name(), authid)
else:
layerName = layer.name()
extents.append(layerName)
extentsDict[layerName] = {"extent": layer.extent(), "authid": authid}
(item, ok) = QInputDialog.getItem(self, self.tr('Select extent'),
self.tr('Use extent from'), extents, False)
if ok:
self.setValueFromRect(QgsReferencedRectangle(extentsDict[item]["extent"], QgsCoordinateReferenceSystem(extentsDict[item]["authid"])))
def selectOnCanvas(self):
canvas = iface.mapCanvas()
canvas.setMapTool(self.tool)
self.dialog.showMinimized()
def updateExtent(self):
r = self.tool.rectangle()
self.setValueFromRect(r)
def setValueFromRect(self, r):
s = '{},{},{},{}'.format(
r.xMinimum(), r.xMaximum(), r.yMinimum(), r.yMaximum())
#.........这里部分代码省略.........
示例9: ExtentSelectionPanel
class ExtentSelectionPanel(BASE, WIDGET):
def __init__(self, dialog, alg, default=None):
super(ExtentSelectionPanel, self).__init__(None)
self.setupUi(self)
self.dialog = dialog
self.params = alg.parameters
if self.canUseAutoExtent():
if hasattr(self.leText, "setPlaceholderText"):
self.leText.setPlaceholderText(self.tr("[Leave blank to use min covering extent]"))
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
if default:
tokens = unicode(default).split(",")
if len(tokens) == 4:
try:
float(tokens[0])
float(tokens[1])
float(tokens[2])
float(tokens[3])
self.leText.setText(unicode(default))
except:
pass
def canUseAutoExtent(self):
for param in self.params:
if isinstance(param, (ParameterRaster, ParameterVector)):
return True
if isinstance(param, ParameterMultipleInput):
return True
return False
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(self.tr("Use layer/canvas extent"), self.btnSelect)
selectOnCanvasAction = QAction(self.tr("Select extent on canvas"), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
if self.canUseAutoExtent():
useMincoveringExtentAction = QAction(self.tr("Use min covering extent from input layers"), self.btnSelect)
useMincoveringExtentAction.triggered.connect(self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QCursor.pos())
def useMinCoveringExtent(self):
self.leText.setText("")
def getMinCoveringExtent(self):
first = True
found = False
for param in self.params:
if param.value:
if isinstance(param, (ParameterRaster, ParameterVector)):
if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
layer = param.value
else:
layer = dataobjects.getObject(param.value)
if layer:
found = True
self.addToRegion(layer, first)
first = False
elif isinstance(param, ParameterMultipleInput):
layers = param.value.split(";")
for layername in layers:
layer = dataobjects.getObject(layername)
if layer:
found = True
self.addToRegion(layer, first)
first = False
if found:
return "{},{},{},{}".format(self.xmin, self.xmax, self.ymin, self.ymax)
else:
return None
def useNewAlg(self, alg):
self.params = alg.parameters
def addToRegion(self, layer, first):
if first:
self.xmin = layer.extent().xMinimum()
self.xmax = layer.extent().xMaximum()
self.ymin = layer.extent().yMinimum()
self.ymax = layer.extent().yMaximum()
else:
self.xmin = min(self.xmin, layer.extent().xMinimum())
self.xmax = max(self.xmax, layer.extent().xMaximum())
self.ymin = min(self.ymin, layer.extent().yMinimum())
#.........这里部分代码省略.........
示例10: ExtentSelectionPanel
class ExtentSelectionPanel(QtGui.QWidget):
def __init__(self, dialog, alg, default):
super(ExtentSelectionPanel, self).__init__(None)
self.dialog = dialog
self.params = alg.parameters
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QtGui.QLineEdit()
self.text.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
if self.canUseAutoExtent():
if hasattr(self.text, 'setPlaceholderText'):
self.text.setPlaceholderText(
self.tr('[Leave blank to use min covering extent]'))
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
self.pushButton.setText('...')
self.pushButton.clicked.connect(self.buttonPushed)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.connect(self.tool, SIGNAL('rectangleCreated()'), self.fillCoords)
def canUseAutoExtent(self):
for param in self.params:
if isinstance(param, (ParameterRaster, ParameterVector)):
return True
if isinstance(param, ParameterMultipleInput):
return True
return False
def buttonPushed(self):
popupmenu = QMenu()
useLayerExtentAction = QtGui.QAction(self.tr('Use layer/canvas extent'),
self.pushButton)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
popupmenu.addAction(useLayerExtentAction)
selectOnCanvasAction = QtGui.QAction(self.tr('Select extent on canvas'),
self.pushButton)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
popupmenu.addAction(selectOnCanvasAction)
if self.canUseAutoExtent():
useMincoveringExtentAction = \
QtGui.QAction(self.tr('Use min covering extent from input layers'),
self.pushButton)
useMincoveringExtentAction.triggered.connect(
self.useMinCoveringExtent)
popupmenu.addAction(useMincoveringExtentAction)
popupmenu.exec_(QtGui.QCursor.pos())
def useMinCoveringExtent(self):
self.text.setText('')
def getMinCoveringExtent(self):
first = True
found = False
for param in self.params:
if param.value:
if isinstance(param, (ParameterRaster, ParameterVector)):
if isinstance(param.value, (QgsRasterLayer,
QgsVectorLayer)):
layer = param.value
else:
layer = dataobjects.getObjectFromUri(param.value)
if layer:
found = True
self.addToRegion(layer, first)
first = False
elif isinstance(param, ParameterMultipleInput):
layers = param.value.split(';')
for layername in layers:
layer = dataobjects.getObjectFromUri(layername, first)
if layer:
found = True
self.addToRegion(layer, first)
first = False
if found:
return str(self.xmin) + ',' + str(self.xmax) + ',' \
+ str(self.ymin) + ',' + str(self.ymax)
else:
return None
def useNewAlg(self, alg):
self.params = alg.parameters
def addToRegion(self, layer, first):
if first:
self.xmin = layer.extent().xMinimum()
self.xmax = layer.extent().xMaximum()
self.ymin = layer.extent().yMinimum()
self.ymax = layer.extent().yMaximum()
else:
self.xmin = min(self.xmin, layer.extent().xMinimum())
self.xmax = max(self.xmax, layer.extent().xMaximum())
#.........这里部分代码省略.........
示例11: BboxWidget
class BboxWidget(BASE, WIDGET):
def __init__(self, parent=None):
super(BboxWidget, self).__init__(parent)
self.setupUi(self)
self.dialog = None
self.btnSelect.clicked.connect(self.selectExtent)
canvas = iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.tool.rectangleCreated.connect(self.updateExtent)
def setDialog(self):
self._dialog = Dialog
def selectExtent(self):
popupmenu = QMenu()
useLayerExtentAction = QAction(
self.tr('Use layer/canvas extent'), self.btnSelect)
selectOnCanvasAction = QAction(
self.tr('Select extent on canvas'), self.btnSelect)
popupmenu.addAction(useLayerExtentAction)
popupmenu.addAction(selectOnCanvasAction)
selectOnCanvasAction.triggered.connect(self.selectOnCanvas)
useLayerExtentAction.triggered.connect(self.useLayerExtent)
popupmenu.exec_(QCursor.pos())
def useLayerExtent(self):
CANVAS_KEY = 'Use canvas extent'
extentsDict = {}
extentsDict[CANVAS_KEY] = {"extent": iface.mapCanvas().extent(),
"authid": iface.mapCanvas().mapSettings().destinationCrs().authid()}
extents = [CANVAS_KEY]
for layer in QgsProject.instance().mapLayers().values():
authid = layer.crs().authid()
layerName = layer.name()
extents.append(layerName)
extentsDict[layerName] = {"extent": layer.extent(), "authid": authid}
(item, ok) = QInputDialog.getItem(self, self.tr('Select extent'),
self.tr('Use extent from'), extents, False)
if ok:
self.setValue(extentsDict[item]["extent"], extentsDict[item]['authid'])
def selectOnCanvas(self):
canvas = iface.mapCanvas()
canvas.setMapTool(self.tool)
if self.dialog:
self.dialog.showMinimized()
def updateExtent(self):
self.setValue(self.tool.rectangle(),
iface.mapCanvas().mapSettings().destinationCrs().authid())
self.tool.reset()
canvas = iface.mapCanvas()
canvas.setMapTool(self.prevMapTool)
if self.dialog:
self.dialog.showNormal()
self.dialog.raise_()
self.dialog.activateWindow()
def setValue(self, value, crs_authid):
if isinstance(value, QgsRectangle):
s = '{},{},{},{}'.format(value.xMinimum(),
value.yMinimum(),
value.xMaximum(),
value.yMaximum())
elif isinstance(value, str):
s = value
else:
s = ",".join([str(v) for v in value])
s = '{},{}'.format(s, crs_authid)
self.leText.setText(s)
return True
def value(self):
return self.leText.text()
def rectangle(self):
if self.value() == '':
return None
xmin, ymin, xmax, ymax = [float(x) for x in self.value().split(',')[0:4]]
return QgsRectangle(xmin, ymin, xmax, ymax)
def crs(self):
if self.value() == '':
return None
return QgsCoordinateReferenceSystem(self.value().split(',')[4])
def isValid(self):
try:
rect = self.rectangle()
#.........这里部分代码省略.........