Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Deprecate some more methods
  • Loading branch information
nyalldawson committed Mar 22, 2019
1 parent 16a64ed commit 427ea51
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
7 changes: 6 additions & 1 deletion python/core/auto_generated/symbology/qgssymbol.sip.in
Expand Up @@ -514,6 +514,7 @@ class QgsSymbolRenderContext
%End
public:


QgsSymbolRenderContext( QgsRenderContext &c, QgsUnitTypes::RenderUnit u, qreal opacity = 1.0, bool selected = false, QgsSymbol::RenderHints renderHints = 0, const QgsFeature *f = 0, const QgsFields &fields = QgsFields(), const QgsMapUnitScale &mapUnitScale = QgsMapUnitScale() );
%Docstring
Constructor for QgsSymbolRenderContext
Expand Down Expand Up @@ -682,7 +683,11 @@ Sets the part number of current geometry
.. versionadded:: 2.16
%End

double outputLineWidth( double width ) const;
double outputLineWidth( double width ) const /Deprecated/;
%Docstring

.. deprecated:: Use the size conversion methods in QgsRenderContext instead.
%End

double outputPixelSize( double size ) const /Deprecated/;
%Docstring
Expand Down
2 changes: 1 addition & 1 deletion src/3d/chunks/qgschunkedentity_p.h
Expand Up @@ -133,7 +133,7 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
//! max. length for replacement queue
int mMaxLoadedChunks = 512;

//! Entity that shows bounding boxes of active chunks (null if not enabled)
//! Entity that shows bounding boxes of active chunks (NULLPTR if not enabled)
QgsChunkBoundsEntity *mBboxesEntity = nullptr;

//! job that is currently being processed (asynchronously in a worker thread)
Expand Down
9 changes: 5 additions & 4 deletions src/core/symbology/qgspointdisplacementrenderer.cpp
Expand Up @@ -100,7 +100,8 @@ void QgsPointDisplacementRenderer::drawGroup( QPointF centerPoint, QgsRenderCont
}
else
{
context.painter()->drawRect( QRectF( centerPoint.x() - symbolContext.outputLineWidth( 1 ), centerPoint.y() - symbolContext.outputLineWidth( 1 ), symbolContext.outputLineWidth( 2 ), symbolContext.outputLineWidth( 2 ) ) );
const double rectSize = symbolContext.renderContext().convertToPainterUnits( 1, QgsUnitTypes::RenderMillimeters );
context.painter()->drawRect( QRectF( centerPoint.x() - rectSize, centerPoint.y() - rectSize, rectSize * 2, rectSize * 2 ) );
}
}

Expand Down Expand Up @@ -247,7 +248,7 @@ void QgsPointDisplacementRenderer::calculateSymbolAndLabelPositions( QgsSymbolRe
return;
}

double circleAdditionPainterUnits = symbolContext.outputLineWidth( mCircleRadiusAddition );
double circleAdditionPainterUnits = symbolContext.renderContext().convertToPainterUnits( mCircleRadiusAddition, QgsUnitTypes::RenderMillimeters );

switch ( mPlacement )
{
Expand Down Expand Up @@ -355,7 +356,7 @@ void QgsPointDisplacementRenderer::drawGrid( int gridSizeUnits, QgsSymbolRenderC
}

QPen gridPen( mCircleColor );
gridPen.setWidthF( context.outputLineWidth( mCircleWidth ) );
gridPen.setWidthF( context.renderContext().convertToPainterUnits( mCircleWidth, QgsUnitTypes::RenderMillimeters ) );
p->setPen( gridPen );

for ( int i = 0; i < pointSymbolPositions.size(); ++i )
Expand Down Expand Up @@ -384,7 +385,7 @@ void QgsPointDisplacementRenderer::drawCircle( double radiusPainterUnits, QgsSym

//draw Circle
QPen circlePen( mCircleColor );
circlePen.setWidthF( context.outputLineWidth( mCircleWidth ) );
circlePen.setWidthF( context.renderContext().convertToPainterUnits( mCircleWidth, QgsUnitTypes::RenderMillimeters ) );
p->setPen( circlePen );
p->drawArc( QRectF( centerPoint.x() - radiusPainterUnits, centerPoint.y() - radiusPainterUnits, 2 * radiusPainterUnits, 2 * radiusPainterUnits ), 0, 5760 );
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/symbology/qgspointdistancerenderer.cpp
Expand Up @@ -394,7 +394,9 @@ void QgsPointDistanceRenderer::drawLabels( QPointF centerPoint, QgsSymbolRenderC

//scale font (for printing)
QFont pixelSizeFont = mLabelFont;
pixelSizeFont.setPixelSize( context.outputLineWidth( mLabelFont.pointSizeF() * 0.3527 ) );

const double fontSizeInPixels = context.renderContext().convertToPainterUnits( mLabelFont.pointSizeF(), QgsUnitTypes::RenderPoints );
pixelSizeFont.setPixelSize( static_cast< int >( std::round( fontSizeInPixels ) ) );
QFont scaledFont = pixelSizeFont;
scaledFont.setPixelSize( pixelSizeFont.pixelSize() );
p->setFont( scaledFont );
Expand Down
7 changes: 6 additions & 1 deletion src/core/symbology/qgssymbol.h
Expand Up @@ -550,6 +550,8 @@ class CORE_EXPORT QgsSymbolRenderContext
{
public:

//TODO QGIS 4.0 - remove mapUnitScale

/**
* Constructor for QgsSymbolRenderContext
* \param c
Expand Down Expand Up @@ -701,7 +703,10 @@ class CORE_EXPORT QgsSymbolRenderContext
*/
void setGeometryPartNum( int num ) { mGeometryPartNum = num; }

double outputLineWidth( double width ) const;
/**
* \deprecated Use the size conversion methods in QgsRenderContext instead.
*/
Q_DECL_DEPRECATED double outputLineWidth( double width ) const SIP_DEPRECATED;

/**
* \deprecated Use the size conversion methods in QgsRenderContext instead.
Expand Down

0 comments on commit 427ea51

Please sign in to comment.