• 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
GeoDataFlyTo.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 2013 Mayank Madan <maddiemadan@gmail.com>
9 //
10 
11 #include "GeoDataFlyTo.h"
12 #include "GeoDataTypes.h"
13 #include "GeoDataAbstractView.h"
14 #include "GeoDataCamera.h"
15 #include "GeoDataLookAt.h"
16 
17 namespace Marble {
18 
19 class GeoDataFlyToPrivate
20 {
21 public:
22  double m_duration;
23 
24  GeoDataFlyTo::FlyToMode m_flyToMode;
25 
26  GeoDataAbstractView* m_view;
27 
28  GeoDataFlyToPrivate();
29 };
30 
31 GeoDataFlyToPrivate::GeoDataFlyToPrivate() :
32  m_duration( 0.0 ), m_flyToMode(), m_view( 0 )
33 {
34 
35 }
36 
37 GeoDataFlyTo::GeoDataFlyTo() : d( new GeoDataFlyToPrivate )
38 {
39 
40 }
41 
42 GeoDataFlyTo::GeoDataFlyTo( const Marble::GeoDataFlyTo &other ) :
43  GeoDataTourPrimitive( other ), d( new GeoDataFlyToPrivate( *other.d ) )
44 {
45 
46 }
47 
48 GeoDataFlyTo &GeoDataFlyTo::operator=( const GeoDataFlyTo &other )
49 {
50  GeoDataTourPrimitive::operator=( other );
51  *d = *other.d;
52  return *this;
53 }
54 
55 bool GeoDataFlyTo::operator==( const GeoDataFlyTo& other ) const
56 {
57  if ( !equals(other) ||
58  d->m_duration != other.d->m_duration ||
59  d->m_flyToMode != other.d->m_flyToMode ) {
60  return false;
61  }
62 
63  if ( (!d->m_view && other.d->m_view) ||
64  (d->m_view && !other.d->m_view) ) {
65  return false;
66  } else if ( !d->m_view && !other.d->m_view ) {
67  return true;
68  }
69 
70  if ( d->m_view->nodeType() != other.d->m_view->nodeType() ) {
71  return false;
72  }
73 
74  if ( d->m_view->nodeType() == GeoDataTypes::GeoDataCameraType ) {
75  GeoDataCamera *thisCam = dynamic_cast<GeoDataCamera*>( d->m_view );
76  GeoDataCamera *otherCam = dynamic_cast<GeoDataCamera*>( other.d->m_view );
77  Q_ASSERT( thisCam && otherCam );
78 
79  if ( *thisCam != *otherCam ) {
80  return false;
81  }
82  } else if ( d->m_view->nodeType() == GeoDataTypes::GeoDataLookAtType ) {
83  GeoDataLookAt *thisLookAt = dynamic_cast<GeoDataLookAt*>( d->m_view );
84  GeoDataLookAt *otherLookAt = dynamic_cast<GeoDataLookAt*>( other.d->m_view );
85  Q_ASSERT( thisLookAt && otherLookAt );
86 
87  if ( *thisLookAt != *otherLookAt ) {
88  return false;
89  }
90  }
91 
92  return true;
93 }
94 
95 bool GeoDataFlyTo::operator!=( const GeoDataFlyTo& other ) const
96 {
97  return !this->operator==(other);
98 }
99 
100 GeoDataFlyTo::~GeoDataFlyTo()
101 {
102  delete d;
103 }
104 
105 const char *GeoDataFlyTo::nodeType() const
106 {
107  return GeoDataTypes::GeoDataFlyToType;
108 }
109 
110 const GeoDataAbstractView *GeoDataFlyTo::view() const
111 {
112  return d->m_view;
113 }
114 
115 GeoDataAbstractView *GeoDataFlyTo::view()
116 {
117  return d->m_view;
118 }
119 
120 void GeoDataFlyTo::setView( GeoDataAbstractView *view )
121 {
122  d->m_view = view;
123 }
124 
125 double GeoDataFlyTo::duration() const
126 {
127  return d->m_duration;
128 }
129 
130 void GeoDataFlyTo::setDuration( double duration )
131 {
132  d->m_duration = duration;
133 }
134 
135 GeoDataFlyTo::FlyToMode GeoDataFlyTo::flyToMode() const
136 {
137  return d->m_flyToMode;
138 }
139 
140 void GeoDataFlyTo::setFlyToMode( const GeoDataFlyTo::FlyToMode flyToMode )
141 {
142  d->m_flyToMode = flyToMode;
143 }
144 
145 }
Marble::GeoDataAbstractView
Definition: GeoDataAbstractView.h:30
GeoDataAbstractView.h
Marble::GeoDataTypes::GeoDataLookAtType
const char * GeoDataLookAtType
Definition: GeoDataTypes.cpp:58
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::GeoDataTourPrimitive
Definition: GeoDataTourPrimitive.h:20
Marble::GeoDataCamera
Definition: GeoDataCamera.h:22
Marble::GeoDataFlyTo::FlyToMode
FlyToMode
Definition: GeoDataFlyTo.h:26
Marble::GeoDataFlyTo::operator=
GeoDataFlyTo & operator=(const GeoDataFlyTo &other)
Definition: GeoDataFlyTo.cpp:48
GeoDataCamera.h
GeoDataLookAt.h
Marble::GeoDataFlyTo::setDuration
void setDuration(double duration)
Definition: GeoDataFlyTo.cpp:130
Marble::GeoDataFlyTo
Definition: GeoDataFlyTo.h:23
Marble::GeoDataFlyTo::operator==
bool operator==(const GeoDataFlyTo &other) const
Definition: GeoDataFlyTo.cpp:55
Marble::GeoDataTypes::GeoDataFlyToType
const char * GeoDataFlyToType
Definition: GeoDataTypes.cpp:41
Marble::GeoDataFlyTo::operator!=
bool operator!=(const GeoDataFlyTo &other) const
Definition: GeoDataFlyTo.cpp:95
Marble::GeoDataFlyTo::setView
void setView(GeoDataAbstractView *view)
Definition: GeoDataFlyTo.cpp:120
Marble::GeoDataFlyTo::flyToMode
FlyToMode flyToMode() const
Definition: GeoDataFlyTo.cpp:135
Marble::GeoDataFlyTo::GeoDataFlyTo
GeoDataFlyTo()
Definition: GeoDataFlyTo.cpp:37
Marble::GeoDataFlyTo::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataFlyTo.cpp:105
Marble::GeoDataLookAt
Definition: GeoDataLookAt.h:23
Marble::GeoDataTypes::GeoDataCameraType
const char * GeoDataCameraType
Definition: GeoDataTypes.cpp:31
Marble::GeoDataFlyTo::duration
double duration() const
Definition: GeoDataFlyTo.cpp:125
GeoDataFlyTo.h
Marble::GeoDataObject::operator=
GeoDataObject & operator=(const GeoDataObject &)
Definition: GeoDataObject.cpp:54
Marble::GeoDataFlyTo::setFlyToMode
void setFlyToMode(const FlyToMode flyToMode)
Definition: GeoDataFlyTo.cpp:140
GeoDataTypes.h
Marble::GeoDataFlyTo::view
const GeoDataAbstractView * view() const
Definition: GeoDataFlyTo.cpp:110
Marble::GeoDataFlyTo::~GeoDataFlyTo
~GeoDataFlyTo()
Definition: GeoDataFlyTo.cpp:100
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