本文整理汇总了Python中safe.gui.tools.rectangle_map_tool.RectangleMapTool.reset方法的典型用法代码示例。如果您正苦于以下问题:Python RectangleMapTool.reset方法的具体用法?Python RectangleMapTool.reset怎么用?Python RectangleMapTool.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.gui.tools.rectangle_map_tool.RectangleMapTool
的用法示例。
在下文中一共展示了RectangleMapTool.reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExtentSelectorDialog
# 需要导入模块: from safe.gui.tools.rectangle_map_tool import RectangleMapTool [as 别名]
# 或者: from safe.gui.tools.rectangle_map_tool.RectangleMapTool import reset [as 别名]
#.........这里部分代码省略.........
def show_help(self):
"""Show usage info to the user."""
# Read the header and footer html snippets
self.main_stacked_widget.setCurrentIndex(0)
header = html_header()
footer = html_footer()
string = header
message = extent_selector_help()
string += message.to_html()
string += footer
self.help_web_view.setHtml(string)
def start_capture(self):
"""Start capturing the rectangle."""
previous_map_tool = self.canvas.mapTool()
if previous_map_tool != self.tool:
self.previous_map_tool = previous_map_tool
self.canvas.setMapTool(self.tool)
self.hide()
def stop_capture(self):
"""Stop capturing the rectangle and reshow the dialog."""
self._populate_coordinates()
self.canvas.setMapTool(self.previous_map_tool)
self.show()
def clear(self):
"""Clear the currently set extent.
"""
self.tool.reset()
self._populate_coordinates()
# Revert to using hazard, exposure and view as basis for analysis
self.hazard_exposure_view_extent.setChecked(True)
def reject(self):
"""User rejected the rectangle.
"""
self.canvas.unsetMapTool(self.tool)
if self.previous_map_tool != self.tool:
self.canvas.setMapTool(self.previous_map_tool)
self.tool.reset()
self.extent_selector_closed.emit()
super(ExtentSelectorDialog, self).reject()
def accept(self):
"""User accepted the rectangle.
"""
mode = None
if self.hazard_exposure_view_extent.isChecked():
mode = 'HazardExposureView'
elif self.hazard_exposure_only.isChecked():
mode = 'HazardExposure'
elif self.hazard_exposure_bookmark.isChecked():
mode = 'HazardExposureBookmark'
elif self.hazard_exposure_user_extent.isChecked():
mode = 'HazardExposureBoundingBox'
# LOGGER.info(
# 'Setting analysis extent mode to %s' % mode
# )
settings = QSettings()
settings.setValue('inasafe/analysis_extents_mode', mode)
示例2: OsmDownloaderDialog
# 需要导入模块: from safe.gui.tools.rectangle_map_tool import RectangleMapTool [as 别名]
# 或者: from safe.gui.tools.rectangle_map_tool.RectangleMapTool import reset [as 别名]
#.........这里部分代码省略.........
self.tr('Bounding box from the map canvas'))
# Get the extent as [xmin, ymin, xmax, ymax]
extent = viewport_geo_array(self.iface.mapCanvas())
self.update_extent(extent)
def update_extent_from_rectangle(self):
"""Update extent value in GUI based from the QgsMapTool rectangle.
.. note:: Delegates to update_extent()
"""
self.show()
self.canvas.unsetMapTool(self.rectangle_map_tool)
self.canvas.setMapTool(self.pan_tool)
rectangle = self.rectangle_map_tool.rectangle()
if rectangle:
self.bounding_box_group.setTitle(
self.tr('Bounding box from rectangle'))
extent = rectangle_geo_array(rectangle, self.iface.mapCanvas())
self.update_extent(extent)
@pyqtSignature('') # prevents actions being handled twice
def on_directory_button_clicked(self):
"""Show a dialog to choose directory."""
# noinspection PyCallByClass,PyTypeChecker
self.output_directory.setText(QFileDialog.getExistingDirectory(
self, self.tr('Select download directory')))
def drag_rectangle_on_map_canvas(self):
"""Hide the dialog and allow the user to draw a rectangle."""
self.hide()
self.rectangle_map_tool.reset()
self.canvas.unsetMapTool(self.pan_tool)
self.canvas.setMapTool(self.rectangle_map_tool)
def get_checked_features(self):
"""Create a tab with all checked features.
:return A list with all features which are checked in the UI.
:rtype list
"""
feature_types = []
if self.roads_flag.isChecked():
feature_types.append('roads')
if self.buildings_flag.isChecked():
feature_types.append('buildings')
if self.building_points_flag.isChecked():
feature_types.append('building-points')
if self.potential_idp_flag.isChecked():
feature_types.append('potential-idp')
if self.boundary_flag.isChecked():
level = self.admin_level_comboBox.currentIndex() + 1
feature_types.append('boundary-%s' % level)
return feature_types
def accept(self):
"""Do osm download and display it in QGIS."""
error_dialog_title = self.tr('InaSAFE OpenStreetMap Downloader Error')
# Lock the bounding_box_group
self.bounding_box_group.setDisabled(True)
# Get the extent
y_minimum = self.y_minimum.value()
示例3: ExtentSelectorDialog
# 需要导入模块: from safe.gui.tools.rectangle_map_tool import RectangleMapTool [as 别名]
# 或者: from safe.gui.tools.rectangle_map_tool.RectangleMapTool import reset [as 别名]
#.........这里部分代码省略.........
'the map as a blue rectangle. Please note that when running '
'your analysis, the effective analysis extent will be the '
'intersection of the hazard extent, exposure extent and user '
'extent - thus the entire user extent area may not be used for '
'analysis.'
)
message = m.Message()
message.add(heading)
message.add(body)
string += message.to_html()
string += footer
self.web_view.setHtml(string)
def start_capture(self):
"""Start capturing the rectangle."""
previous_map_tool = self.canvas.mapTool()
if previous_map_tool != self.tool:
self.previous_map_tool = previous_map_tool
self.canvas.setMapTool(self.tool)
self.hide()
def stop_capture(self):
"""Stop capturing the rectangle and reshow the dialog."""
self._populate_coordinates()
self.canvas.setMapTool(self.previous_map_tool)
self.show()
def clear(self):
"""Clear the currently set extent.
"""
self.tool.reset()
self._populate_coordinates()
def reject(self):
"""User rejected the rectangle.
"""
self.canvas.unsetMapTool(self.tool)
if self.previous_map_tool != self.tool:
self.canvas.setMapTool(self.previous_map_tool)
self.tool.reset()
self.extent_selector_closed.emit()
super(ExtentSelectorDialog, self).reject()
def accept(self):
"""User accepted the rectangle.
"""
self.canvas.unsetMapTool(self.tool)
if self.previous_map_tool != self.tool:
self.canvas.setMapTool(self.previous_map_tool)
if self.tool.rectangle() is not None:
LOGGER.info(
'Extent selector setting user extents to %s' %
self.tool.rectangle().toString())
self.extent_defined.emit(
self.tool.rectangle(),
self.canvas.mapRenderer().destinationCrs()
)
else:
LOGGER.info(
'Extent selector setting user extents to nothing')
self.clear_extent.emit()
示例4: OsmDownloaderDialog
# 需要导入模块: from safe.gui.tools.rectangle_map_tool import RectangleMapTool [as 别名]
# 或者: from safe.gui.tools.rectangle_map_tool.RectangleMapTool import reset [as 别名]
#.........这里部分代码省略.........
# min_latitude < max_latitude
if min_latitude >= max_latitude:
return False
# min_longitude < max_longitude
if min_longitude >= max_longitude:
return False
# -90 <= latitude <= 90
if min_latitude < -90 or min_latitude > 90:
return False
if max_latitude < -90 or max_latitude > 90:
return False
# -180 <= longitude <= 180
if min_longitude < -180 or min_longitude > 180:
return False
if max_longitude < -180 or max_longitude > 180:
return False
return True
@pyqtSignature('') # prevents actions being handled twice
def on_directory_button_clicked(self):
"""Show a dialog to choose directory."""
# noinspection PyCallByClass,PyTypeChecker
self.output_directory.setText(QFileDialog.getExistingDirectory(
self, self.tr('Select download directory')))
def drag_rectangle_on_map_canvas(self):
"""Hide the dialog and allow the user to draw a rectangle."""
self.hide()
self.rectangle_map_tool.reset()
self.canvas.unsetMapTool(self.pan_tool)
self.canvas.setMapTool(self.rectangle_map_tool)
def accept(self):
"""Do osm download and display it in QGIS."""
error_dialog_title = self.tr('InaSAFE OpenStreetMap Downloader Error')
# Lock the groupbox
self.groupBox.setDisabled(True)
# Validate extent
valid_flag = self.validate_extent()
if not valid_flag:
message = self.tr(
'The bounding box is not valid. Please make sure it is '
'valid or check your projection!')
# noinspection PyCallByClass,PyTypeChecker,PyArgumentList
display_warning_message_box(self, error_dialog_title, message)
# Unlock the groupbox
self.groupBox.setEnabled(True)
return
# Get all the feature types
index = self.feature_type.currentIndex()
if index == 0:
feature_types = ['buildings', 'roads', 'building-points']
elif index == 1:
feature_types = ['buildings']
elif index == 2:
feature_types = ['building-points']
else:
feature_types = ['roads']
示例5: ExtentSelectorDialog
# 需要导入模块: from safe.gui.tools.rectangle_map_tool import RectangleMapTool [as 别名]
# 或者: from safe.gui.tools.rectangle_map_tool.RectangleMapTool import reset [as 别名]
#.........这里部分代码省略.........
'the map as a blue rectangle. Please note that when running '
'your analysis, the effective analysis extent will be the '
'intersection of the hazard extent, exposure extent and user '
'extent - thus the entire user extent area may not be used for '
'analysis.'
)
message = m.Message()
message.add(heading)
message.add(body)
string += message.to_html()
string += footer
self.web_view.setHtml(string)
def start_capture(self):
"""Start capturing the rectangle."""
previous_map_tool = self.canvas.mapTool()
if previous_map_tool != self.tool:
self.previous_map_tool = previous_map_tool
self.canvas.setMapTool(self.tool)
self.hide()
def stop_capture(self):
"""Stop capturing the rectangle and reshow the dialog."""
self._populate_coordinates()
self.canvas.setMapTool(self.previous_map_tool)
self.show()
def clear(self):
"""Clear the currently set extent.
"""
self.tool.reset()
self._populate_coordinates()
def reject(self):
"""User rejected the rectangle.
"""
self.canvas.unsetMapTool(self.tool)
if self.previous_map_tool != self.tool:
self.canvas.setMapTool(self.previous_map_tool)
self.tool.reset()
self.extent_selector_closed.emit()
super(ExtentSelectorDialog, self).reject()
def accept(self):
"""User accepted the rectangle.
"""
self.canvas.unsetMapTool(self.tool)
if self.previous_map_tool != self.tool:
self.canvas.setMapTool(self.previous_map_tool)
if self.tool.rectangle() is not None:
LOGGER.info(
'Extent selector setting user extents to %s' %
self.tool.rectangle().toString())
self.extent_defined.emit(
self.tool.rectangle(),
self.canvas.mapRenderer().destinationCrs()
)
else:
LOGGER.info(
'Extent selector setting user extents to nothing')
self.clear_extent.emit()