#1173 Made the legend a separate hide/show entity, and changed the overall layout of the well allocation plot

This commit is contained in:
Jacob Støren
2017-02-13 08:40:27 +01:00
parent 30ea467f0e
commit 321b9e2d62
12 changed files with 1490 additions and 1171 deletions

View File

@@ -10,6 +10,7 @@ ${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.h
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.h
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -18,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlotLegend.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -180,6 +180,7 @@ void RimTotalWellAllocationPlot::loadDataAndUpdate()
QWidget* RimTotalWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
{
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget(mainWindowParent);
m_wellTotalAllocationPlotWidget->showLegend(false);
return m_wellTotalAllocationPlotWidget;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +1,114 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QPointer>
class RimEclipseResultCase;
class RimEclipseWell;
class RimFlowDiagSolution;
class RimTotalWellAllocationPlot;
class RimWellLogPlot;
class RiuWellAllocationPlot;
class RimWellLogTrack;
namespace caf {
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
//==================================================================================================
class RimWellAllocationPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
RimWellAllocationPlot();
virtual ~RimWellAllocationPlot();
void setFromSimulationWell(RimEclipseWell* simWell);
void setDescription(const QString& description);
QString description() const;
void loadDataAndUpdate();
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
QString wellName() const;
void removeFromMdiAreaAndDeleteViewWidget();
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual QImage snapshotWindowContent() override;
private:
void updateFromWell();
void addStackedCurve(const QString& tracerName,
const std::vector<double>& connNumbers,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
void updateWidgetTitleWindowTitle();
static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep);
// RimViewWindow overrides
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
};
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimViewWindow.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QPointer>
class RimEclipseResultCase;
class RimEclipseWell;
class RimFlowDiagSolution;
class RimTotalWellAllocationPlot;
class RimWellAllocationPlotLegend;
class RimWellLogPlot;
class RiuWellAllocationPlot;
class RimWellLogTrack;
namespace caf {
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
//==================================================================================================
class RimWellAllocationPlot : public RimViewWindow
{
CAF_PDM_HEADER_INIT;
public:
RimWellAllocationPlot();
virtual ~RimWellAllocationPlot();
void setFromSimulationWell(RimEclipseWell* simWell);
void setDescription(const QString& description);
QString description() const;
void loadDataAndUpdate();
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
QString wellName() const;
void removeFromMdiAreaAndDeleteViewWidget();
void showPlotLegend(bool doShow);
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual QImage snapshotWindowContent() override;
private:
void updateFromWell();
void addStackedCurve(const QString& tracerName,
const std::vector<double>& connNumbers,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
void updateWidgetTitleWindowTitle();
static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep);
// RimViewWindow overrides
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
};

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellAllocationPlotLegend.h"
#include "RimWellAllocationPlot.h"
CAF_PDM_SOURCE_INIT(RimWellAllocationPlotLegend, "WellAllocationPlotLegend");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlotLegend::RimWellAllocationPlotLegend()
{
CAF_PDM_InitObject("Well Allocation Plot Legend", ":/newIcon16x16.png", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlotLegend::~RimWellAllocationPlotLegend()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellAllocationPlotLegend::objectToggleField()
{
return &m_showLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlotLegend::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_showLegend)
{
RimWellAllocationPlot* walp;
firstAncestorOrThisOfType(walp);
if (walp) walp->showPlotLegend(m_showLegend());
}
}

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellAllocationPlotLegend : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellAllocationPlotLegend();
virtual ~RimWellAllocationPlotLegend();
bool isShowingLegend() { return m_showLegend();}
protected:
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
caf::PdmField<bool> m_showLegend;
};