Monday 18 March 2019

CoordinateExtractor Plugin: improvements

However CoordinateExtractorPlugin work as we expect - there are still some features that are missing that significantly increase capability of getting pairs of coordinates from plain text. The first is quite obvious - user should be able to define her or his own latitude-longitude separator. (I might have implemented only this option from the beginning actually). The second one comes form the fact, that there are possible some deviation from the pattern of coordinates, such as variable number of blank characters as latitude-longitude separator, or in the string that is latitude-longitude separator.

First, we need to change a bit GUI for dialog:
for comboBoxCoordSeparator add new item 'User defined'
new QLineEdit: lineEditUserSeparator
new QCheckBox: checkBoxReomveBlanks
 
Method that sets separator between latitude and longitude has to be changed, so it will takes user defined separator: 


def set_latlon_separator(self):
    if self.dlg.comboBoxCoordSeparator.currentIndex() == 0:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = None
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 1:  # Null separator
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_NULL
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 2:  # Space
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_SPACE
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 3:  # Hyphen
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_HYPHEN
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 4:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_SLASH
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 5:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = '\\'
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 6:
        self.dlg.lineEditUserSeparator.setEnabled(True)
        self.latlon_separator = self.dlg.lineEditUserSeparator.text()



No comments:

Post a Comment