mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#1889 Curve Creator : Close dialog when closing project
This commit is contained in:
parent
d27dc2be76
commit
d94eddc1ef
@ -34,6 +34,22 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEditSummaryCurves, "RicEditSummaryCurves");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditSummaryCurves::closeDialogAndResetTargetPlot()
|
||||
{
|
||||
if (m_dialogWithSplitter && m_dialogWithSplitter->isVisible())
|
||||
{
|
||||
m_dialogWithSplitter->hide();
|
||||
}
|
||||
|
||||
if (m_curveCreator)
|
||||
{
|
||||
m_curveCreator->updateFromSummaryPlot(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,7 +80,7 @@ void RicEditSummaryCurves::onActionTriggered(bool isChecked)
|
||||
caf::SelectionManager::instance()->objectsByType(&plots);
|
||||
if (plots.size() == 1)
|
||||
{
|
||||
m_curveCreator->setTargetPlot(plots.front());
|
||||
m_curveCreator->updateFromSummaryPlot(plots.front());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,9 @@ class RicEditSummaryCurves : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
void closeDialogAndResetTargetPlot();
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
|
@ -164,7 +164,6 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", "Cell IJK", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", "Block Vectors", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_previewPlot, "PreviewPlot", "PreviewPlot", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPlot, "TargetPlot", "Target Plot", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", "");
|
||||
@ -196,9 +195,6 @@ RicSummaryCurveCreator::RicSummaryCurveCreator() : m_identifierFieldsMap(
|
||||
m_selectedSummaryCategory.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
m_selectedSummaryCategory.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
m_previewPlot.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
//m_previewPlot.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_applyButtonField, "ApplySelection", "", "", "", "");
|
||||
m_applyButtonField = false;
|
||||
m_applyButtonField.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||
@ -226,19 +222,29 @@ RicSummaryCurveCreator::~RicSummaryCurveCreator()
|
||||
delete identifierAndField->pdmField();
|
||||
}
|
||||
}
|
||||
|
||||
delete m_previewPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::setTargetPlot(RimSummaryPlot* targetPlot)
|
||||
void RicSummaryCurveCreator::updateFromSummaryPlot(RimSummaryPlot* targetPlot)
|
||||
{
|
||||
m_targetPlot = targetPlot;
|
||||
if (targetPlot != nullptr)
|
||||
if (m_targetPlot != targetPlot)
|
||||
{
|
||||
populateCurveCreator(*targetPlot);
|
||||
updateConnectedEditors();
|
||||
resetAllFields();
|
||||
}
|
||||
|
||||
m_targetPlot = targetPlot;
|
||||
|
||||
if (m_targetPlot)
|
||||
{
|
||||
populateCurveCreator(*m_targetPlot);
|
||||
loadDataAndUpdatePlot();
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1032,3 +1038,23 @@ void RicSummaryCurveCreator::copyCurveAndAddToPlot(const RimSummaryCurve *curve,
|
||||
curveCopy->initAfterReadRecursively();
|
||||
curveCopy->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreator::resetAllFields()
|
||||
{
|
||||
m_selectedCases.clear();
|
||||
|
||||
m_previewPlot->deleteAllSummaryCurves();
|
||||
m_targetPlot = nullptr;
|
||||
|
||||
// clear all state in fields
|
||||
for (auto& identifierAndFieldList : m_identifierFieldsMap)
|
||||
{
|
||||
for (auto a : identifierAndFieldList.second)
|
||||
{
|
||||
a->pdmField()->v().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
virtual ~RicSummaryCurveCreator();
|
||||
|
||||
RimSummaryPlot* previewPlot() { return m_previewPlot;}
|
||||
void setTargetPlot(RimSummaryPlot* targetPlot);
|
||||
void updateFromSummaryPlot(RimSummaryPlot* targetPlot);
|
||||
|
||||
bool isCloseButtonPressed() const;
|
||||
void clearCloseButton();
|
||||
@ -113,13 +113,16 @@ private:
|
||||
void updateTargetPlot();
|
||||
void copyCurveAndAddToPlot(const RimSummaryCurve *curve, RimSummaryPlot *plot);
|
||||
|
||||
void resetAllFields();
|
||||
|
||||
private:
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_selectedCases;
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_selectedSummaryCategory;
|
||||
std::map<RifEclipseSummaryAddress::SummaryVarCategory, std::vector<SummaryIdentifierAndField*>> m_identifierFieldsMap;
|
||||
|
||||
caf::PdmPtrField<RimSummaryPlot*> m_targetPlot;
|
||||
caf::PdmChildField<RimSummaryPlot*> m_previewPlot;
|
||||
|
||||
RimSummaryPlot* m_previewPlot;
|
||||
|
||||
caf::PdmField<bool> m_useAutoAppearanceAssignment;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_caseAppearanceType;
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
#include "SummaryPlotCommands/RicEditSummaryCurves.h"
|
||||
|
||||
#include "cvfTimer.h"
|
||||
|
||||
@ -183,6 +184,12 @@ void RiuMainWindow::cleanupGuiCaseClose()
|
||||
}
|
||||
}
|
||||
m_processMonitor->startMonitorWorkProcess(NULL);
|
||||
|
||||
RicEditSummaryCurves* editSumCurves = dynamic_cast<RicEditSummaryCurves*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicEditSummaryCurves"));
|
||||
if (editSumCurves)
|
||||
{
|
||||
editSumCurves->closeDialogAndResetTargetPlot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user