Marble

GeoDataPlaylist.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Illya Kovalevskyy <[email protected]>
4 //
5 
6 #include "GeoDataPlaylist.h"
7 
8 #include "GeoDataTypes.h"
9 
10 namespace Marble
11 {
12 
13 bool GeoDataPlaylist::operator==(const GeoDataPlaylist& other) const
14 {
15  if( this->m_primitives.size() != other.m_primitives.size() ){
16  return false;
17  }
18  else{
19  int index = 0;
20  for( GeoDataTourPrimitive* m_primitive: m_primitives ){
21  if (*m_primitive != *other.m_primitives.at(index)) {
22  return false;
23  }
24 
25  index++;
26  }
27  return true;
28  }
29 }
30 
31 bool GeoDataPlaylist::operator!=(const GeoDataPlaylist& other) const
32 {
33  return !this->operator==(other);
34 }
35 
36 const char *GeoDataPlaylist::nodeType() const
37 {
38  return GeoDataTypes::GeoDataPlaylistType;
39 }
40 
41 GeoDataTourPrimitive* GeoDataPlaylist::primitive(int id)
42 {
43  if (size() <= id || id < 0) {
44  return nullptr;
45  }
46  return m_primitives.at(id);
47 }
48 
49 const GeoDataTourPrimitive* GeoDataPlaylist::primitive(int id) const
50 {
51  if (size() <= id || id < 0) {
52  return nullptr;
53  }
54  return m_primitives.at(id);
55 }
56 
57 void GeoDataPlaylist::addPrimitive( GeoDataTourPrimitive *primitive )
58 {
59  primitive->setParent( this );
60  m_primitives.push_back( primitive );
61 }
62 
63 void GeoDataPlaylist::insertPrimitive( int position, GeoDataTourPrimitive *primitive )
64 {
65  primitive->setParent( this );
66  int const index = qBound( 0, position, m_primitives.size() );
67  m_primitives.insert( index, primitive );
68 }
69 
70 void GeoDataPlaylist::removePrimitiveAt(int position)
71 {
72  m_primitives.removeAt( position );
73 }
74 
75 void GeoDataPlaylist::swapPrimitives( int positionA, int positionB )
76 {
77  if ( qMin( positionA, positionB ) >= 0 && qMax( positionA, positionB ) < m_primitives.size() ) {
78 
79 #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
80  m_primitives.swapItemsAt( positionA, positionB );
81 #else
82  m_primitives.swap( positionA, positionB );
83 #endif
84  }
85 }
86 
87 int GeoDataPlaylist::size() const
88 {
89  return m_primitives.size();
90 }
91 
92 } // namespace Marble
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.