Esempio n. 1
0
    def display(self, output_filename):
        self.freezeCanvas(True)
        # result_layer = manage_QGIS.get_raster_layer( output_filename, os.path.basename(os.path.splitext(self.layer.source_file)[0]) + "_" + self.processing_name )
        result_layer = manage_QGIS.addRasterLayerToQGIS(output_filename, os.path.basename(os.path.splitext(output_filename)[0]) , self.iface)
        manage_QGIS.histogram_stretching(result_layer, self.iface.mapCanvas())
        self.output_layer = result_layer
        # 2 ouvrir une nouvelle vue
        self.mirror = self.mirrormap_tool.runDockableMirror("Angle Spectral")
        logger.debug(self.mirror)
        self.mirror.mainWidget.addLayer(result_layer.id())
        # 1 mettre image en queue



        ifaceLegend = self.iface.legendInterface()
        ifaceLayers = QgsMapLayerRegistry.instance().mapLayers()
        logger.debug("ifacelayers {}".format(ifaceLayers))
        id_layer = result_layer.id()
        logger.debug("id_layer {}".format(id_layer))
        logger.debug("result layer {}".format(result_layer))
        # QgsMapLayerRegistry.instance().mapLayers()
        # {u'QB_1_ortho20140521141641682': <qgis.core.QgsRasterLayer object at 0x6592b00>, u'QB_1_ortho_bande_bleue20140521141927295': <qgis.core.QgsRasterLayer object at 0x6592950>}
        ifaceLegend.setLayerVisible(result_layer, False)
        self.iface.mapCanvas().refresh()
        logger.debug(ifaceLegend.isLayerVisible(result_layer))

        # thaw the canvas
        self.freezeCanvas(False)
Esempio n. 2
0
    def display(self, output_filename):
        self.freezeCanvas(True)
        # result_layer = manage_QGIS.get_raster_layer( output_filename, os.path.basename(os.path.splitext(self.layer.source_file)[0]) + "_" + self.processing_name )
        result_layer = manage_QGIS.addRasterLayerToQGIS(
            output_filename,
            os.path.basename(os.path.splitext(output_filename)[0]), self.iface)
        manage_QGIS.histogram_stretching(result_layer, self.iface.mapCanvas())
        self.output_layer = result_layer
        # 2 ouvrir une nouvelle vue
        self.mirror = self.mirrormap_tool.runDockableMirror("Angle Spectral")
        logger.debug(self.mirror)
        self.mirror.mainWidget.addLayer(result_layer.id())
        # 1 mettre image en queue

        ifaceLegend = self.iface.legendInterface()
        ifaceLayers = QgsMapLayerRegistry.instance().mapLayers()
        logger.debug("ifacelayers" + str(ifaceLayers))
        id_layer = result_layer.id()
        logger.debug("id_layer" + str(id_layer))
        logger.debug("result layer" + str(result_layer))
        # QgsMapLayerRegistry.instance().mapLayers()
        # {u'QB_1_ortho20140521141641682': <qgis.core.QgsRasterLayer object at 0x6592b00>, u'QB_1_ortho_bande_bleue20140521141927295': <qgis.core.QgsRasterLayer object at 0x6592950>}
        ifaceLegend.setLayerVisible(result_layer, False)
        self.iface.mapCanvas().refresh()
        logger.debug(ifaceLegend.isLayerVisible(result_layer))

        # thaw the canvas
        self.freezeCanvas(False)
Esempio n. 3
0
    def display(self, output_filename):
        #         if "Angle Spectral" in self.processing_name:
        #             print self.rubberband
        #             print self.rubberband.getPoint(0)
        self.freezeCanvas(True)
        # result_layer = manage_QGIS.get_raster_layer( output_filename,
        # os.path.basename(os.path.splitext(self.layer.source_file)[0]) + "_" + self.processing_name )
        if self.r_layer:
            result_layer = self.r_layer
        else:
            result_layer = manage_QGIS.addRasterLayerToQGIS(
                output_filename, self.processing_name, self.iface)
            self.r_layer = result_layer
        if self.processing_name == "Seuillage":
            manage_QGIS.histogram_stretching_for_threshold(
                result_layer, self.iface.mapCanvas())
        else:
            manage_QGIS.histogram_stretching(result_layer,
                                             self.iface.mapCanvas())

        logger.debug("defining self.output_working_layer")
        self.output_working_layer = WorkingLayer(output_filename, result_layer)
        # 2 ouvrir une nouvelle vue
        self.mirror = self.mirrormap_tool.runDockableMirror(
            self.processing_name)
        logger.debug(self.mirror)
        self.mirror.mainWidget.addLayer(result_layer.id())
        self.mirror.mainWidget.onExtentsChanged()
        # 1 mettre image en queue

        iface_legend = self.iface.legendInterface()
        iface_layers = QgsMapLayerRegistry.instance().mapLayers()
        logger.debug("ifacelayers" + str(iface_layers))
        id_layer = result_layer.id()
        logger.debug("id_layer" + str(id_layer))
        logger.debug("result layer" + str(result_layer))
        # QgsMapLayerRegistry.instance().mapLayers()
        # {u'QB_1_ortho20140521141641682': <qgis.core.QgsRasterLayer object at 0x6592b00>,
        # u'QB_1_ortho_bande_bleue20140521141927295': <qgis.core.QgsRasterLayer object at 0x6592950>}
        iface_legend.setLayerVisible(result_layer, False)
        self.iface.mapCanvas().refresh()
        logger.debug(iface_legend.isLayerVisible(result_layer))

        ProcessingManager().add_processing(self)

        self.emit(SIGNAL("display_ok()"))
        logger.debug("signal emitted")
        # thaw the canvas
        self.freezeCanvas(False)
Esempio n. 4
0
    def display(self, output_filename):
        #         if "Angle Spectral" in self.processing_name:
        #             logger.debug(self.rubberband)
        #             logger.debug(self.rubberband.getPoint(0))
        self.freezeCanvas(True)
        # result_layer = manage_QGIS.get_raster_layer( output_filename,
        # os.path.basename(os.path.splitext(self.layer.source_file)[0]) + "_" + self.processing_name )
        if self.r_layer:
            result_layer = self.r_layer
        else:
            result_layer = manage_QGIS.addRasterLayerToQGIS(output_filename, self.processing_name, self.iface)
            self.r_layer = result_layer
        if self.processing_name == "Seuillage":
            manage_QGIS.histogram_stretching_for_threshold(result_layer, self.iface.mapCanvas())
        else:
            manage_QGIS.histogram_stretching(result_layer, self.iface.mapCanvas())

        logger.debug("defining self.output_working_layer")
        self.output_working_layer = WorkingLayer(output_filename, result_layer)
        # 2 ouvrir une nouvelle vue
        self.mirror = self.mirrormap_tool.runDockableMirror(self.processing_name)
        logger.debug(self.mirror)
        self.mirror.mainWidget.addLayer(result_layer.id())
        self.mirror.mainWidget.onExtentsChanged()
        # 1 mettre image en queue

        iface_legend = self.iface.legendInterface()
        iface_layers = QgsMapLayerRegistry.instance().mapLayers()
        logger.debug("ifacelayers {}".format(iface_layers))
        id_layer = result_layer.id()
        logger.debug("id_layer {}".format(id_layer))
        logger.debug("result layer {}".format(result_layer))
        # QgsMapLayerRegistry.instance().mapLayers()
        # {u'QB_1_ortho20140521141641682': <qgis.core.QgsRasterLayer object at 0x6592b00>,
        # u'QB_1_ortho_bande_bleue20140521141927295': <qgis.core.QgsRasterLayer object at 0x6592950>}
        iface_legend.setLayerVisible(result_layer, False)
        self.iface.mapCanvas().refresh()
        logger.debug(iface_legend.isLayerVisible(result_layer))

        ProcessingManager().add_processing(self)

        self.emit(SIGNAL("display_ok()"))
        logger.debug("signal emitted")
        # thaw the canvas
        self.freezeCanvas(False)