Example #1
0
    def do_manage_histograms(self, text_changed):
        logger.debug("text changed histogram: {}".format(text_changed))
        if text_changed == "Image de travail":
            self.main_histogram()
        elif text_changed != "Histogrammes" and text_changed != "":
            # find the layer corresponding to the name
            process = ProcessingManager().processing_from_name(text_changed)
            if process:
                process = process[0]
                specific_band = -1

                if text_changed == "Couleurs naturelles":
                    logger.debug("text changed couleurs naturelles")
                    self.set_working_message(True)
                    if not process.histogram:
                        hist = TerreImageHistogram_multiband(
                            ProcessingManager().working_layer, self.canvas, 3,
                            process)
                        process.histogram = hist
                        self.histogram(process.output_working_layer, process,
                                       specific_band, hist)
                else:
                    logger.debug("working layer")
                    bs = ["rouge", "verte", "bleue", "pir", "nir"]
                    corres = {
                        "rouge": process.layer.red,
                        "verte": process.layer.green,
                        "bleue": process.layer.blue,
                        "pir": process.layer.pir,
                        "mir": process.layer.mir
                    }
                    logger.debug("corres: " + str(corres))

                    for item in bs:
                        if item in text_changed:
                            logger.debug("bande à afficher : " +
                                         str(corres[item]))
                            specific_band = corres[item]

                    logger.debug("specific band: " + str(specific_band))

                    if not process.histogram:
                        # display the histogram of the layer
                        hist = self.histogram(process.output_working_layer,
                                              process, specific_band)
                        process.histogram = hist
                    else:
                        hist = self.histogram(process.output_working_layer,
                                              process, specific_band,
                                              process.histogram)
        self.comboBox_histogrammes.setCurrentIndex(0)
    def do_manage_histograms(self, text_changed):
        logger.debug("text changed histogram: " + text_changed)
        if text_changed == "Image de travail":
            self.main_histogram()
        elif text_changed != "Histogrammes" and text_changed != "":
            # find the layer corresponding to the name
            process = ProcessingManager().processing_from_name(text_changed)
            if process :
                process = process[0]
                specific_band = -1

                if text_changed == "Couleurs naturelles":
                    logger.debug("text changed couleurs naturelles")
                    self.set_working_message(True)
                    if not process.histogram:
                        hist = TerreImageHistogram_multiband(ProcessingManager().working_layer, self.canvas, 3, process)
                        process.histogram = hist
                        self.histogram(process.output_working_layer, process, specific_band, hist)
                else:
                    logger.debug("working layer")
                    bs = ["rouge", "verte", "bleue", "pir", "nir"]
                    corres = {"rouge":process.layer.red, "verte":process.layer.green, "bleue":process.layer.blue, "pir":process.layer.pir, "mir":process.layer.mir}
                    logger.debug("corres: " + str(corres))

                    for item in bs:
                        if item in text_changed:
                            logger.debug("bande à afficher : " + str(corres[item]))
                            specific_band = corres[item]

                    logger.debug("specific band: " + str(specific_band))

                    if not process.histogram:
                        # display the histogram of the layer
                        hist = self.histogram(process.output_working_layer, process, specific_band)
                        process.histogram = hist
                    else :
                        hist = self.histogram(process.output_working_layer, process, specific_band, process.histogram)
        self.comboBox_histogrammes.setCurrentIndex(0)