[Marble-commits] KDE/kdeedu/marble/src/lib
Torsten Rahn
tackat at kde.org
Sat Aug 14 14:43:40 CEST 2010
SVN commit 1163577 by rahn:
- Adding easier access to float items
M +12 -0 MarbleMap.cpp
M +1 -0 MarbleMap.h
M +5 -0 MarbleWidget.cpp
M +7 -0 MarbleWidget.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1163576:1163577
@@ -31,6 +31,7 @@
#endif
// Marble
+#include "AbstractFloatItem.h"
#include "AbstractProjection.h"
#include "AbstractScanlineTextureMapper.h"
#include "FileStorageWatcher.h"
@@ -1241,6 +1242,17 @@
return d->m_model->floatItems();
}
+AbstractFloatItem * MarbleMap::floatItem( const QString &nameId ) const
+{
+ foreach ( AbstractFloatItem * floatItem, floatItems() ) {
+ if ( floatItem && floatItem->nameId() == nameId ) {
+ return floatItem;
+ }
+ }
+
+ return 0; // No item found
+}
+
void MarbleMap::flyTo( const GeoDataLookAt &lookAt )
{
int zoom = zoomFromDistance( lookAt.range() * METER2KM );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.h #1163576:1163577
@@ -431,6 +431,7 @@
QList<RenderPlugin *> renderPlugins() const;
QList<AbstractFloatItem *> floatItems() const;
+ AbstractFloatItem * floatItem( const QString &nameId ) const;
/**
* @brief Move camera to the given position. This can change
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1163576:1163577
@@ -1364,6 +1364,11 @@
return d->m_model->floatItems();
}
+AbstractFloatItem * MarbleWidget::floatItem( const QString &nameId ) const
+{
+ return d->m_map->floatItem( nameId );
+}
+
void MarbleWidget::changeEvent( QEvent * event )
{
if ( event->type() == QEvent::EnabledChange )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1163576:1163577
@@ -500,6 +500,13 @@
* @return the list of the floatItems
*/
QList<AbstractFloatItem *> floatItems() const;
+ /**
+ * @brief Returns the FloatItem with the given id
+ * @return The pointer to the requested floatItem,
+ *
+ * If no item is found the null pointer is returned.
+ */
+ AbstractFloatItem * floatItem( const QString &nameId ) const;
/**
* Reads the plugin settings from the passed QSettings.
More information about the Marble-commits
mailing list