本文整理汇总了Python中safe.test.utilities.load_standard_layers函数的典型用法代码示例。如果您正苦于以下问题:Python load_standard_layers函数的具体用法?Python load_standard_layers怎么用?Python load_standard_layers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_standard_layers函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
"""Fixture run before all tests"""
register_impact_functions()
self.maxDiff = None # show full diff for assert errors
os.environ['LANG'] = 'en'
self.DOCK.show_only_visible_layers_flag = True
load_standard_layers(self.DOCK)
self.DOCK.cboHazard.setCurrentIndex(0)
self.DOCK.cboExposure.setCurrentIndex(0)
self.DOCK.cboFunction.setCurrentIndex(0)
self.DOCK.run_in_thread_flag = False
self.DOCK.show_only_visible_layers_flag = False
self.DOCK.set_layer_from_title_flag = False
self.DOCK.zoom_to_impact_flag = False
self.DOCK.hide_exposure_flag = False
self.DOCK.show_intermediate_layers = False
set_jakarta_extent()
self._keywordIO = KeywordIO()
self._defaults = get_defaults()
# Set extent as Jakarta extent
geo_crs = QgsCoordinateReferenceSystem()
geo_crs.createFromSrid(4326)
self.extent = extent_to_geo_array(CANVAS.extent(), geo_crs)
示例2: setUp
def setUp(self):
"""Fixture run before all tests"""
register_impact_functions()
self.dock.show_only_visible_layers_flag = True
load_standard_layers(self.dock)
self.dock.cboHazard.setCurrentIndex(0)
self.dock.cboExposure.setCurrentIndex(0)
self.dock.cboFunction.setCurrentIndex(0)
self.dock.run_in_thread_flag = False
self.dock.show_only_visible_layers_flag = False
self.dock.set_layer_from_title_flag = False
self.dock.zoom_to_impact_flag = False
self.dock.hide_exposure_flag = False
self.dock.show_intermediate_layers = False
self.dock.user_extent = None
self.dock.user_extent_crs = None
# For these tests we will generally use explicit overlap
# between hazard, exposure and view, so make that default
# see also safe/test/utilities.py where this is globally
# set to HazardExposure
settings = QtCore.QSettings()
settings.setValue(
'inasafe/analysis_extents_mode',
'HazardExposureView')
示例3: setUp
def setUp(self):
"""Fixture run before all tests."""
os.environ['LANG'] = 'en'
self.DOCK.show_only_visible_layers_flag = True
load_standard_layers(self.DOCK)
self.DOCK.hazard_layer_combo.setCurrentIndex(0)
self.DOCK.exposure_layer_combo.setCurrentIndex(0)
self.DOCK.run_in_thread_flag = False
self.DOCK.show_only_visible_layers_flag = False
self.DOCK.set_layer_from_title_flag = False
self.DOCK.zoom_to_impact_flag = False
self.DOCK.hide_exposure_flag = False
# Create scenario dialog
self.save_scenario_dialog = SaveScenarioDialog(IFACE, self.DOCK)
示例4: setUp
def setUp(self):
"""Fixture run before all tests"""
os.environ['LANG'] = 'en'
DOCK.show_only_visible_layers_flag = True
load_standard_layers(DOCK)
DOCK.cboHazard.setCurrentIndex(0)
DOCK.cboExposure.setCurrentIndex(0)
DOCK.cboFunction.setCurrentIndex(0)
DOCK.run_in_thread_flag = False
DOCK.show_only_visible_layers_flag = False
DOCK.set_layer_from_title_flag = False
DOCK.zoom_to_impact_flag = False
DOCK.hide_exposure_flag = False
DOCK.show_intermediate_layers = False
set_jakarta_extent()
示例5: setUp
def setUp(self):
"""Fixture run before all tests."""
os.environ['LANG'] = 'en'
DOCK.show_only_visible_layers_flag = True
load_standard_layers(DOCK)
DOCK.cboHazard.setCurrentIndex(0)
DOCK.cboExposure.setCurrentIndex(0)
DOCK.cboFunction.setCurrentIndex(0)
DOCK.run_in_thread_flag = False
DOCK.show_only_visible_layers_flag = False
DOCK.set_layer_from_title_flag = False
DOCK.zoom_to_impact_flag = False
DOCK.hide_exposure_flag = False
DOCK.show_intermediate_layers = False
# Create scenario dialog
self.save_scenario_dialog = SaveScenarioDialog(IFACE, DOCK)
示例6: setUp
def setUp(self):
"""Fixture run before all tests"""
register_impact_functions()
DOCK.show_only_visible_layers_flag = True
load_standard_layers(DOCK)
DOCK.cboHazard.setCurrentIndex(0)
DOCK.cboExposure.setCurrentIndex(0)
DOCK.cboFunction.setCurrentIndex(0)
DOCK.run_in_thread_flag = False
DOCK.show_only_visible_layers_flag = False
DOCK.set_layer_from_title_flag = False
DOCK.zoom_to_impact_flag = False
DOCK.hide_exposure_flag = False
DOCK.show_intermediate_layers = False
DOCK.user_extent = None
DOCK.user_extent_crs = None
示例7: setUp
def setUp(self):
"""Fixture run before all tests."""
self.dock.show_only_visible_layers_flag = True
load_standard_layers(self.dock)
self.dock.hazard_layer_combo.setCurrentIndex(1)
self.dock.exposure_layer_combo.setCurrentIndex(0)
self.dock.show_only_visible_layers_flag = False
self.dock.set_layer_from_title_flag = False
self.dock.zoom_to_impact_flag = False
self.dock.hide_exposure_flag = False
self.dock.user_extent = None
self.dock.user_extent_crs = None
# For these tests we will generally use explicit overlap
# between hazard, exposure and view, so make that default
# see also safe/test/utilities.py where this is globally
# set to HazardExposure
settings = QtCore.QSettings()
settings.setValue(
'inasafe/analysis_extents_mode', HAZARD_EXPOSURE_VIEW)
示例8: test_init
def test_init(self):
"""Test initialization with different layers.."""
# No layer
QgsProject.instance().removeAllMapLayers()
dialog = MetadataConverterDialog(PARENT, IFACE)
self.assertEqual(dialog.input_layer_combo_box.count(), 0)
dialog.close()
# Load many layers
QgsProject.instance().removeAllMapLayers()
load_standard_layers()
dialog = MetadataConverterDialog(PARENT, IFACE)
self.assertGreater(dialog.input_layer_combo_box.count(), 0)
dialog.close()
# Load aggregation layer
QgsProject.instance().removeAllMapLayers()
layer = load_test_vector_layer(
'gisv4', 'aggregation', 'small_grid_complex.geojson', clone=True)
QgsProject.instance().addMapLayer(layer)
dialog = MetadataConverterDialog(PARENT, IFACE)
dialog.input_layer_combo_box.setLayer(layer)
self.assertEqual(dialog.input_layer_combo_box.count(), 1)
self.assertFalse(dialog.target_exposure_combo_box.isEnabled())
dialog.close()
# Load hazard layer, must have the target exposure
QgsProject.instance().removeAllMapLayers()
layer = load_test_vector_layer(
'gisv4', 'hazard', 'tsunami_vector.geojson', clone=True)
QgsProject.instance().addMapLayer(layer)
dialog = MetadataConverterDialog(PARENT, IFACE)
dialog.input_layer_combo_box.setLayer(layer)
self.assertEqual(dialog.input_layer_combo_box.count(), 1)
num_exposures = len(layer.keywords['value_maps'])
self.assertEqual(
dialog.target_exposure_combo_box.count(), num_exposures)
dialog.close()
示例9: test_load_layers
def test_load_layers(self):
"""Layers can be loaded and list widget was updated appropriately
"""
hazard_layer_count, exposure_layer_count = load_standard_layers()
message = 'Expect %s layer(s) in hazard list widget but got %s' % (
hazard_layer_count, self.dock.cboHazard.count())
# pylint: disable=W0106
self.assertEqual(self.dock.cboHazard.count(),
hazard_layer_count), message
message = 'Expect %s layer(s) in exposure list widget but got %s' % (
exposure_layer_count, self.dock.cboExposure.count())
self.assertEqual(self.dock.cboExposure.count(),
exposure_layer_count), message
示例10: add_test_layers
def add_test_layers(self):
"""Add standard test layers."""
from safe.test.utilities import load_standard_layers
load_standard_layers()
示例11: add_test_layers
def add_test_layers(self):
"""Add standard test layers."""
from safe.test.utilities import load_standard_layers
load_standard_layers()
rect = QgsRectangle(106.806, -6.195, 106.837, -6.167)
self.iface.mapCanvas().setExtent(rect)