4 #include "ViewPointStyle.h"
7 const QColor COLOR_FOR_BRUSH_ENABLED (Qt::white);
8 const QColor COLOR_FOR_BRUSH_DISABLED (Qt::gray);
17 QPixmap ViewPointStyle::pixmapForCurrentSettings ()
const
19 LOG4CPP_INFO_S ((*mainCat)) <<
"ViewPointStyle::pixmapForCurrentSettings";
22 QPolygonF polygonUnscaled = m_pointStyle.
polygon();
25 double xMinGot = polygonUnscaled.boundingRect().left();
26 double xMaxGot = polygonUnscaled.boundingRect().right();
27 double yMinGot = polygonUnscaled.boundingRect().top();
28 double yMaxGot = polygonUnscaled.boundingRect().bottom();
30 QPolygonF polygonScaled;
31 for (
int i = 0; i < polygonUnscaled.length(); i++) {
32 QPointF pOld = polygonUnscaled.at(i);
33 polygonScaled.append (QPointF ((width () - 1) * (pOld.x() - xMinGot) / (xMaxGot - xMinGot),
34 (height () - 1) * (pOld.y() - yMinGot) / (yMaxGot - yMinGot)));
38 QColor color = ColorPaletteToQColor(m_pointStyle.
paletteColor());
40 color = QColor (Qt::black);
46 QImage::Format_RGB32);
47 QPainter painter (&img);
53 QBrush (m_enabled ? COLOR_FOR_BRUSH_ENABLED : COLOR_FOR_BRUSH_DISABLED));
56 painter.setPen (QPen (color, m_pointStyle.
lineWidth()));
57 painter.drawPolygon (polygonScaled);
61 QPixmap pixmap = QPixmap::fromImage (img);
68 LOG4CPP_INFO_S ((*mainCat)) <<
"ViewPointStyle::setEnabled"
69 <<
" enabled=" << (enabled ?
"true" :
"false");
72 setPixmap (pixmapForCurrentSettings ());
77 LOG4CPP_INFO_S ((*mainCat)) <<
"ViewPointStyle::setPointStyle";
79 m_pointStyle = pointStyle;
80 setPixmap (pixmapForCurrentSettings ());
85 LOG4CPP_INFO_S ((*mainCat)) <<
"ViewPointStyle::unsetPointStyle";
87 QPixmap pEmpty (width (),
89 pEmpty.fill (COLOR_FOR_BRUSH_DISABLED);
void unsetPointStyle()
Apply no PointStyle.
int lineWidth() const
Get method for line width.
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius...
ViewPointStyle(QWidget *parent=0)
Single constructor.
Details for a specific Point.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
ColorPalette paletteColor() const
Get method for point color.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.