mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#857) Summary : Added properties for left and right Y-axis
This commit is contained in:
@@ -92,6 +92,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -182,6 +183,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimSummaryYAxisProperties.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryYAxisProperties.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuSelectionColors.h"
|
||||
@@ -58,6 +59,20 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
|
||||
CAF_PDM_InitField(&m_visibleWindow, "VisibleWindow", std::vector<float>(), "Visible Display Window", "", "", "");
|
||||
m_visibleWindow.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", "");
|
||||
m_leftYAxisProperties.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_leftYAxisPropertiesObject = std::unique_ptr<RimSummaryYAxisProperties>(new RimSummaryYAxisProperties);
|
||||
m_leftYAxisPropertiesObject->setName("Left Y-Axis");
|
||||
m_leftYAxisProperties = m_leftYAxisPropertiesObject.get();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis", "", "", "");
|
||||
m_rightYAxisProperties.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_rightYAxisPropertiesObject = std::unique_ptr<RimSummaryYAxisProperties>(new RimSummaryYAxisProperties);
|
||||
m_rightYAxisPropertiesObject->setName("Right Y-Axis");
|
||||
m_rightYAxisProperties = m_rightYAxisPropertiesObject.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -23,14 +23,19 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
#include <memory>
|
||||
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryCurve;
|
||||
class RimSummaryCurveFilter;
|
||||
class RimSummaryYAxisProperties;
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -85,5 +90,11 @@ private:
|
||||
caf::PdmChildArrayField<RimSummaryCurveFilter*> m_curveFilters;
|
||||
caf::PdmField<std::vector<float> > m_visibleWindow;
|
||||
|
||||
caf::PdmChildField<RimSummaryYAxisProperties*> m_leftYAxisProperties;
|
||||
caf::PdmChildField<RimSummaryYAxisProperties*> m_rightYAxisProperties;
|
||||
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
|
||||
std::unique_ptr<RimSummaryYAxisProperties> m_leftYAxisPropertiesObject;
|
||||
std::unique_ptr<RimSummaryYAxisProperties> m_rightYAxisPropertiesObject;
|
||||
};
|
||||
|
||||
137
ApplicationCode/ProjectDataModel/RimSummaryYAxisProperties.cpp
Normal file
137
ApplicationCode/ProjectDataModel/RimSummaryYAxisProperties.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 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 "RimSummaryYAxisProperties.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryYAxisProperties, "SummaryYAxisProperties");
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RimSummaryYAxisProperties::NumberFormatType >::setUp()
|
||||
{
|
||||
addItem(RimSummaryYAxisProperties::NUMBER_FORMAT_AUTO, "NUMBER_FORMAT_AUTO", "Auto");
|
||||
addItem(RimSummaryYAxisProperties::NUMBER_FORMAT_DECIMAL, "NUMBER_FORMAT_DECIMAL", "Decimal");
|
||||
addItem(RimSummaryYAxisProperties::NUMBER_FORMAT_SCIENTIFIC,"NUMBER_FORMAT_SCIENTIFIC", "Scientific");
|
||||
|
||||
setDefault(RimSummaryYAxisProperties::NUMBER_FORMAT_AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSummaryYAxisProperties::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryYAxisProperties::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
*useOptionsOnly = true;
|
||||
|
||||
if (&fontSize == fieldNeedingOptions)
|
||||
{
|
||||
std::vector<int> fontSizes;
|
||||
fontSizes.push_back(8);
|
||||
fontSizes.push_back(10);
|
||||
fontSizes.push_back(12);
|
||||
fontSizes.push_back(16);
|
||||
fontSizes.push_back(24);
|
||||
|
||||
for (int value : fontSizes)
|
||||
{
|
||||
QString text = QString("%1").arg(value);
|
||||
options.push_back(caf::PdmOptionItemInfo(text, value));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryYAxisProperties::RimSummaryYAxisProperties()
|
||||
{
|
||||
CAF_PDM_InitObject("Y-Axis Properties", ":/SummaryPlot16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name", "", "", "");
|
||||
m_name.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&isAutoTitle, "AutoTitle", true, "Auto Title", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title", "", "", "");
|
||||
CAF_PDM_InitField(&fontSize, "FontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&isAutoScaleEnabled, "AutoScale", true, "Auto Scale", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", m_minLogValueDefault, "Min", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", m_maxLogValueDefault, "Max", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::setName(const QString& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isAutoTitle ||
|
||||
changedField == &isAutoScaleEnabled)
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::updateOptionSensitivity()
|
||||
{
|
||||
customTitle.uiCapability()->setUiReadOnly(isAutoTitle);
|
||||
|
||||
visibleRangeMin.uiCapability()->setUiReadOnly(isAutoScaleEnabled);
|
||||
visibleRangeMax.uiCapability()->setUiReadOnly(isAutoScaleEnabled);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::initAfterRead()
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
79
ApplicationCode/ProjectDataModel/RimSummaryYAxisProperties.h
Normal file
79
ApplicationCode/ProjectDataModel/RimSummaryYAxisProperties.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryYAxisProperties : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum NumberFormatType
|
||||
{
|
||||
NUMBER_FORMAT_AUTO,
|
||||
NUMBER_FORMAT_DECIMAL,
|
||||
NUMBER_FORMAT_SCIENTIFIC
|
||||
};
|
||||
|
||||
|
||||
|
||||
public:
|
||||
RimSummaryYAxisProperties();
|
||||
|
||||
void setName(const QString& name);
|
||||
|
||||
caf::PdmField<bool> isAutoTitle;
|
||||
caf::PdmField<QString> customTitle;
|
||||
caf::PdmField<int> fontSize;
|
||||
|
||||
caf::PdmField<bool> isAutoScaleEnabled;
|
||||
caf::PdmField<double> visibleRangeMin;
|
||||
caf::PdmField<double> visibleRangeMax;
|
||||
|
||||
caf::PdmField< caf::AppEnum< NumberFormatType > > numberFormat;
|
||||
|
||||
caf::PdmField<bool> isLogarithmicScaleEnabled;
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
protected:
|
||||
virtual void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void updateOptionSensitivity();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
static constexpr double m_minLogValueDefault = - 10.0;
|
||||
static constexpr double m_maxLogValueDefault = 100.0;
|
||||
};
|
||||
Reference in New Issue
Block a user