25 mCategoryBrush.
setStyle( Qt::SolidPattern );
46 attrVal = expression->
evaluate( feature );
58 double scaledValue = attrVal.
toDouble();
69 scaledValue = sqrt( scaledValue );
70 scaledLowerValue = sqrt( scaledLowerValue );
71 scaledUpperValue = sqrt( scaledUpperValue );
72 scaledLowerSizeWidth = sqrt( scaledLowerSizeWidth );
73 scaledLowerSizeHeight = sqrt( scaledLowerSizeHeight );
74 scaledUpperSizeWidth = sqrt( scaledUpperSizeWidth );
75 scaledUpperSizeHeight = sqrt( scaledUpperSizeHeight );
79 double scaledRatio = ( scaledValue - scaledLowerValue ) / ( scaledUpperValue - scaledLowerValue );
104 Q_UNUSED( attributes );
108 int QgsPieDiagram::sCount = 0;
120 double currentVal = 0;
130 valSum += currentVal;
131 if ( currentVal ) valCount++;
135 double totalAngle = 0;
140 double w = spu.
width();
143 double baseX = position.
x();
144 double baseY = position.
y() - h;
155 for ( ; valIt != values.
constEnd(); ++valIt, ++colIt )
159 currentAngle = *valIt / valSum * 360 * 16;
171 totalAngle += currentAngle;
178 mCategoryBrush.
setColor( Qt::transparent );
Class for parsing and evaluation of expressions (formerly called "search strings").
double minimumSize
Scale diagrams smaller than mMinimumSize to mMinimumSize.
void setStyle(Qt::PenStyle style)
void scale(qreal width, qreal height, Qt::AspectRatioMode mode)
void push_back(const T &value)
QVariant evaluate(const QgsFeature *f=NULL)
Evaluate the feature and return the result.
QList< QString > categoryAttributes
QgsExpression * getExpression(const QString &expression, const QgsFields *fields)
bool classificationAttributeIsExpression
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void setStyle(Qt::BrushStyle style)
QSizeF sizePainterUnits(const QSizeF &size, const QgsDiagramSettings &s, const QgsRenderContext &c)
Calculates a size to match the current settings and rendering context.
void renderDiagram(const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, const QPointF &position) override
Draws the diagram at the given position (in pixel coordinates)
QgsAttributes attributes() const
Returns the feature's attributes.
void setPen(const QColor &color)
void drawEllipse(const QRectF &rectangle)
void setWidth(qreal width)
QString classificationAttributeExpression
const QgsFields * fields() const
Returns the field map associated with the feature.
virtual QgsDiagram * clone() const override
Returns an instance that is equivalent to this one.
void setBrush(const QBrush &brush)
void setColor(const QColor &color)
Base class for all diagram types.
void drawPie(const QRectF &rectangle, int startAngle, int spanAngle)
Contains information about the context of a rendering operation.
double toDouble(bool *ok) const
int classificationAttribute
Index of the classification attribute.
const_iterator constEnd() const
const_iterator constBegin() const
void setPenWidth(QPen &pen, const QgsDiagramSettings &s, const QgsRenderContext &c)
Changes the pen width to match the current settings and rendering context.
QList< QColor > categoryColors
void setColor(const QColor &color)
QSizeF diagramSize(const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s) override
Returns the size in map units the diagram will use to render.