From 95e22b581c1017749f655febe7ef7fe681344a08 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 23 Nov 2015 07:24:50 +0100 Subject: [PATCH] (#639) Updated axis cross texts --- .../ProjectDataModel/RimEclipseView.cpp | 14 ++++++- .../ProjectDataModel/RimEclipseView.h | 3 +- .../ProjectDataModel/RimGeoMechView.cpp | 26 ++++++------- .../ProjectDataModel/RimGeoMechView.h | 5 +-- ApplicationCode/ProjectDataModel/RimView.h | 1 + ApplicationCode/UserInterface/RiuViewer.cpp | 39 ++++++++++++------- 6 files changed, 55 insertions(+), 33 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 1eed0aa39a..31e20b5cb9 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -186,7 +186,6 @@ void RimEclipseView::clampCurrentTimestep() if (m_currentTimeStep < 0 ) m_currentTimeStep = 0; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -200,6 +199,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { bool generateDisplayModel = (viewer() == NULL); updateViewerWidget(); + if (generateDisplayModel) { updateDisplayModelForWellResults(); @@ -1718,6 +1718,18 @@ void RimEclipseView::updateIconStateForFilterCollections() m_propertyFilterCollection()->uiCapability()->updateConnectedEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseView::axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) +{ + CVF_ASSERT(xLabel && yLabel && zLabel); + + *xLabel = "E(X)"; + *yLabel = "N(Y)"; + *zLabel = "Z"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.h b/ApplicationCode/ProjectDataModel/RimEclipseView.h index 7dbaa0c89c..5849e04366 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.h @@ -134,6 +134,8 @@ public: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); void updateIconStateForFilterCollections(); + virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel); + protected: virtual void initAfterRead(); virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); @@ -171,7 +173,6 @@ private: void clampCurrentTimestep(); - virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 9794c1dd0c..f99d89ffb9 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -155,7 +155,6 @@ void RimGeoMechView::loadDataAndUpdate() progress.setProgressDescription("Create Display model"); updateViewerWidget(); - setCustomAxisCrossLabels(); this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters(); @@ -483,7 +482,6 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { bool generateDisplayModel = (viewer() == NULL); updateViewerWidget(); - setCustomAxisCrossLabels(); if (generateDisplayModel) { @@ -516,18 +514,6 @@ 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)"); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -642,6 +628,18 @@ void RimGeoMechView::updateIconStateForFilterCollections() m_propertyFilterCollection()->uiCapability()->updateConnectedEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGeoMechView::axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) +{ + CVF_ASSERT(xLabel && yLabel && zLabel); + + *xLabel = "E(X,1)"; + *yLabel = "N(Y,2)"; + *zLabel = "Z(3)"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.h b/ApplicationCode/ProjectDataModel/RimGeoMechView.h index 4fe6dceea7..bcf20262f5 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.h @@ -78,6 +78,8 @@ public: virtual void scheduleGeometryRegen(RivCellSetEnum geometryType); void updateIconStateForFilterCollections(); + virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel); + protected: virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = ""); @@ -101,9 +103,6 @@ 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); diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 39e83ea0d0..5200f119e1 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -144,6 +144,7 @@ public: cvf::ref currentTotalCellVisibility(); virtual bool showActiveCellsOnly(); + virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) = 0; public: virtual void loadDataAndUpdate() = 0; diff --git a/ApplicationCode/UserInterface/RiuViewer.cpp b/ApplicationCode/UserInterface/RiuViewer.cpp index 4bdc8831e2..16d1a1baa5 100644 --- a/ApplicationCode/UserInterface/RiuViewer.cpp +++ b/ApplicationCode/UserInterface/RiuViewer.cpp @@ -53,7 +53,6 @@ #include #include #include -#include "RimCase.h" using cvf::ManipulatorTrackball; @@ -78,7 +77,7 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent) { cvf::Font* standardFont = RiaApplication::instance()->standardFont(); m_axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont); - m_axisCross->setAxisLabels("E", "N", "Z"); + m_axisCross->setAxisLabels("X", "Y", "Z"); m_axisCross->setLayout(cvf::OverlayItem::VERTICAL, cvf::OverlayItem::BOTTOM_LEFT); m_mainRendering->addOverlayItem(m_axisCross.p()); @@ -300,6 +299,13 @@ void RiuViewer::setOwnerReservoirView(RimView * owner) { m_rimView = owner; m_viewerCommands->setOwnerView(owner); + + cvf::String xLabel; + cvf::String yLabel; + cvf::String zLabel; + + m_rimView->axisLabels(&xLabel, &yLabel, &zLabel); + setAxisLabels(xLabel, yLabel, zLabel); } //-------------------------------------------------------------------------------------------------- @@ -579,19 +585,24 @@ void RiuViewer::setAxisLabels(const cvf::String& xLabel, const cvf::String& yLab { 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(); + // The axis cross is designed for short labels, longer labels causes clipping of text + // The commented out code adjust the size of the axis cross, and this makes the axis cross labels visible + // Side effect is also that the axis cross is zoomed (will be larger) + /* + 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) + if (maxAxisLabelLength > 4) { - m_axisCross->setSize(cvf::Vec2ui(140, 140)); + if (maxAxisLabelLength < 6) + { + m_axisCross->setSize(cvf::Vec2ui(140, 140)); + } + else if (maxAxisLabelLength < 8) + { + m_axisCross->setSize(cvf::Vec2ui(160, 160)); + } } - else if (maxAxisLabelLength < 8) - { - m_axisCross->setSize(cvf::Vec2ui(160, 160)); - } - } + */ }