code: def prepare_impact_function(self):
          
  
          # 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:
              # self.extent.crs is the map canvas CRS.
              impact_function.crs = self.extent.crs
              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.asWkt()
                  impact_function.requested_extent = wkt_to_rectangle(wkt)
  
              elif mode == HAZARD_EXPOSURE_VIEW:
                  impact_function.requested_extent = (
                      self.iface.mapCanvas().extent())
  
              elif mode == EXPOSURE:
                  impact_function.use_exposure_view_only = True
  
          # We don't have any checkbox in the wizard for the debug mode.
          impact_function.debug_mode = False
  
          return impact_function
docs: Create analysis as a representation of current situation of IFCW.