Skip to content

Commit

Permalink
[API] Removed old symbology's QgsRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Apr 7, 2013
1 parent 5a951fc commit 7cc3031
Show file tree
Hide file tree
Showing 48 changed files with 42 additions and 400 deletions.
2 changes: 0 additions & 2 deletions python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
%Include raster/qgscubicrasterresampler.sip
%Include raster/qgsmultibandcolorrenderer.sip

%Include renderer/qgsrenderer.sip

%Include symbology-ng/qgsstylev2.sip
%Include symbology-ng/qgssvgcache.sip
%Include symbology-ng/qgssymbolv2.sip
Expand Down
87 changes: 0 additions & 87 deletions python/core/renderer/qgsrenderer.sip

This file was deleted.

1 change: 0 additions & 1 deletion src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ SET(QGIS_ANALYSIS_HDRS ${QGIS_ANALYSIS_HDRS}
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core/
${CMAKE_CURRENT_SOURCE_DIR}/../core/renderer
${CMAKE_CURRENT_SOURCE_DIR}/../core/raster
${CMAKE_CURRENT_SOURCE_DIR}/../core/symbology-ng
interpolation
Expand Down
1 change: 0 additions & 1 deletion src/analysis/interpolation/qgstininterpolator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "Point3D.h"
#include "qgsfeature.h"
#include "qgsgeometry.h"
#include "qgssinglesymbolrenderer.h"
#include "qgsvectorlayer.h"
#include <QProgressDialog>

Expand Down
8 changes: 1 addition & 7 deletions src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2427,13 +2427,7 @@ void QgsLegend::refreshLayerSymbology( QString key, bool expandItem )
if ( current && current->parent() == theLegendLayer )
current = current->parent();

double widthScale = 1.0;
if ( mMapCanvas && mMapCanvas->map() )
{
widthScale = mMapCanvas->map()->paintDevice().logicalDpiX() / 25.4;
}

theLegendLayer->refreshSymbology( key, widthScale );
theLegendLayer->refreshSymbology( key );

//restore the current item again
setCurrentItem( current );
Expand Down
11 changes: 2 additions & 9 deletions src/app/legend/qgslegendlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "qgsmapcanvasmap.h"
#include "qgsmaplayerregistry.h"
#include "qgsrasterlayer.h"
#include "qgsrenderer.h"
#include "qgssymbol.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
Expand Down Expand Up @@ -126,7 +125,7 @@ QgsMapLayer* QgsLegendLayer::layer()
return mLyr.layer();
}

void QgsLegendLayer::refreshSymbology( const QString& key, double widthScale )
void QgsLegendLayer::refreshSymbology( const QString& key )
{
QgsMapLayer* theMapLayer = QgsMapLayerRegistry::instance()->mapLayer( key );
if ( !theMapLayer )
Expand Down Expand Up @@ -515,13 +514,7 @@ QString QgsLegendLayer::layerName()

void QgsLegendLayer::updateAfterLayerModification()
{
double widthScale = 1.0;
QgsMapCanvas* canvas = QgisApp::instance()->mapCanvas();
if ( canvas && canvas->map() )
{
widthScale = canvas->map()->paintDevice().logicalDpiX() / 25.4;
}
refreshSymbology( mLyr.layer()->id(), widthScale );
refreshSymbology( mLyr.layer()->id() );
layerNameChanged();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class QgsLegendLayer : public QgsLegendItem
//void updateCheckState();

/**Updates symbology of the layer and copies symbology to other layer files in the group*/
void refreshSymbology( const QString& key, double widthScale = 1.0 );
void refreshSymbology( const QString& key );

/** Helper method to set font characteristics.
* Not to be confused with setFont() which is inherited
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
#include "qgsrasterrenderer.h"
#include "qgsrasterlayersaveasdialog.h"
#include "qgsrectangle.h"
#include "qgsrenderer.h"
#include "qgsscalecombobox.h"
#include "qgsshortcutsmanager.h"
#include "qgssinglebandgrayrenderer.h"
Expand Down Expand Up @@ -3160,7 +3159,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
prj->writeEntry( "Gui", "/SelectionColorGreenPart", myGreen );
prj->writeEntry( "Gui", "/SelectionColorBluePart", myBlue );
prj->writeEntry( "Gui", "/SelectionColorAlphaPart", myAlpha );
QgsRenderer::setSelectionColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
QgsSymbolV2RenderContext::setSelectionColor( QColor( myRed, myGreen, myBlue, myAlpha ) );

//set the canvas to the default background color
//the default can be set in qgisoptions
Expand Down Expand Up @@ -3544,7 +3543,7 @@ bool QgisApp::addProject( QString projectFile )
int myGreen = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorGreenPart", defaultGreen );
int myBlue = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorBluePart", defaultBlue );
int myAlpha = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorAlphaPart", defaultAlpha );
QgsRenderer::setSelectionColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
QgsSymbolV2RenderContext::setSelectionColor( QColor( myRed, myGreen, myBlue, myAlpha ) );

//load project scales
bool projectScales = QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsaddtaborgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include "ui_qgsaddtaborgroupbase.h"
#include "qgisgui.h"
#include "qgsrenderer.h"

class QgsVectorLayer;

class QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroupBase
{
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsmaptoolrotatepointsymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "qgsapplication.h"
#include "qgsmapcanvas.h"
#include "qgspointrotationitem.h"
#include "qgsrenderer.h"
#include "qgsrendererv2.h"
#include "qgssymbol.h"
#include "qgssymbolv2.h"
Expand Down
3 changes: 1 addition & 2 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "qgsmaprenderer.h"
#include "qgsproject.h"
#include "qgsprojectlayergroupdialog.h"
#include "qgsrenderer.h"
#include "qgssnappingdialog.h"
#include "qgsrasterlayer.h"
#include "qgsvectorlayer.h"
Expand Down Expand Up @@ -584,7 +583,7 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "Gui", "/SelectionColorGreenPart", myColor.green() );
QgsProject::instance()->writeEntry( "Gui", "/SelectionColorBluePart", myColor.blue() );
QgsProject::instance()->writeEntry( "Gui", "/SelectionColorAlphaPart", myColor.alpha() );
QgsRenderer::setSelectionColor( myColor );
QgsSymbolV2RenderContext::setSelectionColor( myColor );

//set the color for canvas
myColor = pbnCanvasColor->color();
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgsvectorlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "ui_qgsvectorlayerpropertiesbase.h"
#include "qgisgui.h"
#include "qgsrenderer.h"
#include "qgsaddattrdialog.h"
#include "qgsdelattrdialog.h"
#include "qgsattributetypedialog.h"
Expand Down Expand Up @@ -148,8 +147,6 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope

/**Renderer dialog which is shown*/
QDialog* mRendererDialog;
/**Buffer renderer, which is assigned to the vector layer when apply is pressed*/
//QgsRenderer* bufferRenderer;
/**Labeling dialog. If apply is pressed, options are applied to vector's QgsLabel */
QgsLabelingGui* labelingDialog;
/**Label dialog. If apply is pressed, options are applied to vector's QgsLabel */
Expand Down
5 changes: 0 additions & 5 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ SET(QGIS_CORE_SRCS
raster/qgsbrightnesscontrastfilter.cpp
raster/qgshuesaturationfilter.cpp

renderer/qgsrenderer.cpp

symbology/qgsmarkercatalogue.cpp
symbology/qgssymbol.cpp
symbology/qgssymbologyutils.cpp
Expand Down Expand Up @@ -376,7 +374,6 @@ QT4_WRAP_CPP(QGIS_CORE_MOC_SRCS ${QGIS_CORE_MOC_HDRS})
SET(QGIS_CORE_HDRS
${CMAKE_BINARY_DIR}/qgsconfig.h
../plugins/qgisplugin.h
../plugins/qgsrendererplugin.h
qgis.h
qgsapplication.h
qgsattributeaction.h
Expand Down Expand Up @@ -487,8 +484,6 @@ SET(QGIS_CORE_HDRS
raster/qgsrastershaderfunction.h
raster/qgsrasterviewport.h

renderer/qgsrenderer.h

symbology/qgsmarkercatalogue.h
symbology/qgssymbol.h
symbology/qgssymbologyutils.h
Expand Down
8 changes: 6 additions & 2 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "qgsmaplayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaprenderer.h"
#include "qgsrenderer.h" //for brush scaling
#include "qgssymbol.h"
#include "qgssymbolv2.h"
#include <QDomDocument>
Expand Down Expand Up @@ -619,7 +618,12 @@ void QgsComposerLegend::drawPolygonSymbol( QPainter* p, QgsSymbol* s, double cur
if ( paintDevice )
{
double rasterScaleFactor = ( paintDevice->logicalDpiX() + paintDevice->logicalDpiY() ) / 2.0 / 25.4;
QgsRenderer::scaleBrush( symbolBrush, rasterScaleFactor );
if ( rasterScaleFactor != 1.0 )
{
QMatrix m;
m.scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
symbolBrush.setMatrix( m );
}
}
p->setBrush( symbolBrush );

Expand Down
1 change: 0 additions & 1 deletion src/core/composer/qgscomposerlegenditem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "qgscomposerlegend.h"
#include "qgsmaplayerregistry.h"
#include "qgsrasterlayer.h"
#include "qgsrenderer.h"
#include "qgsrendererv2.h"
#include "qgssymbol.h"
#include "qgssymbolv2.h"
Expand Down
1 change: 0 additions & 1 deletion src/core/composer/qgslegendmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "qgsmaplayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsrasterlayer.h"
#include "qgsrenderer.h"
#include "qgsrendererv2.h"
#include "qgssymbollayerv2utils.h"
#include "qgssymbol.h"
Expand Down
9 changes: 1 addition & 8 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@

#include "qgsvectorlayer.h"

// renderers
#include "qgscontinuouscolorrenderer.h"
#include "qgsgraduatedsymbolrenderer.h"
#include "qgsrenderer.h"
#include "qgssinglesymbolrenderer.h"
#include "qgsuniquevaluerenderer.h"

#include "qgsattributeaction.h"

#include "qgis.h" //for globals
Expand Down Expand Up @@ -479,7 +472,7 @@ void QgsVectorLayer::drawRendererV2Levels( QgsFeatureIterator &fit, QgsRenderCon
if ( !mSelectedFeatureIds.isEmpty() )
{
selRenderer = new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( geometryType() ) );
selRenderer->symbol()->setColor( QgsRenderer::selectionColor() );
selRenderer->symbol()->setColor( QgsSymbolV2RenderContext::selectionColor() );
selRenderer->setVertexMarkerAppearance( currentVertexMarkerType(), currentVertexMarkerSize() );
selRenderer->startRender( rendererContext, this );
}
Expand Down
1 change: 0 additions & 1 deletion src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class QgsGeometryVertexIndex;
class QgsMapToPixel;
class QgsLabel;
class QgsRectangle;
class QgsRenderer;
class QgsVectorDataProvider;
class QgsVectorOverlay;
class QgsSingleSymbolRendererV2;
Expand Down
Loading

1 comment on commit 7cc3031

@dakcarto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Martin,

Do you think something related to the changes the default selection color here are causing http://hub.qgis.org/issues/7549 ?

Please sign in to comment.