Kstars

ksdssimage.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Akarsh Simha <akarsh.simha@kdemail.net>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "ksdssimage.h"
8
9#include <QImageReader>
10
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}
KSDssImage(const QString &fileName)
Constructor.
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
char toLatin1() const const
QByteArray format() const const
QImage read()
QString text(const QString &key) const const
const QChar at(qsizetype position) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
float toFloat(bool *ok) const const
int toInt(bool *ok, int base) const const
Source src
DSS / SDSS – source of the image.
Definition ksdssimage.h:71
FileFormat format
File format used.
Definition ksdssimage.h:69
bool valid
Are these data valid?
Definition ksdssimage.h:85
QString version
Used for DSS – Indicates which version of scans to pull.
Definition ksdssimage.h:65
int gen
Generation for DSS images, data release for SDSS; use -1 for unknown.
Definition ksdssimage.h:83
float height
Height in arcminutes.
Definition ksdssimage.h:77
Source
Contains possible sources for digitized sky-survey images.
Definition ksdssimage.h:42
QString object
Name / identifier of the object. Added to metadata.
Definition ksdssimage.h:67
float width
Width in arcminutes.
Definition ksdssimage.h:79
char band
Photometric band (UBVRI...) Use "?" for unknown.
Definition ksdssimage.h:81
dms dec0
Center Dec (J2000.0)
Definition ksdssimage.h:75
dms ra0
Center RA (J2000.0)
Definition ksdssimage.h:73
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.