File indexing completed on 2024-04-28 04:42:41

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com>
0003  * SPDX-FileCopyrightText: 2021 Anjani Kumar <anjanik012@gmail.com>
0004  * SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #include "caparea.h"
0009 
0010 using namespace KWeatherCore;
0011 
0012 namespace KWeatherCore
0013 {
0014 class CAPAreaPrivate : public QSharedData
0015 {
0016 public:
0017     QString description;
0018     std::vector<CAPPolygon> polygons;
0019     std::vector<CAPCircle> circles;
0020     std::vector<CAPNamedValue> geoCodes;
0021     float altitude = NAN;
0022     float ceiling = NAN;
0023 };
0024 }
0025 
0026 CAPArea::CAPArea()
0027     : d(new CAPAreaPrivate)
0028 {
0029 }
0030 
0031 CAPArea::CAPArea(const CAPArea &other) = default;
0032 CAPArea::CAPArea(CAPArea &&other) = default;
0033 CAPArea::~CAPArea() = default;
0034 CAPArea &CAPArea::operator=(const CAPArea &other) = default;
0035 CAPArea &CAPArea::operator=(CAPArea &&other) = default;
0036 
0037 QString CAPArea::description() const
0038 {
0039     return d->description;
0040 }
0041 
0042 void CAPArea::setDescription(const QString &areaDesc)
0043 {
0044     d->description = areaDesc;
0045 }
0046 
0047 const std::vector<CAPPolygon> &CAPArea::polygons() const
0048 {
0049     return d->polygons;
0050 }
0051 
0052 void CAPArea::addPolygon(CAPPolygon &&polygon)
0053 {
0054     d->polygons.push_back(std::move(polygon));
0055 }
0056 
0057 const std::vector<CAPCircle> &CAPArea::circles() const
0058 {
0059     return d->circles;
0060 }
0061 
0062 void CAPArea::addCircle(CAPCircle &&circle)
0063 {
0064     d->circles.push_back(std::move(circle));
0065 }
0066 
0067 const std::vector<CAPNamedValue> &CAPArea::geoCodes() const
0068 {
0069     return d->geoCodes;
0070 }
0071 
0072 void CAPArea::addGeoCode(CAPNamedValue &&geoCode)
0073 {
0074     d->geoCodes.push_back(std::move(geoCode));
0075 }
0076 
0077 float CAPArea::altitude() const
0078 {
0079     return d->altitude;
0080 }
0081 
0082 void CAPArea::setAltitude(float altitude)
0083 {
0084     d->altitude = altitude;
0085 }
0086 
0087 float CAPArea::ceiling() const
0088 {
0089     return d->ceiling;
0090 }
0091 
0092 void CAPArea::setCeiling(float ceiling)
0093 {
0094     d->ceiling = ceiling;
0095 }
0096 
0097 #include "moc_caparea.cpp"