Commit 3f3d7eb3 authored by Bernhard Beschow's avatar Bernhard Beschow

instantiate StyleBuilder in MarbleMap as value and pass to GeometryLayer

parent 228f6af3
......@@ -63,6 +63,7 @@
#include "MarbleDirs.h"
#include "MarbleModel.h"
#include "RenderPlugin.h"
#include "StyleBuilder.h"
#include "SunLocator.h"
#include "TileCoordsPyramid.h"
#include "TileCreator.h"
......@@ -135,7 +136,7 @@ public:
ViewportParams m_viewport;
bool m_showFrameRate;
bool m_showDebugPolygons;
StyleBuilder m_styleBuilder;
LayerManager m_layerManager;
MarbleSplashLayer m_marbleSplashLayer;
......@@ -158,9 +159,10 @@ MarbleMapPrivate::MarbleMapPrivate( MarbleMap *parent, MarbleModel *model ) :
m_viewParams(),
m_showFrameRate( false ),
m_showDebugPolygons( false ),
m_styleBuilder(),
m_layerManager( model, parent ),
m_customPaintLayer( parent ),
m_geometryLayer( model->treeModel() ),
m_geometryLayer(model->treeModel(), &m_styleBuilder),
m_textureLayer( model->downloadManager(), model->pluginManager(), model->sunLocator(), model->groundOverlayModel() ),
m_placemarkLayer( model->placemarkModel(), model->placemarkSelectionModel(), model->clock() ),
m_vectorTileLayer( model->downloadManager(), model->pluginManager(), model->treeModel() ),
......
......@@ -11,8 +11,6 @@
#ifndef MARBLE_STYLEBUILDER_H
#define MARBLE_STYLEBUILDER_H
#include <QSharedPointer>
#include <GeoDataStyle.h>
#include <GeoDataFeature.h>
......@@ -30,8 +28,6 @@ public:
class StyleBuilder
{
public:
typedef QSharedPointer<StyleBuilder> Ptr;
StyleBuilder();
~StyleBuilder();
......
......@@ -103,7 +103,7 @@ GeoDataStyle::ConstPtr GeoGraphicsItem::style() const
return d->m_style;
}
void GeoGraphicsItem::setStyleBuilder(const StyleBuilder::Ptr &styleBuilder)
void GeoGraphicsItem::setStyleBuilder(const StyleBuilder *styleBuilder)
{
d->m_styleBuilder = styleBuilder;
}
......
......@@ -15,7 +15,6 @@
// Marble
#include "marble_export.h"
#include "GeoDataStyle.h"
#include "StyleBuilder.h"
class QString;
......@@ -26,6 +25,7 @@ class GeoDataFeature;
class GeoDataLatLonAltBox;
class GeoGraphicsItemPrivate;
class GeoPainter;
class StyleBuilder;
class ViewportParams;
class RenderContext
......@@ -112,7 +112,7 @@ class MARBLE_EXPORT GeoGraphicsItem
/**
* Set the style for the item.
*/
void setStyleBuilder(const StyleBuilder::Ptr &styleBuilder );
void setStyleBuilder(const StyleBuilder *styleBuilder);
/**
* Set the style which will be used when
......
......@@ -46,7 +46,7 @@ class GeoGraphicsItemPrivate
GeoDataLatLonAltBox m_latLonAltBox;
RenderContext m_renderContext;
GeoDataStyle::ConstPtr m_style;
StyleBuilder::Ptr m_styleBuilder;
const StyleBuilder *m_styleBuilder;
QStringList m_paintLayers;
......
......@@ -59,7 +59,7 @@ class GeometryLayerPrivate
public:
typedef QList<GeoDataPlacemark const *> OsmQueue;
explicit GeometryLayerPrivate( const QAbstractItemModel *model );
explicit GeometryLayerPrivate(const QAbstractItemModel *model, const StyleBuilder *styleBuilder);
void createGraphicsItems( const GeoDataObject *object );
void createGraphicsItemFromGeometry( const GeoDataGeometry *object, const GeoDataPlacemark *placemark, bool avoidOsmDuplicates );
......@@ -67,24 +67,23 @@ public:
void removeGraphicsItems( const GeoDataFeature *feature );
const QAbstractItemModel *const m_model;
const StyleBuilder *const m_styleBuilder;
GeoGraphicsScene m_scene;
QString m_runtimeTrace;
QList<ScreenOverlayGraphicsItem*> m_items;
QMap<qint64,OsmQueue> m_osmWayItems;
QMap<qint64,OsmQueue> m_osmRelationItems;
StyleBuilder::Ptr m_styleBuilder;
};
GeometryLayerPrivate::GeometryLayerPrivate( const QAbstractItemModel *model )
: m_model( model ),
m_styleBuilder(new StyleBuilder)
GeometryLayerPrivate::GeometryLayerPrivate(const QAbstractItemModel *model, const StyleBuilder *styleBuilder) :
m_model(model),
m_styleBuilder(styleBuilder)
{
}
GeometryLayer::GeometryLayer( const QAbstractItemModel *model )
: d( new GeometryLayerPrivate( model ) )
GeometryLayer::GeometryLayer(const QAbstractItemModel *model, const StyleBuilder *styleBuilder) :
d(new GeometryLayerPrivate(model, styleBuilder))
{
const GeoDataObject *object = static_cast<GeoDataObject*>( d->m_model->index( 0, 0, QModelIndex() ).internalPointer() );
if ( object && object->parent() )
......
......@@ -26,15 +26,17 @@ namespace Marble
{
class GeoPainter;
class GeoDataFeature;
class GeoDataPlacemark;
class StyleBuilder;
class ViewportParams;
class GeometryLayerPrivate;
class GeoDataPlacemark;
class GeometryLayer : public QObject, public LayerInterface
{
Q_OBJECT
public:
explicit GeometryLayer( const QAbstractItemModel *model );
explicit GeometryLayer(const QAbstractItemModel *model, const StyleBuilder *styleBuilder);
~GeometryLayer();
virtual QStringList renderPosition() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment