~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgsrenderer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "qgslegendvectorsymbologyitem.h"
2
 
#include "qgsrenderer.h"
3
 
#include "qgssymbol.h"
4
 
//Added by qt3to4:
5
 
#include <QPixmap>
6
 
#include <QIcon>
7
 
 
8
 
 
9
 
QColor QgsRenderer::mSelectionColor=QColor(0,0,0);
10
 
 
11
 
QgsRenderer::QgsRenderer()
12
 
{
13
 
 
14
 
}
15
 
 
16
 
void QgsRenderer::refreshLegend(std::list< std::pair<QString, QPixmap> >* symbologyList) const
17
 
{
18
 
    if(symbologyList)
19
 
    {
20
 
      //add the new items
21
 
      QString lw, uv, label;
22
 
      const std::list<QgsSymbol*> sym = symbols();
23
 
        
24
 
      for(std::list<QgsSymbol*>::const_iterator it=sym.begin(); it!=sym.end(); ++it)
25
 
        {
26
 
          QPixmap pix;
27
 
          if((*it)->type() == QGis::Point)
28
 
            {
29
 
              pix = (*it)->getPointSymbolAsPixmap();
30
 
            }
31
 
          else if((*it)->type() == QGis::Line)
32
 
            {
33
 
              pix = (*it)->getLineSymbolAsPixmap();
34
 
            }
35
 
          else //polygon
36
 
            {
37
 
              pix = (*it)->getPolygonSymbolAsPixmap();
38
 
            }
39
 
 
40
 
          QString values;
41
 
          lw = (*it)->lowerValue();
42
 
          if(!lw.isEmpty())
43
 
            {
44
 
              values += lw;
45
 
            }
46
 
          uv = (*it)->upperValue();
47
 
          if(!uv.isEmpty())
48
 
            {
49
 
              values += " - ";
50
 
              values += uv;
51
 
            }
52
 
          label = (*it)->label();
53
 
          if(!label.isEmpty())
54
 
            {
55
 
              values += " ";
56
 
              values += label;
57
 
            }
58
 
          symbologyList->push_back(std::make_pair(values, pix));
59
 
        }
60
 
    }
61
 
}
62
 
 
63
 
bool QgsRenderer::containsPixmap() const
64
 
{
65
 
  //default implementation returns true only for points
66
 
  switch(mVectorType)
67
 
    {
68
 
    case QGis::Point:
69
 
       return true;
70
 
    default:
71
 
      return false;
72
 
    }
73
 
}
74
 
 
75
 
bool QgsRenderer::willRenderFeature(QgsFeature *f) 
76
 
{
77
 
  // Normally render the feature, unless told otherwise
78
 
  return true;
79
 
}