Skip to content
Permalink
Browse files

dwg import: implement suggestion from #21330

(cherry picked from commit 6bf2d9d)
  • Loading branch information
jef-n committed Feb 22, 2019
1 parent 17ed796 commit b4cf2fdf8a1b938b1b6d04a59e373befde0bea8a
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/app/dwg/qgsdwgimportdialog.cpp
@@ -329,16 +329,27 @@ void QgsDwgImportDialog::createGroup( QgsLayerTreeGroup *group, const QString &n
l = layer( layerGroup, layerFilter, QStringLiteral( "polylines" ) );
if ( l )
{
sym = new QgsLineSymbol();

QgsSimpleLineSymbolLayer *sll = new QgsSimpleLineSymbolLayer();
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( QStringLiteral( "color" ) ) );
sll->setPenJoinStyle( Qt::MiterJoin );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( QStringLiteral( "width" ) ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyLayerEnabled, QgsProperty::fromExpression( QStringLiteral( "width>0" ) ) );
sll->setOutputUnit( QgsUnitTypes::RenderMapUnits );
// sll->setUseCustomDashPattern( true );
// sll->setCustomDashPatternUnit( QgsSymbolV2::MapUnit );
// sll->setDataDefinedProperty( QgsSymbolLayer::PropertyCustomDash, QgsProperty::fromField( "linetype" ) );
sym = new QgsLineSymbol();
sym->changeSymbolLayer( 0, sll );
sym->setOutputUnit( QgsUnitTypes::RenderMapUnits );

sll = new QgsSimpleLineSymbolLayer();
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromField( QStringLiteral( "color" ) ) );
sll->setPenJoinStyle( Qt::MiterJoin );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeWidth, QgsProperty::fromField( QStringLiteral( "linewidth" ) ) );
sll->setDataDefinedProperty( QgsSymbolLayer::PropertyLayerEnabled, QgsProperty::fromExpression( QStringLiteral( "width=0" ) ) );
sll->setOutputUnit( QgsUnitTypes::RenderMillimeters );
sym->appendSymbolLayer( sll );

l->setRenderer( new QgsSingleSymbolRenderer( sym ) );
}

0 comments on commit b4cf2fd

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