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.
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
Contains possible sources for digitized sky-survey images.
Definition ksdssimage.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:53:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.