@@ -93,15 +93,30 @@ void GotoLocatorFilter::fetchResults( const QString &string, const QgsLocatorCon
93
93
if ( !match.hasMatch () )
94
94
{
95
95
// Check if the string is a pair of degree minute second
96
- separatorRx = QRegularExpression ( QStringLiteral ( " ^((?:([-+nsew])\\ s*)?\\ d{1,3}(?:[^0-9.]+[0-5]?\\ d)?[^0-9.]+[0-5]?\\ d(?:[\\ .\\ %1]\\ d+)?[^0-9.,]*[-+nsew]?)[,\\ s]+((?:([-+nsew])\\ s*)?\\ d{1,3}(?:[^0-9.]+[0-5]?\\ d)?[^0-9.]+[0-5]?\\ d(?:[\\ .\\ %1]\\ d+)?[^0-9.,]*[-+nsew]?)$" )
97
- .arg ( locale.decimalPoint () ) );
96
+ const QString dmsRx = QStringLiteral ( " \\ d{1,3}(?:[^0-9.]+[0-5]?\\ d)?[^0-9.]+[0-5]?\\ d(?:[\\ .\\ %1]\\ d+)?" ).arg ( locale.decimalPoint () );
97
+ separatorRx = QRegularExpression ( QStringLiteral (
98
+ " ^("
99
+ " (\\ s*%1[^0-9.,]*[-+NSEWnsew]?)[,\\ s]+(%1[^0-9.,]*[-+NSEWnsew]?)"
100
+ " )|("
101
+ " ((?:([-+NSEWnsew])\\ s*)%1[^0-9.,]*)[,\\ s]+((?:([-+NSEWnsew])\\ s*)%1[^0-9.,]*)"
102
+ " )$" )
103
+ .arg ( dmsRx ) );
104
+
98
105
match = separatorRx.match ( string.trimmed () );
99
106
if ( match.hasMatch () )
100
107
{
101
108
posIsWgs84 = true ;
102
109
bool isEasting = false ;
103
- firstNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 1 ), &firstOk, &isEasting );
104
- secondNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 3 ), &secondOk );
110
+ if ( !match.captured ( 1 ).isEmpty () )
111
+ {
112
+ firstNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 2 ), &firstOk, &isEasting );
113
+ secondNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 3 ), &secondOk );
114
+ }
115
+ else
116
+ {
117
+ firstNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 5 ), &firstOk, &isEasting );
118
+ secondNumber = QgsCoordinateUtils::dmsToDecimal ( match.captured ( 7 ), &secondOk );
119
+ }
105
120
// normalize to northing (i.e. Y) first
106
121
if ( isEasting )
107
122
std::swap ( firstNumber, secondNumber );
0 commit comments