Skip to content

Commit

Permalink
Added the possibility for renderers to have different transparency le…
Browse files Browse the repository at this point in the history
…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 52c37ff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions python/core/qgsrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;

};

23 changes: 20 additions & 3 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/core/renderer/qgsrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52c37ff

Please sign in to comment.