Remove unused code

This commit is contained in:
Magne Sjaastad 2018-05-02 12:47:12 +02:00
parent 95c11d0085
commit cfab910272
2 changed files with 38 additions and 252 deletions

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017- Statoil ASA // Copyright (C) 2017- Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -23,26 +23,22 @@
#include "RifReaderEclipseSummary.h" #include "RifReaderEclipseSummary.h"
#include "RimProject.h"
#include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSet.h"
#include "RimProject.h"
#include "RimSummaryCase.h" #include "RimSummaryCase.h"
#include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlot.h"
#include "RimSummaryCurve.h" #include "RimSummaryCurve.h"
#include "RimSummaryCurveAppearanceCalculator.h"
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
#include "RimSummaryPlotSourceStepping.h" #include "RimSummaryPlotSourceStepping.h"
#include "RimSummaryCurveAppearanceCalculator.h"
#include "RiuLineSegmentQwtPlotCurve.h" #include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuSummaryQwtPlot.h" #include "RiuSummaryQwtPlot.h"
#include "cafPdmUiTreeViewEditor.h"
#include <QKeyEvent>
CAF_PDM_SOURCE_INIT(RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollection"); CAF_PDM_SOURCE_INIT(RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollection");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection()
{ {
@ -54,33 +50,10 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection()
CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", ""); CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", "");
m_showCurves.uiCapability()->setUiHidden(true); 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() RimEnsembleCurveSetCollection::~RimEnsembleCurveSetCollection()
{ {
@ -88,7 +61,7 @@ RimEnsembleCurveSetCollection::~RimEnsembleCurveSetCollection()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimEnsembleCurveSetCollection::isCurveSetsVisible() bool RimEnsembleCurveSetCollection::isCurveSetsVisible()
{ {
@ -96,7 +69,7 @@ bool RimEnsembleCurveSetCollection::isCurveSetsVisible()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot) void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
{ {
@ -105,28 +78,22 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
curveSet->loadDataAndUpdate(updateParentPlot); curveSet->loadDataAndUpdate(updateParentPlot);
} }
//for (RimSummaryCurve* curve : m_curves) if (updateParentPlot)
//{
// curve->loadDataAndUpdate(false);
// curve->updateQwtPlotAxis();
//}
if ( updateParentPlot )
{ {
RimSummaryPlot* parentPlot; RimSummaryPlot* parentPlot;
firstAncestorOrThisOfTypeAsserted(parentPlot); firstAncestorOrThisOfTypeAsserted(parentPlot);
if ( parentPlot->qwtPlot() ) if (parentPlot->qwtPlot())
{ {
parentPlot->updatePlotTitle(); parentPlot->updatePlotTitle();
parentPlot->qwtPlot()->updateLegend(); parentPlot->qwtPlot()->updateLegend();
parentPlot->updateAxes(); parentPlot->updateAxes();
parentPlot->updateZoomInQwt(); parentPlot->updateZoomInQwt();
} }
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot(QwtPlot* plot) void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot(QwtPlot* plot)
{ {
@ -139,18 +106,18 @@ void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot(QwtPlot* plot)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::detachQwtCurves() void RimEnsembleCurveSetCollection::detachQwtCurves()
{ {
for(const auto& curveSet : m_curveSets) for (const auto& curveSet : m_curveSets)
{ {
curveSet->detachQwtCurves(); curveSet->detachQwtCurves();
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve(const QwtPlotCurve* qwtCurve) const RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve(const QwtPlotCurve* qwtCurve) const
{ {
@ -169,12 +136,12 @@ RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve(
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::addCurveSet(RimEnsembleCurveSet* curveSet) void RimEnsembleCurveSetCollection::addCurveSet(RimEnsembleCurveSet* curveSet)
{ {
static int nextAutoColorIndex = 1; static int nextAutoColorIndex = 1;
static int numberOfColors = (int)RiaColorTables::summaryCurveDefaultPaletteColors().size(); static int numberOfColors = (int)RiaColorTables::summaryCurveDefaultPaletteColors().size();
if (curveSet) if (curveSet)
{ {
@ -186,7 +153,7 @@ void RimEnsembleCurveSetCollection::addCurveSet(RimEnsembleCurveSet* curveSet)
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::deleteCurveSet(RimEnsembleCurveSet* curveSet) void RimEnsembleCurveSetCollection::deleteCurveSet(RimEnsembleCurveSet* curveSet)
{ {
@ -198,7 +165,7 @@ void RimEnsembleCurveSetCollection::deleteCurveSet(RimEnsembleCurveSet* curveSet
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::curveSets() const std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::curveSets() const
{ {
@ -206,7 +173,7 @@ std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::curveSets() con
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::visibleCurveSets() const std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::visibleCurveSets() const
{ {
@ -214,7 +181,7 @@ std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::visibleCurveSet
if (m_showCurves()) if (m_showCurves())
{ {
for (auto c : m_curveSets) for (const auto& c : m_curveSets)
{ {
if (c->isCurvesVisible()) if (c->isCurvesVisible())
{ {
@ -226,57 +193,16 @@ std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::visibleCurveSet
return visible; return visible;
} }
////--------------------------------------------------------------------------------------------------
/////
////--------------------------------------------------------------------------------------------------
//void RimEnsembleCurveSetCollection::deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase)
//{
// std::vector<RimSummaryCurve*> 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() void RimEnsembleCurveSetCollection::deleteAllCurveSets()
{ {
m_curveSets.deleteAllChildObjects(); 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) void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet)
{ {
@ -285,92 +211,12 @@ void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet(RimEnsembleCurveSe
updateConnectedEditors(); updateConnectedEditors();
} }
////--------------------------------------------------------------------------------------------------
/////
////--------------------------------------------------------------------------------------------------
//std::vector<caf::PdmFieldHandle*> 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) 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() caf::PdmFieldHandle* RimEnsembleCurveSetCollection::objectToggleField()
{ {
return &m_showCurves; return &m_showCurves;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
{
//caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>(attribute);
//if (myAttr && m_currentSummaryCurve.notNull())
//{
// myAttr->currentObject = m_currentSummaryCurve.p();
//}
}

View File

@ -23,9 +23,7 @@
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmPtrArrayField.h"
class RimSummaryCase;
class RimEnsembleCurveSet; class RimEnsembleCurveSet;
class QwtPlot; class QwtPlot;
class QwtPlotCurve; class QwtPlotCurve;
@ -55,22 +53,12 @@ public:
std::vector<RimEnsembleCurveSet*> curveSets() const; std::vector<RimEnsembleCurveSet*> curveSets() const;
std::vector<RimEnsembleCurveSet*> visibleCurveSets() const; std::vector<RimEnsembleCurveSet*> visibleCurveSets() const;
//void deleteCurvesAssosiatedWithCase(RimSummaryCase* summaryCase);
void deleteAllCurveSets(); void deleteAllCurveSets();
//void updateCaseNameHasChanged();
void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet); void setCurrentSummaryCurveSet(RimEnsembleCurveSet* curveSet);
//std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
//void handleKeyPressEvent(QKeyEvent* keyEvent);
private: private:
caf::PdmFieldHandle* objectToggleField(); caf::PdmFieldHandle* objectToggleField() override;
virtual void defineObjectEditorAttribute(QString uiConfigName,
caf::PdmUiEditorAttribute* attribute) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& newValue) override; const QVariant& oldValue, const QVariant& newValue) override;