Beispiel #1
0
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'RCMRD_LandDegr_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = RCMRD_LandDegrDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&RCRMD: land degradation')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'RCMRD: land degradation')
        self.toolbar.setObjectName(u'RCMRD: land degradation')

        # Declare user instance variables
        self.roiDefinitions = None
        self.roiDefinitions = [{
            "name": "IGAD",
            "roiXY": [21.8094, -4.6775, 51.417, 22.227]
        }, {
            "name":
            "Djibouti",
            "roiXY": [41.749110148, 10.929824931, 43.418711785, 12.707912502]
        }, {
            "name":
            "Eritrea",
            "roiXY": [36.423647095, 12.360021871, 43.123871290, 18.004828192]
        }, {
            "name":
            "Ethiopia",
            "roiXY": [32.989799845, 3.403333435, 47.979169149, 14.879532166]
        }, {
            "name":
            "Kenya",
            "roiXY": [33.890468384, -4.677504165, 41.885019165, 5.030375823]
        }, {
            "name":
            "Sudan",
            "roiXY": [42.647246541, 7.996515605, 48.93911199991, 11.498928127]
        }, {
            "name":
            "South Sudan",
            "roiXY": [24.121555623, 3.490201518, 35.920835409, 12.216154684]
        }, {
            "name":
            "Somali Land",
            "roiXY": [42.647246541, 7.996515605, 48.93911199991, 11.498928127]
        }, {
            "name":
            "Somalia",
            "roiXY":
            [40.965385376, -1.69628316498, 51.417037811, 11.989118646]
        }, {
            "name":
            "Uganda",
            "roiXY": [29.548459513, -1.475205994, 35.006472615, 4.219691875]
        }]

        #self.selectedRoi = None
        self.raster_list = [
        ]  # list all files open in QGis, contains file objects
        self.dictReproj = None  # dictionary: 'input filename' -> reprojected filename
        self.clipLayer = None  # store the clipping vector layer

        self.listIDInputs = {
        }  # dictionary: key -> layer name. See keys definition in the code ('VGT', 'RFE', ...)
        self.listIDWeightsPotential = {}
        self.listIDWeightsActual = {}

        SettingsOrganisation = 'RCMRD_QGIS'
        SettingsApplication = 'RCMRD_LandDegr'
 def setUp(self):
     """Runs before each test."""
     self.dialog = RCMRD_LandDegrDialog(None)