From cfab9102721a19f3e88d07d89d38c1df253fc897 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 May 2018 12:47:12 +0200 Subject: [PATCH] Remove unused code --- .../Summary/RimEnsembleCurveSetCollection.cpp | 276 +++--------------- .../Summary/RimEnsembleCurveSetCollection.h | 14 +- 2 files changed, 38 insertions(+), 252 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 6ba4bf20a2..905e7b8b91 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // 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 +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -23,26 +23,22 @@ #include "RifReaderEclipseSummary.h" -#include "RimProject.h" #include "RimEnsembleCurveSet.h" +#include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" +#include "RimSummaryCurveAppearanceCalculator.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotSourceStepping.h" -#include "RimSummaryCurveAppearanceCalculator.h" #include "RiuLineSegmentQwtPlotCurve.h" #include "RiuSummaryQwtPlot.h" -#include "cafPdmUiTreeViewEditor.h" - -#include - CAF_PDM_SOURCE_INIT(RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollection"); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() { @@ -54,33 +50,10 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", ""); m_showCurves.uiCapability()->setUiHidden(true); - - //CAF_PDM_InitFieldNoDefault(&m_ySourceStepping, "YSourceStepping", "", "", "", ""); - //m_ySourceStepping = new RimSummaryPlotSourceStepping; - //m_ySourceStepping->setSourceSteppingType(RimSummaryPlotSourceStepping::Y_AXIS); - //m_ySourceStepping.uiCapability()->setUiHidden(true); - //m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden(true); - //m_ySourceStepping.xmlCapability()->disableIO(); - - //CAF_PDM_InitFieldNoDefault(&m_xSourceStepping, "XSourceStepping", "", "", "", ""); - //m_xSourceStepping = new RimSummaryPlotSourceStepping; - //m_xSourceStepping->setSourceSteppingType(RimSummaryPlotSourceStepping::X_AXIS); - //m_xSourceStepping.uiCapability()->setUiHidden(true); - //m_xSourceStepping.uiCapability()->setUiTreeChildrenHidden(true); - //m_xSourceStepping.xmlCapability()->disableIO(); - - //CAF_PDM_InitFieldNoDefault(&m_unionSourceStepping, "UnionSourceStepping", "", "", "", ""); - //m_unionSourceStepping = new RimSummaryPlotSourceStepping; - //m_unionSourceStepping->setSourceSteppingType(RimSummaryPlotSourceStepping::UNION_X_Y_AXIS); - //m_unionSourceStepping.uiCapability()->setUiHidden(true); - //m_unionSourceStepping.uiCapability()->setUiTreeChildrenHidden(true); - //m_unionSourceStepping.xmlCapability()->disableIO(); - - } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSetCollection::~RimEnsembleCurveSetCollection() { @@ -88,7 +61,7 @@ RimEnsembleCurveSetCollection::~RimEnsembleCurveSetCollection() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimEnsembleCurveSetCollection::isCurveSetsVisible() { @@ -96,7 +69,7 @@ bool RimEnsembleCurveSetCollection::isCurveSetsVisible() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot) { @@ -105,28 +78,22 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot) curveSet->loadDataAndUpdate(updateParentPlot); } - //for (RimSummaryCurve* curve : m_curves) - //{ - // curve->loadDataAndUpdate(false); - // curve->updateQwtPlotAxis(); - //} - - if ( updateParentPlot ) + if (updateParentPlot) { - RimSummaryPlot* parentPlot; - firstAncestorOrThisOfTypeAsserted(parentPlot); - if ( parentPlot->qwtPlot() ) - { - parentPlot->updatePlotTitle(); - parentPlot->qwtPlot()->updateLegend(); - parentPlot->updateAxes(); - parentPlot->updateZoomInQwt(); - } + RimSummaryPlot* parentPlot; + firstAncestorOrThisOfTypeAsserted(parentPlot); + if (parentPlot->qwtPlot()) + { + parentPlot->updatePlotTitle(); + parentPlot->qwtPlot()->updateLegend(); + parentPlot->updateAxes(); + parentPlot->updateZoomInQwt(); + } } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot(QwtPlot* plot) { @@ -139,18 +106,18 @@ void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot(QwtPlot* plot) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::detachQwtCurves() { - for(const auto& curveSet : m_curveSets) + for (const auto& curveSet : m_curveSets) { curveSet->detachQwtCurves(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve(const QwtPlotCurve* qwtCurve) const { @@ -169,12 +136,12 @@ RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve( } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::addCurveSet(RimEnsembleCurveSet* curveSet) { static int nextAutoColorIndex = 1; - static int numberOfColors = (int)RiaColorTables::summaryCurveDefaultPaletteColors().size(); + static int numberOfColors = (int)RiaColorTables::summaryCurveDefaultPaletteColors().size(); if (curveSet) { @@ -186,7 +153,7 @@ void RimEnsembleCurveSetCollection::addCurveSet(RimEnsembleCurveSet* curveSet) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::deleteCurveSet(RimEnsembleCurveSet* curveSet) { @@ -198,7 +165,7 @@ void RimEnsembleCurveSetCollection::deleteCurveSet(RimEnsembleCurveSet* curveSet } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::vector RimEnsembleCurveSetCollection::curveSets() const { @@ -206,7 +173,7 @@ std::vector RimEnsembleCurveSetCollection::curveSets() con } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::vector RimEnsembleCurveSetCollection::visibleCurveSets() const { @@ -214,7 +181,7 @@ std::vector RimEnsembleCurveSetCollection::visibleCurveSet if (m_showCurves()) { - for (auto c : m_curveSets) + for (const auto& c : m_curveSets) { if (c->isCurvesVisible()) { @@ -226,57 +193,16 @@ std::vector RimEnsembleCurveSetCollection::visibleCurveSet return visible; } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -//void RimEnsembleCurveSetCollection::deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase) -//{ -// std::vector summaryCurvesToDelete; -// -// for (RimSummaryCurve* summaryCurve : m_curves) -// { -// if (!summaryCurve) continue; -// if (!summaryCurve->summaryCaseY()) continue; -// -// if (summaryCurve->summaryCaseY() == summaryCase) -// { -// summaryCurvesToDelete.push_back(summaryCurve); -// } -// } -// for (RimSummaryCurve* summaryCurve : summaryCurvesToDelete) -// { -// m_curves.removeChildObject(summaryCurve); -// delete summaryCurve; -// } -// -//} - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::deleteAllCurveSets() { m_curveSets.deleteAllChildObjects(); } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -//void RimEnsembleCurveSetCollection::updateCaseNameHasChanged() -//{ -// for (RimSummaryCurve* curve : m_curves) -// { -// curve->updateCurveNameNoLegendUpdate(); -// curve->updateConnectedEditors(); -// } -// -// RimSummaryPlot* parentPlot; -// firstAncestorOrThisOfTypeAsserted(parentPlot); -// if (parentPlot->qwtPlot()) parentPlot->qwtPlot()->updateLegend(); -//} -// //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet) { @@ -285,92 +211,12 @@ void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet(RimEnsembleCurveSe updateConnectedEditors(); } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -//std::vector RimEnsembleCurveSetCollection::fieldsToShowInToolbar() -//{ -// RimSummaryCrossPlot* parentCrossPlot; -// firstAncestorOrThisOfType(parentCrossPlot); -// -// if (parentCrossPlot) -// { -// return m_unionSourceStepping->fieldsToShowInToolbar(); -// } -// -// return m_ySourceStepping()->fieldsToShowInToolbar(); -//} -// -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -//void RimEnsembleCurveSetCollection::handleKeyPressEvent(QKeyEvent* keyEvent) -//{ -// if (!keyEvent) return; -// -// RimSummaryPlotSourceStepping* sourceStepping = nullptr; -// { -// RimSummaryCrossPlot* summaryCrossPlot = nullptr; -// this->firstAncestorOrThisOfType(summaryCrossPlot); -// -// if (summaryCrossPlot) -// { -// sourceStepping = m_unionSourceStepping(); -// } -// else -// { -// sourceStepping = m_ySourceStepping(); -// } -// } -// -// if (keyEvent->key() == Qt::Key_PageUp) -// { -// if (keyEvent->modifiers() & Qt::ShiftModifier) -// { -// sourceStepping->applyPrevCase(); -// -// keyEvent->accept(); -// } -// else if (keyEvent->modifiers() & Qt::ControlModifier) -// { -// sourceStepping->applyPrevOtherIdentifier(); -// -// keyEvent->accept(); -// } -// else -// { -// sourceStepping->applyPrevQuantity(); -// -// keyEvent->accept(); -// } -// } -// else if (keyEvent->key() == Qt::Key_PageDown) -// { -// if (keyEvent->modifiers() & Qt::ShiftModifier) -// { -// sourceStepping->applyNextCase(); -// -// keyEvent->accept(); -// } -// else if (keyEvent->modifiers() & Qt::ControlModifier) -// { -// sourceStepping->applyNextOtherIdentifier(); -// -// keyEvent->accept(); -// } -// else -// { -// sourceStepping->applyNextQuantity(); -// -// keyEvent->accept(); -// } -// } -//} - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue) { if (changedField == &m_showCurves) { @@ -383,57 +229,9 @@ void RimEnsembleCurveSetCollection::fieldChangedByUi(const caf::PdmFieldHandle* } //-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) -{ - //RimSummaryCrossPlot* parentCrossPlot; - //firstAncestorOrThisOfType(parentCrossPlot); - - //if (parentCrossPlot) - //{ - // { - // auto group = uiOrdering.addNewGroup("Y Source Stepping"); - - // m_ySourceStepping()->uiOrdering(uiConfigName, *group); - // } - - // { - // auto group = uiOrdering.addNewGroup("X Source Stepping"); - - // m_xSourceStepping()->uiOrdering(uiConfigName, *group); - // } - - // { - // auto group = uiOrdering.addNewGroup("XY Union Source Stepping"); - - // m_unionSourceStepping()->uiOrdering(uiConfigName, *group); - // } - //} - //else - //{ - // auto group = uiOrdering.addNewGroup("Plot Source Stepping"); - - // m_ySourceStepping()->uiOrdering(uiConfigName, *group); - //} -} - -//-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimEnsembleCurveSetCollection::objectToggleField() { return &m_showCurves; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute) -{ - //caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast(attribute); - //if (myAttr && m_currentSummaryCurve.notNull()) - //{ - // myAttr->currentObject = m_currentSummaryCurve.p(); - //} -} diff --git a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h index 756ba20aee..2eb506aa84 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h +++ b/ApplicationCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h @@ -23,9 +23,7 @@ #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmPtrArrayField.h" -class RimSummaryCase; class RimEnsembleCurveSet; class QwtPlot; class QwtPlotCurve; @@ -55,22 +53,12 @@ public: std::vector curveSets() const; std::vector visibleCurveSets() const; - //void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase); void deleteAllCurveSets(); - //void updateCaseNameHasChanged(); void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet); - //std::vector fieldsToShowInToolbar(); - - //void handleKeyPressEvent(QKeyEvent* keyEvent); - private: - caf::PdmFieldHandle* objectToggleField(); - virtual void defineObjectEditorAttribute(QString uiConfigName, - caf::PdmUiEditorAttribute* attribute) override; - - virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + caf::PdmFieldHandle* objectToggleField() override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;