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:
parent
b356be9464
commit
b26d199815
@ -155,6 +155,8 @@ void RimGeoMechView::loadDataAndUpdate()
|
||||
progress.setProgressDescription("Create Display model");
|
||||
|
||||
updateViewerWidget();
|
||||
setCustomAxisCrossLabels();
|
||||
|
||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
this->scheduleCreateDisplayModelAndRedraw();
|
||||
@ -481,6 +483,8 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
bool generateDisplayModel = (viewer() == NULL);
|
||||
updateViewerWidget();
|
||||
setCustomAxisCrossLabels();
|
||||
|
||||
if (generateDisplayModel)
|
||||
{
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
@ -512,6 +516,18 @@ void RimGeoMechView::initAfterRead()
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechView::setCustomAxisCrossLabels()
|
||||
{
|
||||
// Minimalistic - size of axis cross does not have to be adjusted
|
||||
if (m_viewer) m_viewer->setAxisLabels("E-x1", "N-y2", "Z-3");
|
||||
|
||||
// A bit larger - size of axis cross is slightly larger
|
||||
//if (m_viewer) m_viewer->setAxisLabels("E(x,1)", "N(y,2)", "Z(3)");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -101,6 +101,8 @@ private:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
|
||||
void setCustomAxisCrossLabels();
|
||||
|
||||
|
||||
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user