class Controller(AbstractController.Controller):
    '''
    classdocs
    '''
    ShapeSelected = None
    ImgRefSelected = None
    
    def inicializar(self):
        
        self.ui.leImgRefPath.setText("C:\\Gafanhoto WorkSpace\\DataTestes\\raster\\semeadura_soja_11-12.tif")
        self.ui.leShapePath.setText("C:\\Gafanhoto WorkSpace\\DataTestes\\shape\\Contorno_Agassis_Pontos_2015.shp")
        
    def btn_FindShp_ClickAction(self):
        self.findPath(self.ui.leShapePath)

    def btn_FindImgRef_ClickAction(self):
        self.findPath(self.ui.leImgRefPath)

    def le_shapePath_ChangeAction(self):
        if (self.ShapeSelected == None):
            text = str(self.ui.leShapePath.text())
            self.ShapeSelected = VectorFile(file_full_path = text)
        else:
            self.ShapeSelected.file_full_path = self.ui.leShapePath.text()
            
        itens = self.ShapeSelected.readVectorData()["properties"].keys()
        self.ui.cbAtribute.addItems(itens)
        self.ui.cbAtribute.setEnabled(True)
        self.ui.cbAtribute.setCurrentIndex(0)
        
    def le_imgRefPath_ChangeAction(self):
        if (self.ImgRefSelected == None):
            self.ImgRefSelected = RasterFile(file_full_path = str(self.ui.leImgRefPath.text()))
        else:
            self.ImgRefSelected.file_full_path = str(self.ui.leImgRefPath.text())
        
    def cb_Atribute_ChangeAction(self):
        
        itens = self.ShapeSelected.readVectorData()["properties"].keys()   
        
        itens.remove(self.ui.cbAtribute.currentText())
        
        self.ui.lwGroupAtributes.clear()
        
        for item in itens:
        
            item = QtGui.QListWidgetItem(item)
            item.setCheckState(QtCore.Qt.Unchecked)
            self.ui.lwGroupAtributes.addItem(item)
            
        self.ui.lwGroupAtributes.setEnabled(True)
        __sortingEnabled = self.ui.lwGroupAtributes.isSortingEnabled()
        self.ui.lwGroupAtributes.setSortingEnabled(__sortingEnabled)
      
    def executa(self):
        
        print "executando.."
        
        self.function = Interpola.InterpolaTabela()
        self.function.console = self.print_text
        
        self.print_text("Executando..")
        
        separador = SplitTable()   
        dados_separador = TableData()
        atributos = list()
        
        for index in xrange(self.ui.lwGroupAtributes.count()):
            if self.ui.lwGroupAtributes.item(index).checkState() == 2:
                atributos.append(str(self.ui.lwGroupAtributes.item(index).text()))
        
        
        vector_table = self.ShapeSelected.readVectorData()
        
        dados_separador.data = {'table' : vector_table, 'atributos' : atributos}
        dados_separador.data["data_path"] = self.ui.leShapePath.text()
        
          
        dados_interpolador = TableData()
        image_information = self.ImgRefSelected.getRasterInformation()

        dados_interpolador['table_data'] = dados_separador
        dados_interpolador['atributo'] = str(self.ui.cbAtribute.currentText())
        dados_interpolador["format_image_data"] = image_information

        
        self.print_text("Interpolando")
        
        mensagem = self.function.executar(dados_interpolador)
        self.finalizar()
        

    def valida_form(self):
        if self.ShapeSelected is None:
            self.message(u"Shape para interpolação não encontrado.")
            return False   
        if self.ImgRefSelected is None:
            self.message(u"Imagem de referencia não encontrada.")
            return False   
        return True
예제 #2
0
    #img_teste.loadListByRoot()

    #paramIN = dict()
    #paramIN["images"] = img_teste
    #paramIN["out_folder"] = "C:\\Users\\rennan.paloschi\\Desktop\\Dados_Gerais\\raster\\ECMWF\\Teste_raster_csv\\Saida\\"

    #csv_vrt_files = RasterToCSVeVRT().executar(paramIN)
    '''
        Imagem de referencia
    '''
    from Modelo.beans import RasterFile

    img_referencia_path = "C:\\Gafanhoto WorkSpace\\DataTestes\\raster\\Fazer\\20110101.tif"
    img_referencia = RasterFile(file_full_path=img_referencia_path)

    info_img_referencia = img_referencia.getRasterInformation()
    '''
        Conf algoritimo 
    '''
    conf_alg = TableData()
    #conf_alg["max_points"] = "12"
    #conf_alg["radius"] = "0"
    '''
        Imagem de saida
    '''
    img_out = RasterFile(
        file_full_path=
        "C:\\Gafanhoto WorkSpace\\DataTestes\\out\\Primeira tentativa\\evpt_20110101.tif"
    )
    '''
        Unindo e executando
예제 #3
0
 
 #paramIN = dict()
 #paramIN["images"] = img_teste
 #paramIN["out_folder"] = "C:\\Users\\rennan.paloschi\\Desktop\\Dados_Gerais\\raster\\ECMWF\\Teste_raster_csv\\Saida\\"
 
 #csv_vrt_files = RasterToCSVeVRT().executar(paramIN)
 
 '''
     Imagem de referencia
 '''
 from Modelo.beans import RasterFile
 
 img_referencia_path = "C:\\Gafanhoto WorkSpace\\DataTestes\\raster\\Fazer\\20110101.tif"
 img_referencia = RasterFile(file_full_path = img_referencia_path)
 
 info_img_referencia = img_referencia.getRasterInformation()
 
 '''
     Conf algoritimo 
 '''
 conf_alg = TableData()
 #conf_alg["max_points"] = "12"
 #conf_alg["radius"] = "0"
 
 '''
     Imagem de saida
 '''
 img_out = RasterFile(file_full_path = "C:\\Gafanhoto WorkSpace\\DataTestes\\out\\Primeira tentativa\\evpt_20110101.tif")
 
 '''
     Unindo e executando
예제 #4
0
class Controller(AbstractController.Controller):
    '''
    classdocs
    '''
    ShapeSelected = None
    ImgRefSelected = None

    def inicializar(self):

        self.ui.leImgRefPath.setText(
            "C:\\Gafanhoto WorkSpace\\DataTestes\\raster\\semeadura_soja_11-12.tif"
        )
        self.ui.leShapePath.setText(
            "C:\\Gafanhoto WorkSpace\\DataTestes\\shape\\Contorno_Agassis_Pontos_2015.shp"
        )

    def btn_FindShp_ClickAction(self):
        self.findPath(self.ui.leShapePath)

    def btn_FindImgRef_ClickAction(self):
        self.findPath(self.ui.leImgRefPath)

    def le_shapePath_ChangeAction(self):
        if (self.ShapeSelected == None):
            text = str(self.ui.leShapePath.text())
            self.ShapeSelected = VectorFile(file_full_path=text)
        else:
            self.ShapeSelected.file_full_path = self.ui.leShapePath.text()

        itens = self.ShapeSelected.readVectorData()["properties"].keys()
        self.ui.cbAtribute.addItems(itens)
        self.ui.cbAtribute.setEnabled(True)
        self.ui.cbAtribute.setCurrentIndex(0)

    def le_imgRefPath_ChangeAction(self):
        if (self.ImgRefSelected == None):
            self.ImgRefSelected = RasterFile(
                file_full_path=str(self.ui.leImgRefPath.text()))
        else:
            self.ImgRefSelected.file_full_path = str(
                self.ui.leImgRefPath.text())

    def cb_Atribute_ChangeAction(self):

        itens = self.ShapeSelected.readVectorData()["properties"].keys()

        itens.remove(self.ui.cbAtribute.currentText())

        self.ui.lwGroupAtributes.clear()

        for item in itens:

            item = QtGui.QListWidgetItem(item)
            item.setCheckState(QtCore.Qt.Unchecked)
            self.ui.lwGroupAtributes.addItem(item)

        self.ui.lwGroupAtributes.setEnabled(True)
        __sortingEnabled = self.ui.lwGroupAtributes.isSortingEnabled()
        self.ui.lwGroupAtributes.setSortingEnabled(__sortingEnabled)

    def executa(self):

        print "executando.."

        self.function = Interpola.InterpolaTabela()
        self.function.console = self.print_text

        self.print_text("Executando..")

        separador = SplitTable()
        dados_separador = TableData()
        atributos = list()

        for index in xrange(self.ui.lwGroupAtributes.count()):
            if self.ui.lwGroupAtributes.item(index).checkState() == 2:
                atributos.append(
                    str(self.ui.lwGroupAtributes.item(index).text()))

        vector_table = self.ShapeSelected.readVectorData()

        dados_separador.data = {'table': vector_table, 'atributos': atributos}
        dados_separador.data["data_path"] = self.ui.leShapePath.text()

        dados_interpolador = TableData()
        image_information = self.ImgRefSelected.getRasterInformation()

        dados_interpolador['table_data'] = dados_separador
        dados_interpolador['atributo'] = str(self.ui.cbAtribute.currentText())
        dados_interpolador["format_image_data"] = image_information

        self.print_text("Interpolando")

        mensagem = self.function.executar(dados_interpolador)
        self.finalizar()

    def valida_form(self):
        if self.ShapeSelected is None:
            self.message(u"Shape para interpolação não encontrado.")
            return False
        if self.ImgRefSelected is None:
            self.message(u"Imagem de referencia não encontrada.")
            return False
        return True