Skip to content
Permalink
Browse files

[3d] If a buffered line symbol is set to 0 width, transparently bump the

width up to a tiny amount so that the tesselator actually has a (super narrow)
polygon to work from

This means that 3d buffered lines set to 0 width will actually render like
walls or fences, matching user expectations...

(cherry picked from commit d2f95d5)
  • Loading branch information
nyalldawson committed Dec 21, 2020
1 parent 46e9452 commit 1da434b3b2a629997d5026399953395693dd86ae
Showing with 11 additions and 3 deletions.
  1. +10 −1 src/3d/symbols/qgsline3dsymbol_p.cpp
  2. +1 −2 src/app/3d/qgsline3dsymbolwidget.cpp
@@ -119,7 +119,16 @@ void QgsBufferedLine3DSymbolHandler::processFeature( QgsFeature &f, const Qgs3DR
const double mitreLimit = 0;

QgsGeos engine( g );
QgsAbstractGeometry *buffered = engine.buffer( mSymbol->width() / 2., nSegments, endCapStyle, joinStyle, mitreLimit ); // factory

double width = mSymbol->width();
if ( qgsDoubleNear( width, 0 ) )
{
// a zero-width buffered line should be treated like a "wall" or "fence" -- we fake this by bumping the width to a very tiny amount,
// so that we get a very narrow polygon shape to work with...
width = 0.001;
}

QgsAbstractGeometry *buffered = engine.buffer( width / 2., nSegments, endCapStyle, joinStyle, mitreLimit ); // factory
if ( !buffered )
return;

@@ -24,7 +24,7 @@ QgsLine3DSymbolWidget::QgsLine3DSymbolWidget( QWidget *parent )
setupUi( this );

spinHeight->setClearValue( 0.0 );
spinWidth->setClearValue( 0.0 );
spinWidth->setClearValue( 0.0, tr( "Hairline" ) );
spinExtrusion->setClearValue( 0.0 );

QgsLine3DSymbol defaultLine;
@@ -86,7 +86,6 @@ QString QgsLine3DSymbolWidget::symbolType() const
void QgsLine3DSymbolWidget::updateGuiState()
{
bool simple = chkSimpleLines->isChecked();
//spinWidth->setEnabled( !simple );
spinExtrusion->setEnabled( !simple );
widgetMaterial->setTechnique( chkSimpleLines->isChecked() ? QgsMaterialSettingsRenderingTechnique::Lines
: QgsMaterialSettingsRenderingTechnique::Triangles );

0 comments on commit 1da434b

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