Kstars

scope.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Prakash Mohan <prakash.mohan@kdemail.net>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "oal/scope.h"
8#include <QJsonObject>
9
10void OAL::Scope::setScope(const QString &_id, const QString &_model, const QString &_vendor, const QString &_type,
11 double _focalLength, double _aperture)
12{
13 m_Id = _id;
14 m_Model = _model;
15 m_Vendor = _vendor;
16 m_Type = _type;
17 m_FocalLength = _focalLength;
18 m_Aperture = _aperture;
19
20 m_Name = QString("%1 %2 %3@F/%4").arg(m_Vendor, m_Model, QString::number(m_FocalLength, 'f', 0),
21 QString::number(m_FocalLength / m_Aperture, 'f', 1));
22}
23
24QJsonObject OAL::Scope::toJson() const
25{
26 return
27 {
28 {"id", m_Id},
29 {"model", m_Model},
30 {"vendor", m_Vendor},
31 {"type", m_Type},
32 {"name", m_Name},
33 {"focal_length", m_FocalLength},
34 {"aperture", m_Aperture},
35 };
36}
QString arg(Args &&... args) const const
QString number(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.