mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Remove use of deprecated QRegExp.
This commit is contained in:
parent
4f822b4daf
commit
41716632d4
@ -24,7 +24,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
@ -636,9 +636,10 @@ void AISDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterMMSI != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterMMSI);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterMMSI));
|
||||
QTableWidgetItem *fromItem = ui->messages->item(row, MESSAGE_COL_MMSI);
|
||||
if (!re.exactMatch(fromItem->text()))
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
ui->messages->setRowHidden(row, hidden);
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QGraphicsScene>
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "dabdemodgui.h"
|
||||
|
||||
@ -423,9 +423,10 @@ void DABDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filter != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filter);
|
||||
QRegularExpression re(m_settings.m_filter);
|
||||
QTableWidgetItem *fromItem = ui->programs->item(row, PROGRAMS_COL_NAME);
|
||||
if (re.indexIn(fromItem->text()) == -1)
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
ui->programs->setRowHidden(row, hidden);
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QRegExp>
|
||||
#include <QScrollBar>
|
||||
#include <QMenu>
|
||||
#include <QDesktopServices>
|
||||
@ -467,8 +466,9 @@ void DSCDemodGUI::filterRow(int row)
|
||||
if (m_settings.m_filter != "")
|
||||
{
|
||||
QTableWidgetItem *item = ui->messages->item(row, m_settings.m_filterColumn);
|
||||
QRegExp re(m_settings.m_filter);
|
||||
if (!re.exactMatch(item->text())) {
|
||||
QRegularExpression re(m_settings.m_filter);
|
||||
QRegularExpressionMatch match = re.match(item->text());
|
||||
if (!match.hasMatch()) {
|
||||
hidden = true;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
@ -345,9 +345,10 @@ void EndOfTrainDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterFrom != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterFrom);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterFrom));
|
||||
QTableWidgetItem *fromItem = ui->packets->item(row, PACKETS_COL_ADDRESS);
|
||||
if (!re.exactMatch(fromItem->text()))
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
ui->packets->setRowHidden(row, hidden);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
@ -330,16 +330,18 @@ void PacketDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterFrom != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterFrom);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterFrom));
|
||||
QTableWidgetItem *fromItem = ui->packets->item(row, PACKET_COL_FROM);
|
||||
if (!re.exactMatch(fromItem->text()))
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
if (m_settings.m_filterTo != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterTo);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterTo));
|
||||
QTableWidgetItem *toItem = ui->packets->item(row, PACKET_COL_TO);
|
||||
if (!re.exactMatch(toItem->text()))
|
||||
QRegularExpressionMatch match = re.match(toItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
if (m_settings.m_filterPID != "")
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
@ -473,9 +473,10 @@ void RadiosondeDemodGUI::filterRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterSerial != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterSerial);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern(m_settings.m_filterSerial));
|
||||
QTableWidgetItem *fromItem = ui->frames->item(row, FRAME_COL_SERIAL);
|
||||
if (!re.exactMatch(fromItem->text()))
|
||||
QRegularExpressionMatch match = re.match(fromItem->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
ui->frames->setRowHidden(row, hidden);
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
#include <QImage>
|
||||
@ -6054,10 +6054,11 @@ void RadioAstronomyGUI::networkManagerFinished(QNetworkReply *reply)
|
||||
else
|
||||
{
|
||||
QString answer = reply->readAll();
|
||||
QRegExp re("a href=\\\"download.php([^\"]*)\"");
|
||||
if (re.indexIn(answer) != -1)
|
||||
QRegularExpression re("a href=\\\"download.php([^\"]*)\"");
|
||||
QRegularExpressionMatch match = re.match(answer);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
QString filename = re.capturedTexts()[1];
|
||||
QString filename = match.capturedTexts()[1];
|
||||
qDebug() << "RadioAstronomyGUI: Downloading LAB reference data: " << filename;
|
||||
m_dlm.download(QUrl("https://www.astro.uni-bonn.de/hisurvey/euhou/LABprofile/download.php" + filename), m_filenameLAB);
|
||||
}
|
||||
|
@ -1147,9 +1147,10 @@ void APRSGUI::filterMessageRow(int row)
|
||||
bool hidden = false;
|
||||
if (m_settings.m_filterAddressee != "")
|
||||
{
|
||||
QRegExp re(m_settings.m_filterAddressee);
|
||||
QRegularExpression re(m_settings.m_filterAddressee);
|
||||
QTableWidgetItem *addressee = ui->messagesTable->item(row, MESSAGE_COL_ADDRESSEE);
|
||||
if (!re.exactMatch(addressee->text()))
|
||||
QRegularExpressionMatch match = re.match(addressee->text());
|
||||
if (!match.hasMatch())
|
||||
hidden = true;
|
||||
}
|
||||
ui->messagesTable->setRowHidden(row, hidden);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <QHash>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
struct SatNogsTransmitter {
|
||||
|
||||
@ -196,10 +196,11 @@ struct SatNogsSatellite {
|
||||
// tle0 is of the form:
|
||||
// MOZHAYETS 4 (RS-22)
|
||||
// GOES 9 [-]
|
||||
QRegExp re("([A-Za-z0-9\\- ]+)([\\(]([A-Z0-9\\- ]+)[\\)])?");
|
||||
if (re.indexIn(tle->m_tle0) != -1)
|
||||
QRegularExpression re("([A-Za-z0-9\\- ]+)([\\(]([A-Z0-9\\- ]+)[\\)])?");
|
||||
QRegularExpressionMatch match = re.match(tle->m_tle0);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
QStringList groups = re.capturedTexts();
|
||||
QStringList groups = match.capturedTexts();
|
||||
m_name = groups[1].trimmed();
|
||||
if ((groups.size() >= 4) && (groups[3] != "-") && !groups[3].isEmpty())
|
||||
m_names = QStringList({groups[3].trimmed()});
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <algorithm>
|
||||
#include <QMessageBox>
|
||||
#include <QLineEdit>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QGraphicsScene>
|
||||
@ -1253,8 +1253,8 @@ void StarTrackerGUI::plotGalacticLineOfSight()
|
||||
}
|
||||
|
||||
// Calculate Galactic longitude we're observing
|
||||
float ra = Astronomy::raToDecimal(m_settings.m_ra);
|
||||
float dec = Astronomy::decToDecimal(m_settings.m_dec);
|
||||
float ra = Units::raToDecimal(m_settings.m_ra);
|
||||
float dec = Units::decToDecimal(m_settings.m_dec);
|
||||
double l, b;
|
||||
Astronomy::equatorialToGalactic(ra, dec, l, b);
|
||||
|
||||
@ -1365,8 +1365,8 @@ void StarTrackerGUI::plotSkyTemperatureChart()
|
||||
}
|
||||
|
||||
QScatterSeries *series = new QScatterSeries();
|
||||
float ra = Astronomy::raToDecimal(m_settings.m_ra);
|
||||
float dec = Astronomy::decToDecimal(m_settings.m_dec);
|
||||
float ra = Units::raToDecimal(m_settings.m_ra);
|
||||
float dec = Units::decToDecimal(m_settings.m_dec);
|
||||
|
||||
double beamWidth = m_settings.m_beamwidth;
|
||||
// Ellipse not supported, so draw circle on shorter axis
|
||||
@ -1664,8 +1664,8 @@ void StarTrackerGUI::plotElevationLineChart()
|
||||
}
|
||||
else
|
||||
{
|
||||
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
|
||||
rd.ra = Units::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Units::decToDecimal(m_settings.m_dec);
|
||||
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
|
||||
}
|
||||
|
||||
@ -1850,8 +1850,8 @@ void StarTrackerGUI::plotElevationPolarChart()
|
||||
}
|
||||
else
|
||||
{
|
||||
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
|
||||
rd.ra = Units::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Units::decToDecimal(m_settings.m_dec);
|
||||
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
|
||||
}
|
||||
|
||||
@ -2282,12 +2282,13 @@ bool StarTrackerGUI::readSolarFlux()
|
||||
// 000000 000019 000027 000037 000056 000073 000116 000202 000514 sfu
|
||||
// Occasionally, file will contain ////// in a column, presumably to indicate no data
|
||||
// Values can be negative
|
||||
QRegExp re("([0-9]{2})([0-9]{2})([0-9]{2}) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+)");
|
||||
QRegularExpression re("([0-9]{2})([0-9]{2})([0-9]{2}) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+) (-?[0-9\\/]+)");
|
||||
QRegularExpressionMatch match = re.match(string);
|
||||
|
||||
if (re.indexIn(string) != -1)
|
||||
if (match.hasMatch())
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
m_solarFluxes[i] = re.capturedTexts()[i+4].toInt();
|
||||
m_solarFluxes[i] = match.capturedTexts()[i+4].toInt();
|
||||
m_solarFluxesValid = true;
|
||||
displaySolarFlux();
|
||||
plotChart();
|
||||
@ -2322,11 +2323,12 @@ void StarTrackerGUI::networkManagerFinished(QNetworkReply *reply)
|
||||
else
|
||||
{
|
||||
QString answer = reply->readAll();
|
||||
QRegExp re("\\<th\\>Observed Flux Density\\<\\/th\\>\\<td\\>([0-9]+(\\.[0-9]+)?)\\<\\/td\\>");
|
||||
QRegularExpression re("\\<th\\>Observed Flux Density\\<\\/th\\>\\<td\\>([0-9]+(\\.[0-9]+)?)\\<\\/td\\>");
|
||||
QRegularExpressionMatch match = re.match(answer);
|
||||
|
||||
if (re.indexIn(answer) != -1)
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_solarFlux = re.capturedTexts()[1].toDouble();
|
||||
m_solarFlux = match.capturedTexts()[1].toDouble();
|
||||
displaySolarFlux();
|
||||
}
|
||||
else
|
||||
|
@ -580,8 +580,8 @@ void StarTrackerWorker::update()
|
||||
else
|
||||
{
|
||||
// Convert RA/Dec to Alt/Az
|
||||
rd.ra = Astronomy::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Astronomy::decToDecimal(m_settings.m_dec);
|
||||
rd.ra = Units::raToDecimal(m_settings.m_ra);
|
||||
rd.dec = Units::decToDecimal(m_settings.m_dec);
|
||||
aa = Astronomy::raDecToAzAlt(rd, m_settings.m_latitude, m_settings.m_longitude, dt, !m_settings.m_jnow);
|
||||
Astronomy::equatorialToGalactic(rd.ra, rd.dec, l, b);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
@ -407,34 +406,37 @@ bool APRSPacket::parseDataExension(QString& info, int& idx)
|
||||
QString s = info.right(remainingLength);
|
||||
|
||||
// Course and speed
|
||||
QRegExp courseSpeed("^([0-9]{3})\\/([0-9]{3})");
|
||||
if (courseSpeed.indexIn(s) >= 0)
|
||||
QRegularExpression courseSpeed("^([0-9]{3})\\/([0-9]{3})");
|
||||
QRegularExpressionMatch match;
|
||||
match = courseSpeed.match(s);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_course = courseSpeed.capturedTexts()[1].toInt();
|
||||
m_speed = courseSpeed.capturedTexts()[2].toInt();
|
||||
m_course = match.capturedTexts()[1].toInt();
|
||||
m_speed = match.capturedTexts()[2].toInt();
|
||||
m_hasCourseAndSpeed = true;
|
||||
idx += 7;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Station radio details
|
||||
QRegExp phg("^PHG([0-9])([0-9])([0-9])([0-9])");
|
||||
if (phg.indexIn(s) >= 0)
|
||||
QRegularExpression phg("^PHG([0-9])([0-9])([0-9])([0-9])");
|
||||
match = phg.match(s);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
// Transmitter power
|
||||
int powerCode = phg.capturedTexts()[1].toInt();
|
||||
int powerCode = match.capturedTexts()[1].toInt();
|
||||
int powerMap[] = {0, 1, 4, 9, 16, 25, 36, 49, 64, 81};
|
||||
m_powerWatts = powerMap[powerCode];
|
||||
|
||||
// Antenna height
|
||||
int heightCode = phg.capturedTexts()[2].toInt();
|
||||
int heightCode = match.capturedTexts()[2].toInt();
|
||||
m_antennaHeightFt = heightMap[heightCode];
|
||||
|
||||
// Antenna gain
|
||||
m_antennaGainDB = phg.capturedTexts()[3].toInt();
|
||||
m_antennaGainDB = match.capturedTexts()[3].toInt();
|
||||
|
||||
// Antenna directivity
|
||||
int directivityCode = phg.capturedTexts()[4].toInt();
|
||||
int directivityCode = match.capturedTexts()[4].toInt();
|
||||
m_antennaDirectivity = directivityMap[directivityCode];
|
||||
|
||||
m_hasStationDetails = true;
|
||||
@ -444,31 +446,33 @@ bool APRSPacket::parseDataExension(QString& info, int& idx)
|
||||
}
|
||||
|
||||
// Radio range
|
||||
QRegExp rng("^RNG([0-9]{4})");
|
||||
if (rng.indexIn(s) >= 0)
|
||||
QRegularExpression rng("^RNG([0-9]{4})");
|
||||
match = rng.match(s);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_radioRangeMiles = rng.capturedTexts()[1].toInt();
|
||||
m_radioRangeMiles = match.capturedTexts()[1].toInt();
|
||||
m_hasRadioRange = true;
|
||||
idx += 7;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Omni-DF strength
|
||||
QRegExp dfs("^DFS([0-9])([0-9])([0-9])([0-9])");
|
||||
if (dfs.indexIn(s) >= 0)
|
||||
QRegularExpression dfs("^DFS([0-9])([0-9])([0-9])([0-9])");
|
||||
match = dfs.match(s);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
// Strength S-points
|
||||
m_dfStrength = dfs.capturedTexts()[1].toInt();
|
||||
m_dfStrength = match.capturedTexts()[1].toInt();
|
||||
|
||||
// Antenna height
|
||||
int heightCode = dfs.capturedTexts()[2].toInt();
|
||||
int heightCode = match.capturedTexts()[2].toInt();
|
||||
m_dfHeightFt = heightMap[heightCode];
|
||||
|
||||
// Antenna gain
|
||||
m_dfGainDB = dfs.capturedTexts()[3].toInt();
|
||||
m_dfGainDB = match.capturedTexts()[3].toInt();
|
||||
|
||||
// Antenna directivity
|
||||
int directivityCode = dfs.capturedTexts()[4].toInt();
|
||||
int directivityCode = match.capturedTexts()[4].toInt();
|
||||
m_dfAntennaDirectivity = directivityMap[directivityCode];
|
||||
|
||||
m_hasDf = true;
|
||||
@ -487,14 +491,14 @@ bool APRSPacket::parseComment(QString& info, int& idx)
|
||||
m_comment = info.right(commentLength);
|
||||
|
||||
// Comment can contain altitude anywhere in it. Of the form /A=001234 in feet
|
||||
QRegExp re("\\/A=([0-9]{6})");
|
||||
int pos = re.indexIn(m_comment);
|
||||
if (pos >= 0)
|
||||
QRegularExpression re("\\/A=([0-9]{6})");
|
||||
QRegularExpressionMatch match = re.match(m_comment);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_altitudeFt = re.capturedTexts()[1].toInt();
|
||||
m_altitudeFt = match.capturedTexts()[1].toInt();
|
||||
m_hasAltitude = true;
|
||||
// Strip it out of comment if at start of string
|
||||
if (pos == 0)
|
||||
if (match.capturedStart(0) == 0)
|
||||
m_comment = m_comment.mid(9);
|
||||
}
|
||||
}
|
||||
@ -755,18 +759,20 @@ bool APRSPacket::parseStatus(QString& info, int& idx)
|
||||
{
|
||||
QString remaining = info.mid(idx);
|
||||
|
||||
QRegExp timestampRE("^([0-9]{6})z"); // DHM timestamp
|
||||
QRegExp maidenheadRE("^([A-Z]{2}[0-9]{2}[A-Z]{0,2})[/\\\\]."); // Maidenhead grid locator and symbol
|
||||
QRegularExpression timestampRE("^([0-9]{6})z"); // DHM timestamp
|
||||
QRegularExpression maidenheadRE("^([A-Z]{2}[0-9]{2}[A-Z]{0,2})[/\\\\]."); // Maidenhead grid locator and symbol
|
||||
QRegularExpressionMatch matchTimestamp = timestampRE.match(remaining);
|
||||
QRegularExpressionMatch matchMaidenhead = maidenheadRE.match(remaining);
|
||||
|
||||
if (timestampRE.indexIn(remaining) >= 0)
|
||||
if (matchTimestamp.hasMatch())
|
||||
{
|
||||
parseTime(info, idx);
|
||||
m_status = info.mid(idx);
|
||||
idx += m_status.length();
|
||||
}
|
||||
else if (maidenheadRE.indexIn(remaining) >= 0)
|
||||
else if (matchMaidenhead.hasMatch())
|
||||
{
|
||||
m_maidenhead = maidenheadRE.capturedTexts()[1];
|
||||
m_maidenhead = matchMaidenhead.capturedTexts()[1];
|
||||
idx += m_maidenhead.length();
|
||||
m_symbolTable = info[idx++].toLatin1();
|
||||
m_symbolCode = info[idx++].toLatin1();
|
||||
@ -959,10 +965,11 @@ bool APRSPacket::parseMessage(QString& info, int& idx)
|
||||
else
|
||||
{
|
||||
// Check for message number
|
||||
QRegExp noRE("\\{([0-9]{1,5})$");
|
||||
if (noRE.indexIn(m_message) >= 0)
|
||||
QRegularExpression noRE("\\{([0-9]{1,5})$");
|
||||
QRegularExpressionMatch match = noRE.match(m_message);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_messageNo = noRE.capturedTexts()[1];
|
||||
m_messageNo = match.capturedTexts()[1];
|
||||
m_message = m_message.left(m_message.length() - m_messageNo.length() - 1);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
|
||||
@ -701,40 +700,6 @@ double Astronomy::refractionPAL(double alt, double pressure, double temperature,
|
||||
return z-Units::radiansToDegrees(zr);
|
||||
}
|
||||
|
||||
double Astronomy::raToDecimal(const QString& value)
|
||||
{
|
||||
QRegExp decimal("^([0-9]+(\\.[0-9]+)?)");
|
||||
QRegExp hms("^([0-9]+)[ h]([0-9]+)[ m]([0-9]+(\\.[0-9]+)?)s?");
|
||||
|
||||
if (decimal.exactMatch(value))
|
||||
return decimal.capturedTexts()[0].toDouble();
|
||||
else if (hms.exactMatch(value))
|
||||
{
|
||||
return Units::hoursMinutesSecondsToDecimal(
|
||||
hms.capturedTexts()[1].toDouble(),
|
||||
hms.capturedTexts()[2].toDouble(),
|
||||
hms.capturedTexts()[3].toDouble());
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double Astronomy::decToDecimal(const QString& value)
|
||||
{
|
||||
QRegExp decimal("^(-?[0-9]+(\\.[0-9]+)?)");
|
||||
QRegExp dms(QString("^(-?[0-9]+)[ %1d]([0-9]+)[ 'm]([0-9]+(\\.[0-9]+)?)[\"s]?").arg(QChar(0xb0)));
|
||||
|
||||
if (decimal.exactMatch(value))
|
||||
return decimal.capturedTexts()[0].toDouble();
|
||||
else if (dms.exactMatch(value))
|
||||
{
|
||||
return Units::degreesMinutesSecondsToDecimal(
|
||||
dms.capturedTexts()[1].toDouble(),
|
||||
dms.capturedTexts()[2].toDouble(),
|
||||
dms.capturedTexts()[3].toDouble());
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double Astronomy::lstAndRAToLongitude(double lst, double raHours)
|
||||
{
|
||||
double longitude = lst - (raHours * 15.0); // Convert hours to degrees
|
||||
|
@ -64,9 +64,6 @@ public:
|
||||
static double refractionSaemundsson(double alt, double pressure, double temperature);
|
||||
static double refractionPAL(double alt, double pressure, double temperature, double humidity, double frequency, double latitude, double heightAboveSeaLevel, double temperatureLapseRate);
|
||||
|
||||
static double raToDecimal(const QString& value);
|
||||
static double decToDecimal(const QString& value);
|
||||
|
||||
static double lstAndRAToLongitude(double lst, double raHours);
|
||||
|
||||
static void equatorialToGalactic(double ra, double dec, double& l, double& b);
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
#include <QResource>
|
||||
|
||||
@ -49,59 +49,73 @@ FITS::FITS(QString resourceName) :
|
||||
int hLen = std::min((qint64)m_headerSize * 3, m_fileSize); // Could possibly be bigger
|
||||
QByteArray headerBytes = m_data.left(hLen);
|
||||
QString header = QString::fromLatin1(headerBytes);
|
||||
QRegExp widthRE("NAXIS1 *= *([0-9]+)");
|
||||
QRegExp heightRE("NAXIS2 *= *([0-9]+)");
|
||||
QRegExp bitsPerPixelRE("BITPIX *= *(-?[0-9]+)");
|
||||
QRegExp bzeroRE("BZERO *= *([0-9]+)");
|
||||
QRegExp bscaleRE("BSCALE *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegExp buintRE("BUNIT *= *\\'([A-Z ]+)\\'");
|
||||
QRegExp cdelt1RE("CDELT1 *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegExp cdelt2RE("CDELT2 *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegExp endRE("END {77}");
|
||||
QRegularExpression widthRE("NAXIS1 *= *([0-9]+)");
|
||||
QRegularExpression heightRE("NAXIS2 *= *([0-9]+)");
|
||||
QRegularExpression bitsPerPixelRE("BITPIX *= *(-?[0-9]+)");
|
||||
QRegularExpression bzeroRE("BZERO *= *([0-9]+)");
|
||||
QRegularExpression bscaleRE("BSCALE *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegularExpression buintRE("BUNIT *= *\\'([A-Z ]+)\\'");
|
||||
QRegularExpression cdelt1RE("CDELT1 *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegularExpression cdelt2RE("CDELT2 *= *(-?[0-9]+(.[0-9]+)?)");
|
||||
QRegularExpression endRE("END {77}");
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
if (widthRE.indexIn(header) != -1)
|
||||
m_width = widthRE.capturedTexts()[1].toInt();
|
||||
match = widthRE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_width = match.capturedTexts()[1].toInt();
|
||||
else
|
||||
{
|
||||
qWarning() << "FITS: NAXIS1 missing";
|
||||
return;
|
||||
}
|
||||
if (heightRE.indexIn(header) != -1)
|
||||
m_height = heightRE.capturedTexts()[1].toInt();
|
||||
|
||||
match = heightRE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_height = match.capturedTexts()[1].toInt();
|
||||
else
|
||||
{
|
||||
qWarning() << "FITS: NAXIS2 missing";
|
||||
return;
|
||||
}
|
||||
if (bitsPerPixelRE.indexIn(header) != -1)
|
||||
m_bitsPerPixel = bitsPerPixelRE.capturedTexts()[1].toInt();
|
||||
|
||||
match = bitsPerPixelRE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_bitsPerPixel = match.capturedTexts()[1].toInt();
|
||||
else
|
||||
{
|
||||
qWarning() << "FITS: BITPIX missing";
|
||||
return;
|
||||
}
|
||||
|
||||
m_bytesPerPixel = abs(m_bitsPerPixel)/8;
|
||||
if (bzeroRE.indexIn(header) != -1)
|
||||
m_bzero = bzeroRE.capturedTexts()[1].toInt();
|
||||
match = bzeroRE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_bzero = match.capturedTexts()[1].toInt();
|
||||
else
|
||||
m_bzero = 0;
|
||||
if (bscaleRE.indexIn(header) != -1)
|
||||
m_bscale = bscaleRE.capturedTexts()[1].toDouble();
|
||||
|
||||
match = bscaleRE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_bscale = match.capturedTexts()[1].toDouble();
|
||||
else
|
||||
m_bscale = 1.0;
|
||||
|
||||
if (cdelt1RE.indexIn(header) != -1)
|
||||
m_cdelta1 = cdelt1RE.capturedTexts()[1].toDouble();
|
||||
match = cdelt1RE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_cdelta1 = match.capturedTexts()[1].toDouble();
|
||||
else
|
||||
m_cdelta1 = 0.0;
|
||||
if (cdelt2RE.indexIn(header) != -1)
|
||||
m_cdelta2 = cdelt2RE.capturedTexts()[1].toDouble();
|
||||
|
||||
match = cdelt2RE.match(header);
|
||||
if (match.hasMatch())
|
||||
m_cdelta2 = match.capturedTexts()[1].toDouble();
|
||||
else
|
||||
m_cdelta2 = 0.0;
|
||||
|
||||
if (buintRE.indexIn(header) != -1)
|
||||
match = buintRE.match(header);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
m_buint = buintRE.capturedTexts()[1].trimmed();
|
||||
m_buint = match.capturedTexts()[1].trimmed();
|
||||
if (m_buint.contains("MILLI"))
|
||||
m_uintScale = 0.001f;
|
||||
else
|
||||
@ -109,8 +123,10 @@ FITS::FITS(QString resourceName) :
|
||||
}
|
||||
else
|
||||
m_uintScale = 1.0f;
|
||||
int endIdx = endRE.indexIn(header);
|
||||
if (endIdx == -1)
|
||||
|
||||
match = endRE.match(header);
|
||||
int endIdx = match.capturedStart(0);
|
||||
if (!match.hasMatch())
|
||||
{
|
||||
qWarning() << "FITS: END missing";
|
||||
return;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "maidenhead.h"
|
||||
|
||||
@ -83,6 +83,6 @@ bool Maidenhead::isMaidenhead(const QString& maidenhead)
|
||||
int length = maidenhead.length();
|
||||
if ((length != 4) && (length != 6) && (length != 8))
|
||||
return false;
|
||||
QRegExp re("[A-Ra-r][A-Ra-r][0-9][0-9]([A-Xa-x][A-Xa-x]([0-9][0-9])?)?");
|
||||
return re.exactMatch(maidenhead);
|
||||
QRegularExpression re(QRegularExpression::anchoredPattern("[A-Ra-r][A-Ra-r][0-9][0-9]([A-Xa-x][A-Xa-x]([0-9][0-9])?)?"));
|
||||
return re.match(maidenhead).hasMatch();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <cmath>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
|
||||
#include "export.h"
|
||||
@ -158,35 +158,35 @@ public:
|
||||
// Also supports decimal degrees
|
||||
static bool degreeMinuteAndSecondsToDecimalDegrees(const QString& string, float& degrees)
|
||||
{
|
||||
QRegExp decimal("(-?[0-9]+(\\.[0-9]+)?)");
|
||||
if (decimal.exactMatch(string))
|
||||
QRegularExpression decimal(QRegularExpression::anchoredPattern("(-?[0-9]+(\\.[0-9]+)?)"));
|
||||
QRegularExpressionMatch match;
|
||||
match = decimal.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
degrees = decimal.capturedTexts()[1].toFloat();
|
||||
degrees = match.capturedTexts()[1].toFloat();
|
||||
return true;
|
||||
}
|
||||
QRegExp dms(QString("(-)?([0-9]+)[%1d](([0-9]+)['m](([0-9]+(\\.[0-9]+)?)[\"s])?)?").arg(QChar(0xb0)));
|
||||
if (dms.exactMatch(string))
|
||||
|
||||
QRegularExpression dms(QRegularExpression::anchoredPattern(QString("(-)?([0-9]+)[%1d](([0-9]+)['m](([0-9]+(\\.[0-9]+)?)[\"s])?)?").arg(QChar(0xb0))));
|
||||
match = dms.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
float d = 0.0f;
|
||||
bool neg = false;
|
||||
for (int i = 0; i < dms.captureCount(); i++) {
|
||||
qDebug() << dms.capturedTexts()[i];
|
||||
}
|
||||
if (dms.captureCount() >= 1) {
|
||||
neg = dms.capturedTexts()[1] == "-";
|
||||
neg = match.capturedTexts()[1] == "-";
|
||||
}
|
||||
if (dms.captureCount() >= 3) {
|
||||
d = dms.capturedTexts()[2].toFloat();
|
||||
d = match.capturedTexts()[2].toFloat();
|
||||
}
|
||||
float m = 0.0f;
|
||||
if (dms.captureCount() >= 5) {
|
||||
m = dms.capturedTexts()[4].toFloat();
|
||||
m = match.capturedTexts()[4].toFloat();
|
||||
}
|
||||
float s = 0.0f;
|
||||
if (dms.captureCount() >= 7) {
|
||||
s = dms.capturedTexts()[6].toFloat();
|
||||
s = match.capturedTexts()[6].toFloat();
|
||||
}
|
||||
qDebug() << neg << d << m << s;
|
||||
degrees = d + m/60.0 + s/(60.0*60.0);
|
||||
if (neg) {
|
||||
degrees = -degrees;
|
||||
@ -271,24 +271,29 @@ public:
|
||||
// We support both decimal and DMS formats
|
||||
static bool stringToLatitudeAndLongitude(const QString& string, float& latitude, float& longitude)
|
||||
{
|
||||
QRegExp decimal("(-?[0-9]+(\\.[0-9]+)?) *,? *(-?[0-9]+(\\.[0-9]+)?)");
|
||||
if (decimal.exactMatch(string))
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
QRegularExpression decimal(QRegularExpression::anchoredPattern("(-?[0-9]+(\\.[0-9]+)?) *,? *(-?[0-9]+(\\.[0-9]+)?)"));
|
||||
match = decimal.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
latitude = decimal.capturedTexts()[1].toFloat();
|
||||
longitude = decimal.capturedTexts()[3].toFloat();
|
||||
latitude = match.capturedTexts()[1].toFloat();
|
||||
longitude = match.capturedTexts()[3].toFloat();
|
||||
return true;
|
||||
}
|
||||
QRegExp dms(QString("([0-9]+)[%1d]([0-9]+)['m]([0-9]+(\\.[0-9]+)?)[\"s]([NS]) *,? *([0-9]+)[%1d]([0-9]+)['m]([0-9]+(\\.[0-9]+)?)[\"s]([EW])").arg(QChar(0xb0)));
|
||||
if (dms.exactMatch(string))
|
||||
|
||||
QRegularExpression dms(QRegularExpression::anchoredPattern(QString("([0-9]+)[%1d]([0-9]+)['m]([0-9]+(\\.[0-9]+)?)[\"s]([NS]) *,? *([0-9]+)[%1d]([0-9]+)['m]([0-9]+(\\.[0-9]+)?)[\"s]([EW])").arg(QChar(0xb0))));
|
||||
match = dms.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
float latD = dms.capturedTexts()[1].toFloat();
|
||||
float latM = dms.capturedTexts()[2].toFloat();
|
||||
float latS = dms.capturedTexts()[3].toFloat();
|
||||
bool north = dms.capturedTexts()[5] == "N";
|
||||
float lonD = dms.capturedTexts()[6].toFloat();
|
||||
float lonM = dms.capturedTexts()[7].toFloat();
|
||||
float lonS = dms.capturedTexts()[8].toFloat();
|
||||
bool east = dms.capturedTexts()[10] == "E";
|
||||
float latD = match.capturedTexts()[1].toFloat();
|
||||
float latM = match.capturedTexts()[2].toFloat();
|
||||
float latS = match.capturedTexts()[3].toFloat();
|
||||
bool north = match.capturedTexts()[5] == "N";
|
||||
float lonD = match.capturedTexts()[6].toFloat();
|
||||
float lonM = match.capturedTexts()[7].toFloat();
|
||||
float lonS = match.capturedTexts()[8].toFloat();
|
||||
bool east = match.capturedTexts()[10] == "E";
|
||||
latitude = latD + latM/60.0 + latS/(60.0*60.0);
|
||||
if (!north)
|
||||
latitude = -latitude;
|
||||
@ -297,17 +302,19 @@ public:
|
||||
longitude = -longitude;
|
||||
return true;
|
||||
}
|
||||
QRegExp dms2(QString("([0-9]+)([NS])([0-9]{2})([0-9]{2}) *,?([0-9]+)([EW])([0-9]{2})([0-9]{2})"));
|
||||
if (dms2.exactMatch(string))
|
||||
|
||||
QRegularExpression dms2(QRegularExpression::anchoredPattern(QString("([0-9]+)([NS])([0-9]{2})([0-9]{2}) *,?([0-9]+)([EW])([0-9]{2})([0-9]{2})")));
|
||||
match = dms2.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
float latD = dms2.capturedTexts()[1].toFloat();
|
||||
bool north = dms2.capturedTexts()[2] == "N";
|
||||
float latM = dms2.capturedTexts()[3].toFloat();
|
||||
float latS = dms2.capturedTexts()[4].toFloat();
|
||||
float lonD = dms2.capturedTexts()[5].toFloat();
|
||||
bool east = dms2.capturedTexts()[6] == "E";
|
||||
float lonM = dms2.capturedTexts()[7].toFloat();
|
||||
float lonS = dms2.capturedTexts()[8].toFloat();
|
||||
float latD = match.capturedTexts()[1].toFloat();
|
||||
bool north = match.capturedTexts()[2] == "N";
|
||||
float latM = match.capturedTexts()[3].toFloat();
|
||||
float latS = match.capturedTexts()[4].toFloat();
|
||||
float lonD = match.capturedTexts()[5].toFloat();
|
||||
bool east = match.capturedTexts()[6] == "E";
|
||||
float lonM = match.capturedTexts()[7].toFloat();
|
||||
float lonS = match.capturedTexts()[8].toFloat();
|
||||
latitude = latD + latM/60.0 + latS/(60.0*60.0);
|
||||
if (!north)
|
||||
latitude = -latitude;
|
||||
@ -316,18 +323,20 @@ public:
|
||||
longitude = -longitude;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 512255.5900N 0024400.6105W as used on aviation charts
|
||||
QRegExp dms3(QString("(\\d{2})(\\d{2})((\\d{2})(\\.\\d+)?)([NS]) *,?(\\d{3})(\\d{2})((\\d{2})(\\.\\d+)?)([EW])"));
|
||||
if (dms3.exactMatch(string))
|
||||
QRegularExpression dms3(QRegularExpression::anchoredPattern(QString("(\\d{2})(\\d{2})((\\d{2})(\\.\\d+)?)([NS]) *,?(\\d{3})(\\d{2})((\\d{2})(\\.\\d+)?)([EW])")));
|
||||
match = dms3.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
float latD = dms3.capturedTexts()[1].toFloat();
|
||||
float latM = dms3.capturedTexts()[2].toFloat();
|
||||
float latS = dms3.capturedTexts()[3].toFloat();
|
||||
bool north = dms3.capturedTexts()[6] == "N";
|
||||
float lonD = dms3.capturedTexts()[7].toFloat();
|
||||
float lonM = dms3.capturedTexts()[8].toFloat();
|
||||
float lonS = dms3.capturedTexts()[9].toFloat();
|
||||
bool east = dms3.capturedTexts()[12] == "E";
|
||||
float latD = match.capturedTexts()[1].toFloat();
|
||||
float latM = match.capturedTexts()[2].toFloat();
|
||||
float latS = match.capturedTexts()[3].toFloat();
|
||||
bool north = match.capturedTexts()[6] == "N";
|
||||
float lonD = match.capturedTexts()[7].toFloat();
|
||||
float lonM = match.capturedTexts()[8].toFloat();
|
||||
float lonS = match.capturedTexts()[9].toFloat();
|
||||
bool east = match.capturedTexts()[12] == "E";
|
||||
latitude = latD + latM/60.0 + latS/(60.0*60.0);
|
||||
if (!north)
|
||||
latitude = -latitude;
|
||||
@ -348,17 +357,19 @@ public:
|
||||
// 107.1324 -34.233
|
||||
static bool stringToRADec(const QString& string, float& ra, float& dec)
|
||||
{
|
||||
QRegExp dms("([0-9]+)[ :h]([0-9]+)[ :m]([0-9]+(\\.[0-9]+)?)s? *,? *([+-]?[0-9]+)[ :d]([0-9]+)[ :m]([0-9]+(\\.[0-9]+)?)s?");
|
||||
if (dms.exactMatch(string))
|
||||
QRegularExpressionMatch match;
|
||||
QRegularExpression dms(QRegularExpression::anchoredPattern("([0-9]+)[ :h]([0-9]+)[ :m]([0-9]+(\\.[0-9]+)?)s? *,? *([+-]?[0-9]+)[ :d]([0-9]+)[ :m]([0-9]+(\\.[0-9]+)?)s?"));
|
||||
match = dms.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
int raHours = dms.capturedTexts()[1].toInt();
|
||||
int raMins = dms.capturedTexts()[2].toInt();
|
||||
float raSecs = dms.capturedTexts()[3].toFloat();
|
||||
int raHours = match.capturedTexts()[1].toInt();
|
||||
int raMins = match.capturedTexts()[2].toInt();
|
||||
float raSecs = match.capturedTexts()[3].toFloat();
|
||||
ra = raHours + raMins / 60.0f + raSecs / (60.0f * 60.0f);
|
||||
qDebug() << ra << raHours << raMins << raSecs;
|
||||
int decDegs = dms.capturedTexts()[5].toInt();
|
||||
int decMins = dms.capturedTexts()[6].toInt();
|
||||
float decSecs = dms.capturedTexts()[7].toFloat();
|
||||
int decDegs = match.capturedTexts()[5].toInt();
|
||||
int decMins = match.capturedTexts()[6].toInt();
|
||||
float decSecs = match.capturedTexts()[7].toFloat();
|
||||
bool neg = decDegs < 0;
|
||||
dec = abs(decDegs) + decMins / 60.0f + decSecs / (60.0f * 60.0f);
|
||||
if (neg) {
|
||||
@ -366,16 +377,56 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
QRegExp decimal("([0-9]+(\\.[0-9]+)?) *,? *([+-]?[0-9]+(\\.[0-9]+)?)");
|
||||
if (decimal.exactMatch(string))
|
||||
|
||||
QRegularExpression decimal(QRegularExpression::anchoredPattern("([0-9]+(\\.[0-9]+)?) *,? *([+-]?[0-9]+(\\.[0-9]+)?)"));
|
||||
match = decimal.match(string);
|
||||
if (match.hasMatch())
|
||||
{
|
||||
ra = decimal.capturedTexts()[1].toFloat();
|
||||
dec = decimal.capturedTexts()[3].toFloat();
|
||||
ra = match.capturedTexts()[1].toFloat();
|
||||
dec = match.capturedTexts()[3].toFloat();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static double raToDecimal(const QString& value)
|
||||
{
|
||||
QRegularExpression decimal(QRegularExpression::anchoredPattern("^([0-9]+(\\.[0-9]+)?)"));
|
||||
QRegularExpression hms(QRegularExpression::anchoredPattern("^([0-9]+)[ h]([0-9]+)[ m]([0-9]+(\\.[0-9]+)?)s?"));
|
||||
QRegularExpressionMatch decimalMatch = decimal.match(value);
|
||||
QRegularExpressionMatch hmsMatch = hms.match(value);
|
||||
|
||||
if (decimalMatch.hasMatch())
|
||||
return decimalMatch.capturedTexts()[0].toDouble();
|
||||
else if (hmsMatch.hasMatch())
|
||||
{
|
||||
return Units::hoursMinutesSecondsToDecimal(
|
||||
hmsMatch.capturedTexts()[1].toDouble(),
|
||||
hmsMatch.capturedTexts()[2].toDouble(),
|
||||
hmsMatch.capturedTexts()[3].toDouble());
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static double decToDecimal(const QString& value)
|
||||
{
|
||||
QRegularExpression decimal(QRegularExpression::anchoredPattern("^(-?[0-9]+(\\.[0-9]+)?)"));
|
||||
QRegularExpression dms(QRegularExpression::anchoredPattern(QString("^(-?[0-9]+)[ %1d]([0-9]+)[ 'm]([0-9]+(\\.[0-9]+)?)[\"s]?").arg(QChar(0xb0))));
|
||||
QRegularExpressionMatch decimalMatch = decimal.match(value);
|
||||
QRegularExpressionMatch dmsMatch = dms.match(value);
|
||||
|
||||
if (decimalMatch.hasMatch())
|
||||
return decimalMatch.capturedTexts()[0].toDouble();
|
||||
else if (dmsMatch.hasMatch())
|
||||
{
|
||||
return Units::degreesMinutesSecondsToDecimal(
|
||||
dmsMatch.capturedTexts()[1].toDouble(),
|
||||
dmsMatch.capturedTexts()[2].toDouble(),
|
||||
dmsMatch.capturedTexts()[3].toDouble());
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static float solarFluxUnitsToJansky(float sfu)
|
||||
{
|
||||
return sfu * 10000.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user