• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataTimeSpan.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2010 Harshit Jain <hjain.itbhu@gmail.com>
9 //
10 
11 // Own
12 #include "GeoDataTimeSpan.h"
13 
14 // Private
15 #include "GeoDataTimeSpan_p.h"
16 
17 // Qt
18 #include <QDataStream>
19 
20 // GeoData
21 #include "GeoDataTypes.h"
22 #include "MarbleDebug.h"
23 
24 namespace Marble
25 {
26 
27 GeoDataTimeSpan::GeoDataTimeSpan()
28  : GeoDataTimePrimitive(), d( new GeoDataTimeSpanPrivate )
29 {
30 }
31 
32 GeoDataTimeSpan::GeoDataTimeSpan( const GeoDataTimeSpan& other )
33  : GeoDataTimePrimitive( other ), d( new GeoDataTimeSpanPrivate( *other.d ) )
34 {
35 }
36 
37 GeoDataTimeSpan::~GeoDataTimeSpan()
38 {
39  delete d;
40 }
41 
42 const char* GeoDataTimeSpan::nodeType() const
43 {
44  return d->nodeType();
45 }
46 
47 const GeoDataTimeStamp & GeoDataTimeSpan::end() const
48 {
49  return d->m_end;
50 }
51 
52 GeoDataTimeStamp &GeoDataTimeSpan::end()
53 {
54  return d->m_end;
55 }
56 
57 void GeoDataTimeSpan::setEnd( const GeoDataTimeStamp& end )
58 {
59  d->m_end = end;
60 }
61 
62 bool GeoDataTimeSpan::isValid() const
63 {
64  if (d->m_begin.when().isValid() != d->m_end.when().isValid()) {
65  return true;
66  }
67 
68  return d->m_begin.when().isValid() && d->m_end.when().isValid() && d->m_begin.when() <= d->m_end.when();
69 }
70 
71 const GeoDataTimeStamp & GeoDataTimeSpan::begin() const
72 {
73  return d->m_begin;
74 }
75 
76 GeoDataTimeStamp &GeoDataTimeSpan::begin()
77 {
78  return d->m_begin;
79 }
80 
81 void GeoDataTimeSpan::setBegin( const GeoDataTimeStamp& begin )
82 {
83  d->m_begin = begin;
84 }
85 
86 GeoDataTimeSpan& GeoDataTimeSpan::operator=( const GeoDataTimeSpan& other )
87 {
88  GeoDataTimePrimitive::operator=( other );
89  *d = *other.d;
90  return *this;
91 }
92 
93 bool GeoDataTimeSpan::operator==( const GeoDataTimeSpan& other ) const
94 {
95  return equals(other) &&
96  d->m_begin == other.d->m_begin &&
97  d->m_end == other.d->m_end;
98 }
99 
100 bool GeoDataTimeSpan::operator!=( const GeoDataTimeSpan& other ) const
101 {
102  return !this->operator==( other );
103 }
104 
105 void GeoDataTimeSpan::pack( QDataStream& stream ) const
106 {
107  GeoDataTimePrimitive::pack( stream );
108  d->m_begin.pack( stream );
109  d->m_end.pack( stream );
110 }
111 
112 void GeoDataTimeSpan::unpack( QDataStream& stream )
113 {
114  GeoDataTimePrimitive::unpack( stream );
115  d->m_begin.unpack( stream );
116  d->m_end.unpack( stream );
117 }
118 
119 }
Marble::GeoDataTimePrimitive::operator=
GeoDataTimePrimitive & operator=(const GeoDataTimePrimitive &other)
Definition: GeoDataTimePrimitive.cpp:41
Marble::GeoDataTimeSpan::unpack
virtual void unpack(QDataStream &stream)
Unserialize the timespan from a stream.
Definition: GeoDataTimeSpan.cpp:112
Marble::GeoDataTimePrimitive
a base class for the style classes
Definition: GeoDataTimePrimitive.h:34
Marble::GeoDataTimeStamp
Definition: GeoDataTimeStamp.h:27
Marble::GeoDataTimeSpan::operator==
bool operator==(const GeoDataTimeSpan &other) const
equality operators
Definition: GeoDataTimeSpan.cpp:93
Marble::GeoDataTimeStamp::pack
virtual void pack(QDataStream &stream) const
Serialize the timestamp to a stream.
Definition: GeoDataTimeStamp.cpp:86
Marble::GeoDataTimePrimitive::unpack
virtual void unpack(QDataStream &stream)
Unserialize the styleselector from a stream.
Definition: GeoDataTimePrimitive.cpp:58
QDataStream
Marble::GeoDataTimeSpanPrivate::m_begin
GeoDataTimeStamp m_begin
Definition: GeoDataTimeSpan_p.h:30
Marble::GeoDataObject::equals
virtual bool equals(const GeoDataObject &other) const
Compares the value of id and targetId of the two objects.
Definition: GeoDataObject.cpp:126
Marble::GeoDataTimeSpan::operator=
GeoDataTimeSpan & operator=(const GeoDataTimeSpan &other)
assignment operator
Definition: GeoDataTimeSpan.cpp:86
Marble::GeoDataTimeSpanPrivate
Definition: GeoDataTimeSpan_p.h:22
Marble::GeoDataTimeSpan::begin
const GeoDataTimeStamp & begin() const
return the beginning instant of a timespan
Definition: GeoDataTimeSpan.cpp:71
MarbleDebug.h
GeoDataTimeSpan.h
Marble::GeoDataTimeSpan::setEnd
void setEnd(const GeoDataTimeStamp &end)
Set the ending instant of a timespan.
Definition: GeoDataTimeSpan.cpp:57
Marble::GeoDataTimeSpan::~GeoDataTimeSpan
~GeoDataTimeSpan()
Definition: GeoDataTimeSpan.cpp:37
Marble::GeoDataTimeSpan::isValid
bool isValid() const
Definition: GeoDataTimeSpan.cpp:62
Marble::GeoDataTimeSpan::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataTimeSpan.cpp:42
Marble::GeoDataTimeStamp::when
QDateTime when() const
return the when time of timestamp
Definition: GeoDataTimeStamp.cpp:66
Marble::GeoDataTimeSpan::pack
virtual void pack(QDataStream &stream) const
Serialize the timespan to a stream.
Definition: GeoDataTimeSpan.cpp:105
Marble::GeoDataTimeSpanPrivate::m_end
GeoDataTimeStamp m_end
Definition: GeoDataTimeSpan_p.h:31
Marble::GeoDataTimeSpan::GeoDataTimeSpan
GeoDataTimeSpan()
Definition: GeoDataTimeSpan.cpp:27
Marble::GeoDataTimeSpanPrivate::nodeType
const char * nodeType() const
Definition: GeoDataTimeSpan_p.h:25
QDateTime::isValid
bool isValid() const
Marble::GeoDataTimePrimitive::pack
virtual void pack(QDataStream &stream) const
Serialize the styleselector to a stream.
Definition: GeoDataTimePrimitive.cpp:53
Marble::GeoDataTimeSpan
Definition: GeoDataTimeSpan.h:28
GeoDataTimeSpan_p.h
Marble::GeoDataTimeSpan::setBegin
void setBegin(const GeoDataTimeStamp &begin)
Set the beginning instant of a timespan.
Definition: GeoDataTimeSpan.cpp:81
Marble::GeoDataTimeStamp::unpack
virtual void unpack(QDataStream &stream)
Unserialize the timestamp from a stream.
Definition: GeoDataTimeStamp.cpp:93
Marble::GeoDataTimeSpan::operator!=
bool operator!=(const GeoDataTimeSpan &other) const
Definition: GeoDataTimeSpan.cpp:100
GeoDataTypes.h
Marble::GeoDataTimeSpan::end
const GeoDataTimeStamp & end() const
return the ending instant of a timespan
Definition: GeoDataTimeSpan.cpp:47
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal