Remove option to show label shadow rectangles from GUI

...and instead just make it #ifdef out
This commit is contained in:
Nyall Dawson 2016-09-27 14:29:47 +10:00
parent 4d5e7536d9
commit aac2622816
8 changed files with 49 additions and 91 deletions

View File

@ -638,7 +638,6 @@ class QgsPalLayerSettings
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
bool showingShadowRects; // whether to show debug rectangles for drop shadows
};
class QgsLabelCandidate
@ -764,9 +763,6 @@ class QgsPalLabeling : QgsLabelingEngineInterface
bool isShowingCandidates() const;
void setShowingCandidates( bool showing );
bool isShowingShadowRectangles() const;
void setShowingShadowRectangles( bool showing );
bool isShowingAllLabels() const;
void setShowingAllLabels( bool showing );

View File

@ -43,7 +43,6 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QWidget* parent )
chkShowCandidates->setChecked( lbl.isShowingCandidates() );
chkShowAllLabels->setChecked( lbl.isShowingAllLabels() );
mShadowDebugRectChkBox->setChecked( lbl.isShowingShadowRectangles() );
chkShowPartialsLabels->setChecked( lbl.isShowingPartialsLabels() );
mDrawOutlinesChkBox->setChecked( lbl.isDrawingOutlineLabels() );
@ -62,7 +61,6 @@ void QgsLabelEngineConfigDialog::onOK()
spinCandPolygon->value() );
lbl.setShowingCandidates( chkShowCandidates->isChecked() );
lbl.setShowingShadowRectangles( mShadowDebugRectChkBox->isChecked() );
lbl.setShowingAllLabels( chkShowAllLabels->isChecked() );
lbl.setShowingPartialsLabels( chkShowPartialsLabels->isChecked() );
lbl.setDrawingOutlineLabels( mDrawOutlinesChkBox->isChecked() );
@ -81,7 +79,6 @@ void QgsLabelEngineConfigDialog::setDefaults()
spinCandPolygon->setValue( p.getPolyP() );
chkShowCandidates->setChecked( false );
chkShowAllLabels->setChecked( false );
mShadowDebugRectChkBox->setChecked( false );
chkShowPartialsLabels->setChecked( p.getShowPartial() );
mDrawOutlinesChkBox->setChecked( true );
}

View File

@ -349,7 +349,6 @@ void QgsLabelingEngine::readSettingsFromProject()
mFlags = 0;
if ( prj->readBoolEntry( "PAL", "/ShowingCandidates", false, &saved ) ) mFlags |= DrawCandidates;
if ( prj->readBoolEntry( "PAL", "/DrawRectOnly", false, &saved ) ) mFlags |= DrawLabelRectOnly;
if ( prj->readBoolEntry( "PAL", "/ShowingShadowRects", false, &saved ) ) mFlags |= DrawShadowRects;
if ( prj->readBoolEntry( "PAL", "/ShowingAllLabels", false, &saved ) ) mFlags |= UseAllLabels;
if ( prj->readBoolEntry( "PAL", "/ShowingPartialsLabels", true, &saved ) ) mFlags |= UsePartialCandidates;
if ( prj->readBoolEntry( "PAL", "/DrawOutlineLabels", true, &saved ) ) mFlags |= RenderOutlineLabels;
@ -364,7 +363,6 @@ void QgsLabelingEngine::writeSettingsToProject()
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mFlags.testFlag( DrawCandidates ) );
QgsProject::instance()->writeEntry( "PAL", "/DrawRectOnly", mFlags.testFlag( DrawLabelRectOnly ) );
QgsProject::instance()->writeEntry( "PAL", "/ShowingShadowRects", mFlags.testFlag( DrawShadowRects ) );
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mFlags.testFlag( UseAllLabels ) );
QgsProject::instance()->writeEntry( "PAL", "/ShowingPartialsLabels", mFlags.testFlag( UsePartialCandidates ) );
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", mFlags.testFlag( RenderOutlineLabels ) );

View File

@ -172,7 +172,6 @@ class CORE_EXPORT QgsLabelingEngine
RenderOutlineLabels = 1 << 3, //!< Whether to render labels as text or outlines
DrawLabelRectOnly = 1 << 4, //!< Whether to only draw the label rect and not the actual label text (used for unit tests)
DrawCandidates = 1 << 5, //!< Whether to draw rectangles of generated candidates (good for debugging)
DrawShadowRects = 1 << 6, //!< Whether to show debugging rectangles for drop shadows
};
Q_DECLARE_FLAGS( Flags, Flag )

View File

@ -290,8 +290,6 @@ QgsPalLayerSettings::QgsPalLayerSettings()
mDataDefinedNames.insert( Show, QPair<QString, int>( "Show", 15 ) );
mDataDefinedNames.insert( AlwaysShow, QPair<QString, int>( "AlwaysShow", 20 ) );
// temp stuff for when drawing label components (don't copy)
showingShadowRects = false;
}
QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
@ -302,7 +300,6 @@ QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
, mFeaturesToLabel( 0 )
, mFeatsSendingToPal( 0 )
, mFeatsRegPal( 0 )
, showingShadowRects( false )
, expression( nullptr )
{
*this = s;
@ -3983,16 +3980,6 @@ void QgsPalLabeling::setShowingCandidates( bool showing )
mEngine->setFlag( QgsLabelingEngine::DrawCandidates, showing );
}
bool QgsPalLabeling::isShowingShadowRectangles() const
{
return mEngine->testFlag( QgsLabelingEngine::DrawShadowRects );
}
void QgsPalLabeling::setShowingShadowRectangles( bool showing )
{
mEngine->setFlag( QgsLabelingEngine::DrawShadowRects, showing );
}
bool QgsPalLabeling::isShowingAllLabels() const
{
return mEngine->testFlag( QgsLabelingEngine::UseAllLabels );
@ -4510,19 +4497,18 @@ void QgsPalLabeling::drawLabelShadow( QgsRenderContext& context,
QgsSymbolLayerUtils::blurImageInPlace( blurImg, blurImg.rect(), radius, shadow.blurAlphaOnly() );
}
if ( tmpLyr.showingShadowRects ) // engine setting, not per layer
{
// debug rect for QImage shadow registration and clipping visualization
QPainter picti;
picti.begin( &blurImg );
picti.setBrush( Qt::Dense7Pattern );
QPen imgPen( QColor( 0, 0, 255, 255 ) );
imgPen.setWidth( 1 );
picti.setPen( imgPen );
picti.setOpacity( 0.1 );
picti.drawRect( 0, 0, blurImg.width(), blurImg.height() );
picti.end();
}
#if 0
// debug rect for QImage shadow registration and clipping visualization
QPainter picti;
picti.begin( &blurImg );
picti.setBrush( Qt::Dense7Pattern );
QPen imgPen( QColor( 0, 0, 255, 255 ) );
imgPen.setWidth( 1 );
picti.setPen( imgPen );
picti.setOpacity( 0.1 );
picti.drawRect( 0, 0, blurImg.width(), blurImg.height() );
picti.end();
#endif
double offsetDist = QgsTextRenderer::scaleToPixelContext( shadow.offsetDistance(), context,
shadow.offsetUnit(), true, shadow.offsetMapUnitScale() );
@ -4562,39 +4548,38 @@ void QgsPalLabeling::drawLabelShadow( QgsRenderContext& context,
p->restore();
// debug rects
if ( tmpLyr.showingShadowRects ) // engine setting, not per layer
#if 0
// draw debug rect for QImage painting registration
p->save();
p->setBrush( Qt::NoBrush );
QPen imgPen( QColor( 255, 0, 0, 10 ) );
imgPen.setWidth( 2 );
imgPen.setStyle( Qt::DashLine );
p->setPen( imgPen );
p->scale( scale, scale );
if ( component.useOrigin() )
{
// draw debug rect for QImage painting registration
p->save();
p->setBrush( Qt::NoBrush );
QPen imgPen( QColor( 255, 0, 0, 10 ) );
imgPen.setWidth( 2 );
imgPen.setStyle( Qt::DashLine );
p->setPen( imgPen );
p->scale( scale, scale );
if ( component.useOrigin() )
{
p->translate( component.origin().x(), component.origin().y() );
}
p->translate( transPt );
p->translate( -imgOffset.x(),
-imgOffset.y() );
p->drawRect( 0, 0, blurImg.width(), blurImg.height() );
p->restore();
// draw debug rect for passed in component dimensions
p->save();
p->setBrush( Qt::NoBrush );
QPen componentRectPen( QColor( 0, 255, 0, 70 ) );
componentRectPen.setWidth( 1 );
if ( component.useOrigin() )
{
p->translate( component.origin().x(), component.origin().y() );
}
p->setPen( componentRectPen );
p->drawRect( QRect( -xOffset, -componentHeight - yOffset, componentWidth, componentHeight ) );
p->restore();
p->translate( component.origin().x(), component.origin().y() );
}
p->translate( transPt );
p->translate( -imgOffset.x(),
-imgOffset.y() );
p->drawRect( 0, 0, blurImg.width(), blurImg.height() );
p->restore();
// draw debug rect for passed in component dimensions
p->save();
p->setBrush( Qt::NoBrush );
QPen componentRectPen( QColor( 0, 255, 0, 70 ) );
componentRectPen.setWidth( 1 );
if ( component.useOrigin() )
{
p->translate( component.origin().x(), component.origin().y() );
}
p->setPen( componentRectPen );
p->drawRect( QRect( -xOffset, -componentHeight - yOffset, componentWidth, componentHeight ) );
p->restore();
#endif
}
void QgsPalLabeling::loadEngineSettings()
@ -4614,7 +4599,6 @@ void QgsPalLabeling::clearEngineSettings()
QgsProject::instance()->removeEntry( "PAL", "/CandidatesLine" );
QgsProject::instance()->removeEntry( "PAL", "/CandidatesPolygon" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingShadowRects" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingPartialsLabels" );
QgsProject::instance()->removeEntry( "PAL", "/DrawOutlineLabels" );
@ -4626,7 +4610,6 @@ QgsPalLabeling* QgsPalLabeling::clone()
lbl->setShowingAllLabels( isShowingAllLabels() );
lbl->setShowingCandidates( isShowingCandidates() );
lbl->setDrawLabelRectOnly( drawLabelRectOnly() );
lbl->setShowingShadowRectangles( isShowingShadowRectangles() );
lbl->setShowingPartialsLabels( isShowingPartialsLabels() );
lbl->setDrawingOutlineLabels( isDrawingOutlineLabels() );
return lbl;

View File

@ -658,8 +658,6 @@ class CORE_EXPORT QgsPalLayerSettings
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
bool showingShadowRects; // whether to show debug rectangles for drop shadows
private:
void readDataDefinedPropertyMap( QgsVectorLayer* layer, QDomElement* parentElem,
@ -890,9 +888,6 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
bool isShowingCandidates() const;
void setShowingCandidates( bool showing );
bool isShowingShadowRectangles() const;
void setShowingShadowRectangles( bool showing );
bool isShowingAllLabels() const;
void setShowingAllLabels( bool showing );

View File

@ -456,8 +456,6 @@ void QgsVectorLayerLabelProvider::drawLabel( QgsRenderContext& context, pal::Lab
// update tmpLyr with any data defined drop shadow values
QgsPalLabeling::dataDefinedDropShadow( tmpLyr, ddValues );
tmpLyr.showingShadowRects = mEngine->testFlag( QgsLabelingEngine::DrawShadowRects );
// Render the components of a label in reverse order
// (backgrounds -> text)

View File

@ -215,20 +215,6 @@
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="chkShowPartialsLabels">
<property name="text">
<string>Show partials labels</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="mShadowDebugRectChkBox">
<property name="text">
<string>Show shadow rectangles (for debugging)</string>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
@ -298,6 +284,13 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="chkShowPartialsLabels">
<property name="text">
<string>Show partials labels</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -334,7 +327,6 @@
<tabstop>chkShowPartialsLabels</tabstop>
<tabstop>chkShowAllLabels</tabstop>
<tabstop>chkShowCandidates</tabstop>
<tabstop>mShadowDebugRectChkBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>