Skip to content
Permalink
Browse files

Deprecate some more methods

  • Loading branch information
nyalldawson committed Mar 19, 2019
1 parent 16a64ed commit 427ea515a52db6ed2cb5b8d6d72d914edd1b3eb2
@@ -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
@@ -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
@@ -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)
@@ -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 ) );
}
}

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

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

switch ( mPlacement )
{
@@ -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 )
@@ -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 );
}
@@ -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 );
@@ -550,6 +550,8 @@ class CORE_EXPORT QgsSymbolRenderContext
{
public:

//TODO QGIS 4.0 - remove mapUnitScale

/**
* Constructor for QgsSymbolRenderContext
* \param c
@@ -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.

0 comments on commit 427ea51

Please sign in to comment.
You can’t perform that action at this time.