Esempio n. 1
0
    def _setupUI(self):
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        self.setMinimumHeight(180)

        self.main_horizontal_layout = QHBoxLayout(self)

        italic_font = QFont()
        italic_font.setItalic(True)

        # unselected widget
        self.unselected_widget = QListWidget(self)
        self._set_list_widget_defaults(self.unselected_widget)
        unselected_label = QLabel()
        unselected_label.setText("Unselected")
        unselected_label.setAlignment(Qt.AlignCenter)
        unselected_label.setFont(italic_font)
        unselected_v_layout = QVBoxLayout()
        unselected_v_layout.addWidget(unselected_label)
        unselected_v_layout.addWidget(self.unselected_widget)

        # selected widget
        self.selected_widget = QListWidget(self)
        self._set_list_widget_defaults(self.selected_widget)
        selected_label = QLabel()
        selected_label.setText("Selected")
        selected_label.setAlignment(Qt.AlignCenter)
        selected_label.setFont(italic_font)
        selected_v_layout = QVBoxLayout()
        selected_v_layout.addWidget(selected_label)
        selected_v_layout.addWidget(self.selected_widget)

        # buttons
        self.buttons_vertical_layout = QVBoxLayout()
        self.buttons_vertical_layout.setContentsMargins(0, -1, 0, -1)

        self.select_all_btn = SmallQPushButton(">>")
        self.deselect_all_btn = SmallQPushButton("<<")
        self.select_btn = SmallQPushButton(">")
        self.deselect_btn = SmallQPushButton("<")
        self.select_btn.setToolTip("Add the selected items")
        self.deselect_btn.setToolTip("Remove the selected items")
        self.select_all_btn.setToolTip("Add all")
        self.deselect_all_btn.setToolTip("Remove all")

        # add buttons
        spacer_label = QLabel()  # pragmatic way to create a spacer with
        # the same height of the labels on top
        # of the lists, in order to align the
        # buttons with the lists.
        self.buttons_vertical_layout.addWidget(spacer_label)
        self.buttons_vertical_layout.addWidget(self.select_btn)
        self.buttons_vertical_layout.addWidget(self.deselect_btn)
        self.buttons_vertical_layout.addWidget(self.select_all_btn)
        self.buttons_vertical_layout.addWidget(self.deselect_all_btn)

        # add sub widgets
        self.main_horizontal_layout.addLayout(unselected_v_layout)
        self.main_horizontal_layout.addLayout(self.buttons_vertical_layout)
        self.main_horizontal_layout.addLayout(selected_v_layout)
Esempio n. 2
0
    def _setupUI(self):
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

        self.setMinimumHeight(180)

        self.main_horizontal_layout = QHBoxLayout(self)

        italic_font = QFont()
        italic_font.setItalic(True)

        # deselected widget
        self.deselected_widget = QListWidget(self)
        self._set_list_widget_defaults(self.deselected_widget)
        deselected_label = QLabel()
        deselected_label.setText('Deselected')
        deselected_label.setAlignment(Qt.AlignCenter)
        deselected_label.setFont(italic_font)
        deselected_v_layout = QVBoxLayout()
        deselected_v_layout.addWidget(deselected_label)
        deselected_v_layout.addWidget(self.deselected_widget)

        # selected widget
        self.selected_widget = QListWidget(self)
        self._set_list_widget_defaults(self.selected_widget)
        selected_label = QLabel()
        selected_label.setText('Selected')
        selected_label.setAlignment(Qt.AlignCenter)
        selected_label.setFont(italic_font)
        selected_v_layout = QVBoxLayout()
        selected_v_layout.addWidget(selected_label)
        selected_v_layout.addWidget(self.selected_widget)

        # buttons
        self.buttons_vertical_layout = QVBoxLayout()
        self.buttons_vertical_layout.setContentsMargins(0, -1, 0, -1)

        self.select_all_btn = SmallQPushButton('>>')
        self.deselect_all_btn = SmallQPushButton('<<')
        self.select_btn = SmallQPushButton('>')
        self.deselect_btn = SmallQPushButton('<')
        self.select_btn.setToolTip('Add the selected items')
        self.deselect_btn.setToolTip('Remove the selected items')
        self.select_all_btn.setToolTip('Add all')
        self.deselect_all_btn.setToolTip('Remove all')

        # add buttons
        spacer_label = QLabel()  # pragmatic way to create a spacer with
        # the same height of the labels on top
        # of the lists, in order to align the
        # buttons with the lists.
        self.buttons_vertical_layout.addWidget(spacer_label)
        self.buttons_vertical_layout.addWidget(self.select_btn)
        self.buttons_vertical_layout.addWidget(self.deselect_btn)
        self.buttons_vertical_layout.addWidget(self.select_all_btn)
        self.buttons_vertical_layout.addWidget(self.deselect_all_btn)

        # add sub widgets
        self.main_horizontal_layout.addLayout(deselected_v_layout)
        self.main_horizontal_layout.addLayout(self.buttons_vertical_layout)
        self.main_horizontal_layout.addLayout(selected_v_layout)
Esempio n. 3
0
    def __init__(self, table):
        QWidget.__init__(self)

        layout = QVBoxLayout()

        hlayout = QHBoxLayout()
        l = QLabel(table.name())
        font = l.font()
        font.setBold(True)
        l.setFont(font)

        hlayout.addWidget(l)
        open_table_btn = QToolButton()
        icon = QIcon(os.path.dirname(__file__) + "/mActionOpenTableGML.svg")
        open_table_btn.setIcon(icon)
        open_table_btn.resize(32, 32)
        open_table_btn.clicked.connect(
            lambda checked: self.linkActivated.emit(table.name())
        )
        hlayout.addWidget(open_table_btn)

        f = QFrame()
        f.setFrameStyle(QFrame.Panel | QFrame.Plain)
        f.setLineWidth(2.0)
        f.setLayout(hlayout)

        layout.addWidget(f)

        self.attribute_label = QLabel()
        names = [f.name() for f in table.columns()]
        names += [l.name() + "_id" for l in table.links() if l.max_occurs() == 1]
        names += [l.ref_table().name() + "_id" for l in table.back_links()]

        self.attribute_label.setText("\n".join(names))
        v2 = QVBoxLayout()
        v2.addWidget(self.attribute_label)

        self.attribute_frame = QFrame()
        self.attribute_frame.setFrameStyle(QFrame.Panel | QFrame.Plain)
        self.attribute_frame.setLineWidth(2.0)
        self.attribute_frame.setLayout(v2)
        layout.addWidget(self.attribute_frame)

        self.setLayout(layout)

        fm = QFontMetricsF(self.attribute_label.font())
        self.__font_height = fm.height()
        margins = layout.contentsMargins()

        self.attribute_x_offset = margins.left()
        self.attribute_x2_offset = margins.right()
Esempio n. 4
0
    def draw(self, layout: QBoxLayout):
        '''
        draw title in given layout (appended)

        Parameters
        ----------
        layout : QBoxLayout
            layout to append the drawn parameter to
        '''
        label = QLabel(self.title)
        font = label.font()
        font.setBold(self.bold)
        font.setPointSize(self.fontsize)
        label.setFont(font)
        layout.addWidget(label)
Esempio n. 5
0
    def _creaFila(self, text1, text2):
        lbl1 = QLabel(text1)
        lbl2 = QLabel(text2)

        # Per si hi ha algun enllaç
        lbl1.setOpenExternalLinks(True)
        lbl2.setOpenExternalLinks(True)

        # SizePolicy
        lbl1.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        lbl2.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

        # Fonts
        # Fem una còpia de la font dels textos per posar-la en negreta
        fontNoms = QFont(QvConstants.FONTTEXT)
        fontNoms.setBold(True)
        lbl1.setFont(fontNoms)
        lbl2.setFont(QvConstants.FONTTEXT)

        self._lay.addWidget(lbl1, self._i, 0, Qt.AlignTop | Qt.AlignRight)
        self._lay.addWidget(lbl2, self._i, 1, Qt.AlignTop)

        self._i += 1
    def show_current_state(self):
        """Setup the UI for QTextEdit to show the current state."""
        right_panel_heading = QLabel(tr('Status'))
        right_panel_heading.setFont(big_font)
        right_panel_heading.setSizePolicy(
            QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.right_layout.addWidget(right_panel_heading)

        message = m.Message()
        if self.layer_mode == layer_mode_continuous:
            title = tr('Thresholds')
        else:
            title = tr('Value maps')

        message.add(m.Heading(title, **INFO_STYLE))

        for i in range(len(self.exposures)):
            message.add(m.Text(self.exposure_labels[i]))

            classification = self.get_classification(
                self.exposure_combo_boxes[i])
            if self.layer_mode == layer_mode_continuous:
                thresholds = self.thresholds.get(self.exposures[i]['key'])
                if not thresholds or not classification:
                    message.add(m.Paragraph(tr('No classifications set.')))
                    continue
                table = m.Table(
                    style_class='table table-condensed table-striped')
                header = m.Row()
                header.add(m.Cell(tr('Class name')))
                header.add(m.Cell(tr('Minimum')))
                header.add(m.Cell(tr('Maximum')))
                table.add(header)
                classes = classification.get('classes')
                # Sort by value, put the lowest first
                classes = sorted(classes, key=lambda k: k['value'])
                for the_class in classes:
                    threshold = thresholds[classification['key']]['classes'][
                        the_class['key']]
                    row = m.Row()
                    row.add(m.Cell(the_class['name']))
                    row.add(m.Cell(threshold[0]))
                    row.add(m.Cell(threshold[1]))
                    table.add(row)
            else:
                value_maps = self.value_maps.get(self.exposures[i]['key'])
                if not value_maps or not classification:
                    message.add(m.Paragraph(tr('No classifications set.')))
                    continue
                table = m.Table(
                    style_class='table table-condensed table-striped')
                header = m.Row()
                header.add(m.Cell(tr('Class name')))
                header.add(m.Cell(tr('Value')))
                table.add(header)
                classes = classification.get('classes')
                # Sort by value, put the lowest first
                classes = sorted(classes, key=lambda k: k['value'])
                for the_class in classes:
                    value_map = value_maps[classification['key']][
                        'classes'].get(the_class['key'], [])
                    row = m.Row()
                    row.add(m.Cell(the_class['name']))
                    row.add(m.Cell(', '.join([str(v) for v in value_map])))
                    table.add(row)
            message.add(table)

        # status_text_edit = QTextBrowser(None)
        status_text_edit = QWebView(None)
        status_text_edit.setSizePolicy(
            QSizePolicy.Ignored,
            QSizePolicy.Ignored)

        status_text_edit.page().mainFrame().setScrollBarPolicy(
            Qt.Horizontal,
            Qt.ScrollBarAlwaysOff)
        html_string = html_header() + message.to_html() + html_footer()
        status_text_edit.setHtml(html_string)
        self.right_layout.addWidget(status_text_edit)
    def setup_left_panel(self):
        """Setup the UI for left panel.

        Generate all exposure, combobox, and edit button.
        """
        hazard = self.parent.step_kw_subcategory.selected_subcategory()
        left_panel_heading = QLabel(tr('Classifications'))
        left_panel_heading.setFont(big_font)
        self.left_layout.addWidget(left_panel_heading)

        inner_left_layout = QGridLayout()

        row = 0
        for exposure in exposure_all:
            special_case = False
            if not setting('developer_mode'):
                # Filter out unsupported exposure for the hazard
                if exposure in hazard['disabled_exposures']:
                    # Remove from the storage if the exposure is disabled
                    if self.layer_mode == layer_mode_continuous:
                        if exposure['key'] in self.thresholds:
                            self.thresholds.pop(exposure['key'])
                    else:
                        if exposure['key'] in self.value_maps:
                            self.value_maps.pop(exposure['key'])
                    continue
            # Trick for EQ raster for population #3853
            if exposure == exposure_population and hazard == hazard_earthquake:
                if is_raster_layer(self.parent.layer):
                    if self.layer_mode == layer_mode_continuous:
                        self.use_default_thresholds = True
                        special_case = True
                        # Set classification for EQ Raster for Population
                        self.thresholds[exposure_population['key']] = {
                            earthquake_mmi_scale['key']: {
                                'classes': default_classification_thresholds(
                                    earthquake_mmi_scale),
                                'active': True
                            }
                        }

            # Add label
            # Hazard on Exposure Classifications
            label = tr(
                '{hazard_name} on {exposure_name} Classifications').format(
                hazard_name=hazard['name'],
                exposure_name=exposure['name']
            )
            exposure_label = QLabel(label)

            # Add combo box
            exposure_combo_box = QComboBox()
            hazard_classifications = hazard.get('classifications')
            exposure_combo_box.addItem(tr('No classifications'))
            exposure_combo_box.setItemData(
                0, None, Qt.UserRole)

            current_index = 0
            i = 0
            # Iterate through all available hazard classifications
            for hazard_classification in hazard_classifications:
                # Skip if the classification is not for the exposure
                if 'exposures' in hazard_classification:
                    if exposure not in hazard_classification['exposures']:
                        continue
                exposure_combo_box.addItem(hazard_classification['name'])
                exposure_combo_box.setItemData(
                    i + 1, hazard_classification, Qt.UserRole)
                if self.layer_mode == layer_mode_continuous:
                    current_hazard_classifications = self.thresholds.get(
                        exposure['key'])
                else:
                    current_hazard_classifications = self.value_maps.get(
                        exposure['key'])
                if current_hazard_classifications:
                    current_hazard_classification = \
                        current_hazard_classifications.get(
                            hazard_classification['key'])
                    if current_hazard_classification:
                        is_active = current_hazard_classification.get('active')
                        if is_active:
                            current_index = i + 1
                i += 1
            # Set current classification
            exposure_combo_box.setCurrentIndex(current_index)

            # Add edit button
            exposure_edit_button = QPushButton(tr('Edit'))

            # For special case. Raster EQ on Population.
            if special_case:
                mmi_index = exposure_combo_box.findText(
                    earthquake_mmi_scale['name'])
                exposure_combo_box.setCurrentIndex(mmi_index)
                exposure_combo_box.setEnabled(False)
                exposure_edit_button.setEnabled(False)
                tool_tip_message = tr(
                    'InaSAFE use default classification for Raster Earthquake '
                    'hazard on population.')
                exposure_label.setToolTip(tool_tip_message)
                exposure_combo_box.setToolTip(tool_tip_message)
                exposure_edit_button.setToolTip(tool_tip_message)

            else:
                if current_index == 0:
                    # Disable if there is no classification chosen.
                    exposure_edit_button.setEnabled(False)
                exposure_edit_button.clicked.connect(
                    partial(
                        self.edit_button_clicked,
                        edit_button=exposure_edit_button,
                        exposure_combo_box=exposure_combo_box,
                        exposure=exposure))
                exposure_combo_box.currentIndexChanged.connect(
                    partial(
                        self.classifications_combo_box_changed,
                        exposure=exposure,
                        exposure_combo_box=exposure_combo_box,
                        edit_button=exposure_edit_button))

            # Arrange in layout
            inner_left_layout.addWidget(exposure_label, row, 0)
            inner_left_layout.addWidget(exposure_combo_box, row, 1)
            inner_left_layout.addWidget(exposure_edit_button, row, 2)

            # Adding to step's attribute
            self.exposures.append(exposure)
            self.exposure_combo_boxes.append(exposure_combo_box)
            self.exposure_edit_buttons.append(exposure_edit_button)
            self.exposure_labels.append(label)
            if special_case:
                self.special_case_index = len(self.exposures) - 1

            row += 1

        self.left_layout.addLayout(inner_left_layout)
        # To push the inner_left_layout up
        self.left_layout.addStretch(1)
Esempio n. 8
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(
            QtCore.QSize(QtCore.QRect(0, 0, 440, 660).size()).expandedTo(
                Dialog.minimumSizeHint()))

        self.gridlayout = QGridLayout(Dialog)
        self.gridlayout.setObjectName("gridlayout")

        font = QFont()
        font.setPointSize(15)
        font.setWeight(50)
        font.setBold(True)

        self.label_2 = QLabel(Dialog)
        self.label_2.setFont(font)
        self.label_2.setTextFormat(QtCore.Qt.RichText)
        self.label_2.setObjectName("label_2")
        self.gridlayout.addWidget(self.label_2, 1, 1, 1, 2)

        self.textEdit = QTextEdit(Dialog)

        palette = QPalette()

        brush = QBrush(QColor(0, 0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)

        brush = QBrush(QColor(0, 0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QPalette.Inactive, QPalette.Base, brush)

        brush = QBrush(QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QPalette.Disabled, QPalette.Base, brush)
        self.textEdit.setPalette(palette)
        self.textEdit.setAutoFillBackground(True)
        self.textEdit.width = 320
        self.textEdit.height = 360
        self.textEdit.setFrameShape(QFrame.NoFrame)
        self.textEdit.setFrameShadow(QFrame.Plain)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName("textEdit")
        self.textEdit.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)

        self.gridlayout.addWidget(self.textEdit, 2, 1, 5, 2)

        self.pushButton = QPushButton(Dialog)
        self.pushButton.setObjectName("pushButton")
        self.gridlayout.addWidget(self.pushButton, 4, 2, 1, 1)

        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.gridlayout.addItem(spacerItem, 3, 1, 1, 1)

        self.retranslateUi(Dialog)
        self.pushButton.clicked.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QApplication.translate("Dialog", "GroupPointsWithinDistance",
                                   None))
        self.label_2.setText(
            QApplication.translate("Dialog", "GroupPointsWithinDistance 0.2",
                                   None))
        self.textEdit.setHtml(
            QApplication.translate(
                "Dialog",
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:8pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\'; font-size:8pt;\"><span style=\" font-weight:600;\">"
                " GroupPointsWithinDistance 0.2 :</span>"
                "  A little QGIS plugin to find and group/aggregate points of a points' layer if they are at a given distance of one another.</b>\n"
                +
                "                                                                                                                                                                                           \n"
                +
                " <br><b>WARNING:</b><br><b> Work with projected datas only, in other words do not use geographical (long-lat type) reference systems !</b>\n "
                +
                "                                                                                                                                             \n"
                + "             \n" +
                "This plugin is meant to deal with points datas (not multipoints, convert first to points) (for instance faunistic or floristic observations), nearby from one another, that the user wants to be regrouped/aggregated as a station.\n"
                + "\n" +
                "                                                                                                                                                                                                                    \n"
                +
                "The user should appreciate and cheack which distance to use, and - may be - keep the distance chosen as small as possible in order to avoid '"
                'chains effect'
                "' and producing too widespread groups .\n" +
                "                                                                                                                                          \n"
                + "The plugin produces a layer of point called '"
                'input_layer_name_aggregated_with_Distance'
                "' with 3 mores attributes:                                                          \n"
                +
                "                                                                                                                                                                                                                    \n"
                +
                " - Point_id: the point id,                                                                                                                                                              \n"
                +
                "                                                                                                                                                                                                                    \n"
                + " - NumAggreg: the '"
                'aggregates id number'
                "'                                                                                                                                                              \n"
                +
                "                                                                                                                                                                                                                    \n"
                +
                " - Nb_Pts: the number of regrouped points,                                              \n "
                + "\n" +
                "                                                                                                                                                                                                                    \n"
                +
                " - List_Pts: the list of the points ids in the aggregate.                                                                                                                     \n"
                + "\n" +
                "                                                                                                                                          \n"
                +
                "                                                                                                                                                          \n"
                + "\n" +
                " The plugin also produce a line layer, with not all lines connecting points of a same aggregate but showing only the very one of the connections that were made to link the points as part of a same aggregate."
                " the plugin also produces a layer of polygons overlaping the regrouped points within distance with an attribute table with also NumAggreg,Nb_Pts,List_Pts attributes.    \n "
                + "\n" +
                "                                                                                                                                                                \n"
                +
                "  The polygons are buffers (D/100) of the convex hull polygons of the aggregated points \n "
                +
                "                                                                                                                                                          \n"
                + "\n" +
                "<br><b>WARNING 2:</b><br> The polygons are meant - as the lines - only to show the aggregates but they overlap often points that are not part of the aggregate. The lines can be used for that matter  \n"
                +
                "<br><b>In order to select point of an aggregate only consider the point table attribute !</b><br>"
                "                                                                                                                                                          \n"
                + "\n" +
                " <br><b><i>NOTA BENE: all rasters should be unchecked in layer panel or the plugin won't work !</i></b></br>"
                " This plugin is not a part of Qgis engine and any problems should be reported only to the author. </p></td></tr></table>"
                "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
                "<p style=\"margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
                "                   "
                "<br><b>[email protected]</b><br>"
                "<br><br><i>code 0.2 (26 march 2019).</i></p></body></html>",
                None))
        self.pushButton.setText(QApplication.translate("Dialog", "OK", None))
    def show_current_state(self):
        """Setup the UI for QTextEdit to show the current state."""
        right_panel_heading = QLabel(tr('Status'))
        right_panel_heading.setFont(big_font)
        right_panel_heading.setSizePolicy(
            QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.right_layout.addWidget(right_panel_heading)

        message = m.Message()
        if self.layer_mode == layer_mode_continuous:
            title = tr('Thresholds')
        else:
            title = tr('Value maps')

        message.add(m.Heading(title, **INFO_STYLE))

        for i in range(len(self.exposures)):
            message.add(m.Text(self.exposure_labels[i]))

            classification = self.get_classification(
                self.exposure_combo_boxes[i])
            if self.layer_mode == layer_mode_continuous:
                thresholds = self.thresholds.get(self.exposures[i]['key'])
                if not thresholds or not classification:
                    message.add(m.Paragraph(tr('No classifications set.')))
                    continue
                table = m.Table(
                    style_class='table table-condensed table-striped')
                header = m.Row()
                header.add(m.Cell(tr('Class name')))
                header.add(m.Cell(tr('Minimum')))
                header.add(m.Cell(tr('Maximum')))
                table.add(header)
                classes = classification.get('classes')
                # Sort by value, put the lowest first
                classes = sorted(classes, key=lambda k: k['value'])
                for the_class in classes:
                    threshold = thresholds[classification['key']]['classes'][
                        the_class['key']]
                    row = m.Row()
                    row.add(m.Cell(the_class['name']))
                    row.add(m.Cell(threshold[0]))
                    row.add(m.Cell(threshold[1]))
                    table.add(row)
            else:
                value_maps = self.value_maps.get(self.exposures[i]['key'])
                if not value_maps or not classification:
                    message.add(m.Paragraph(tr('No classifications set.')))
                    continue
                table = m.Table(
                    style_class='table table-condensed table-striped')
                header = m.Row()
                header.add(m.Cell(tr('Class name')))
                header.add(m.Cell(tr('Value')))
                table.add(header)
                classes = classification.get('classes')
                # Sort by value, put the lowest first
                classes = sorted(classes, key=lambda k: k['value'])
                for the_class in classes:
                    value_map = value_maps[classification['key']][
                        'classes'].get(the_class['key'], [])
                    row = m.Row()
                    row.add(m.Cell(the_class['name']))
                    row.add(m.Cell(', '.join([str(v) for v in value_map])))
                    table.add(row)
            message.add(table)

        # status_text_edit = QTextBrowser(None)
        status_text_edit = QWebView(None)
        status_text_edit.setSizePolicy(
            QSizePolicy.Ignored,
            QSizePolicy.Ignored)

        status_text_edit.page().mainFrame().setScrollBarPolicy(
            Qt.Horizontal,
            Qt.ScrollBarAlwaysOff)
        html_string = html_header() + message.to_html() + html_footer()
        status_text_edit.setHtml(html_string)
        self.right_layout.addWidget(status_text_edit)
    def setup_left_panel(self):
        """Setup the UI for left panel.

        Generate all exposure, combobox, and edit button.
        """
        hazard = self.parent.step_kw_subcategory.selected_subcategory()
        left_panel_heading = QLabel(tr('Classifications'))
        left_panel_heading.setFont(big_font)
        self.left_layout.addWidget(left_panel_heading)

        inner_left_layout = QGridLayout()

        row = 0
        for exposure in exposure_all:
            special_case = False
            if not setting('developer_mode'):
                # Filter out unsupported exposure for the hazard
                if exposure in hazard['disabled_exposures']:
                    # Remove from the storage if the exposure is disabled
                    if self.layer_mode == layer_mode_continuous:
                        if exposure['key'] in self.thresholds:
                            self.thresholds.pop(exposure['key'])
                    else:
                        if exposure['key'] in self.value_maps:
                            self.value_maps.pop(exposure['key'])
                    continue
            # Trick for EQ raster for population #3853
            if exposure == exposure_population and hazard == hazard_earthquake:
                if is_raster_layer(self.parent.layer):
                    if self.layer_mode == layer_mode_continuous:
                        self.use_default_thresholds = True
                        special_case = True
                        # Set classification for EQ Raster for Population
                        self.thresholds[exposure_population['key']] = {
                            earthquake_mmi_scale['key']: {
                                'classes': default_classification_thresholds(
                                    earthquake_mmi_scale),
                                'active': True
                            }
                        }

            # Add label
            # Hazard on Exposure Classifications
            label = tr(
                '{hazard_name} on {exposure_name} Classifications').format(
                hazard_name=hazard['name'],
                exposure_name=exposure['name']
            )
            exposure_label = QLabel(label)

            # Add combo box
            exposure_combo_box = QComboBox()
            hazard_classifications = hazard.get('classifications')
            exposure_combo_box.addItem(tr('No classifications'))
            exposure_combo_box.setItemData(
                0, None, Qt.UserRole)

            current_index = 0
            i = 0
            # Iterate through all available hazard classifications
            for hazard_classification in hazard_classifications:
                # Skip if the classification is not for the exposure
                if 'exposures' in hazard_classification:
                    if exposure not in hazard_classification['exposures']:
                        continue
                exposure_combo_box.addItem(hazard_classification['name'])
                exposure_combo_box.setItemData(
                    i + 1, hazard_classification, Qt.UserRole)
                if self.layer_mode == layer_mode_continuous:
                    current_hazard_classifications = self.thresholds.get(
                        exposure['key'])
                else:
                    current_hazard_classifications = self.value_maps.get(
                        exposure['key'])
                if current_hazard_classifications:
                    current_hazard_classification = \
                        current_hazard_classifications.get(
                            hazard_classification['key'])
                    if current_hazard_classification:
                        is_active = current_hazard_classification.get('active')
                        if is_active:
                            current_index = i + 1
                i += 1
            # Set current classification
            exposure_combo_box.setCurrentIndex(current_index)

            # Add edit button
            exposure_edit_button = QPushButton(tr('Edit'))

            # For special case. Raster EQ on Population.
            if special_case:
                mmi_index = exposure_combo_box.findText(
                    earthquake_mmi_scale['name'])
                exposure_combo_box.setCurrentIndex(mmi_index)
                exposure_combo_box.setEnabled(False)
                exposure_edit_button.setEnabled(False)
                tool_tip_message = tr(
                    'InaSAFE use default classification for Raster Earthquake '
                    'hazard on population.')
                exposure_label.setToolTip(tool_tip_message)
                exposure_combo_box.setToolTip(tool_tip_message)
                exposure_edit_button.setToolTip(tool_tip_message)

            else:
                if current_index == 0:
                    # Disable if there is no classification chosen.
                    exposure_edit_button.setEnabled(False)
                exposure_edit_button.clicked.connect(
                    partial(
                        self.edit_button_clicked,
                        edit_button=exposure_edit_button,
                        exposure_combo_box=exposure_combo_box,
                        exposure=exposure))
                exposure_combo_box.currentIndexChanged.connect(
                    partial(
                        self.classifications_combo_box_changed,
                        exposure=exposure,
                        exposure_combo_box=exposure_combo_box,
                        edit_button=exposure_edit_button))

            # Arrange in layout
            inner_left_layout.addWidget(exposure_label, row, 0)
            inner_left_layout.addWidget(exposure_combo_box, row, 1)
            inner_left_layout.addWidget(exposure_edit_button, row, 2)

            # Adding to step's attribute
            self.exposures.append(exposure)
            self.exposure_combo_boxes.append(exposure_combo_box)
            self.exposure_edit_buttons.append(exposure_edit_button)
            self.exposure_labels.append(label)
            if special_case:
                self.special_case_index = len(self.exposures) - 1

            row += 1

        self.left_layout.addLayout(inner_left_layout)
        # To push the inner_left_layout up
        self.left_layout.addStretch(1)
Esempio n. 11
0
class Ui_form1(object):
    def setupUi(self, form1):
        form1.setObjectName(_fromUtf8("form1"))
        form1.resize(400, 253)
        form1.setFocusPolicy(QtCore.Qt.TabFocus)
        form1.setWindowTitle(_fromUtf8("Kuwahara filter"))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/qgis.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        form1.setWindowIcon(icon)
        self.label = QLabel(form1)
        self.label.setGeometry(QtCore.QRect(21, 10, 111, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label.setFont(font)
        self.label.setToolTip(_fromUtf8(""))
        self.label.setObjectName(_fromUtf8("label"))
        self.outputb = QPushButton(form1)
        self.outputb.setGeometry(QtCore.QRect(320, 47, 31, 23))
        self.outputb.setObjectName(_fromUtf8("outputb"))
        self.label_2 = QLabel(form1)
        self.label_2.setGeometry(QtCore.QRect(22, 49, 101, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_2.setFont(font)
        self.label_2.setToolTip(_fromUtf8(""))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.progressBar = QProgressBar(form1)
        self.progressBar.setGeometry(QtCore.QRect(19, 220, 361, 23))
        self.progressBar.setProperty(_fromUtf8("value"), 24)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.label_3 = QLabel(form1)
        self.label_3.setGeometry(QtCore.QRect(22, 88, 131, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.label_4 = QLabel(form1)
        self.label_4.setGeometry(QtCore.QRect(21, 125, 181, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.run = QPushButton(form1)
        self.run.setGeometry(QtCore.QRect(139, 185, 101, 23))
        self.run.setObjectName(_fromUtf8("run"))
        self.inputbox = QgsMapLayerComboBox(form1)
        self.inputbox.setGeometry(QtCore.QRect(141, 10, 170, 22))
        self.inputbox.setObjectName(_fromUtf8("input"))
        self.output = QLineEdit(form1)
        self.output.setGeometry(QtCore.QRect(149, 45, 160, 28))
        self.output.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.output.setObjectName(_fromUtf8("output"))
        self.refb = QLineEdit(form1)
        self.refb.setGeometry(QtCore.QRect(149, 82, 160, 28))
        self.refb.setObjectName(_fromUtf8("refb"))
        self.mem = QLineEdit(form1)
        self.mem.setGeometry(QtCore.QRect(208, 120, 101, 28))
        self.mem.setObjectName(_fromUtf8("mem"))
        self.addout = QCheckBox(form1)
        self.addout.setGeometry(QtCore.QRect(100, 158, 171, 17))
        self.addout.setChecked(True)
        self.addout.setObjectName(_fromUtf8("checkBox"))
        self.inputb = QPushButton(form1)
        self.inputb.setGeometry(QtCore.QRect(320, 10, 31, 23))
        self.inputb.setObjectName(_fromUtf8("inputb"))
        self.retranslateUi(form1)
        self.setWindowFlags(QtCore.Qt.WindowFlags(QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint | QtCore.Qt.WindowCloseButtonHint))
        QtCore.QMetaObject.connectSlotsByName(form1)
    def retranslateUi(self, form1):
        self.label.setText(QtCore.QCoreApplication.translate("form1", "Input raster"))
        self.outputb.setText("...")
        self.label_2.setText(QApplication.translate("form1", "Output raster"))
        self.label_3.setToolTip(QApplication.translate("form1", "Reference band from which variances will be calculated to choose subwindow mean."))
        self.label_3.setText(QApplication.translate("form1", "Reference band"))
        self.label_4.setToolTip(QApplication.translate("form1", "Maximum memory usage in megabytes (it is an approximated value, since algorithm will only choose how many lines will be read at once)."))
        self.label_4.setText(QApplication.translate("form1", "Max memory usage (MB)"))
        self.run.setText(QApplication.translate("form1", "Run"))
        self.output.setPlaceholderText(QApplication.translate("form1", "<temporary file>"))
        self.refb.setToolTip(QApplication.translate("form1", "Reference band from which variances will be calculated to choose subwindow mean."))
        self.refb.setText("1")
        self.mem.setToolTip(QApplication.translate("form1", "Maximum memory usage in MeB (it is an approximated value, since algorithm will only choose how many lines will be read at once)."))
        self.mem.setText("100")
        self.addout.setText(QApplication.translate("form1", "Add results to project"))
        self.inputb.setText("...")
Esempio n. 12
0
class gpx_to_3d(QDialog):

    # Open Qgis Aplication, for using his function
    # I think there is a better way to start, but by the moment I don't know how
    #QgsApplication.setPrefixPath('/usr', True)
    #qgs = QgsApplication([], False)
    #qgs.initQgis()

    # Initialize window and create Graphic User Interface
    def __init__(self):
        super().__init__()
        self.setWindowTitle("GPX TO 3D")
        #QgsApplication.setPrefixPath('/usr', True)
        #self.qgs = QgsApplication([], False)
        #self.qgs.initQgis()

        # File to show in map
        self.Output_KML_File = 'C:/Roberto/Visual_Studio_Code/Sharing_Little_Things/Python/Qgis/GPX 3D/2019_E6_V8.gpx'
        self.Output_KML_File = 'C:/Roberto/Visual_Studio_Code/Sharing_Little_Things/Python/Qgis/GPX 3D/2019_E6_V8_3D.kml'
        #self.Output_KML_File=None
        self.initGui()

    def select_file(self):
        # User select the file to converter and start convertion
        filename, _ = QFileDialog.getOpenFileName(
            self, 'Select GPX File / Selecciona Fichero GPX',
            os.path.dirname(__file__), 'TRACK (*.gpx *.kml)')
        if filename:
            # Start convertion
            self.convert_track(filename)

            # Create a Profile
            self.profile()

            # Open Map
            map = see_map(self.Output_KML_File)
            map.exec_()
            self.info('Finished / Finalizado')

    def convert_track(self, filename):
        self.file_name = filename
        if self.file_name[-3:] == 'gpx':
            # Set parameters to load file like a layer. Get track like a points, not a line
            uri = self.file_name + "|layername=track_points"
            # Load Layer with points of track gpx o line KML
            self.points = QgsVectorLayer(uri, "Original Points", "ogr")
            # Check if load is correct
            if not self.points.isValid():
                self.info("Track failed to load! /n" + filename)
            else:
                self.info("Track Load Correct! " + filename)

        elif self.file_name[-3:] == 'kml':
            uri = self.file_name
            # Set parameters to load file like a layer. Get track like a line
            # Load Layer with points of track gpx o line KML
            lines = QgsVectorLayer(uri, "Original Line", "ogr")
            # Check if load is correct
            if not lines.isValid():
                self.info("Track failed to load! /n" + filename)
            else:
                self.info("Track Load Correct! " + filename)

            # KML is a line convert line in points
            for line in lines.getFeatures():
                # Create a layer for points in memory
                self.points = QgsVectorLayer("Point?crs=epsg:4326&index=yes",
                                             "Original Points", "memory")
                features = []
                for vertex in line.geometry().vertices():
                    feature = QgsFeature()
                    feature.setGeometry(vertex)
                    features.append(feature)

                self.points.dataProvider().addFeatures(features)

        # Set parameters to load the Digital Elevation Model of IGN
        if self.comboBox.currentIndex() == 3:
            uri = "dpiMode=7&identifier=mdt:Elevacion4258_1000&url=http://www.ign.es/wcs/mdt"
            uri2 = "dpiMode=7&identifier=Elevacion4258_1000&url=http://servicios.idee.es/wcs-inspire/mdt?version%3D1.1.2"
        elif self.comboBox.currentIndex() == 2:
            uri = "dpiMode=7&identifier=mdt:Elevacion4258_500&url=http://www.ign.es/wcs/mdt"
            uri2 = "dpiMode=7&identifier=Elevacion4258_500&url=http://servicios.idee.es/wcs-inspire/mdt?version%3D1.1.2"
        elif self.comboBox.currentIndex() == 1:
            uri = "dpiMode=7&identifier=mdt:Elevacion4258_200&url=http://www.ign.es/wcs/mdt"
            uri2 = "dpiMode=7&identifier=Elevacion4258_200&url=http://servicios.idee.es/wcs-inspire/mdt?version%3D1.1.2"
        else:
            uri = "dpiMode=7&identifier=mdt:Elevacion4258_25&url=http://www.ign.es/wcs/mdt"
            uri2 = "dpiMode=7&identifier=Elevacion4258_25&url=http://servicios.idee.es/wcs-inspire/mdt?version%3D1.1.2"

        DEM = QgsRasterLayer(uri, 'my wcs layer', 'wcs')

        if not DEM.isValid():
            self.info("DEM failed to load!")
        else:
            self.info("DEM Load Correct!")

        # For calculate distance between points
        d = QgsDistanceArea()
        d.setEllipsoid('WGS84')
        point_origin = 0

        # For make profile
        self.all_coord_m = []
        self.all_coord_z = []
        self.ymax = 0

        # Start to create KML file (firts lines of file)
        self.start_creation_kml()

        # Start to create GPX file (firts lines of file)
        self.start_creation_gpx()

        # For put time in points of track
        self.track_day = QDateTime.currentDateTime()

        # For each point in the track, analize information
        for point in self.points.getFeatures():
            # Get Geometry of feature like a point
            geompt = point.geometry().asPoint()
            if not DEM.isValid():
                if self.file_name[-3:] == 'kml':
                    elevation = [0, 0]
                else:
                    elevation = [point['ele'], point['ele']]
            else:
                # Find this point in DEM and return his elevation
                elevation = DEM.dataProvider().identify(
                    geompt, QgsRaster.IdentifyFormatValue).results()

            #print (elevation[1],point['ele'])
            # Get Value of original point (y - Latitude, x - Longitude)
            self.coor_x = geompt.x()
            self.coor_y = geompt.y()
            if len(elevation) > 0:
                # Set value of elevation like coordinate Z
                self.coor_z = elevation[1]
            else:
                self.info('Point ' + str(self.coor_y) + " / " +
                          str(self.coor_x) + " Not Found / No encontrado")
                self.coor_z = 0

            # Calculate lenght of track
            if not point_origin == 0:
                self.distance = d.measureLine(point_origin, geompt)
                self.coor_m += (self.distance / 1000)  # Distance in km
                point_origin = geompt
            else:
                self.coor_m = 0
                self.distance = 0
                point_origin = geompt

            # Maxium Hight for profile
            if self.ymax < self.coor_z:
                self.ymax = self.coor_z
            # Acumulate points (distance / Elevation) for make profile
            self.all_coord_m.append(self.coor_m)
            self.all_coord_z.append(self.coor_z)

            # Put a time in points
            if self.file_name[-3:] == 'kml':
                self.track_day = self.track_day.addSecs(1)
            else:
                if point['time'] == None:
                    # If track hase no time add 1 second to previous time
                    self.track_day = self.track_day.addSecs(1)
                else:
                    # Get point time from track
                    self.track_day = point['time']

            # Add point in the new kml file
            self.add_points_kml()

            # Add point in the new GPX file
            self.add_points_gpx()

        # Close and write finish of kml file
        self.finish_kml()

        # Close and write finish of gpx file
        self.finish_gpx()

    def start_creation_kml(self):
        # Write head lines of kml file
        self.Output_KML_File = self.file_name[:-4] + '_3D.kml'
        self.file_kml = open(self.Output_KML_File, 'w')
        color_dic = {
            'Rojo': 'ff0000ff',
            'Verde': 'ff00ff00',
            'Azul': 'ffff0000',
            'Morado': 'ff800080',
            'Amarillo': 'ff00ffff',
            'Rosado': 'ffff00ff',
            'Naranja': 'ff0080ff',
            'Marrón': 'ff336699'
        }
        color = [
            'ff0000ff', 'ff00ff00', 'ffff0000', 'ff800080', 'ff00ffff',
            'ffff00ff', 'ff0080ff', 'ff336699'
        ]
        self.file_kml.write("<?xml version='1.0' encoding='UTF-8'?>\n")
        self.file_kml.write(
            "<kml xmlns='http://www.opengis.net/kml/2.2' xmlns:gx='http://www.google.com/kml/ext/2.2' xmlns:kml='http://www.opengis.net/kml/2.2' xmlns:atom='http://www.w3.org/2005/Atom'>\n"
        )
        self.file_kml.write("<Document>\n")
        self.file_kml.write("   <name>" + self.Output_KML_File + "</name>\n")
        self.file_kml.write("   <Placemark>\n")
        self.file_kml.write("       <name>" +
                            os.path.basename(self.Output_KML_File) +
                            "</name>\n")
        self.file_kml.write("       <description>" +
                            os.path.basename(self.Output_KML_File) +
                            "</description>\n")
        self.file_kml.write("	<Style>\n")
        self.file_kml.write("		<LineStyle>\n")
        self.file_kml.write("			<color>" + color[0] + "</color>\n")
        self.file_kml.write("			<width>4</width>\n")
        self.file_kml.write("		</LineStyle>\n")
        self.file_kml.write("	</Style>\n")
        self.file_kml.write("       <LineString>\n")
        self.file_kml.write("           <coordinates>")

    def add_points_kml(self):
        self.file_kml.write(
            str(self.coor_x) + "," + str(self.coor_y) + "," +
            str(self.coor_z) + " ")

    def finish_kml(self):
        # Write foot lines, write and close kml file
        self.file_kml.write("           </coordinates>\n")
        self.file_kml.write("       </LineString>\n")
        self.file_kml.write("   </Placemark>\n")
        self.file_kml.write("</Document>\n")
        self.file_kml.write("</kml>\n")
        self.file_kml.close()
        self.info(self.Output_KML_File)

    def start_creation_gpx(self):
        # Write head lines of gpx file
        self.Output_GPX_File = self.file_name[:-4] + '_3D.gpx'
        self.file_gpx = open(self.Output_GPX_File, 'w')

        self.file_gpx.write('''<?xml version="1.0"?>\n''')
        self.file_gpx.write(
            '''<gpx version="1.1" creator="GDAL 3.0.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">\n'''
        )
        self.file_gpx.write("  <trk>\n")
        self.file_gpx.write("    <name>" +
                            os.path.basename(self.Output_GPX_File) +
                            "</name>\n")
        self.file_gpx.write("    <trkseg>\n")

    def add_points_gpx(self):
        # Add points in the GPX file
        self.file_gpx.write('      <trkpt lat="' + str(self.coor_y) +
                            '" lon="' + str(self.coor_x) + '">\n')
        self.file_gpx.write("        <ele>" + str(self.coor_z) + "</ele>\n")
        self.file_gpx.write("      <time>" +
                            self.track_day.toString('yyyy-MM-ddTHH:mm:ssZ') +
                            "</time>\n")
        self.file_gpx.write("      </trkpt>\n")

    def finish_gpx(self):
        # Write foot lines, write and close kml file
        self.file_gpx.write("    </trkseg>\n")
        self.file_gpx.write("  </trk>\n")
        self.file_gpx.write("</gpx>\n")
        self.file_gpx.close()
        self.info(self.Output_GPX_File)

    def profile(self):
        import matplotlib.pyplot as plt

        # Create Profile
        plt.xlim(right=self.coor_m)  #xmax is your value
        plt.xlim(left=0)  #xmin is your value
        plt.ylim(top=self.ymax * 1.2)  #ymax is your value
        plt.ylim(bottom=0)  #ymin is your value
        plt.plot(self.all_coord_m, self.all_coord_z)
        plt.fill_between(self.all_coord_m,
                         self.all_coord_z,
                         facecolor='red',
                         color='#539ecd')
        #pylab.fill_between(x, y, color='#539ecd')
        file_profile = self.file_name[:-3] + "jpg"
        plt.savefig(file_profile)
        plt.clf()
        pixmap = QPixmap(file_profile)
        self.profile_jpg.setPixmap(pixmap)
        self.profile_jpg.setScaledContents(True)
        self.info(file_profile)

    def info(self, message):
        # Show Information message in the screen and print in console
        print(message)
        self.message_box.append(message)

    def initGui(self):
        # Create Graphical User Interface
        icon = QIcon()
        icon.addPixmap(QPixmap(os.path.dirname(__file__) + "/icon.png"),
                       QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.setWindowModality(Qt.WindowModal)
        self.setWindowFlags(Qt.Window
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.resize(520, 520)

        self.label = QLabel(self)
        self.label.setGeometry(QRect(10, 20, 500, 20))
        font = QFont()
        font.setPointSize(14)
        font.setUnderline(True)
        self.label.setFont(font)
        self.label.setAlignment(Qt.AlignCenter)
        self.label_2 = QLabel(self)
        self.label_2.setGeometry(QRect(10, 70, 500, 16))
        self.label_3 = QLabel(self)
        self.label_3.setGeometry(QRect(10, 90, 500, 16))
        self.label_4 = QLabel(self)
        self.label_4.setGeometry(QRect(10, 110, 500, 16))
        self.pushButton = QPushButton(self)
        self.pushButton.setGeometry(QRect(50, 150, 121, 24))
        self.comboBox = QComboBox(self)
        self.comboBox.setGeometry(QRect(240, 150, 121, 24))
        self.comboBox.addItem("Paso Malla 25m")
        self.comboBox.addItem("Paso Malla 200m")
        self.comboBox.addItem("Paso Malla 500m")
        self.comboBox.addItem("Paso Malla 1.000m")
        self.bt_view_map = QPushButton(self)
        self.bt_view_map.setGeometry(QRect(370, 150, 121, 24))
        self.profile_jpg = QLabel(self)
        self.profile_jpg.setGeometry(QRect(20, 200, 480, 180))

        self.message_box = QTextEdit(self)
        self.message_box.setGeometry(QRect(10, 400, 500, 111))
        self.label.setText("KML / GPX TO 3D")
        self.label_2.setText(
            "Convert a GPX file without elevation, in a GPX and KML with elevation. It's only for Spain."
        )
        self.label_3.setText(
            "Convierte un GPX sin elevación, en un GPX y KML con elevación.")
        self.label_4.setText(
            "Es solo para España ya que utiliza el servicio WCS del Instituto Geografico Nacional"
        )
        self.pushButton.setText("File / Fichero")
        self.bt_view_map.setText("Map / Mapa")

        self.pushButton.clicked.connect(self.select_file)
        self.bt_view_map.clicked.connect(
            lambda: see_map(self.Output_KML_File).exec_())