InaSAFE Disaster risk assessment tool developed by AusAid - GUI Dialog.
Contact : ole.moller.nielsen@gmail.com
Note
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Todo
Check raster is single band
Dock implementation class for the inaSAFE plugin.
Although QComboBox allows you to set an InsertAlphabetically enum this only has effect when a user interactively adds combo items to an editable combo. This we have this little function to ensure that combos are always sorted alphabetically.
Raises:
..todo:: Move this to utilities
A helper slot to update the dock combos if the canvas layerset has been changed (e.g. one or more layer visibilities changed). If self.showOnlyVisibleLayersFlag is set to False this method will simply return, doing nothing.
Establish a signal/slot to listen for changes in the layers loaded in QGIS.
..seealso:: disconnectLayerListener
Destroy the signal/slot to listen for changes in the layers loaded in QGIS.
..seealso:: connectLayerListener
Given an html snippet, wrap it in a page header and footer and display it in the wvResults widget.
Convert the supplied extent to geographic and return as as array
Obtain the name of the path to the exposure file from the userrole of the QtCombo for exposure.
Get the canonical impact function ID for the currently selected function (or the specified combo entry if theIndex is supplied. Args:
- theIndex int - Optional index position in the combo that you
- want the function id for. Defaults to None. If not set / None the currently selected combo item’s function id will be returned.
Helper function to obtain a list of impact functions from the impact calculator.
Obtain qgsmaplayer id from the userrole of the QtCombo for exposure and return it as a QgsMapLayer
Helper function to obtain a list of layers currently loaded in QGIS.
On invocation, this method will populate cboHazard, cboExposure and cboAggregate on the dialog with a list of available layers. Only singleband raster layers will be added to the hazard layer list,only point vector layers will be added to the exposure layer list and Only polygon vector layers will be added to the aggregate list
Obtain the name of the path to the aggregation file from the userrole of the QtCombo for aggregation.
Args: None
gets the of the postprocOutput
Args: None
Returns: a string containing the html in the requested format
Get a standard html footer for wrapping content in.
Returns: None
Handler for when the QGIS active layer is changed. If the active layer is changed and it has keywords and a report, show the report..
Slot for the old (pre QGIS 1.8 api) to notify us when a layer is added. This is suboptimal since if many layers are added this slot gets called multiple times. This slot simply delegates to getLayers and is only implemented here to make the connections between the different signals and slots clearer and better documented.
Slot for the old (pre QGIS 1.8 api) to notify us when a layer is removed. This is suboptimal since if many layers are removed this slot gets called multiple times. This slot simply delegates to getLayers and is only implemented here to make the connections between the different signals and slots clearer and better documented.
Slot for the new (QGIS 1.8 and beyond api) to notify us when a group of layers is are added. This is optimal since if many layers are added this slot gets called only once. This slot simply delegates to getLayers and is only implemented here to make the connections between the different signals and slots clearer and better documented.
Slot for the new (QGIS 1.8 and beyond api) to notify us when a group of layers is are removed. This is optimal since if many layers are removed this slot gets called only once. This slot simply delegates to getLayers and is only implemented here to make the connections between the different signals and slots clearer and better documented.
Automatic slot executed when the Exposure combo is changed so that we can see if the ok button should be enabled.
Note
Don’t use the @pyqtSlot() decorator for autoslots!
Automatic slot executed when the Function combo is changed so that we can see if the ok button should be enabled.
Automatic slot executed when the Hazard combo is changed so that we can see if the ok button should be enabled.
Note
Don’t use the @pyqtSlot() decorator for autoslots!
Automatic slot executed when the tool button for configuring impact functions is clicked (when available) to open the dialog
A helper function to perform an optimal clip of the input data. Optimal extent should be considered as the intersection between the three inputs. The inasafe library will perform various checks to ensure that the extent is tenable, includes data from both etc.
The result of this function will be two layers which are clipped and resampled if needed, and in the EPSG:4326 geographic coordinate reference system.
Called on self.runner SIGNAL(‘done()’) starts all postprocessing steps Args: None
Returns: None
Slot to print map when print map button pressed.
Helper function to read and validate layer.
Set the dock state from QSettings. Do this on init and after changing options in the options dialog.
Restore the function combo to a known state.
Restore the state of the dock to the last known state.
Save the current state of the ui to an internal class member so that it can be restored again easily.
Helper function to set the ok button status if the form is valid and disable it if it is not.
Helper function to set the tool function button status if there is function parameters to configure then enable it, otherwise disable it.
Initialise the ImpactCalculator based on the current state of the ui.
Args: None
Returns: None
Raises: Propagates any error from :func:optimalClip()
A helper function to indicate the plugin is processing.
..note:: Uses bootstrap css for progress bar.
Helper method to evaluate the current state of the dialog and determine if it is appropriate for the OK button to be enabled or not.
Note
The enabled state of the OK button on the dialog will NOT be updated (set True or False) depending on the outcome of the UI readiness tests performed - only True or False will be returned by the function.
A two-tuple consisting of:
Example:
flag,myMessage = self.validate()
This module forms part of the InaSAFE tool.