[Marble-commits] KDE/kdeedu/marble/src
Torsten Rahn
tackat at kde.org
Sat Jul 11 17:37:05 CEST 2009
SVN commit 994868 by rahn:
BUG 199785: Fixed
M +12 -31 lib/LayerManager.cpp
M +4 -1 lib/LayerManager.h
M +14 -1 lib/MarbleModel.cpp
M +2 -1 lib/RenderPlugin.h
M +10 -3 plugins/render/stars/StarsPlugin.cpp
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.cpp #994867:994868
@@ -112,7 +112,16 @@
return itemList;
}
-void LayerManager::renderLayers( GeoPainter *painter, ViewParams *viewParams )
+void LayerManager::renderLayers( GeoPainter *painter, ViewParams *viewParams,
+ const QStringList& renderPositions )
+{
+ foreach( const QString& renderPosition, renderPositions ) {
+ renderLayer( painter, viewParams, renderPosition );
+ }
+}
+
+void LayerManager::renderLayer( GeoPainter *painter, ViewParams *viewParams,
+ const QString& renderPosition )
{
if ( !viewParams || !viewParams->viewport() ) {
qDebug() << "LayerManager: No valid viewParams set!";
@@ -122,40 +131,12 @@
ViewportParams* viewport = viewParams->viewport();
foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
- if ( renderPlugin && renderPlugin->renderPosition().contains("SURFACE") ){
+ if ( renderPlugin && renderPlugin->renderPosition().contains( renderPosition ) ){
if ( renderPlugin->enabled() && renderPlugin->visible() ) {
- renderPlugin->render( painter, viewport, "SURFACE" );
+ renderPlugin->render( painter, viewport, renderPosition );
}
}
}
-
- foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
- if ( renderPlugin && renderPlugin->renderPosition().contains("HOVERS_ABOVE_SURFACE") ){
- if ( renderPlugin->enabled() && renderPlugin->visible() ) {
- renderPlugin->render( painter, viewport, "HOVERS_ABOVE_SURFACE" );
- }
- }
- }
-
- foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
- if ( renderPlugin ){
- if ( renderPlugin->enabled() && renderPlugin->visible() ) {
- renderPlugin->render( painter, viewport, "ALWAYS_ON_TOP" );
- }
- }
- }
-
- // Looping a second time through is a quick and dirty way to get
- // the float items displayed on top:
- // FIXME: use d->m_floatItems here?
- foreach( RenderPlugin *renderPlugin, d->m_renderPlugins ) {
- if ( renderPlugin && renderPlugin->renderPosition().contains("FLOAT_ITEM") ) {
- AbstractFloatItem *floatItem = qobject_cast<AbstractFloatItem *>(renderPlugin);
- if ( floatItem && floatItem->enabled() && floatItem->visible() ) {
- floatItem->render( painter, viewport, "FLOAT_ITEM" );
- }
- }
- }
}
void LayerManager::loadLayers()
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.h #994867:994868
@@ -49,8 +49,11 @@
explicit LayerManager( MarbleDataFacade*, QObject *parent = 0);
~LayerManager();
- void renderLayers( GeoPainter *painter, ViewParams *viewParams );
+ void renderLayers( GeoPainter *painter, ViewParams *viewParams, const QStringList& renderPositions );
+ void renderLayer( GeoPainter *painter, ViewParams *viewParams, const QString& renderPosition );
+
+
/**
* @brief Returns a list of all RenderPlugins on the layer, this includes float items
* @return the list of RenderPlugins
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #994867:994868
@@ -551,6 +551,10 @@
GeoSceneLayer *layer =
static_cast<GeoSceneLayer*>( d->m_mapTheme->map()->layer( themeID ) );
+ QStringList renderPositions;
+ renderPositions << "STARS" << "BEHIND_TARGET";
+ d->m_layerManager->renderLayers( painter, viewParams, renderPositions );
+
if ( redrawBackground ) {
if ( d->m_mapTheme->map()->hasTextureLayers() ) {
@@ -594,6 +598,10 @@
// qDebug( "Painted in %ims", t.elapsed() );
+ renderPositions.clear();
+ renderPositions << "SURFACE";
+ d->m_layerManager->renderLayers( painter, viewParams, renderPositions );
+
// Paint the vector layer.
if ( d->m_mapTheme->map()->hasVectorLayers() ) {
@@ -626,7 +634,12 @@
d->m_gpsLayer->paintLayer( painter,
viewParams->canvasImage()->size(),
viewParams );
- d->m_layerManager->renderLayers( painter, viewParams );
+
+ renderPositions.clear();
+ renderPositions << "HOVERS_ABOVE_SURFACE" << "ATMOSPHERE"
+ << "ORBIT" << "ALWAYS_ON_TOP" << "FLOAT_ITEM";
+
+ d->m_layerManager->renderLayers( painter, viewParams, renderPositions );
}
--- trunk/KDE/kdeedu/marble/src/lib/RenderPlugin.h #994867:994868
@@ -32,7 +32,7 @@
class MarbleDataFacade;
/**
- * @short The abstract class that creates an "empty" float item.
+ * @short The abstract class that creates a renderable Item.
*
*/
@@ -44,6 +44,7 @@
public:
/**
* This enum contains the data roles for the QStandardItem that is returned by item().
+ * TODO: This should get moved into PluginInterface.h
*/
enum ItemDataRole {
NameId = Qt::UserRole + 2, // a QString
--- trunk/KDE/kdeedu/marble/src/plugins/render/stars/StarsPlugin.cpp #994867:994868
@@ -29,12 +29,12 @@
QString StarsPlugin::renderPolicy() const
{
- return QString( "STARS" );
+ return QString( "SPECIFIED_ALWAYS" );
}
QStringList StarsPlugin::renderPosition() const
{
- return QStringList( "SPECIFIED_ALWAYS" );
+ return QStringList( "STARS" );
}
QString StarsPlugin::name() const
@@ -107,9 +107,12 @@
bool StarsPlugin::render( GeoPainter *painter, ViewportParams *viewport,
const QString& renderPos, GeoSceneLayer * layer )
{
- Q_UNUSED( renderPos )
Q_UNUSED( layer )
+ if ( renderPos != "STARS" ) {
+ return true;
+ }
+
QString target = dataFacade()->target();
// So far this starry sky plugin only supports displaying stars on earth.
@@ -117,6 +120,8 @@
return true;
}
+ painter->save();
+
painter->autoMapQuality();
QPen starPen( Qt::NoPen );
@@ -191,6 +196,8 @@
}
}
+ painter->restore();
+
return true;
}
More information about the Marble-commits
mailing list