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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace cvf
|
||||
class Model;
|
||||
class OverlayItem;
|
||||
class Part;
|
||||
class OverlayAxisCross;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -84,6 +85,8 @@ public:
|
||||
|
||||
void setCurrentFrame(int frameIndex);
|
||||
|
||||
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
@@ -109,6 +112,7 @@ private:
|
||||
|
||||
QCDEStyle* m_progressBarStyle;
|
||||
|
||||
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
|
||||
cvf::Collection<cvf::OverlayItem> m_visibleLegends;
|
||||
|
||||
caf::PdmPointer<RimView> m_rimView;
|
||||
|
||||
Reference in New Issue
Block a user