[Marble-commits] KDE/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Sun Nov 7 10:43:27 CET 2010
SVN commit 1193817 by beschow:
derive MeasureTool form LayerInterface
M +1 -22 MarbleMap.cpp
M +0 -1 MarbleMap_p.h
M +2 -1 MarbleWidget.cpp
M +16 -3 MeasureTool.cpp
M +6 -3 MeasureTool.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1193816:1193817
@@ -162,27 +162,6 @@
m_justModified = false;
}
-void MarbleMapPrivate::paintOverlay( GeoPainter &painter, QRect &dirtyRect )
-{
- Q_UNUSED( dirtyRect )
-
- if ( !m_viewParams.mapTheme() ) {
- return;
- }
-
- // FIXME: Add this stuff into the Layermanager as something to be
- // called before the float items.
-
- bool antialiased = false;
-
- if ( m_viewParams.mapQuality() == HighQuality
- || m_viewParams.mapQuality() == PrintQuality ) {
- antialiased = true;
- }
-
- m_model->measureTool()->paint( &painter, m_viewParams.viewport(), antialiased );
-}
-
void MarbleMapPrivate::paintFps( GeoPainter &painter, QRect &dirtyRect, qreal fps )
{
Q_UNUSED( dirtyRect );
@@ -723,7 +702,7 @@
d->paintGround( painter, dirtyRect );
customPaint( &painter );
- d->paintOverlay( painter, dirtyRect );
+ d->m_model->measureTool()->render( &painter, viewport() );
qreal fps = 1000.0 / (qreal)( t.elapsed() );
d->paintFps( painter, dirtyRect, fps );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap_p.h #1193816:1193817
@@ -45,7 +45,6 @@
void doResize();
void paintGround( GeoPainter &painter, QRect &dirtyRect);
- void paintOverlay( GeoPainter &painter, QRect &dirtyRect);
void paintFps( GeoPainter &painter, QRect &dirtyRect, qreal fps);
MarbleMap *m_parent;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1193816:1193817
@@ -41,6 +41,7 @@
#include "MarblePhysics.h"
#include "MarblePlacemarkModel.h"
#include "MarbleWidgetInputHandler.h"
+#include "MeasureTool.h"
#include "MergedLayerDecorator.h"
#include "RenderPlugin.h"
#include "SunLocator.h"
@@ -774,7 +775,7 @@
d->m_map->d->paintGround( painter, dirtyRect );
d->m_map->customPaint( &painter );
customPaint( &painter );
- d->m_map->d->paintOverlay( painter, dirtyRect );
+ d->m_model->measureTool()->render( &painter, viewport() );
if ( !isEnabled() )
{
--- trunk/KDE/kdeedu/marble/src/lib/MeasureTool.cpp #1193816:1193817
@@ -51,13 +51,24 @@
}
-void MeasureTool::paint( GeoPainter *painter,
+bool MeasureTool::render( GeoPainter *painter,
ViewportParams *viewport,
- bool antialiasing )
+ const QString& renderPos,
+ GeoSceneLayer * layer )
{
+ // FIXME: Add this stuff into the Layermanager as something to be
+ // called before the float items.
+
+ bool antialiasing = false;
+
+ if ( painter->mapQuality() == HighQuality
+ || painter->mapQuality() == PrintQuality ) {
+ antialiasing = true;
+ }
+
// No way to paint anything if the list is empty.
if ( m_measureLineString.isEmpty() )
- return;
+ return true;
// Prepare for painting the measure line string and paint it.
painter->setRenderHint( QPainter::Antialiasing, antialiasing );
@@ -73,6 +84,8 @@
if ( m_measureLineString.size() > 1 )
drawTotalDistanceLabel( painter, totalDistance );
+
+ return true;
}
void MeasureTool::drawMeasurePoints( GeoPainter *painter,
--- trunk/KDE/kdeedu/marble/src/lib/MeasureTool.h #1193816:1193817
@@ -23,6 +23,7 @@
#include <GeoDataLineString.h>
#include "global.h"
+#include "LayerInterface.h"
namespace Marble
{
@@ -31,16 +32,18 @@
class GeoPainter;
class ViewportParams;
-class MeasureTool : public QObject
+class MeasureTool : public QObject, public LayerInterface
{
Q_OBJECT
public:
explicit MeasureTool( MarbleModel *model, QObject *parent = 0 );
- void paint( GeoPainter *painter, ViewportParams *viewport,
- bool antialiasing );
+ virtual QStringList renderPosition() const { return QStringList(); }
+ virtual bool render( GeoPainter *painter, ViewportParams *viewport,
+ const QString& renderPos = "NONE", GeoSceneLayer * layer = 0 );
+
Q_SIGNALS:
void numberOfMeasurePointsChanged( int newNumber );
More information about the Marble-commits
mailing list