mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#639) Show E (x,1) on axis label
As the space is limited, the text is compressed to "E-x1", "N-y2", "Z-3"
This commit is contained in:
@@ -77,10 +77,10 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||
: caf::Viewer(format, parent)
|
||||
{
|
||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||
cvf::OverlayAxisCross* axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
|
||||
axisCross->setAxisLabels("E", "N", "Z");
|
||||
axisCross->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
|
||||
m_mainRendering->addOverlayItem(axisCross);
|
||||
m_axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
|
||||
m_axisCross->setAxisLabels("E", "N", "Z");
|
||||
m_axisCross->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT);
|
||||
m_mainRendering->addOverlayItem(m_axisCross.p());
|
||||
|
||||
this->enableOverlyPainting(true);
|
||||
this->setReleaseOGLResourcesEachFrame(true);
|
||||
@@ -571,3 +571,27 @@ cvf::Model* RiuViewer::gridBoxModel() const
|
||||
{
|
||||
return m_gridBoxGenerator->model();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel)
|
||||
{
|
||||
m_axisCross->setAxisLabels(xLabel, yLabel, zLabel);
|
||||
|
||||
size_t maxAxisLabelLength = xLabel.size();
|
||||
if (yLabel.size() > maxAxisLabelLength) maxAxisLabelLength = yLabel.size();
|
||||
if (zLabel.size() > maxAxisLabelLength) maxAxisLabelLength = zLabel.size();
|
||||
|
||||
if (maxAxisLabelLength > 4)
|
||||
{
|
||||
if (maxAxisLabelLength < 6)
|
||||
{
|
||||
m_axisCross->setSize(cvf::Vec2ui(140, 140));
|
||||
}
|
||||
else if (maxAxisLabelLength < 8)
|
||||
{
|
||||
m_axisCross->setSize(cvf::Vec2ui(160, 160));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user