QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
qgscelestialbody.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscelestialbody.h
3 ------------------------
4 begin : May 2021
5 copyright : (C) 2021 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSCELESTIALBODY_H
18#define QGSCELESTIALBODY_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22
23#include <QString>
24
25using namespace Qt::StringLiterals;
26
34class CORE_EXPORT QgsCelestialBody
35{
36 public:
37
42 bool isValid() const { return mValid; }
43
47 QString name() const { return mName; }
48
52 QString authority() const { return mAuthority; }
53
54#ifdef SIP_RUN
55 SIP_PYOBJECT __repr__();
56 % MethodCode
57 QString str;
58 if ( !sipCpp->isValid() )
59 {
60 str = u"<QgsCelestialBody: invalid>"_s;
61 }
62 else
63 {
64 QString id;
65 if ( !sipCpp->authority().isEmpty() )
66 id = u"%1 (%2)"_s.arg( sipCpp->name(), sipCpp->authority() );
67 else
68 id = sipCpp->name();
69 str = u"<QgsCelestialBody: %1>"_s.arg( id );
70 }
71 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
72 % End
73#endif
74
75 private:
76
77 bool mValid = false;
78 QString mName;
79 QString mAuthority;
80
82};
83
84#endif // QGSCELESTIALBODY_H
Contains information about a celestial body.
bool isValid() const
Returns true if the body is a valid object, or false if it is a null/invalid object.
QString authority() const
Authority name, e.g.
friend class QgsCoordinateReferenceSystemRegistry
QString name() const
Name of celestial body.