 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
39 qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
46 int fontHeight = painter->fontMetrics().height();
48 if (!
data()->isEmpty()) {
49 double &key =
data()->begin()->key;
50 double &value =
data()->begin()->value;
55 P.setX(P.x() + margin);
57 P.setY(P.y() + fontHeight);
59 for (
int i = 0; i <
m_text.size(); ++i) {
63 painter->fontMetrics().horizontalAdvance(
65 painter->drawText(Pstart,
m_text[i]);
66 P.setY(P.y() + fontHeight);
88 void setData(
const QVector<double> &key,
const QVector<double> &value) {
95 const QVector<double> &value,
96 const QVector<QColor> &
colors) {
97 Q_ASSERT(
colors.size() == key.size());
102 int n = qMin(key.size(), value.size());
104 for (
int i = 0; i < n; ++i) {
106 newData.key = key[i];
107 newData.value = value[i];
132 qDebug() << Q_FUNC_INFO <<
"invalid key or value axis";
136 QCPColoredBarDataMap::const_iterator it;
144 QRectF barRect = getBarRect(it.key(), it.value().value);
146 if (
brush().style() != Qt::NoBrush &&
148 QBrush theBrush =
brush();
149 theBrush.setColor(it.value().color);
152 painter->
setPen(Qt::NoPen);
153 painter->setBrush(theBrush);
154 painter->drawRect(barRect);
157 if (
pen().style() != Qt::NoPen &&
pen().
color().alpha() != 0) {
159 thePen.setColor(it.value().color);
163 painter->setBrush(Qt::NoBrush);
164 painter->drawPolyline(barRect);
225 QVariant *details = 0)
const override {
232 const QRectF &rect)
const override {}
235 QCP::SignDomain inSignDomain = QCP::sdBoth)
const override {
241 QCP::SignDomain inSignDomain = QCP::sdBoth,
261 mPen = QPen(QColor(80, 80, 80), Qt::SolidLine);
278 int x2 =
static_cast<int>(
ceil(currentPosd));
280 if (x2 < rect.x())
return;
281 rect.setWidth(x2 - rect.x());
283 int x1 =
static_cast<int>(
floor(currentPosd));
285 if (x1 < rect.x())
return;
286 int newWidth = rect.width() - (x1 - rect.x());
288 rect.setWidth(newWidth);
295 painter->
setPen(Qt::NoPen);
297 QBrush(QColor(128, 128, 128, 128),
299 painter->drawPolygon(rect);
303 if (
pen().style() != Qt::NoPen &&
pen().
color().alpha() != 0) {
305 QPoint C(
mLeftSide ? rect.x() + rect.width() : rect.x(),
306 rect.y() + rect.height() / 2);
307 int r = rect.height() / 10;
310 painter->setBrush(
brush());
311 painter->drawEllipse(C, r, r);
313 painter->
setPen(QPen(QColor(128, 128, 128, 128),
315 painter->
drawLine(C + QPoint(0, r), C - QPoint(0, r));
338 mPen.setColor(QColor(128, 128, 0));
339 mPen.setStyle(Qt::SolidLine);
343 mBrush.setColor(QColor(255, 255, 0, 196));
344 mBrush.setStyle(Qt::SolidPattern);
350 mBrush.setColor(QColor(r, g, b, 196));
363 int r = rect.height() / 10;
367 QPen
pen(QColor(128, 128, 128, 128), Qt::DashLine);
370 painter->
drawLine(QPoint(currentPos, rect.y() + 2 * r),
371 QPoint(currentPos, rect.y() + rect.height()));
375 if (
pen().style() != Qt::NoPen &&
pen().
color().alpha() != 0) {
380 QPoint O(currentPos, rect.y() + r);
381 QPoint T[3] = {O + QPoint(0, r), O - QPoint(r, r),
385 painter->setBrush(
brush());
386 painter->drawPolygon(T, 3);
constexpr Rgb white(MAX, MAX, MAX)
QCustomPlot: small arrows at the bottom.
Definition: ecvQCustomPlot.h:332
virtual QRect clipRect() const
Definition: qcustomplot.cpp:7400
double colors[3]
Definition: TriangleMeshIO.cpp:53
Definition: ecvQCustomPlot.h:77
double currentVal() const
Definition: ecvQCustomPlot.h:195
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:7136
QBrush mBrush
Definition: qcustomplot.h:1764
QCPBarsWithText(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: ecvQCustomPlot.h:25
void setColor(int r, int g, int b)
Sets triangle 'inside' color.
Definition: ecvQCustomPlot.h:349
void setData(QCPBarDataMap *data, bool copy=false)
Definition: qcustomplot.cpp:19594
QCPBarDataMap * data() const
Definition: qcustomplot.h:3455
double pixelToKey(int pixX) const
Converts a pixel value (X) to the equivalent key.
Definition: ecvQCustomPlot.h:213
double mWidth
Definition: qcustomplot.h:3486
QCPAxis * valueAxis() const
Definition: qcustomplot.h:1709
virtual void clearData()
Definition: ecvQCustomPlot.h:222
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:1199
double coordToPixel(double value) const
Definition: qcustomplot.cpp:5254
void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const override
Definition: ecvQCustomPlot.h:231
int mLastRadius
Definition: ecvQCustomPlot.h:251
double mCurrentVal
Definition: ecvQCustomPlot.h:248
void applyDefaultAntialiasingHint(QCPPainter *painter) const
Definition: qcustomplot.cpp:7541
void appendText(QString text)
Definition: ecvQCustomPlot.h:29
virtual void draw(QCPPainter *painter)
Definition: qcustomplot.cpp:19814
QBrush brush() const
Definition: qcustomplot.h:1706
void setData(const QVector< double > &key, const QVector< double > &value)
Definition: ecvQCustomPlot.h:88
QCPHiddenArea(bool leftSide, QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: ecvQCustomPlot.h:259
void drawLine(const QLineF &line)
Definition: qcustomplot.cpp:116
double maxVal() const
Definition: ecvQCustomPlot.h:197
math::float4 color
Definition: LineSetBuffers.cpp:46
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:3417
virtual void draw(QCPPainter *painter)
Definition: ecvQCustomPlot.h:37
virtual void clearData()
Definition: ecvQCustomPlot.h:117
void setText(QString text)
Definition: ecvQCustomPlot.h:28
QPointer< QCPAxis > mKeyAxis
Definition: qcustomplot.h:1765
QCPColoredBarDataMap m_coloredData
Definition: ecvQCustomPlot.h:169
QCustomPlot: selectable cursor interface.
Definition: ecvQCustomPlot.h:173
QColor color
Definition: ecvQCustomPlot.h:81
void range(double &minVal, double &maxVal) const
Definition: ecvQCustomPlot.h:198
virtual bool isSelectable(QPoint click) const
Definition: ecvQCustomPlot.h:188
double pixelToValue(int pixY) const
Converts a pixel value (Y) to the equivalent value.
Definition: ecvQCustomPlot.h:217
QMultiMap< double, QCPColoredBarData > QCPColoredBarDataMap
Definition: ecvQCustomPlot.h:83
QCustomPlot: vertical bar with text along side.
Definition: ecvQCustomPlot.h:21
void setTextAlignment(bool left)
Definition: ecvQCustomPlot.h:30
bool m_textOnTheLeft
Definition: ecvQCustomPlot.h:34
double mMinVal
Definition: ecvQCustomPlot.h:249
QCPAxis * keyAxis() const
Definition: qcustomplot.h:1708
void setCurrentVal(double val)
Definition: ecvQCustomPlot.h:204
QCPColoredBarData()
Definition: ecvQCustomPlot.h:79
virtual void draw(QCPPainter *painter)
Definition: ecvQCustomPlot.h:124
MiniVec< float, N > floor(const MiniVec< float, N > &a)
Definition: MiniVec.h:75
QCustomPlot: colored histogram.
Definition: ecvQCustomPlot.h:73
void setRange(double minVal, double maxVal)
Definition: ecvQCustomPlot.h:207
QStringList m_text
Definition: ecvQCustomPlot.h:33
QCPColoredBars(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: ecvQCustomPlot.h:85
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:1675
bool mLeftSide
Whether the cursor is displayed on the left side or not.
Definition: ecvQCustomPlot.h:328
Represents the range an axis is encompassing.
Definition: qcustomplot.h:647
void coordsToPixels(double key, double value, double &x, double &y) const
Definition: qcustomplot.cpp:7424
QPointer< QCPAxis > mValueAxis
Definition: qcustomplot.h:1765
void setData(const QVector< double > &key, const QVector< double > &value, const QVector< QColor > &colors)
Definition: ecvQCustomPlot.h:94
virtual void draw(QCPPainter *painter)
Definition: ecvQCustomPlot.h:271
double mMaxVal
Definition: ecvQCustomPlot.h:249
double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const override
Definition: ecvQCustomPlot.h:223
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:78
QCPSelectableCursor(QCPAxis *keyAxis, QCPAxis *valueAxis)
Default constructor.
Definition: ecvQCustomPlot.h:178
void applyFillAntialiasingHint(QCPPainter *painter) const
Definition: qcustomplot.cpp:7558
void addData(const QCPBarDataMap &dataMap)
Definition: qcustomplot.cpp:19701
QPen mPen
Definition: qcustomplot.h:1763
double pixelToCoord(double value) const
Definition: qcustomplot.cpp:5199
constexpr Rgb blue(0, 0, MAX)
QRect rect() const
Definition: ecvQCustomPlot.h:114
QCustomPlot: greyed areas.
Definition: ecvQCustomPlot.h:255
virtual void draw(QCPPainter *painter)
Definition: ecvQCustomPlot.h:356
QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const override
Definition: ecvQCustomPlot.h:233
QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const override
Definition: ecvQCustomPlot.h:239
QCPArrow(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: ecvQCustomPlot.h:336
void setBrush(const QBrush &brush)
Definition: qcustomplot.cpp:7157
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
QPainter subclass used internally.
Definition: qcustomplot.h:463
QPen pen() const
Definition: qcustomplot.h:1704
QPoint mLastPos
Definition: ecvQCustomPlot.h:250
double minVal() const
Definition: ecvQCustomPlot.h:196