diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 96d23181df..ff331c7cd9 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -236,7 +236,7 @@ bool RiaApplication::loadProject(const QString& projectFileName) m_project->fileName = projectFileName; m_project->readFile(); - // If the project filename has changed, call initAfterRead once more to propagate new location of project + // If the project filename has changed, propagate new location of project if (m_project->fileName() != projectFileName) { m_project->setProjectFileNameAndUpdateDependencies(projectFileName); diff --git a/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp index bc642ab3ec..8aca3eff9c 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp @@ -41,18 +41,6 @@ namespace caf { } -namespace caf { - template<> - void caf::AppEnum::setUp() - { - addItem(RimStatisticsCase::CALCULATED, "CALCULATED", "OK"); - addItem(RimStatisticsCase::NOT_CALCULATED, "NOT_CALCULATED", "Needs Calculation"); - setDefault(RimStatisticsCase::NOT_CALCULATED); - } -} - - - CAF_PDM_SOURCE_INIT(RimStatisticsCase, "RimStatisticalCalculation"); //-------------------------------------------------------------------------------------------------- @@ -63,24 +51,20 @@ RimStatisticsCase::RimStatisticsCase() { CAF_PDM_InitObject("Case Group Statistics", ":/Histogram16x16.png", "", ""); - CAF_PDM_InitFieldNoDefault(&m_calculationStatus, "CalcStatus", "Status", "", "", ""); - m_calculationStatus.setIOWritable(false); - m_calculationStatus.setIOReadable(false); - m_calculationStatus.setUiReadOnly(true); - m_calculationStatus.setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault(&m_calculateEditCommand, "m_editingAllowed", "", "", "", ""); + m_calculateEditCommand.setIOWritable(false); + m_calculateEditCommand.setIOReadable(false); + m_calculateEditCommand.setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_calculateEditCommand.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); - CAF_PDM_InitFieldNoDefault(&m_editingAllowed, "m_editingAllowed", "Editing Locked", "", "", ""); - m_editingAllowed.setIOWritable(false); - m_editingAllowed.setIOReadable(false); - m_editingAllowed.setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); - m_editingAllowed = false; + m_calculateEditCommand = false; - CAF_PDM_InitField(&m_selectionSummary, "SelectionSummary", QString(""), "Selected Properties", "", "", ""); + CAF_PDM_InitField(&m_selectionSummary, "SelectionSummary", QString(""), "Summary of calculation setup", "", "", ""); m_selectionSummary.setIOWritable(false); m_selectionSummary.setIOReadable(false); m_selectionSummary.setUiReadOnly(true); m_selectionSummary.setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName()); - m_selectionSummary.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + m_selectionSummary.setUiLabelPosition(caf::PdmUiItemInfo::TOP); CAF_PDM_InitFieldNoDefault(&m_resultType, "ResultType", "Result Type", "", "", ""); m_resultType.setIOWritable(false); @@ -324,14 +308,13 @@ void RimStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin updateSelectionSummaryLabel(); updateSelectionListVisibilities(); updatePercentileUiVisibility(); - updateUnlockUiVisibility(); uiOrdering.add(&caseName); - uiOrdering.add(&m_calculationStatus); - uiOrdering.add(&m_editingAllowed); + uiOrdering.add(&m_calculateEditCommand); + uiOrdering.add(&m_selectionSummary); - caf::PdmUiGroup * group = uiOrdering.addNewGroup("Property Selection"); - group->add(&m_selectionSummary); + caf::PdmUiGroup * group = uiOrdering.addNewGroup("Properties to consider"); + group->setUiHidden(hasComputedStatistics()); group->add(&m_resultType); group->add(&m_porosityModel); group->add(&m_selectedDynamicProperties); @@ -343,7 +326,7 @@ void RimStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin group->add(&m_selectedFractureGeneratedProperties); group->add(&m_selectedFractureInputProperties); - group = uiOrdering.addNewGroup("Percentiles"); + group = uiOrdering.addNewGroup("Percentile setup"); group->setUiHidden(hasComputedStatistics()); group->add(&m_calculatePercentiles); group->add(&m_percentileCalculationType); @@ -432,10 +415,35 @@ void RimStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField { } - if (&m_editingAllowed == changedField) + if (&m_calculateEditCommand == changedField) { - clearComputedStatistics(); - m_editingAllowed = false; + if (hasComputedStatistics()) + { + clearComputedStatistics(); + } + else + { + computeStatistics(); + } + m_calculateEditCommand = false; + } + + //updateSelectionSummaryLabel(); +} + +void addPropertySetToHtmlText(QString& html, const QString& heading, const std::vector& varNames) +{ + if (varNames.size()) + { + html += "

" + heading + "

"; + html += "

"; + for (size_t pIdx = 0; pIdx < varNames.size(); ++pIdx) + { + html += varNames[pIdx]; + if ( (pIdx+1)%6 == 0 ) html += "
"; + else if (pIdx != varNames.size() -1) html += ", "; + } + html += "

"; } } @@ -447,47 +455,34 @@ void RimStatisticsCase::updateSelectionSummaryLabel() QString html; html += ""; - if (m_selectedDynamicProperties().size()) + html += "

Statistical variables to compute:

"; + html += "

"; + html += "Min, Max, Range, Mean, Std.dev"; ; + if (m_calculatePercentiles()) { - html += "

Dynamic properties:

"; - for (size_t pIdx = 0; pIdx < m_selectedDynamicProperties().size(); ++pIdx) - { - html += "" + m_selectedDynamicProperties()[pIdx] + "
"; - } - html += "

"; + html += "
"; + html += "Percentiles for : " + + QString::number(m_lowPercentile()) + ", " + + QString::number(m_midPercentile()) + ", " + + QString::number(m_highPercentile()); } + html += "

"; + + addPropertySetToHtmlText(html, "Dynamic properties", m_selectedDynamicProperties()); + addPropertySetToHtmlText(html, "Static properties", m_selectedStaticProperties()); + addPropertySetToHtmlText(html, "Generated properties", m_selectedGeneratedProperties()); + addPropertySetToHtmlText(html, "Input properties", m_selectedInputProperties()); + + addPropertySetToHtmlText(html, "Dynamic properties, fracture model" , m_selectedFractureDynamicProperties()); + addPropertySetToHtmlText(html, "Static properties, fracture model" , m_selectedFractureStaticProperties()); + addPropertySetToHtmlText(html, "Generated properties, fracture model", m_selectedFractureGeneratedProperties()); + addPropertySetToHtmlText(html, "Input properties, fracture model" , m_selectedFractureInputProperties()); - if (m_selectedStaticProperties().size()) - { - html += "Static properties:

"; - for (size_t pIdx = 0; pIdx < m_selectedStaticProperties().size(); ++pIdx) - { - html += " " + m_selectedStaticProperties()[pIdx] + "
"; - } - html += "

"; - } - if (m_selectedGeneratedProperties().size()) - { - html += "Generated properties:

"; - for (size_t pIdx = 0; pIdx < m_selectedGeneratedProperties().size(); ++pIdx) - { - html += " " + m_selectedGeneratedProperties()[pIdx] + "
"; - } - html += "

"; - } - if (m_selectedInputProperties().size()) - { - html += "Input properties:

"; - for (size_t pIdx = 0; pIdx < m_selectedInputProperties().size(); ++pIdx) - { - html += " " + m_selectedInputProperties()[pIdx] + "
"; - } - html += "

"; - } m_selectionSummary = html; } @@ -502,10 +497,10 @@ void RimStatisticsCase::defineEditorAttribute(const caf::PdmFieldHandle* field, textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML; } - if (&m_editingAllowed == field) + if (&m_calculateEditCommand == field) { caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast (attribute); - attrib->m_buttonText = hasComputedStatistics() ? "UNLOCK": "Unlocked"; + attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute"; } } @@ -542,24 +537,6 @@ void RimStatisticsCase::updatePercentileUiVisibility() m_highPercentile.setUiHidden(isLocked || !m_calculatePercentiles()); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimStatisticsCase::updateUnlockUiVisibility() -{ - bool isLocked = hasComputedStatistics(); - if (isLocked) - { - m_calculationStatus = CALCULATED; - } - else - { - m_calculationStatus = NOT_CALCULATED; - } - - m_editingAllowed.setUiHidden(!isLocked ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStatisticsCase.h b/ApplicationCode/ProjectDataModel/RimStatisticsCase.h index 98d8df780b..b72ec6a98a 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticsCase.h +++ b/ApplicationCode/ProjectDataModel/RimStatisticsCase.h @@ -60,12 +60,7 @@ public: HISTOGRAM_ESTIMATED }; - enum CalculationStatus - { - CALCULATED, - NOT_CALCULATED - }; - + private: RimIdenticalGridCaseGroup* caseGroup(); @@ -74,7 +69,6 @@ private: void updateSelectionListVisibilities(); void updateSelectionSummaryLabel(); void updatePercentileUiVisibility(); - void updateUnlockUiVisibility(); // Pdm system overrides virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) ; @@ -84,8 +78,7 @@ private: virtual void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute ); // Fields - caf::PdmField< caf::AppEnum< CalculationStatus > > m_calculationStatus; - caf::PdmField< bool > m_editingAllowed; + caf::PdmField< bool > m_calculateEditCommand; caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultType; caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModel;