#3790 Z scale label. Display in upper left corner

This commit is contained in:
Bjørn Erik Jensen
2018-12-10 13:03:53 +01:00
parent a6493042d4
commit 488798c3d8
7 changed files with 64 additions and 5 deletions

View File

@@ -189,6 +189,7 @@ void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollectio
{
activeView->setScaleZAndUpdate(1.0);
activeView->scheduleCreateDisplayModelAndRedraw();
activeView->updateZScaleLabel();
RiuMainWindow::instance()->updateScaleValue();
}

View File

@@ -123,6 +123,8 @@ Rim3dView::Rim3dView(void)
CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", "");
CAF_PDM_InitField(&m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "");
m_crossSectionVizModel = new cvf::ModelBasicList;
m_crossSectionVizModel->setName("CrossSectionModel");
@@ -194,6 +196,7 @@ QWidget* Rim3dView::createViewWidget(QWidget* mainWindowParent)
this->axisLabels(&xLabel, &yLabel, &zLabel);
m_viewer->setAxisLabels(xLabel, yLabel, zLabel);
updateZScaleLabel();
return m_viewer->layoutWidget();
}
@@ -265,6 +268,7 @@ void Rim3dView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrd
viewGroup->add(&m_name);
viewGroup->add(&m_backgroundColor);
viewGroup->add(&m_showZScaleLabel);
viewGroup->add(&m_showGridBox);
viewGroup->add(&isPerspectiveView);
viewGroup->add(&m_disableLighting);
@@ -574,7 +578,7 @@ void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
m_viewer->update();
updateZScaleLabel();
}
RiuMainWindow::instance()->updateScaleValue();
@@ -636,6 +640,11 @@ void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
m_viewer->animationControl()->setTimeout(maximumFrameRate != 0 ? 1000/maximumFrameRate : std::numeric_limits<int>::max());
}
}
else if (changedField == &m_showZScaleLabel)
{
m_viewer->showZScaleLabel(m_showZScaleLabel());
m_viewer->update();
}
}
//--------------------------------------------------------------------------------------------------
@@ -752,6 +761,16 @@ void Rim3dView::updateAnnotationItems()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::updateZScaleLabel()
{
// Update Z scale label
int scale = static_cast<int>(scaleZ());
m_viewer->setZScale(scale);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -140,6 +140,7 @@ public:
void createHighlightAndGridBoxDisplayModelWithRedraw();
void updateGridBoxData();
void updateAnnotationItems();
void updateZScaleLabel();
bool isMasterView() const;
@@ -243,5 +244,5 @@ private:
caf::PdmField<cvf::Vec3d> m_cameraPointOfInterest;
caf::PdmField< cvf::Color3f > m_backgroundColor;
caf::PdmField<bool> m_showGridBox;
caf::PdmField<bool> m_showZScaleLabel;
};

View File

@@ -115,7 +115,6 @@ RiuMainWindow* RiuMainWindow::sm_mainWindowInstance = nullptr;
//--------------------------------------------------------------------------------------------------
RiuMainWindow::RiuMainWindow()
: m_pdmRoot(nullptr),
m_mainViewer(nullptr),
m_relPermPlotPanel(nullptr),
m_pvtPlotPanel(nullptr),
m_mohrsCirclePlot(nullptr),

View File

@@ -47,7 +47,6 @@ class RiuMessagePanel;
class RiuProcessMonitor;
class RiuResultInfoPanel;
class RiuResultQwtPlot;
class RiuViewer;
class RiuRelativePermeabilityPlotPanel;
class RiuPvtPlotPanel;
class RiuMohrsCirclePlot;
@@ -176,7 +175,6 @@ private:
caf::AnimationToolBar* m_animationToolBar;
QMdiArea* m_mdiArea;
RiuViewer* m_mainViewer;
RiuResultInfoPanel* m_resultInfoPanel;
RiuProcessMonitor* m_processMonitor;
QPointer<RiuMessagePanel> m_messagePanel;

View File

@@ -146,11 +146,19 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
m_versionInfoLabel->setAlignment(Qt::AlignRight);
m_versionInfoLabel->setText(QString("%1 v%2").arg(RI_APPLICATION_NAME, RiaApplication::getVersionStringApp(false)));
// Z scale label
m_zScaleLabel = new QLabel();
m_zScaleLabel->setFrameShape(QFrame::NoFrame);
m_zScaleLabel->setAlignment(Qt::AlignLeft);
m_zScaleLabel->setText(QString("Z: "));
m_showZScaleLabel = true;
QPalette versionInfoPalette = p;
QColor versionInfoLabelColor = p.color(QPalette::Window);
versionInfoLabelColor.setAlpha(0);
versionInfoPalette.setColor(QPalette::Window, versionInfoLabelColor);
m_versionInfoLabel->setPalette(versionInfoPalette);
m_zScaleLabel->setPalette(versionInfoPalette);
// Animation progress bar
m_animationProgress = new QProgressBar();
@@ -181,6 +189,7 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
m_versionInfoLabel->setFont(regTestFont);
m_animationProgress->setFont(regTestFont);
m_histogramWidget->setFont(regTestFont);
m_zScaleLabel->setFont(regTestFont);
}
// When a context menu is created in the viewer is, and the action triggered is displaying a dialog,
@@ -437,6 +446,15 @@ void RiuViewer::paintOverlayItems(QPainter* painter)
m_versionInfoLabel->render(painter, pos);
}
if (m_showZScaleLabel) // Z scale Label
{
QSize size(m_zScaleLabel->sizeHint().width(), m_zScaleLabel->sizeHint().height());
QPoint pos(margin + edgeAxisFrameBorderWidth,
margin + edgeAxisFrameBorderHeight);
m_zScaleLabel->resize(size.width(), size.height());
m_zScaleLabel->render(painter, pos);
}
if (!m_cursorPositionDomainCoords.isUndefined())
{
if (mainCamera())
@@ -469,6 +487,22 @@ void RiuViewer::setInfoText(QString text)
m_infoLabel->setText(text);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::showZScaleLabel(bool enable)
{
m_showZScaleLabel = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::setZScale(int scale)
{
m_zScaleLabel->setText(QString("Z: %1").arg(scale));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -82,6 +82,10 @@ public:
void showInfoText(bool enable);
void setInfoText(QString text);
void showZScaleLabel(bool enable);
void setZScale(int scale);
void showHistogram(bool enable);
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
void setHistogramPercentiles(double pmin, double pmax, double mean);
@@ -152,6 +156,9 @@ private:
QLabel* m_versionInfoLabel;
bool m_showInfoText;
QLabel* m_zScaleLabel;
bool m_showZScaleLabel;
QProgressBar* m_animationProgress;
bool m_showAnimProgress;
RiuSimpleHistogramWidget* m_histogramWidget;