ResInsight: Added mean value to 3D info text

p4#: 19268
This commit is contained in:
Jacob Støren
2012-10-23 12:08:46 +02:00
parent 1d90bd680e
commit a8b4d35b4f
7 changed files with 62 additions and 5 deletions

View File

@@ -481,9 +481,10 @@ void RIViewer::setHistogram(double min, double max, const std::vector<size_t>& h
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RIViewer::setHistogramPercentiles(double pmin, double pmax)
void RIViewer::setHistogramPercentiles(double pmin, double pmax, double mean)
{
m_histogramWidget->setPercentiles(pmin, pmax);
m_histogramWidget->setMean(mean);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -60,7 +60,7 @@ public:
void setInfoText(QString text);
void showHistogram(bool enable);
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
void setHistogramPercentiles(double pmin, double pmax);
void setHistogramPercentiles(double pmin, double pmax, double mean);
void showAnimationProgress(bool enable);

View File

@@ -10,6 +10,8 @@ QWidget(parent, f)
{
m_minPercentile = HUGE_VAL;
m_maxPercentile = HUGE_VAL;
m_mean = HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
@@ -78,6 +80,14 @@ void RiuSimpleHistogramWidget::draw(QPainter *painter,int x, int y, int width, i
painter->setPen(QColor(255, 0, 0, 200));
painter->drawLine(xpos, y+1, xpos, y + height -1);
}
// Vertical lines for percentiles
if (m_mean != HUGE_VAL)
{
int xpos = xPosFromDomainValue(m_mean);
painter->setPen(QColor(0, 0, 255, 200));
painter->drawLine(xpos, y+1, xpos, y + height -1);
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -11,6 +11,7 @@ public:
void setHistogramData(double min, double max, const std::vector<size_t>& histogram);
void setPercentiles(double pmin, double pmax) {m_minPercentile = pmin; m_maxPercentile = pmax;}
void setMean(double mean) {m_mean = mean;}
protected:
virtual void paintEvent(QPaintEvent* event);
@@ -28,6 +29,7 @@ private:
double m_min;
double m_minPercentile;
double m_maxPercentile;
double m_mean;
size_t m_maxHistogramCount;
double m_width;