[Qgis-developer] line renderer and composition mode
Andrea Peri
aperi2007 at gmail.com
Wed Aug 27 07:20:14 PDT 2014
Your solution is not always good.
You should could use the level symbols to give what symbol won in overlap.
A.
2014-08-27 14:53 GMT+02:00 Jürgen E. <jef at norbit.de>:
> Hi,
>
> any objections to have the line symbol layer render in composition mode
> "source"?
>
> I have a layer with multiple levels of administrative boundaries, where higher
> level boundaries (eg. state) lie over lower level boundaries (county). Lower
> level boundaries should not be visible if there is a higher level boundary on
> top of them. The styles are dash-dotted - so the lines don't fully cover the
> lines below.
>
> I could solve that by putting a white line on the bottom of the symbol, but
> that would also mean that layers below are covered, that I still would like
> see.
>
> Rendering the line in "source" composition would allow to have a fully
> transparent line symbol layers on the bottom of the symbol that would overwrite
> the already rendered lines on that layer with transparency.
>
> Is that already possible in a different way (without resorting to multiple
> vector layers) to achieve the same? Or does it introduce some problem that I
> didn't think of? It could still be optional...
>
>
> Jürgen
>
>
> diff --git a/src/core/symbology-ng/qgslinesymbollayerv2.cpp b/src/core/symbology-ng/qgslinesymbollayerv2.cpp
> index 5a06f23..e21474a 100644
> --- a/src/core/symbology-ng/qgslinesymbollayerv2.cpp
> +++ b/src/core/symbology-ng/qgslinesymbollayerv2.cpp
> @@ -207,10 +207,12 @@ void QgsSimpleLineSymbolLayerV2::renderPolygonOutline( const QPolygonF& points,
> return;
> }
>
> + p->save();
> + p->setCompositionMode( QPainter::CompositionMode_Source );
> +
> if ( mDrawInsidePolygon )
> {
> //only drawing the line on the interior of the polygon, so set clip path for painter
> - p->save();
> QPainterPath clipPath;
> clipPath.addPolygon( points );
>
> @@ -236,11 +238,8 @@ void QgsSimpleLineSymbolLayerV2::renderPolygonOutline( const QPolygonF& points,
> renderPolyline( ring, context );
> }
>
> - if ( mDrawInsidePolygon )
> - {
> - //restore painter to reset clip path
> - p->restore();
> - }
> + //restore painter's composition mode and reset clip path
> + p->restore();
>
> }
>
> @@ -252,6 +251,9 @@ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
> return;
> }
>
> + p->save();
> + p->setCompositionMode( QPainter::CompositionMode_Source );
> +
> double offset = 0.0;
> applyDataDefinedSymbology( context, mPen, mSelPen, offset );
>
> @@ -280,6 +282,8 @@ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
> for ( int part = 0; part < mline.count(); ++part )
> p->drawPolyline( mline[ part ] );
> }
> +
> + p->restore();
> }
>
> QgsStringMap QgsSimpleLineSymbolLayerV2::properties() const
>
>
>
> --
> Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
> Software Engineer D-26506 Norden http://www.norbit.de
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFT/dS6c/GhTF5ESHURAk2fAJ4jTVoeU69IRlX2TPOzrL5KZGSeGACgs7gP
> yPIP/+rhT1MnuZypz3l/OzM=
> =0y5K
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
More information about the Qgis-developer
mailing list