2017-11-08 08:43:14 +01:00
|
|
|
//////////////////////////// /////////////////////////////////////////////////////
|
2017-10-12 07:32:21 +02:00
|
|
|
//
|
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2017-11-06 12:08:13 +01:00
|
|
|
#include "RiuCalculationsContextMenuManager.h"
|
2017-10-12 07:32:21 +02:00
|
|
|
#include "cafPdmField.h"
|
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
#include "cafPdmPtrField.h"
|
2017-11-04 01:14:56 +01:00
|
|
|
#include <memory>
|
2017-10-12 07:32:21 +02:00
|
|
|
|
2017-10-23 14:42:38 +02:00
|
|
|
class RimSummaryCalculationCollection;
|
2017-10-23 14:27:04 +02:00
|
|
|
class RimSummaryCalculation;
|
2017-10-12 07:32:21 +02:00
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
///
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
class RicSummaryCurveCalculator : public caf::PdmObject
|
|
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
RicSummaryCurveCalculator();
|
|
|
|
|
|
2017-10-13 16:22:39 +02:00
|
|
|
static QString calculatedSummariesGroupName();
|
|
|
|
|
static QString calulationGroupName();
|
2017-10-12 07:32:21 +02:00
|
|
|
|
2017-11-08 08:43:14 +01:00
|
|
|
RimSummaryCalculation* currentCalculation() const;
|
|
|
|
|
void setCurrentCalculation(RimSummaryCalculation* calculation);
|
2017-10-12 07:32:21 +02:00
|
|
|
|
2017-10-20 10:20:53 +02:00
|
|
|
bool parseExpression() const;
|
|
|
|
|
bool calculate() const;
|
2017-10-13 16:22:39 +02:00
|
|
|
|
2017-11-04 01:14:56 +01:00
|
|
|
static RimSummaryCalculationCollection* calculationCollection();
|
|
|
|
|
|
2017-10-12 07:32:21 +02:00
|
|
|
private:
|
2018-10-18 19:45:57 +02:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
|
|
|
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
|
|
|
|
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
|
|
|
|
void onEditorWidgetsCreated() override;
|
2017-10-12 07:32:21 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// TODO : Move to a common caf helper class
|
|
|
|
|
static void assignPushButtonEditor(caf::PdmFieldHandle* fieldHandle);
|
|
|
|
|
static void assignPushButtonEditorText(caf::PdmUiEditorAttribute* attribute, const QString& text);
|
|
|
|
|
|
|
|
|
|
private:
|
2017-10-23 14:27:04 +02:00
|
|
|
caf::PdmPtrField<RimSummaryCalculation*> m_currentCalculation;
|
2017-10-12 07:32:21 +02:00
|
|
|
|
|
|
|
|
caf::PdmField<bool> m_newCalculation;
|
|
|
|
|
caf::PdmField<bool> m_deleteCalculation;
|
2017-11-04 01:14:56 +01:00
|
|
|
|
|
|
|
|
std::unique_ptr<RiuCalculationsContextMenuManager> m_calcContextMenuMgr;
|
2017-10-12 07:32:21 +02:00
|
|
|
};
|