mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1322 Improved UI texts and include result name in suggested plot name
This commit is contained in:
parent
881ba2986f
commit
17dbb179d9
@ -24,6 +24,11 @@
|
||||
#include "RicSelectSummaryPlotUI.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridTimeHistoryCurve.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
@ -111,13 +116,16 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
featureUi.setDefaultSummaryPlot(defaultSelectedPlot);
|
||||
}
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Select Summary Plot", "");
|
||||
QString newPlotName = RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName();
|
||||
featureUi.setSuggestedPlotName(newPlotName);
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Select Destination Plot", "");
|
||||
propertyDialog.resize(QSize(400, 200));
|
||||
|
||||
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
if (featureUi.createNewPlot())
|
||||
if (featureUi.isCreateNewPlotChecked())
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
summaryPlotColl->summaryPlots().push_back(plot);
|
||||
@ -141,6 +149,63 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
return summaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName()
|
||||
{
|
||||
|
||||
QString resultName;
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
if (eclView)
|
||||
{
|
||||
RimEclipseResultDefinition* resDef = eclView->cellResult();
|
||||
resultName = resDef->resultVariableUiShortName();
|
||||
}
|
||||
|
||||
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(activeView);
|
||||
if (geoView)
|
||||
{
|
||||
// NOTE: See also RimGeoMechProertyFilter for generation of result name
|
||||
|
||||
RimGeoMechResultDefinition* resultDefinition = geoView->cellResultResultDefinition();
|
||||
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
|
||||
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
resultName = resultDefinition->resultFieldName();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
resultName = posName + ", " + fieldUiName + ", " + compoUiName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString plotName = "New Plot Name";
|
||||
if (!resultName.isEmpty())
|
||||
{
|
||||
plotName = QString("Cell Result - %1").arg(resultName);
|
||||
}
|
||||
|
||||
return plotName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -39,4 +39,5 @@ protected:
|
||||
private:
|
||||
static void createCurveFromSelectionItem(const RiuSelectionItem* selectionItem, RimSummaryPlot* plot);
|
||||
static RimSummaryPlot* userSelectedSummaryPlot();
|
||||
static QString suggestedNewPlotName();
|
||||
};
|
||||
|
@ -18,13 +18,14 @@
|
||||
|
||||
#include "RicSelectSummaryPlotUI.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicSelectSummaryPlotUI, "RicSelectSummaryPlotUI");
|
||||
@ -36,9 +37,9 @@ RicSelectSummaryPlotUI::RicSelectSummaryPlotUI()
|
||||
{
|
||||
CAF_PDM_InitObject("RicSelectSummaryPlotUI", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Summary Plot", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Plot", "", "", "");
|
||||
CAF_PDM_InitField(&m_createNewPlot, "CreateNewPlot", false, "Create New Plot", "", "", "");
|
||||
CAF_PDM_InitField(&m_newSummaryPlotName, "NewViewName", QString("Summary Plot"), "New Summary Plot Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_newSummaryPlotName, "NewViewName", QString("Cell Results"), "New Plot Name", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,6 +50,14 @@ void RicSelectSummaryPlotUI::setDefaultSummaryPlot(RimSummaryPlot* summaryPlot)
|
||||
m_selectedSummaryPlot = summaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::setSuggestedPlotName(const QString& name)
|
||||
{
|
||||
m_newSummaryPlotName = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -60,7 +69,7 @@ RimSummaryPlot* RicSelectSummaryPlotUI::selectedSummaryPlot() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSelectSummaryPlotUI::createNewPlot() const
|
||||
bool RicSelectSummaryPlotUI::isCreateNewPlotChecked() const
|
||||
{
|
||||
return m_createNewPlot;
|
||||
}
|
||||
|
@ -35,8 +35,10 @@ public:
|
||||
RicSelectSummaryPlotUI();
|
||||
|
||||
void setDefaultSummaryPlot(RimSummaryPlot* summaryPlot);
|
||||
void setSuggestedPlotName(const QString& name);
|
||||
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
bool createNewPlot() const;
|
||||
bool isCreateNewPlotChecked() const;
|
||||
QString newPlotName() const;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
|
Loading…
Reference in New Issue
Block a user