[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Sun Feb 21 09:54:09 CET 2010
SVN commit 1093625 by nienhueser:
Extract LayerInterface as a base class of RenderPluginInterface. It is independent of plugins.
Extend MarbleModel and LayerManager to support adding (and removing) instances of LayerInterfaces which are then included in painting.
A LayerInterface.h [License: LGPL]
M +18 -0 LayerManager.cpp
M +11 -0 LayerManager.h
M +10 -0 MarbleModel.cpp
M +11 -0 MarbleModel.h
M +2 -33 RenderPluginInterface.h
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.cpp #1093624:1093625
@@ -28,6 +28,7 @@
#include "PluginManager.h"
#include "RenderPlugin.h"
#include "ViewParams.h"
+#include "LayerInterface.h"
namespace Marble
{
@@ -51,6 +52,7 @@
QList<RenderPlugin *> m_renderPlugins;
QList<AbstractFloatItem *> m_floatItems;
QList<AbstractDataPlugin *> m_dataPlugins;
+ QList<LayerInterface *> m_internalLayers;
};
@@ -147,6 +149,12 @@
}
}
}
+
+ foreach( LayerInterface *layer, d->m_internalLayers) {
+ if ( layer && layer->renderPosition().contains( renderPosition )) {
+ layer->render(painter, viewport, renderPosition);
+ }
+ }
}
void LayerManager::loadLayers()
@@ -215,6 +223,16 @@
}
}
+void LayerManager::addLayer(LayerInterface *layer)
+{
+ d->m_internalLayers.push_back(layer);
}
+void LayerManager::removeLayer(LayerInterface *layer)
+{
+ d->m_internalLayers.removeAll(layer);
+}
+
+}
+
#include "LayerManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.h #1093624:1093625
@@ -37,6 +37,7 @@
class AbstractDataPlugin;
class MarbleDataFacade;
class PluginManager;
+class LayerInterface;
/**
* @short The class that handles Marble's DGML layers.
@@ -79,6 +80,16 @@
*/
QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
+ /**
+ * @brief Add a layer to be included in rendering.
+ */
+ void addLayer(LayerInterface *layer);
+
+ /**
+ * @brief Remove a layer from being included in rendering.
+ */
+ void removeLayer(LayerInterface *layer);
+
Q_SIGNALS:
/**
* @brief Signal that the number of floatItems has changed
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1093624:1093625
@@ -874,6 +874,16 @@
return d->m_layerManager->whichItemAt( curpos );
}
+void MarbleModel::addLayer( LayerInterface *layer )
+{
+ d->m_layerManager->addLayer(layer);
+}
+
+void MarbleModel::removeLayer( LayerInterface *layer )
+{
+ d->m_layerManager->removeLayer(layer);
+}
+
Planet* MarbleModel::planet() const
{
return d->m_planet;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1093624:1093625
@@ -70,6 +70,7 @@
class GeoSceneDocument;
class GeoSceneTexture;
class Planet;
+class LayerInterface;
/**
* @short The data model (not based on QAbstractModel) for a MarbleWidget.
@@ -282,6 +283,16 @@
QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
/**
+ * @brief Add a layer to be included in rendering.
+ */
+ void addLayer( LayerInterface *layer );
+
+ /**
+ * @brief Remove a layer from being included in rendering.
+ */
+ void removeLayer( LayerInterface *layer );
+
+ /**
* @brief Returns the planet object for the current map.
* @return the planet object for the current map
*/
--- trunk/KDE/kdeedu/marble/src/lib/RenderPluginInterface.h #1093624:1093625
@@ -13,18 +13,14 @@
#ifndef MARBLERENDERPLUGININTERFACEH
#define MARBLERENDERPLUGININTERFACEH
-#include <QtCore/QString>
-#include <QtCore/QStringList>
#include <QtCore/QtPlugin>
#include "PluginInterface.h"
+#include "LayerInterface.h"
namespace Marble
{
-class GeoPainter;
-class GeoSceneLayer;
-class ViewportParams;
class RenderPlugin;
/**
@@ -32,7 +28,7 @@
*
*/
-class RenderPluginInterface: public PluginInterface
+class RenderPluginInterface: public PluginInterface, public LayerInterface
{
public:
virtual ~RenderPluginInterface();
@@ -70,33 +66,6 @@
* otherwise choose the preferred position
*/
virtual QString renderPolicy() const = 0;
-
- /**
- * @brief Preferred level in the layer stack for the rendering
- *
- * Gives a preferred level in the existing layer stack where
- * the render() method of this plugin should get executed.
- *.
- * Possible Values:
- * "NONE"
- * "STARS"
- * "BEHIND_TARGET"
- * "SURFACE"
- * "HOVERS_ABOVE_SURFACE"
- * "ATMOSPHERE"
- * "ORBIT"
- * "ALWAYS_ON_TOP"
- * "FLOAT_ITEM"
- * "USER_TOOLS"
- */
- virtual QStringList renderPosition() const = 0;
-
- /**
- * @brief Renders the content provided by the plugin on the viewport.
- * @return @c true Returns whether the rendering has been successful
- */
- virtual bool render( GeoPainter *painter, ViewportParams *viewport,
- const QString& renderPos = "NONE", GeoSceneLayer * layer = 0 ) = 0;
};
}
More information about the Marble-commits
mailing list