summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-25 09:02:09 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-25 10:09:36 (GMT)
commit7d1c80961416ec227f2a0b24aa79e258241cbcdb (patch)
tree532307196c71a88c92087af46002cb9acad29161
parente6002ffa647ceeff34a35c30952f182608a90159 (diff)
Be more leniant when guessing RA/Dec from text.
-rw-r--r--kstars/tools/adddeepskyobject.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/kstars/tools/adddeepskyobject.cpp b/kstars/tools/adddeepskyobject.cpp
index 45f7810..b81ef31 100644
--- a/kstars/tools/adddeepskyobject.cpp
+++ b/kstars/tools/adddeepskyobject.cpp
@@ -65,7 +65,7 @@ void AddDeepSkyObject::fillFromText( const QString &text ) {
QRegularExpression matchJ2000Line( "^(.*)(?:J2000|ICRS|FK5|\\(2000(?:\\.0)?\\))(.*)$" );
matchJ2000Line.setPatternOptions( QRegularExpression::MultilineOption );
QRegularExpression matchCoords( "(?:^|[^-\\d])([-+]?\\d\\d?)(?:h ?|d ?|[^\\d]?° ?|:| +)(\\d\\d)(?:m ?|\' ?|’ ?|′ ?|:| +)(\\d\\d(?:\\.\\d+)?)?(?:s|\"|\'\'|”|″)?\\b" );
- QRegularExpression matchCoords2( "J\\d{6,6}[-+]\\d{6,6}" );
+ QRegularExpression matchCoords2( "J?\\d{6,6}[-+]\\d{6,6}" );
QRegularExpression findMag1( "(?:[mM]ag(?:nitudes?)?\\s*(?:\\([vV]\\))?|V(?=\\b))(?:\\s*=|:)?\\s*(-?\\d{1,2}(?:\\.\\d{1,3})?)" );
QRegularExpression findMag2( "\\b-?\\d{1,2}(\\.\\d{1,3})?\\s*[mM]ag\\b");
QRegularExpression findSize1( "\\b(\\d{1,3}(?:\\.\\d{1,2})?)\\s*(°|\'|\"|\'\')?\\s*[xX×]\\s*(\\d{1,3}(?:\\.\\d{1,2})?)\\s*(°|\'|\"|\'\')?\\b" );
@@ -99,8 +99,6 @@ void AddDeepSkyObject::fillFromText( const QString &text ) {
if ( text.indexOf( matchJ2000Line, 0, &rmatch ) >= 0 ) {
coordText = rmatch.captured( 1 ) + rmatch.captured( 2 );
qDebug() << "Found a J2000 line match: " << coordText;
- if ( countNonOverlappingMatches( coordText, matchCoords ) != 2 )
- coordText = QString(); // Give up
}
}
if ( !coordText.isEmpty() ) {