mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2531 Mohr Circle: Add Info text
This commit is contained in:
parent
10bc5c92ab
commit
f4d4a8aa46
@ -44,6 +44,7 @@
|
||||
#include "qwt_plot_marker.h"
|
||||
#include "qwt_plot_rescaler.h"
|
||||
#include "qwt_plot_shapeitem.h"
|
||||
#include "qwt_plot_textlabel.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -102,6 +103,7 @@ void RiuMohrsCirclePlot::setPrincipalsAndRedrawPlot(double p1, double p2, double
|
||||
|
||||
redrawEnvelope();
|
||||
redrawCircles();
|
||||
addInfoLabel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -140,6 +142,7 @@ void RiuMohrsCirclePlot::clearPlot()
|
||||
{
|
||||
deleteCircles();
|
||||
deleteEnvelope();
|
||||
deleteInfoLabel();
|
||||
|
||||
this->replot();
|
||||
}
|
||||
@ -281,6 +284,46 @@ void RiuMohrsCirclePlot::deleteEnvelope()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMohrsCirclePlot::addInfoLabel()
|
||||
{
|
||||
deleteInfoLabel();
|
||||
|
||||
QString textBuilder;
|
||||
|
||||
textBuilder.append(QString("<b>Factor of Safety</b>: %1<br>").arg("Coming soon"));
|
||||
textBuilder.append(QString("<b>Friction Angle</b>: %1<br>").arg(m_frictionAngle));
|
||||
textBuilder.append(QString("<b>Cohesion</b>: %1<br>").arg(m_cohesion));
|
||||
textBuilder.append(QString("<b>σ<sub>1</sub></b>: %1<br>").arg(m_principal1));
|
||||
textBuilder.append(QString("<b>σ<sub>2</sub></b>: %1<br>").arg(m_principal2));
|
||||
textBuilder.append(QString("<b>σ<sub>3</sub></b>: %1<br>").arg(m_principal3));
|
||||
|
||||
QwtText text = textBuilder;
|
||||
|
||||
text.setRenderFlags(Qt::AlignLeft | Qt::AlignTop);
|
||||
|
||||
m_infoTextItem = new QwtPlotTextLabel();
|
||||
m_infoTextItem->setText(text);
|
||||
m_infoTextItem->attach(this);
|
||||
|
||||
this->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMohrsCirclePlot::deleteInfoLabel()
|
||||
{
|
||||
if (m_infoTextItem)
|
||||
{
|
||||
m_infoTextItem->detach();
|
||||
delete m_infoTextItem;
|
||||
m_infoTextItem = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -305,10 +348,9 @@ void RiuMohrsCirclePlot::queryDataAndUpdatePlot(RimGeoMechView* geoMechView, siz
|
||||
clearPlot();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
setCohesion(geoMechView->geoMechCase()->cohesion());
|
||||
setFrictionAngle(geoMechView->geoMechCase()->frictionAngleDeg());
|
||||
|
||||
RigFemPart* femPart = geoMechView->geoMechCase()->geoMechData()->femParts()->part(gridIndex);
|
||||
|
||||
size_t i, j, k;
|
||||
@ -317,23 +359,9 @@ void RiuMohrsCirclePlot::queryDataAndUpdatePlot(RimGeoMechView* geoMechView, siz
|
||||
int elmId = femPart->elmId(cellIndex);
|
||||
|
||||
QString title;
|
||||
QString resultPos;
|
||||
QString fieldName = geoMechView->cellResultResultDefinition()->resultFieldUiName();
|
||||
|
||||
switch (geoMechView->cellResultResultDefinition()->resultPositionType())
|
||||
{
|
||||
case RIG_ELEMENT_NODAL:
|
||||
resultPos = "Element Nodal";
|
||||
break;
|
||||
|
||||
case RIG_INTEGRATION_POINT:
|
||||
resultPos = "Integration Point";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
title += QString("%1, %2").arg(resultPos).arg(fieldName);
|
||||
title += QString("%1").arg(fieldName);
|
||||
|
||||
title += QString(", Element Id[%1], ijk[%2,%3,%4]").arg(elmId).arg(i).arg(j).arg(k);
|
||||
this->setTitle(title);
|
||||
@ -375,8 +403,13 @@ void RiuMohrsCirclePlot::setDefaults()
|
||||
|
||||
m_envolopePlotItem = nullptr;
|
||||
m_transparentCurve = nullptr;
|
||||
|
||||
m_infoTextItem = nullptr;
|
||||
|
||||
m_cohesion = HUGE_VAL;
|
||||
m_frictionAngle = HUGE_VAL;
|
||||
|
||||
m_factorOfSafety = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -413,6 +446,14 @@ void RiuMohrsCirclePlot::setCohesion(double cohesion)
|
||||
m_cohesion = cohesion;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMohrsCirclePlot::setFactorOfSafety(double fos)
|
||||
{
|
||||
m_factorOfSafety = fos;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Add a transparent curve to make tooltip available on principals crossing the x-axis
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -23,12 +23,13 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
class RiuSelectionItem;
|
||||
class RimGeoMechView;
|
||||
class QwtRoundScaleDraw;
|
||||
class QwtPlotRescaler;
|
||||
class QWidget;
|
||||
class QwtPlotCurve;
|
||||
class QwtPlotRescaler;
|
||||
class QwtPlotTextLabel;
|
||||
class QwtRoundScaleDraw;
|
||||
class RimGeoMechView;
|
||||
class RiuSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -49,18 +50,6 @@ public:
|
||||
void updateOnSelectionChanged(const RiuSelectionItem* selectionItem);
|
||||
void clearPlot();
|
||||
|
||||
protected:
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
|
||||
void redrawCircles();
|
||||
void deleteCircles();
|
||||
|
||||
void redrawEnvelope();
|
||||
void deleteEnvelope();
|
||||
|
||||
void queryDataAndUpdatePlot(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex);
|
||||
|
||||
private:
|
||||
struct MohrCircle
|
||||
{
|
||||
@ -73,11 +62,26 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
|
||||
void redrawCircles();
|
||||
void deleteCircles();
|
||||
|
||||
void redrawEnvelope();
|
||||
void deleteEnvelope();
|
||||
|
||||
void addInfoLabel();
|
||||
void deleteInfoLabel();
|
||||
|
||||
void queryDataAndUpdatePlot(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex);
|
||||
|
||||
void setDefaults();
|
||||
void createMohrCircles();
|
||||
|
||||
void setFrictionAngle(double frictionAngle);
|
||||
void setCohesion(double cohesion);
|
||||
void setFactorOfSafety(double fos);
|
||||
|
||||
void updateTransparentCurveOnPrincipals();
|
||||
|
||||
@ -101,5 +105,7 @@ private:
|
||||
double m_cohesion;
|
||||
double m_factorOfSafety;
|
||||
|
||||
QwtPlotTextLabel* m_infoTextItem;
|
||||
|
||||
QwtPlotRescaler* m_rescaler;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user