Beispiel #1
0
class Ui_DockWidget(object):
    def setupUi(self, DockWidget):
        DockWidget.setObjectName(_fromUtf8("DockWidget"))
        DockWidget.resize(397, 827)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(150)
        sizePolicy.setHeightForWidth(
            DockWidget.sizePolicy().hasHeightForWidth())
        DockWidget.setSizePolicy(sizePolicy)
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.tableCoordFeu = QtGui.QTableWidget(self.dockWidgetContents)
        self.tableCoordFeu.setGeometry(QtCore.QRect(12, 310, 241, 181))
        self.tableCoordFeu.setRowCount(5)
        self.tableCoordFeu.setColumnCount(2)
        self.tableCoordFeu.setObjectName(_fromUtf8("tableCoordFeu"))
        self.btSynchronize = QtGui.QPushButton(self.dockWidgetContents)
        self.btSynchronize.setGeometry(QtCore.QRect(270, 310, 101, 51))
        self.btSynchronize.setObjectName(_fromUtf8("btSynchronize"))
        self.btViderFichier = QtGui.QPushButton(self.dockWidgetContents)
        self.btViderFichier.setGeometry(QtCore.QRect(270, 370, 101, 23))
        self.btViderFichier.setObjectName(_fromUtf8("btViderFichier"))
        self.label_6 = QtGui.QLabel(self.dockWidgetContents)
        self.label_6.setGeometry(QtCore.QRect(10, 280, 191, 16))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial"))
        font.setItalic(True)
        self.label_6.setFont(font)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.btFermer = QtGui.QPushButton(self.dockWidgetContents)
        self.btFermer.setGeometry(QtCore.QRect(20, 770, 111, 25))
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/close.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btFermer.setIcon(icon)
        self.btFermer.setIconSize(QtCore.QSize(18, 18))
        self.btFermer.setObjectName(_fromUtf8("btFermer"))
        self.btControler = QtGui.QPushButton(self.dockWidgetContents)
        self.btControler.setGeometry(QtCore.QRect(130, 770, 111, 25))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/controle.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btControler.setIcon(icon1)
        self.btControler.setIconSize(QtCore.QSize(18, 18))
        self.btControler.setObjectName(_fromUtf8("btControler"))
        self.btCheck = QtGui.QPushButton(self.dockWidgetContents)
        self.btCheck.setEnabled(False)
        self.btCheck.setGeometry(QtCore.QRect(240, 770, 111, 25))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(":/plugins/PoussePousseEditData/img/valider.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btCheck.setIcon(icon2)
        self.btCheck.setIconSize(QtCore.QSize(18, 18))
        self.btCheck.setObjectName(_fromUtf8("btCheck"))
        self.label_grille = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_grille.setGeometry(QtCore.QRect(10, 9, 371, 131))
        self.label_grille.setObjectName(_fromUtf8("label_grille"))
        self.label_importer = QtGui.QLabel(self.label_grille)
        self.label_importer.setGeometry(QtCore.QRect(25, 30, 61, 16))
        self.label_importer.setObjectName(_fromUtf8("label_importer"))
        self.fileImportGrille = QgsFileWidget(self.label_grille)
        self.fileImportGrille.setGeometry(QtCore.QRect(90, 21, 271, 27))
        self.fileImportGrille.setObjectName(_fromUtf8("fileImportGrille"))
        self.label_cell_encours = QtGui.QLabel(self.label_grille)
        self.label_cell_encours.setGeometry(QtCore.QRect(128, 61, 101, 20))
        self.label_cell_encours.setObjectName(_fromUtf8("label_cell_encours"))
        self.currentId = QtGui.QLineEdit(self.label_grille)
        self.currentId.setGeometry(QtCore.QRect(230, 61, 61, 21))
        self.currentId.setObjectName(_fromUtf8("currentId"))
        self.btGo = QtGui.QPushButton(self.label_grille)
        self.btGo.setGeometry(QtCore.QRect(290, 61, 75, 23))
        self.btGo.setObjectName(_fromUtf8("btGo"))
        self.btSuiv = QtGui.QPushButton(self.label_grille)
        self.btSuiv.setGeometry(QtCore.QRect(250, 96, 111, 23))
        self.btSuiv.setObjectName(_fromUtf8("btSuiv"))
        self.btPrec = QtGui.QPushButton(self.label_grille)
        self.btPrec.setGeometry(QtCore.QRect(140, 96, 111, 23))
        self.btPrec.setObjectName(_fromUtf8("btPrec"))
        self.btZoomGrille = QtGui.QPushButton(self.label_grille)
        self.btZoomGrille.setGeometry(QtCore.QRect(40, 96, 101, 23))
        self.btZoomGrille.setObjectName(_fromUtf8("btZoomGrille"))
        self.label_fichier = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_fichier.setGeometry(QtCore.QRect(10, 150, 371, 121))
        self.label_fichier.setObjectName(_fromUtf8("label_fichier"))
        self.label_2 = QtGui.QLabel(self.label_fichier)
        self.label_2.setGeometry(QtCore.QRect(34, 32, 71, 20))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_7 = QtGui.QLabel(self.label_fichier)
        self.label_7.setGeometry(QtCore.QRect(18, 62, 91, 20))
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.fileControleCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileControleCSV.setEnabled(False)
        self.fileControleCSV.setGeometry(QtCore.QRect(110, 63, 251, 20))
        self.fileControleCSV.setObjectName(_fromUtf8("fileControleCSV"))
        self.fileValidationCSV = QtGui.QLineEdit(self.label_fichier)
        self.fileValidationCSV.setEnabled(False)
        self.fileValidationCSV.setGeometry(QtCore.QRect(110, 90, 251, 20))
        self.fileValidationCSV.setObjectName(_fromUtf8("fileValidationCSV"))
        self.label_16 = QtGui.QLabel(self.label_fichier)
        self.label_16.setGeometry(QtCore.QRect(10, 91, 91, 20))
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.fileOuvrirInventaireCSV = QgsFileWidget(self.label_fichier)
        self.fileOuvrirInventaireCSV.setGeometry(QtCore.QRect(
            111, 25, 251, 27))
        self.fileOuvrirInventaireCSV.setObjectName(
            _fromUtf8("fileOuvrirInventaireCSV"))
        self.label_qualite = QtGui.QGroupBox(self.dockWidgetContents)
        self.label_qualite.setGeometry(QtCore.QRect(10, 510, 361, 241))
        self.label_qualite.setObjectName(_fromUtf8("label_qualite"))
        self.txtNbCell = QtGui.QLineEdit(self.label_qualite)
        self.txtNbCell.setGeometry(QtCore.QRect(200, 30, 150, 20))
        self.txtNbCell.setObjectName(_fromUtf8("txtNbCell"))
        self.label_4 = QtGui.QLabel(self.label_qualite)
        self.label_4.setGeometry(QtCore.QRect(40, 30, 151, 20))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.txtNbAcquis = QtGui.QLineEdit(self.label_qualite)
        self.txtNbAcquis.setGeometry(QtCore.QRect(200, 50, 150, 20))
        self.txtNbAcquis.setObjectName(_fromUtf8("txtNbAcquis"))
        self.label_5 = QtGui.QLabel(self.label_qualite)
        self.label_5.setGeometry(QtCore.QRect(20, 50, 181, 20))
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.txtNbValidation = QtGui.QLineEdit(self.label_qualite)
        self.txtNbValidation.setGeometry(QtCore.QRect(200, 70, 150, 20))
        self.txtNbValidation.setObjectName(_fromUtf8("txtNbValidation"))
        self.label_14 = QtGui.QLabel(self.label_qualite)
        self.label_14.setGeometry(QtCore.QRect(20, 71, 181, 20))
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.label_8 = QtGui.QLabel(self.label_qualite)
        self.label_8.setGeometry(QtCore.QRect(120, 100, 71, 16))
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.txtCompletion = QtGui.QLineEdit(self.label_qualite)
        self.txtCompletion.setGeometry(QtCore.QRect(200, 100, 150, 20))
        self.txtCompletion.setObjectName(_fromUtf8("txtCompletion"))
        self.txtMissing = QtGui.QLineEdit(self.label_qualite)
        self.txtMissing.setGeometry(QtCore.QRect(200, 120, 150, 20))
        self.txtMissing.setObjectName(_fromUtf8("txtMissing"))
        self.label_9 = QtGui.QLabel(self.label_qualite)
        self.label_9.setGeometry(QtCore.QRect(10, 120, 191, 20))
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.txtError = QtGui.QLineEdit(self.label_qualite)
        self.txtError.setGeometry(QtCore.QRect(200, 140, 150, 20))
        self.txtError.setObjectName(_fromUtf8("txtError"))
        self.label_10 = QtGui.QLabel(self.label_qualite)
        self.label_10.setGeometry(QtCore.QRect(59, 140, 131, 20))
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.txtRMSE = QtGui.QLineEdit(self.label_qualite)
        self.txtRMSE.setGeometry(QtCore.QRect(200, 160, 150, 20))
        self.txtRMSE.setObjectName(_fromUtf8("txtRMSE"))
        self.label_11 = QtGui.QLabel(self.label_qualite)
        self.label_11.setGeometry(QtCore.QRect(38, 160, 161, 16))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.txtSBE = QtGui.QLineEdit(self.label_qualite)
        self.txtSBE.setGeometry(QtCore.QRect(200, 190, 150, 20))
        self.txtSBE.setObjectName(_fromUtf8("txtSBE"))
        self.label_12 = QtGui.QLabel(self.label_qualite)
        self.label_12.setGeometry(QtCore.QRect(130, 190, 61, 20))
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.txtSBN = QtGui.QLineEdit(self.label_qualite)
        self.txtSBN.setGeometry(QtCore.QRect(200, 210, 150, 20))
        self.txtSBN.setObjectName(_fromUtf8("txtSBN"))
        self.label_13 = QtGui.QLabel(self.label_qualite)
        self.label_13.setGeometry(QtCore.QRect(130, 210, 61, 20))
        self.label_13.setObjectName(_fromUtf8("label_13"))
        DockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(DockWidget)
        QtCore.QMetaObject.connectSlotsByName(DockWidget)

    def retranslateUi(self, DockWidget):
        DockWidget.setWindowTitle(
            _translate("DockWidget", "PoussePousseEditData", None))
        self.btSynchronize.setText(
            _translate("DockWidget", "Synchroniser \n"
                       " le fichier \n"
                       " et le layer", None))
        self.btViderFichier.setText(
            _translate("DockWidget", "! Vider fichier", None))
        self.label_6.setText(
            _translate("DockWidget", "Vue sur le fichier en cours de saisie:",
                       None))
        self.btFermer.setToolTip(
            _translate("DockWidget", "Fermer le plugin", None))
        self.btFermer.setText(_translate("DockWidget", "Fermer", None))
        self.btControler.setToolTip(
            _translate("DockWidget", "Saisir les points de contrôle", None))
        self.btControler.setText(_translate("DockWidget", "Contrôler", None))
        self.btCheck.setToolTip(_translate("DockWidget", "Valider", None))
        self.btCheck.setText(_translate("DockWidget", "Valider", None))
        self.label_grille.setTitle(_translate("DockWidget", "Grille", None))
        self.label_importer.setText(_translate("DockWidget", "Importer:",
                                               None))
        self.label_cell_encours.setText(
            _translate("DockWidget", "Cellule en cours :", None))
        self.btGo.setText(_translate("DockWidget", "Go", None))
        self.btSuiv.setText(_translate("DockWidget", ">>", None))
        self.btPrec.setText(_translate("DockWidget", "<<", None))
        self.btZoomGrille.setText(_translate("DockWidget", "Zoom Grille",
                                             None))
        self.label_fichier.setTitle(_translate("DockWidget", "Fichier", None))
        self.label_2.setText(_translate("DockWidget", "Saisie CSV:", None))
        self.label_7.setText(_translate("DockWidget", "Contrôle CSV:", None))
        self.label_16.setText(_translate("DockWidget", "Validation CSV:",
                                         None))
        self.label_qualite.setTitle(_translate("DockWidget", "Qualité", None))
        self.label_4.setText(
            _translate("DockWidget", "Nombre de cellules tirées:", None))
        self.label_5.setText(
            _translate("DockWidget", "Taille échantillon d\'acquisition:",
                       None))
        self.label_14.setText(
            _translate("DockWidget", "Taille échantillon de contrôle:", None))
        self.label_8.setText(_translate("DockWidget", "Complétion:", None))
        self.label_9.setText(
            _translate("DockWidget", "Nb théorique de pts manquants:", None))
        self.label_10.setText(
            _translate("DockWidget", "Moyenne des erreurs: ", None))
        self.label_11.setText(
            _translate("DockWidget", "Écart quadratique moyen:", None))
        self.label_12.setText(_translate("DockWidget", "biais en X:", None))
        self.label_13.setText(_translate("DockWidget", "biais en Y:", None))
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(433, 261)
        self.groupBox = QtWidgets.QGroupBox(Dialog)
        self.groupBox.setGeometry(QtCore.QRect(10, 10, 411, 241))
        self.groupBox.setAutoFillBackground(True)
        self.groupBox.setTitle("")
        self.groupBox.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                   | QtCore.Qt.AlignTop)
        self.groupBox.setFlat(False)
        self.groupBox.setCheckable(False)
        self.groupBox.setObjectName("groupBox")
        self.panImage = QgsFileWidget(self.groupBox)
        self.panImage.setGeometry(QtCore.QRect(210, 50, 171, 27))
        self.panImage.setAccessibleName("")
        self.panImage.setObjectName("panImage")
        self.multImage = QgsFileWidget(self.groupBox)
        self.multImage.setEnabled(True)
        self.multImage.setGeometry(QtCore.QRect(210, 100, 171, 27))
        self.multImage.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.multImage.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.multImage.setFileWidgetButtonVisible(True)
        self.multImage.setFullUrl(True)
        self.multImage.setFilter("")
        self.multImage.setDefaultRoot("")
        self.multImage.setObjectName("multImage")
        self.panImageLabel = QtWidgets.QLabel(self.groupBox)
        self.panImageLabel.setGeometry(QtCore.QRect(30, 50, 161, 20))
        self.panImageLabel.setObjectName("panImageLabel")
        self.multImageLabel = QtWidgets.QLabel(self.groupBox)
        self.multImageLabel.setEnabled(True)
        self.multImageLabel.setGeometry(QtCore.QRect(30, 100, 161, 20))
        self.multImageLabel.setAcceptDrops(False)
        self.multImageLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.multImageLabel.setFrameShadow(QtWidgets.QFrame.Plain)
        self.multImageLabel.setLineWidth(1)
        self.multImageLabel.setWordWrap(False)
        self.multImageLabel.setObjectName("multImageLabel")
        self.btnPansharpen = QtWidgets.QPushButton(self.groupBox)
        self.btnPansharpen.setGeometry(QtCore.QRect(230, 160, 91, 31))
        self.btnPansharpen.setTabletTracking(False)
        self.btnPansharpen.setObjectName("btnPansharpen")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Qgis Pansharpen Plugin"))
        self.panImage.setDialogTitle(_translate("Dialog", "arquivo"))
        self.multImage.setDialogTitle(_translate("Dialog", "arquivo"))
        self.panImageLabel.setText(
            _translate("Dialog", "Panchromatic Image (.tiff)"))
        self.multImageLabel.setText(
            _translate("Dialog", "Multispectral Image (.tiff)"))
        self.btnPansharpen.setText(_translate("Dialog", "Pansharpen"))

    def panImageFile(self):
        return self.panImage.filePath()

    def multImageFile(self):
        return self.multImage.filePath()

    def GdalClass(self):
        return gdalClass.GdalClass()

    def onClick(self):
        print('botão funcionou')
        print(self.panImageFile())
        print(self.multImageFile())
        self.GdalClass().testando()
        nameOutput = os.path.basename(
            self.panImageFile()) + '-' + os.path.basename(
                self.multImageFile()) + '.tiff'
        output = os.path.join(os.path.dirname(self.panImageFile()), nameOutput)
        print(output)
        self.GdalClass().pansharpening(self.panImageFile(),
                                       self.multImageFile(), output)