Marble

GeoDataTimeSpan.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com>
4//
5
6// Own
7#include "GeoDataTimeSpan.h"
8
9// Private
10#include "GeoDataTimeSpan_p.h"
11
12// Qt
13#include <QDataStream>
14#include <QDateTime>
15
16// GeoData
17#include "GeoDataTypes.h"
18#include "MarbleDebug.h"
19
20namespace Marble
21{
22
23GeoDataTimeSpan::GeoDataTimeSpan()
24 : GeoDataTimePrimitive(), d( new GeoDataTimeSpanPrivate )
25{
26}
27
28GeoDataTimeSpan::GeoDataTimeSpan( const GeoDataTimeSpan& other )
29 : GeoDataTimePrimitive( other ), d( new GeoDataTimeSpanPrivate( *other.d ) )
30{
31}
32
33GeoDataTimeSpan::~GeoDataTimeSpan()
34{
35 delete d;
36}
37
38const char* GeoDataTimeSpan::nodeType() const
39{
40 return GeoDataTypes::GeoDataTimePrimitiveType;
41}
42
43const GeoDataTimeStamp & GeoDataTimeSpan::end() const
44{
45 return d->m_end;
46}
47
48GeoDataTimeStamp &GeoDataTimeSpan::end()
49{
50 return d->m_end;
51}
52
53void GeoDataTimeSpan::setEnd( const GeoDataTimeStamp& end )
54{
55 d->m_end = end;
56}
57
58bool GeoDataTimeSpan::isValid() const
59{
60 if (d->m_begin.when().isValid() != d->m_end.when().isValid()) {
61 return true;
62 }
63
64 return d->m_begin.when().isValid() && d->m_end.when().isValid() && d->m_begin.when() <= d->m_end.when();
65}
66
67const GeoDataTimeStamp & GeoDataTimeSpan::begin() const
68{
69 return d->m_begin;
70}
71
72GeoDataTimeStamp &GeoDataTimeSpan::begin()
73{
74 return d->m_begin;
75}
76
77void GeoDataTimeSpan::setBegin( const GeoDataTimeStamp& begin )
78{
79 d->m_begin = begin;
80}
81
82GeoDataTimeSpan& GeoDataTimeSpan::operator=( const GeoDataTimeSpan& other )
83{
84 GeoDataTimePrimitive::operator=( other );
85 *d = *other.d;
86 return *this;
87}
88
89bool GeoDataTimeSpan::operator==( const GeoDataTimeSpan& other ) const
90{
91 return equals(other) &&
92 d->m_begin == other.d->m_begin &&
93 d->m_end == other.d->m_end;
94}
95
96bool GeoDataTimeSpan::operator!=( const GeoDataTimeSpan& other ) const
97{
98 return !this->operator==( other );
99}
100
101void GeoDataTimeSpan::pack( QDataStream& stream ) const
102{
103 GeoDataTimePrimitive::pack( stream );
104 d->m_begin.pack( stream );
105 d->m_end.pack( stream );
106}
107
108void GeoDataTimeSpan::unpack( QDataStream& stream )
109{
110 GeoDataTimePrimitive::unpack( stream );
111 d->m_begin.unpack( stream );
112 d->m_end.unpack( stream );
113}
114
115}
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
const QList< QKeySequence > & begin()
bool equals(const QVariant &lhs, const QVariant &rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:57 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.