24 mCategoryBrush.
setStyle( Qt::SolidPattern );
87 if ( attributes.
count() == 0 )
92 double maxValue = attributes[0].toDouble();
94 for (
int i = 0; i < attributes.
count(); ++i )
96 maxValue = qMax( attributes[i].toDouble(), maxValue );
110 mScaleFactor = maxValue / s.
size.
width();
134 maxValue = qMax( currentVal, maxValue );
139 double currentOffset = 0;
142 double baseX = position.
x();
143 double baseY = position.
y();
151 for ( ; valIt != values.
constEnd(); ++valIt, ++colIt )
161 p->
drawRect( baseX + currentOffset, baseY, scaledWidth, length * -1 );
165 p->
drawRect( baseX + currentOffset, baseY - scaledMaxVal, scaledWidth, length );
169 p->
drawRect( baseX, baseY - currentOffset, length, scaledWidth * -1 );
173 p->
drawRect( baseX + scaledMaxVal, baseY - currentOffset, 0 - length, scaledWidth * -1 );
177 currentOffset += scaledWidth;
Class for parsing and evaluation of expressions (formerly called "search strings").
QSizeF diagramSize(const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s) override
Returns the size in map units the diagram will use to render.
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)
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 drawRect(const QRectF &rectangle)
DiagramOrientation diagramOrientation
QgsAttributes attributes() const
Returns the feature's attributes.
void setPen(const QColor &color)
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 renderDiagram(const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, const QPointF &position) override
Draws the diagram at the given position (in pixel coordinates)
Contains information about the context of a rendering operation.
int count(const T &value) const
double toDouble(bool *ok) const
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)