• 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
PlaybackAnimatedUpdateItem.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 2014 Sanjiban Bairagya <sanjiban22393@gmail.com>
9 //
10 
11 #include "PlaybackAnimatedUpdateItem.h"
12 #include "GeoDataTypes.h"
13 
14 #include <QString>
15 
16 namespace Marble
17 {
18 PlaybackAnimatedUpdateItem::PlaybackAnimatedUpdateItem( const GeoDataAnimatedUpdate* animatedUpdate )
19 {
20  m_animatedUpdate = animatedUpdate;
21 }
22 
23 const GeoDataAnimatedUpdate* PlaybackAnimatedUpdateItem::animatedUpdate() const
24 {
25  return m_animatedUpdate;
26 }
27 
28 double PlaybackAnimatedUpdateItem::duration() const
29 {
30  return m_animatedUpdate->duration();
31 }
32 
33 void PlaybackAnimatedUpdateItem::play()
34 {
35  if ( m_animatedUpdate->update() && m_animatedUpdate->update()->change() ) {
36  QVector<GeoDataPlacemark*> placemarkList = m_animatedUpdate->update()->change()->placemarkList();
37  for( int i = 0; i < placemarkList.size(); i++ ){
38  GeoDataPlacemark* placemark = placemarkList.at( i );
39  QString targetId = placemark->targetId();
40  if( placemark->isBalloonVisible() ){
41  GeoDataDocument* document = rootDocument( placemark );
42  GeoDataPlacemark* placemarkFromDocument = findPlacemark( document, targetId );
43  if( placemarkFromDocument ){
44  emit balloonShown( placemarkFromDocument );
45  }
46  } else {
47  emit balloonHidden();
48  }
49  }
50  }
51 }
52 
53 GeoDataPlacemark* PlaybackAnimatedUpdateItem::findPlacemark( GeoDataFeature* feature, const QString& targetId ) const
54 {
55  if ( feature && feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType ) {
56  if( static_cast<GeoDataPlacemark*>( feature )->id() == targetId ){
57  return static_cast<GeoDataPlacemark*>( feature );
58  }
59  }
60 
61  GeoDataContainer *container = dynamic_cast<GeoDataContainer*>( feature );
62  if ( container ){
63  QVector<GeoDataFeature*>::Iterator end = container->end();
64  QVector<GeoDataFeature*>::Iterator iter = container->begin();
65  for( ; iter != end; ++iter ){
66  GeoDataPlacemark *placemark = findPlacemark( *iter, targetId );
67  if ( placemark ) {
68  return placemark;
69  }
70  }
71  }
72  return 0;
73 }
74 
75 GeoDataDocument* PlaybackAnimatedUpdateItem::rootDocument( GeoDataObject* object ) const
76 {
77  if( !object || !object->parent() ){
78  GeoDataDocument* document = dynamic_cast<GeoDataDocument*>( object );
79  return document;
80  } else {
81  return rootDocument( object->parent() );
82  }
83  return 0;
84 }
85 
86 void PlaybackAnimatedUpdateItem::pause()
87 {
88  //do nothing
89 }
90 
91 void PlaybackAnimatedUpdateItem::seek( double position )
92 {
93  Q_UNUSED( position );
94  //do nothing
95 }
96 
97 void PlaybackAnimatedUpdateItem::stop()
98 {
99  //do nothing
100 }
101 
102 }
103 
104 #include "PlaybackAnimatedUpdateItem.moc"
Marble::PlaybackItem::balloonShown
void balloonShown(GeoDataPlacemark *)
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
QVector::begin
iterator begin()
Marble::GeoDataAnimatedUpdate::update
const GeoDataUpdate * update() const
Definition: GeoDataAnimatedUpdate.cpp:76
Marble::GeoDataTypes::GeoDataPlacemarkType
const char * GeoDataPlacemarkType
Definition: GeoDataTypes.cpp:66
Marble::PlaybackAnimatedUpdateItem::seek
void seek(double position)
Definition: PlaybackAnimatedUpdateItem.cpp:91
Marble::PlaybackItem::balloonHidden
void balloonHidden()
PlaybackAnimatedUpdateItem.h
Marble::GeoDataPlacemark::isBalloonVisible
bool isBalloonVisible() const
Returns whether balloon is visible or not.
Definition: GeoDataPlacemark.cpp:282
Marble::PlaybackAnimatedUpdateItem::PlaybackAnimatedUpdateItem
PlaybackAnimatedUpdateItem(const GeoDataAnimatedUpdate *animatedUpdate)
Definition: PlaybackAnimatedUpdateItem.cpp:18
Marble::PlaybackAnimatedUpdateItem::pause
void pause()
Definition: PlaybackAnimatedUpdateItem.cpp:86
Marble::GeoDataAnimatedUpdate
Definition: GeoDataAnimatedUpdate.h:23
QString
Marble::GeoDataObject::targetId
QString targetId() const
Get the targetId of the object to be replaced.
Definition: GeoDataObject.cpp:85
Marble::PlaybackAnimatedUpdateItem::animatedUpdate
const GeoDataAnimatedUpdate * animatedUpdate() const
Definition: PlaybackAnimatedUpdateItem.cpp:23
Marble::PlaybackAnimatedUpdateItem::duration
double duration() const
Definition: PlaybackAnimatedUpdateItem.cpp:28
QVector::at
const T & at(int i) const
QVector
Marble::GeoDataFeature
A base class for all geodata features.
Definition: GeoDataFeature.h:57
Marble::PlaybackAnimatedUpdateItem::stop
void stop()
Definition: PlaybackAnimatedUpdateItem.cpp:97
Marble::PlaybackAnimatedUpdateItem::play
void play()
Definition: PlaybackAnimatedUpdateItem.cpp:33
Marble::GeoDataAnimatedUpdate::duration
double duration() const
Definition: GeoDataAnimatedUpdate.cpp:95
Marble::GeoDataUpdate::change
GeoDataChange * change() const
Definition: GeoDataUpdate.cpp:88
GeoDataTypes.h
QVector::size
int size() const
Marble::GeoDataFeature::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataFeature.cpp:158
QVector::end
iterator end()
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::GeoDataContainer::placemarkList
QVector< GeoDataPlacemark * > placemarkList() const
A convenience function that returns all placemarks in this container.
Definition: GeoDataContainer.cpp:214
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 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