本文整理匯總了Python中safe.impact_function.impact_function.ImpactFunction.callback方法的典型用法代碼示例。如果您正苦於以下問題:Python ImpactFunction.callback方法的具體用法?Python ImpactFunction.callback怎麽用?Python ImpactFunction.callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe.impact_function.impact_function.ImpactFunction
的用法示例。
在下文中一共展示了ImpactFunction.callback方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: prepare_impact_function
# 需要導入模塊: from safe.impact_function.impact_function import ImpactFunction [as 別名]
# 或者: from safe.impact_function.impact_function.ImpactFunction import callback [as 別名]
def prepare_impact_function(self):
"""Create analysis as a representation of current situation of IFCW."""
# Impact Functions
impact_function = ImpactFunction()
impact_function.callback = self.progress_callback
# Layers
impact_function.hazard = self.parent.hazard_layer
impact_function.exposure = self.parent.exposure_layer
aggregation = self.parent.aggregation_layer
if aggregation:
impact_function.aggregation = aggregation
impact_function.use_selected_features_only = (
setting('useSelectedFeaturesOnly', False, bool))
else:
mode = setting('analysis_extents_mode')
if self.extent.user_extent:
# This like a hack to transform a geometry to a rectangle.
# self.extent.user_extent is a QgsGeometry.
# impact_function.requested_extent needs a QgsRectangle.
wkt = self.extent.user_extent.exportToWkt()
impact_function.requested_extent = wkt_to_rectangle(wkt)
impact_function.requested_extent_crs = self.extent.crs
elif mode == HAZARD_EXPOSURE_VIEW:
impact_function.requested_extent = (
self.iface.mapCanvas().extent())
impact_function.requested_extent_crs = self.extent.crs
# We don't have any checkbox in the wizard for the debug mode.
impact_function.debug_mode = False
return impact_function