Skip to content
Permalink
Browse files
Added the possibility for renderers to have different transparency le…
…vels for different classes

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6967 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 30, 2007
1 parent 9e763f2 commit 52c37ff30320a19e5a1a9a848f295b50d994d657
Showing with 26 additions and 3 deletions.
  1. +3 −0 python/core/qgsrenderer.sip
  2. +20 −3 src/core/qgsvectorlayer.cpp
  3. +3 −0 src/core/renderer/qgsrenderer.h
@@ -38,6 +38,9 @@ class QgsRenderer /Abstract/
static void setSelectionColor(QColor color);
/**Returns true if this renderer returns a pixmap in the render method (e.g. for point data or diagrams)*/
virtual bool containsPixmap() const;
/**Returns true if this renderer uses its own transparency settings, e.g. differentiated by classification.
This is a hint for QgsVectorLayer to not use the transparency setting on layer level in this cases*/
virtual bool usesTransparency() const;

};

@@ -407,7 +407,12 @@ unsigned char* QgsVectorLayer::drawLineString(unsigned char* feature,
//
QPen myTransparentPen = p->pen(); // store current pen
QColor myColor = myTransparentPen.color();
myColor.setAlpha(mTransparencyLevel);
//only set transparency from layer level if renderer does not provide
//transparency on class level
if(!mRenderer->usesTransparency())
{
myColor.setAlpha(mTransparencyLevel);
}
myTransparentPen.setColor(myColor);
p->setPen(myTransparentPen);
p->drawPolyline(pa);
@@ -631,11 +636,23 @@ std::cerr << i << ": " << ring->first[i]
//
QBrush myTransparentBrush = p->brush();
QColor myColor = brush.color();
myColor.setAlpha(mTransparencyLevel);

//only set transparency from layer level if renderer does not provide
//transparency on class level
if(!mRenderer->usesTransparency())
{
myColor.setAlpha(mTransparencyLevel);
}
myTransparentBrush.setColor(myColor);
QPen myTransparentPen = p->pen(); // store current pen
myColor = myTransparentPen.color();
myColor.setAlpha(mTransparencyLevel);

//only set transparency from layer level if renderer does not provide
//transparency on class level
if(!mRenderer->usesTransparency())
{
myColor.setAlpha(mTransparencyLevel);
}
myTransparentPen.setColor(myColor);

p->setBrush(myTransparentBrush);
@@ -73,6 +73,9 @@ class CORE_EXPORT QgsRenderer
static void setSelectionColor(QColor color);
/**Returns true if this renderer returns a pixmap in the render method (e.g. for point data or diagrams)*/
virtual bool containsPixmap() const;
/**Returns true if this renderer uses its own transparency settings, e.g. differentiated by classification.
This is a hint for QgsVectorLayer to not use the transparency setting on layer level in this cases*/
virtual bool usesTransparency() const {return false;}

protected:
/**Color to draw selected features - static so we can change it in proj props and automatically

0 comments on commit 52c37ff

Please sign in to comment.