Navigation Menu

Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 29, 2021
1 parent 4131714 commit d4fceb2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmvectorize.cpp
Expand Up @@ -113,7 +113,7 @@ QVariantMap QgsVectorizeAlgorithmBase::processAlgorithm( const QVariantMap &para
for ( int column = 0; column < iterCols; column++ )
{
const double value = rasterBlock->valueAndNoData( row, column, isNoData );
if ( !isNoData && !qgsDoubleNear( value, 0.0 ) )
if ( !isNoData )
{
const QgsGeometry pixelRectGeometry = createGeometryForPixel( currentX, currentY, mRasterUnitsPerPixelX, mRasterUnitsPerPixelY );

Expand Down
8 changes: 4 additions & 4 deletions src/core/maprenderer/qgsmaprendererjob.h
Expand Up @@ -354,16 +354,16 @@ class CORE_EXPORT QgsMapRendererJob : public QObject SIP_ABSTRACT

/**
* Returns the label sink associated to this rendering job.
* \note not available in Python bindings
* \note Not available in Python bindings.
* \since QGIS 3.24
*/
QgsLabelSink *labelSink() const { return mLabelSink; } SIP_SKIP

/**
* Assigns the label sink which will take over responsability for handling labels
* Assigns the label sink which will take over responsibility for handling labels
* during the rendering job.
* \note the ownership is not transferred
* \note not available in Python bindings
* \note Ownership is not transferred and the sink must exist for the lifetime of the map rendering job.
* \note Not available in Python bindings.
* \since QGIS 3.24
*/
void setLabelSink( QgsLabelSink *sink ) { mLabelSink = sink; } SIP_SKIP
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsrendercontext.cpp
Expand Up @@ -56,6 +56,7 @@ QgsRenderContext::QgsRenderContext( const QgsRenderContext &rh )
, mRendererScale( rh.mRendererScale )
, mSymbologyReferenceScale( rh.mSymbologyReferenceScale )
, mLabelingEngine( rh.mLabelingEngine )
, mLabelSink( rh.mLabelSink )
, mSelectionColor( rh.mSelectionColor )
, mVectorSimplifyMethod( rh.mVectorSimplifyMethod )
, mExpressionContext( rh.mExpressionContext )
Expand Down Expand Up @@ -99,6 +100,7 @@ QgsRenderContext &QgsRenderContext::operator=( const QgsRenderContext &rh )
mRendererScale = rh.mRendererScale;
mSymbologyReferenceScale = rh.mSymbologyReferenceScale;
mLabelingEngine = rh.mLabelingEngine;
mLabelSink = rh.mLabelSink;
mSelectionColor = rh.mSelectionColor;
mVectorSimplifyMethod = rh.mVectorSimplifyMethod;
mExpressionContext = rh.mExpressionContext;
Expand Down
12 changes: 7 additions & 5 deletions src/core/qgsrendercontext.h
Expand Up @@ -361,13 +361,14 @@ class CORE_EXPORT QgsRenderContext : public QgsTemporalRangeObject
double symbologyReferenceScale() const { return mSymbologyReferenceScale; }

/**
* Gets access to new labeling engine (may be NULLPTR)
* \note not available in Python bindings
* Gets access to new labeling engine (may be NULLPTR).
* \note Not available in Python bindings.
*/
QgsLabelingEngine *labelingEngine() const { return mLabelingEngine; } SIP_SKIP

/**
* Returns the associated label sink, or NULLPTR if not set.
* \note Not available in Python bindings.
* \since QGIS 3.24
*/
QgsLabelSink *labelSink() const { return mLabelSink; } SIP_SKIP
Expand Down Expand Up @@ -539,13 +540,14 @@ class CORE_EXPORT QgsRenderContext : public QgsTemporalRangeObject

/**
* Assigns the labeling engine
* \note not available in Python bindings
* \note Not available in Python bindings.
*/
void setLabelingEngine( QgsLabelingEngine *engine ) { mLabelingEngine = engine; } SIP_SKIP

/**
* Assigns the label sink which will take over responsability for handling labels.
* \note the ownership is not transferred
* Assigns the label sink which will take over responsibility for handling labels.
* \note Ownership is not transferred and the sink must exist for the lifetime of the map rendering job.
* \note Not available in Python bindings.
* \since QGIS 3.24
*/
void setLabelSink( QgsLabelSink *sink ) { mLabelSink = sink; } SIP_SKIP
Expand Down
20 changes: 7 additions & 13 deletions src/core/vector/qgsvectorlayerrenderer.cpp
Expand Up @@ -736,24 +736,18 @@ void QgsVectorLayerRenderer::prepareLabeling( QgsVectorLayer *layer, QSet<QStrin
QgsPalLayerSettings settings = layer->labeling()->settings();
mLabelProvider = new QgsLabelSinkProvider( layer, QString(), context.labelSink(), &settings );
}
engine2->addProvider( mLabelProvider );
if ( !mLabelProvider->prepare( context, attributeNames ) )
{
engine2->removeProvider( mLabelProvider );
mLabelProvider = nullptr;
}
}
else
{
mLabelProvider = layer->labeling()->provider( layer );
if ( mLabelProvider )
}
if ( mLabelProvider )
{
engine2->addProvider( mLabelProvider );
if ( !mLabelProvider->prepare( context, attributeNames ) )
{
engine2->addProvider( mLabelProvider );
if ( !mLabelProvider->prepare( context, attributeNames ) )
{
engine2->removeProvider( mLabelProvider );
mLabelProvider = nullptr; // deleted by engine
}
engine2->removeProvider( mLabelProvider );
mLabelProvider = nullptr; // deleted by engine
}
}
}
Expand Down

0 comments on commit d4fceb2

Please sign in to comment.