1 /*
2  SPDX-FileCopyrightText: 2016 Akarsh Simha <[email protected]>
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
7 #include "ksdssimage.h"
9 #include <QImageReader>
12 {
13  m_FileName = fileName;
14  QImageReader reader(
15  m_FileName); // FIXME: Need a good way to tell whether we are dealing with a metadata-ful image or not
16  m_Metadata.format =
17  (reader.format().toLower().contains("png") ? KSDssImage::Metadata::PNG : KSDssImage::Metadata::GIF);
18  if (reader.text("Author").contains("KStars")) // Must have metadata
19  {
20  m_Metadata.valid = true;
21  m_Metadata.src = (KSDssImage::Metadata::Source)reader.text("Source").toInt();
22  m_Metadata.version = reader.text("Version");
23  m_Metadata.object = reader.text("Object");
24  m_Metadata.ra0.setFromString(reader.text("RA"), false);
25  m_Metadata.dec0.setFromString(reader.text("Dec"), true);
26  m_Metadata.width = reader.text("Width").toFloat();
27  m_Metadata.height = reader.text("Height").toFloat();
28  QString band = reader.text("Band");
29  if (!band.isEmpty())
30  m_Metadata.band = band.at(0).toLatin1();
31  m_Metadata.gen = reader.text("Generation").toInt();
32  }
33  m_Image = reader.read();
34 }
QString version
Used for DSS – Indicates which version of scans to pull.
Definition: ksdssimage.h:65
QByteArray toLower() const const
KSDssImage(const QString &fileName)
Definition: ksdssimage.cpp:11
QByteArray format() const const
QString object
Name / identifier of the object. Added to metadata.
Definition: ksdssimage.h:67
QString text(const QString &key) const const
Source src
DSS / SDSS – source of the image.
Definition: ksdssimage.h:71
dms ra0
Center RA (J2000.0)
Definition: ksdssimage.h:73
FileFormat format
File format used.
Definition: ksdssimage.h:69
Contains possible sources for digitized sky-survey images.
Definition: ksdssimage.h:41
QImage read()
int toInt(bool *ok, int base) const const
float toFloat(bool *ok) const const
float width
Width in arcminutes.
Definition: ksdssimage.h:79
int gen
Generation for DSS images, data release for SDSS; use -1 for unknown.
Definition: ksdssimage.h:83
virtual bool setFromString(const QString &s, bool isDeg=true)
Attempt to parse the string argument as a dms value, and set the dms object accordingly.
Definition: dms.cpp:48
float height
Height in arcminutes.
Definition: ksdssimage.h:77
bool contains(char ch) const const
dms dec0
Center Dec (J2000.0)
Definition: ksdssimage.h:75
bool valid
Are these data valid?
Definition: ksdssimage.h:85
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
char band
Photometric band (UBVRI...) Use "?" for unknown.
Definition: ksdssimage.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Aug 14 2022 04:13:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.