#4200 Grid Cross Plot : Adjustments for Linux

This commit is contained in:
Magne Sjaastad 2019-03-19 15:19:34 +01:00
parent 59c83157d1
commit a07f375daf
3 changed files with 29 additions and 13 deletions

View File

@ -85,6 +85,8 @@ void RimPlotAxisAnnotation::setEquilibriumData(RimEclipseCase* eclipseCas
m_sourceCase = eclipseCase;
m_equilNum = zeroBasedEquilRegionIndex + 1;
m_annotationType = annotationType;
updateName();
}
//--------------------------------------------------------------------------------------------------
@ -146,14 +148,6 @@ void RimPlotAxisAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedF
const QVariant& oldValue,
const QVariant& newValue)
{
/*
RimViewWindow* viewWindow = nullptr;
this->firstAncestorOrThisOfType(viewWindow);
if (viewWindow)
{
viewWindow->loadDataAndUpdate();
}
*/
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
this->firstAncestorOrThisOfType(parentPlot);
if (parentPlot)
@ -176,7 +170,7 @@ QList<caf::PdmOptionItemInfo> RimPlotAxisAnnotation::calculateValueOptions(const
}
else if (fieldNeedingOptions == &m_equilNum)
{
for (int i = 0; i < equilItems().size(); i++)
for (int i = 0; i < static_cast<int>(equilItems().size()); i++)
{
QString uiText = QString("%1").arg(i + 1);
options.push_back(caf::PdmOptionItemInfo(uiText, i));
@ -214,7 +208,7 @@ RigEquil RimPlotAxisAnnotation::selectedItem() const
{
int index = m_equilNum() - 1;
if (index < equilItems().size())
if (index < static_cast<int>(equilItems().size()))
{
return equilItems()[index];
}
@ -234,3 +228,22 @@ std::vector<RigEquil> RimPlotAxisAnnotation::equilItems() const
return std::vector<RigEquil>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::updateName()
{
QString text;
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
{
text = QString("WOC %1").arg(value());
}
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
{
text = QString("GOC %1").arg(value());
}
m_name = text;
}

View File

@ -69,6 +69,7 @@ protected:
private:
RigEquil selectedItem() const;
std::vector<RigEquil> equilItems() const;
void updateName();
private:
caf::PdmField<ExportKeywordEnum> m_annotationType;

View File

@ -17,14 +17,16 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiuInterfaceToViewWindow.h"
#include "RiuPlotAnnotationTool.h"
#include "RiuQwtPlot.h"
#include "cafPdmPointer.h"
#include <QPointer>
#include <memory>
class RimGridCrossPlotCurveSet;
class RiuCvfOverlayItemWidget;
class RiuPlotAnnotationTool;
@ -54,11 +56,11 @@ public:
protected:
void updateLayout() override;
void updateLegendLayout();
void resizeEvent(QResizeEvent *e) override;
void resizeEvent(QResizeEvent* e) override;
bool resizeOverlayItemToFitPlot(caf::TitledOverlayFrame* overlayItem);
void contextMenuEvent(QContextMenuEvent*) override;
private:
std::map<caf::PdmPointer<RimGridCrossPlotCurveSet>, QPointer<RiuCvfOverlayItemWidget>> m_legendWidgets;
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
};