Clang-format changed files

This commit is contained in:
Gaute Lindkvist 2019-09-06 13:17:36 +02:00
parent bf9f43c3b4
commit de8a5a59f3
34 changed files with 3612 additions and 3469 deletions

View File

@ -2,44 +2,44 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPltPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "Rim3dView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPltPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimPltPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimEclipseResultCase.h"
#include "RimWellPltPlot.h"
#include "RiuPlotMainWindowTools.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
@ -47,99 +47,98 @@
#include <vector>
CAF_CMD_SOURCE_INIT(RicNewPltPlotFeature, "RicNewPltPlotFeature");
CAF_CMD_SOURCE_INIT( RicNewPltPlotFeature, "RicNewPltPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
bool enable = true;
if (selectedWellPath)
if ( selectedWellPath )
{
if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath))
if ( selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData( selectedWellPath ) )
{
return false;
}
}
if (simWell != nullptr)
if ( simWell != nullptr )
{
RimProject* proj = RiaApplication::instance()->project();
QString simWellName = simWell->name();
RimProject* proj = RiaApplication::instance()->project();
QString simWellName = simWell->name();
RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName);
enable = wellPath != nullptr;
RimWellPath* wellPath = proj->wellPathFromSimWellName( simWellName );
enable = wellPath != nullptr;
}
return enable;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered(bool isChecked)
void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
if (pltPlotColl)
if ( pltPlotColl )
{
QString wellPathName;
RimWellPath* wellPath = nullptr;
QString wellPathName;
RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr;
if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr)
if ( ( wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() ) != nullptr )
{
wellPathName = wellPath->name();
}
else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr)
else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>() ) != nullptr )
{
wellPath = proj->wellPathFromSimWellName(eclipseWell->name());
if (!wellPath ) return;
wellPath = proj->wellPathFromSimWellName( eclipseWell->name() );
if ( !wellPath ) return;
wellPathName = wellPath->name();
}
QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName);
QString plotName = QString( RimWellPltPlot::plotNameFormatString() ).arg( wellPathName );
RimWellPltPlot* pltPlot = new RimWellPltPlot();
pltPlot->setCurrentWellName(wellPathName);
pltPlot->setCurrentWellName( wellPathName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(pltPlot->trackCount()));
pltPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->trackCount() ) );
pltPlotColl->addPlot(pltPlot);
pltPlot->setDescription(plotName);
pltPlotColl->addPlot( pltPlot );
pltPlot->setDescription( plotName );
//pltPlot->applyInitialSelections();
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack);
RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot);
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( pltPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::setupActionLook(QAction* actionToSetup)
void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText("New PLT Plot");
actionToSetup->setIcon(QIcon(":/WellFlowPlot16x16.png"));
actionToSetup->setText( "New PLT Plot" );
actionToSetup->setIcon( QIcon( ":/WellFlowPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{
@ -148,34 +147,33 @@ RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex ) const
{
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>( selItem );
if ( simWellSelItem )
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
( *branchIndex ) = static_cast<int>( simWellSelItem->m_branchIndex );
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);
RiaApplication::instance()->project()->allCases( cases );
return cases.size() > 0;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -37,18 +37,17 @@
#include <vector>
CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::isCommandEnabled()
{
RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
if (simWell) return true;
if (selectedWellName().isEmpty())
if ( simWell ) return true;
if ( selectedWellName().isEmpty() )
{
return false;
}
@ -57,58 +56,58 @@ bool RicNewRftPlotFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl)
if ( rftPlotColl )
{
QString wellName = selectedWellName();
QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName);
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName(wellName);
rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(rftPlot->trackCount()));
rftPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot(rftPlot);
rftPlot->setDescription(plotName);
rftPlotColl->addPlot( rftPlot );
rftPlot->setDescription( plotName );
rftPlot->applyInitialSelections();
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack);
RiuPlotMainWindowTools::selectAsCurrentItem(rftPlot);
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( rftPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup)
void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText("New RFT Plot");
actionToSetup->setIcon(QIcon(":/FlowCharPlot16x16.png"));
actionToSetup->setText( "New RFT Plot" );
actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RicNewRftPlotFeature::selectedWellName()
{
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
if (simWell) return simWell->name();
if ( simWell ) return simWell->name();
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if (rimWellPath) return rimWellPath->name();
if ( rimWellPath ) return rimWellPath->name();
return QString();
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -38,93 +38,106 @@ class RimWellAllocationPlotLegend;
class RimWellLogTrack;
class RiuWellAllocationPlot;
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
namespace caf {
class PdmOptionItemInfo;
namespace caf
{
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimWellAllocationPlot : public RimWellLogPlot
{
CAF_PDM_HEADER_INIT;
public:
enum FlowType { ACCUMULATED, INFLOW};
enum FlowType
{
ACCUMULATED,
INFLOW
};
public:
RimWellAllocationPlot();
~RimWellAllocationPlot() override;
void setFromSimulationWell(RimSimWellInView* simWell);
void setFromSimulationWell( RimSimWellInView* simWell );
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
caf::PdmObject* plotLegend();
RimEclipseResultCase* rimCase();
int timeStep();
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
caf::PdmObject* plotLegend();
RimEclipseResultCase* rimCase();
int timeStep();
QString wellName() const;
QString wellName() const;
void removeFromMdiAreaAndDeleteViewWidget();
void removeFromMdiAreaAndDeleteViewWidget();
void showPlotLegend( bool doShow );
void showPlotLegend(bool doShow);
protected:
// Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
std::set<QString> findSortedWellNames();
std::set<QString> findSortedWellNames();
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
private:
void updateFromWell();
void updateFromWell();
std::map<QString, const std::vector<double> *> findRelevantTracerCellFractions(const RigSimWellData* simWellData);
std::map<QString, const std::vector<double>*> findRelevantTracerCellFractions( const RigSimWellData* simWellData );
void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack);
void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack );
void addStackedCurve(const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack);
static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep);
void addStackedCurve( const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack );
QWidget* createViewWidget(QWidget* mainWindowParent) override;
static QString wellStatusTextForTimeStep( const QString& wellName,
const RimEclipseResultCase* eclipseResultCase,
size_t timeStep );
cvf::Color3f getTracerColor(const QString& tracerName);
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void updateFormationNamesData() const;
std::set<RiaDefines::DepthUnitType> availableDepthUnits() const override;
std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override;
void onDepthTypeChanged() override;
cvf::Color3f getTracerColor( const QString& tracerName );
void updateFormationNamesData() const;
std::set<RiaDefines::DepthUnitType> availableDepthUnits() const override;
std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override;
void onDepthTypeChanged() override;
RiuWellAllocationPlot* allocationPlotWidget() const;
RiuWellAllocationPlot* allocationPlotWidget() const;
private:
caf::PdmField<bool> m_branchDetection;
caf::PdmField<bool> m_branchDetection;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<bool> m_groupSmallContributions;
caf::PdmField<double> m_smallContributionsThreshold;
caf::PdmField<caf::AppEnum<FlowType> > m_flowType;
caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<bool> m_groupSmallContributions;
caf::PdmField<double> m_smallContributionsThreshold;
caf::PdmField<caf::AppEnum<FlowType>> m_flowType;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot_OBSOLETE;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot_OBSOLETE;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
};

File diff suppressed because it is too large Load Diff

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -22,18 +22,18 @@
#include "RimWellLogPlot.h"
#include "RimWellPlotTools.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafPdmChildArrayField.h"
#include "cvfCollection.h"
#include <QPointer>
#include <QDate>
#include <QMetaType>
#include <QPointer>
#include <set>
#include <map>
#include <set>
class RimEclipseCase;
class RimEclipseResultCase;
@ -45,18 +45,19 @@ class RimWellLogTrack;
class RiaRftPltCurveDefinition;
class RimDataSourceForRftPlt;
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
namespace caf {
class PdmOptionItemInfo;
namespace caf
{
class PdmOptionItemInfo;
}
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimWellPltPlot : public RimWellLogPlot
{
@ -68,64 +69,69 @@ public:
RimWellPltPlot();
~RimWellPltPlot() override;
void setCurrentWellName(const QString& currWellName);
static const char* plotNameFormatString();
void setCurrentWellName( const QString& currWellName );
static const char* plotNameFormatString();
protected:
// Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
void onLoadDataAndUpdate() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void setupBeforeSave() override;
void initAfterLoad();
void initAfterRead() override;
void setupBeforeSave() override;
void initAfterLoad();
private:
void syncSourcesIoFieldFromGuiField();
void syncCurvesFromUiSelection();
void syncSourcesIoFieldFromGuiField();
void syncCurvesFromUiSelection();
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
void addStackedCurve(const QString& tracerName,
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
void addStackedCurve( const QString& tracerName,
const std::vector<double>& depthValues,
const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack,
cvf::Color3f color,
int curveGroupId,
bool doFillCurve);
bool doFillCurve );
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
// RimViewWindow overrides
void setPlotXAxisTitles(RimWellLogTrack* plotTrack);
void setPlotXAxisTitles( RimWellLogTrack* plotTrack );
void updateFormationsOnPlot() const;
void updateFormationsOnPlot() const;
std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override;
private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<QString> m_wellPathName;
caf::PdmField<QString> m_wellPathName;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
caf::PdmChildArrayField<RimDataSourceForRftPlt*> m_selectedSourcesForIo;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
caf::PdmChildArrayField<RimDataSourceForRftPlt*> m_selectedSourcesForIo;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
caf::PdmField<bool> m_useStandardConditionCurves;
caf::PdmField<bool> m_useReservoirConditionCurves;
caf::PdmField<bool> m_useStandardConditionCurves;
caf::PdmField<bool> m_useReservoirConditionCurves;
caf::PdmField<std::vector<caf::AppEnum<FlowPhase>>> m_phases;
bool m_doInitAfterLoad;
bool m_isOnLoad;
bool m_doInitAfterLoad;
bool m_isOnLoad;
};

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ public:
~RimWellRftPlot() override;
const QString& simWellOrWellPathName() const;
void setSimWellOrWellPathName(const QString& currWellName);
void setSimWellOrWellPathName( const QString& currWellName );
int branchIndex() const;
@ -82,49 +82,52 @@ public:
static const char* plotNameFormatString();
void deleteCurvesAssosicatedWithObservedData(const RimObservedFmuRftData* observedFmuRftData);
void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData );
protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
private:
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options);
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void updateEditorsFromCurves();
void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves();
RimObservedFmuRftData* findObservedFmuData(const QString& wellPathName, const QDateTime& timeStep) const;
RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const;
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
std::set<RiaRftPltCurveDefinition> curveDefsFromCurves() const;
void updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>& allCurveDefs,
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
const std::set<RimWellLogCurve*>& curvesToDelete);
void updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition>& allCurveDefs,
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
const std::set<RimWellLogCurve*>& curvesToDelete );
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
// RimViewWindow overrides
void applyCurveAppearance(RimWellLogCurve* newCurve);
void applyCurveAppearance( RimWellLogCurve* newCurve );
void updateFormationsOnPlot() const;
QString associatedSimWellName() const;
static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress(const RifEclipseRftAddress& address);
static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress(const RifEclipseRftAddress& address);
static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address );
static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address );
void defineCurveColorsAndSymbols(const std::set<RiaRftPltCurveDefinition>& allCurveDefs);
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
void onDepthTypeChanged() override;
private:
caf::PdmField<QString> m_wellPathNameOrSimWellName;
caf::PdmField<int> m_branchIndex;
@ -139,7 +142,7 @@ private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
bool m_isOnLoad;
bool m_isOnLoad;
};

View File

@ -43,41 +43,40 @@
#include <QDebug>
CAF_PDM_SOURCE_INIT(RimGridCrossPlot, "RimGridCrossPlot");
CAF_PDM_SOURCE_INIT( RimGridCrossPlot, "RimGridCrossPlot" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlot::RimGridCrossPlot()
{
CAF_PDM_InitObject("Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", "");
CAF_PDM_InitObject( "Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", "" );
CAF_PDM_InitField(&m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Show Legend", "", "", "");
CAF_PDM_InitField(&m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "");
m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize());
CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend", "", "", "" );
CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "" );
m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name Config", "", "", "");
m_nameConfig.uiCapability()->setUiTreeHidden(true);
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
m_nameConfig = new RimGridCrossPlotNameConfig();
CAF_PDM_InitFieldNoDefault(&m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "");
m_xAxisProperties.uiCapability()->setUiTreeHidden(true);
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "" );
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
m_xAxisProperties = new RimPlotAxisProperties;
m_xAxisProperties->setNameAndAxis("X-Axis", QwtPlot::xBottom);
m_xAxisProperties->setEnableTitleTextSettings(false);
m_xAxisProperties->setNameAndAxis( "X-Axis", QwtPlot::xBottom );
m_xAxisProperties->setEnableTitleTextSettings( false );
CAF_PDM_InitFieldNoDefault(&m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "");
m_yAxisProperties.uiCapability()->setUiTreeHidden(true);
CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "" );
m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
m_yAxisProperties = new RimPlotAxisProperties;
m_yAxisProperties->setNameAndAxis("Y-Axis", QwtPlot::yLeft);
m_yAxisProperties->setEnableTitleTextSettings(false);
CAF_PDM_InitFieldNoDefault(&m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "");
m_crossPlotDataSets.uiCapability()->setUiHidden(true);
m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft );
m_yAxisProperties->setEnableTitleTextSettings( false );
CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "" );
m_crossPlotDataSets.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
@ -95,23 +94,23 @@ RimGridCrossPlot::~RimGridCrossPlot()
RimGridCrossPlotDataSet* RimGridCrossPlot::createDataSet()
{
RimGridCrossPlotDataSet* dataSet = new RimGridCrossPlotDataSet();
m_crossPlotDataSets.push_back(dataSet);
m_crossPlotDataSets.push_back( dataSet );
return dataSet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::indexOfDataSet(const RimGridCrossPlotDataSet* dataSetToCheck) const
int RimGridCrossPlot::indexOfDataSet( const RimGridCrossPlotDataSet* dataSetToCheck ) const
{
int index = 0;
for (auto dataSet : m_crossPlotDataSets())
for ( auto dataSet : m_crossPlotDataSets() )
{
if (dataSet == dataSetToCheck)
if ( dataSet == dataSetToCheck )
{
return index;
}
if (dataSet->isChecked() && dataSet->visibleCurveCount() > 0u)
if ( dataSet->isChecked() && dataSet->visibleCurveCount() > 0u )
{
index++;
}
@ -122,9 +121,9 @@ int RimGridCrossPlot::indexOfDataSet(const RimGridCrossPlotDataSet* dataSetToChe
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::addDataSet(RimGridCrossPlotDataSet* dataSet)
void RimGridCrossPlot::addDataSet( RimGridCrossPlotDataSet* dataSet )
{
m_crossPlotDataSets.push_back(dataSet);
m_crossPlotDataSets.push_back( dataSet );
}
//--------------------------------------------------------------------------------------------------
@ -150,9 +149,9 @@ QImage RimGridCrossPlot::snapshotWindowContent()
{
QImage image;
if (m_qwtPlot)
if ( m_qwtPlot )
{
QPixmap pix = QPixmap::grabWidget(m_qwtPlot);
QPixmap pix = QPixmap::grabWidget( m_qwtPlot );
image = pix.toImage();
}
@ -164,16 +163,16 @@ QImage RimGridCrossPlot::snapshotWindowContent()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::zoomAll()
{
if (!m_qwtPlot) return;
if ( !m_qwtPlot ) return;
setAutoZoomForAllAxes(true);
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
setAutoZoomForAllAxes( true );
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
m_qwtPlot->replot();
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM);
updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
}
//--------------------------------------------------------------------------------------------------
@ -181,7 +180,7 @@ void RimGridCrossPlot::zoomAll()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
{
if (m_qwtPlot)
if ( m_qwtPlot )
{
m_qwtPlot->replot();
}
@ -192,14 +191,14 @@ void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
{
if (m_qwtPlot)
if ( m_qwtPlot )
{
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->detachAllCurves();
if (dataSet->isChecked())
if ( dataSet->isChecked() )
{
dataSet->setParentQwtPlotNoReplot(m_qwtPlot);
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
}
}
updateAxisDisplay();
@ -212,52 +211,52 @@ void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
QString RimGridCrossPlot::createAutoName() const
{
QStringList autoName;
if (!m_nameConfig->customName().isEmpty())
if ( !m_nameConfig->customName().isEmpty() )
{
autoName += m_nameConfig->customName();
}
if (m_nameConfig->addDataSetNames())
if ( m_nameConfig->addDataSetNames() )
{
QStringList dataSetStrings;
QStringList dataSetStrings;
std::map<RimGridCrossPlotDataSet::NameComponents, std::set<QString>> allNameComponents;
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
if (dataSet->isChecked())
if ( dataSet->isChecked() )
{
QStringList componentList;
auto dataSetNameComponents = dataSet->nameComponents();
auto dataSetNameComponents = dataSet->nameComponents();
for (auto dataSetNameComponent : dataSetNameComponents)
for ( auto dataSetNameComponent : dataSetNameComponents )
{
if (!dataSetNameComponent.second.isEmpty())
if ( !dataSetNameComponent.second.isEmpty() )
{
if (allNameComponents[dataSetNameComponent.first].count(dataSetNameComponent.second) == 0u)
if ( allNameComponents[dataSetNameComponent.first].count( dataSetNameComponent.second ) == 0u )
{
componentList += dataSetNameComponent.second;
allNameComponents[dataSetNameComponent.first].insert(dataSetNameComponent.second);
allNameComponents[dataSetNameComponent.first].insert( dataSetNameComponent.second );
}
}
}
if (!componentList.isEmpty())
if ( !componentList.isEmpty() )
{
dataSetStrings += componentList.join(", ");
dataSetStrings += componentList.join( ", " );
}
}
}
dataSetStrings.removeDuplicates();
if (dataSetStrings.size() > 2)
if ( dataSetStrings.size() > 2 )
{
autoName += QString("(%1 Data Sets)").arg(dataSetStrings.size());
autoName += QString( "(%1 Data Sets)" ).arg( dataSetStrings.size() );
}
if (!dataSetStrings.isEmpty())
if ( !dataSetStrings.isEmpty() )
{
autoName += QString("(%1)").arg(dataSetStrings.join("; "));
autoName += QString( "(%1)" ).arg( dataSetStrings.join( "; " ) );
}
}
return autoName.join(" ");
return autoName.join( " " );
}
//--------------------------------------------------------------------------------------------------
@ -281,7 +280,7 @@ caf::PdmFieldHandle* RimGridCrossPlot::userDescriptionField()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::detachAllCurves()
{
for (auto dataSet : m_crossPlotDataSets())
for ( auto dataSet : m_crossPlotDataSets() )
{
dataSet->detachAllCurves();
}
@ -300,13 +299,13 @@ void RimGridCrossPlot::updateAxisScaling()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisDisplay()
{
if (!m_qwtPlot) return;
if ( !m_qwtPlot ) return;
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
m_qwtPlot->updateAnnotationObjects(m_xAxisProperties);
m_qwtPlot->updateAnnotationObjects(m_yAxisProperties);
m_qwtPlot->updateAnnotationObjects( m_xAxisProperties );
m_qwtPlot->updateAnnotationObjects( m_yAxisProperties );
m_qwtPlot->replot();
}
@ -316,48 +315,48 @@ void RimGridCrossPlot::updateAxisDisplay()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateZoomWindowFromQwt()
{
if (!m_qwtPlot) return;
if ( !m_qwtPlot ) return;
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM);
setAutoZoomForAllAxes(false);
updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
setAutoZoomForAllAxes( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::selectAxisInPropertyEditor(int axis)
void RimGridCrossPlot::selectAxisInPropertyEditor( int axis )
{
RiuPlotMainWindowTools::showPlotMainWindow();
if (axis == QwtPlot::yLeft)
if ( axis == QwtPlot::yLeft )
{
RiuPlotMainWindowTools::selectAsCurrentItem(m_yAxisProperties);
RiuPlotMainWindowTools::selectAsCurrentItem( m_yAxisProperties );
}
else if (axis == QwtPlot::xBottom)
else if ( axis == QwtPlot::xBottom )
{
RiuPlotMainWindowTools::selectAsCurrentItem(m_xAxisProperties);
RiuPlotMainWindowTools::selectAsCurrentItem( m_xAxisProperties );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setAutoZoomForAllAxes(bool enableAutoZoom)
void RimGridCrossPlot::setAutoZoomForAllAxes( bool enableAutoZoom )
{
m_xAxisProperties->setAutoZoom(enableAutoZoom);
m_yAxisProperties->setAutoZoom(enableAutoZoom);
m_xAxisProperties->setAutoZoom( enableAutoZoom );
m_yAxisProperties->setAutoZoom( enableAutoZoom );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCurve* qwtCurve) const
caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
{
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
for (auto curve : dataSet->curves())
for ( auto curve : dataSet->curves() )
{
if (curve->qwtPlotCurve() == qwtCurve)
if ( curve->qwtPlotCurve() == qwtCurve )
{
return curve;
}
@ -369,15 +368,15 @@ caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCur
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent)
QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
{
if (!m_qwtPlot)
if ( !m_qwtPlot )
{
m_qwtPlot = new RiuGridCrossQwtPlot(this, mainWindowParent);
m_qwtPlot = new RiuGridCrossQwtPlot( this, mainWindowParent );
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->setParentQwtPlotNoReplot(m_qwtPlot);
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
}
m_qwtPlot->replot();
}
@ -391,7 +390,7 @@ QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent)
void RimGridCrossPlot::deleteViewWidget()
{
detachAllCurves();
if (m_qwtPlot)
if ( m_qwtPlot )
{
m_qwtPlot->deleteLater();
m_qwtPlot = nullptr;
@ -405,9 +404,9 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
{
updateMdiWindowVisibility();
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->loadDataAndUpdate(false);
dataSet->loadDataAndUpdate( false );
dataSet->updateConnectedEditors();
}
@ -418,47 +417,47 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add(&m_showInfoBox);
uiOrdering.add(&m_showLegend);
uiOrdering.add( &m_showInfoBox );
uiOrdering.add( &m_showLegend );
if (m_showLegend())
if ( m_showLegend() )
{
uiOrdering.add(&m_legendFontSize);
uiOrdering.add( &m_legendFontSize );
}
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Name Configuration");
m_nameConfig->uiOrdering(uiConfigName, *nameGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
void RimGridCrossPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add("Axes", ":/Axes16x16.png");
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add( "Axes", ":/Axes16x16.png" );
axisFolder->add(&m_xAxisProperties);
axisFolder->add(&m_yAxisProperties);
axisFolder->add( &m_xAxisProperties );
axisFolder->add( &m_yAxisProperties );
uiTreeOrdering.add(&m_crossPlotDataSets);
uiTreeOrdering.add( &m_crossPlotDataSets );
uiTreeOrdering.skipRemainingChildren(true);
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &m_legendFontSize)
if ( changedField == &m_legendFontSize )
{
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();
}
@ -469,24 +468,24 @@ void RimGridCrossPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_legendFontSize)
if ( fieldNeedingOptions == &m_legendFontSize )
{
std::vector<int> fontSizes;
fontSizes.push_back(8);
fontSizes.push_back(10);
fontSizes.push_back(12);
fontSizes.push_back(14);
fontSizes.push_back(16);
fontSizes.push_back( 8 );
fontSizes.push_back( 10 );
fontSizes.push_back( 12 );
fontSizes.push_back( 14 );
fontSizes.push_back( 16 );
for (int value : fontSizes)
for ( int value : fontSizes )
{
QString text = QString("%1").arg(value);
options.push_back(caf::PdmOptionItemInfo(text, value));
QString text = QString( "%1" ).arg( value );
options.push_back( caf::PdmOptionItemInfo( text, value ) );
}
}
return options;
@ -505,31 +504,31 @@ void RimGridCrossPlot::performAutoNameUpdate()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updatePlot()
{
if (m_qwtPlot)
if ( m_qwtPlot )
{
RiuQwtPlotTools::setCommonPlotBehaviour(m_qwtPlot);
RiuQwtPlotTools::setDefaultAxes(m_qwtPlot);
RiuQwtPlotTools::setCommonPlotBehaviour( m_qwtPlot );
RiuQwtPlotTools::setDefaultAxes( m_qwtPlot );
updateAxisDisplay();
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->setParentQwtPlotNoReplot(m_qwtPlot);
dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
}
if (m_showLegend())
if ( m_showLegend() )
{
// Will be released in plot destructor or when a new legend is set
QwtLegend* legend = new QwtLegend(m_qwtPlot);
QwtLegend* legend = new QwtLegend( m_qwtPlot );
auto font = legend->font();
font.setPointSize(m_legendFontSize());
legend->setFont(font);
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend);
font.setPointSize( m_legendFontSize() );
legend->setFont( font );
m_qwtPlot->insertLegend( legend, QwtPlot::BottomLegend );
}
else
{
m_qwtPlot->insertLegend(nullptr);
m_qwtPlot->insertLegend( nullptr );
}
m_qwtPlot->updateLegendSizesToMatchPlot();
m_qwtPlot->replot();
@ -541,14 +540,14 @@ void RimGridCrossPlot::updatePlot()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
{
for (size_t i = 0; i < m_crossPlotDataSets.size(); ++i)
for ( size_t i = 0; i < m_crossPlotDataSets.size(); ++i )
{
m_crossPlotDataSets[i]->updateCurveNames(i, m_crossPlotDataSets.size());
m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
}
if (m_qwtPlot)
if ( m_qwtPlot )
{
m_qwtPlot->setTitle(this->createAutoName());
m_qwtPlot->setTitle( this->createAutoName() );
}
updateMdiWindowTitle();
}
@ -563,17 +562,17 @@ void RimGridCrossPlot::swapAxes()
QString tmpName = xAxisProperties->name();
QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType();
xAxisProperties->setNameAndAxis(yAxisProperties->name(), yAxisProperties->qwtPlotAxisType());
yAxisProperties->setNameAndAxis(tmpName, tmpAxis);
xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->qwtPlotAxisType() );
yAxisProperties->setNameAndAxis( tmpName, tmpAxis );
m_xAxisProperties.removeChildObject(xAxisProperties);
m_yAxisProperties.removeChildObject(yAxisProperties);
m_xAxisProperties.removeChildObject( xAxisProperties );
m_yAxisProperties.removeChildObject( yAxisProperties );
m_yAxisProperties = xAxisProperties;
m_xAxisProperties = yAxisProperties;
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->swapAxisProperties(false);
dataSet->swapAxisProperties( false );
}
loadDataAndUpdate();
@ -584,9 +583,9 @@ void RimGridCrossPlot::swapAxes()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiTitleForPlotExport(int dataSetIndex) const
QString RimGridCrossPlot::asciiTitleForPlotExport( int dataSetIndex ) const
{
if ((size_t)dataSetIndex < m_crossPlotDataSets.size())
if ( (size_t)dataSetIndex < m_crossPlotDataSets.size() )
{
return m_crossPlotDataSets[dataSetIndex]->createAutoName();
}
@ -596,20 +595,20 @@ QString RimGridCrossPlot::asciiTitleForPlotExport(int dataSetIndex) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiDataForPlotExport(int dataSetIndex) const
QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const
{
if ((size_t)dataSetIndex < m_crossPlotDataSets.size())
if ( (size_t)dataSetIndex < m_crossPlotDataSets.size() )
{
QString asciiData;
QTextStream stringStream(&asciiData);
QTextStream stringStream( &asciiData );
RifEclipseDataTableFormatter formatter(stringStream);
formatter.setCommentPrefix("");
formatter.setTableRowPrependText("");
formatter.setTableRowLineAppendText("");
formatter.setColumnSpacing(3);
RifEclipseDataTableFormatter formatter( stringStream );
formatter.setCommentPrefix( "" );
formatter.setTableRowPrependText( "" );
formatter.setTableRowLineAppendText( "" );
formatter.setColumnSpacing( 3 );
m_crossPlotDataSets[dataSetIndex]->exportFormattedData(formatter);
m_crossPlotDataSets[dataSetIndex]->exportFormattedData( formatter );
formatter.tableCompleted();
return asciiData;
}
@ -646,9 +645,9 @@ bool RimGridCrossPlot::isYAxisLogarithmic() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setYAxisInverted(bool inverted)
void RimGridCrossPlot::setYAxisInverted( bool inverted )
{
m_yAxisProperties->setAxisInverted(inverted);
m_yAxisProperties->setAxisInverted( inverted );
}
//--------------------------------------------------------------------------------------------------
@ -662,19 +661,19 @@ int RimGridCrossPlot::legendFontSize() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const
bool RimGridCrossPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
{
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
if ( fontSettingType != RiaDefines::PLOT_FONT ) return false;
for (auto plotAxis : allPlotAxes())
for ( auto plotAxis : allPlotAxes() )
{
if (plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize)
if ( plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize )
{
return true;
}
}
if (legendFontSize() != defaultFontSize)
if ( legendFontSize() != defaultFontSize )
{
return true;
}
@ -684,32 +683,35 @@ bool RimGridCrossPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/)
bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false*/ )
{
if (fontSettingType != RiaDefines::PLOT_FONT) return false;
if ( fontSettingType != RiaDefines::PLOT_FONT ) return false;
bool anyChange = false;
for (auto plotAxis : allPlotAxes())
for ( auto plotAxis : allPlotAxes() )
{
if (forceChange || plotAxis->titleFontSize() == oldFontSize)
if ( forceChange || plotAxis->titleFontSize() == oldFontSize )
{
plotAxis->setTitleFontSize(fontSize);
plotAxis->setTitleFontSize( fontSize );
anyChange = true;
}
if (forceChange || plotAxis->valuesFontSize() == oldFontSize)
if ( forceChange || plotAxis->valuesFontSize() == oldFontSize )
{
plotAxis->setValuesFontSize(fontSize);
plotAxis->setValuesFontSize( fontSize );
anyChange = true;
}
}
if (forceChange || legendFontSize() == oldFontSize)
if ( forceChange || legendFontSize() == oldFontSize )
{
m_legendFontSize = fontSize;
anyChange = true;
anyChange = true;
}
if (anyChange) loadDataAndUpdate();
if ( anyChange ) loadDataAndUpdate();
return anyChange;
}
@ -720,22 +722,22 @@ bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType
QString RimGridCrossPlot::xAxisParameterString() const
{
QStringList xAxisParams;
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
if (dataSet->isChecked() && dataSet->sampleCount() > 0u)
if ( dataSet->isChecked() && dataSet->sampleCount() > 0u )
{
xAxisParams.push_back(dataSet->xAxisName());
xAxisParams.push_back( dataSet->xAxisName() );
}
}
xAxisParams.removeDuplicates();
if (xAxisParams.size() > 4)
if ( xAxisParams.size() > 4 )
{
return QString("%1 parameters").arg(xAxisParams.size());
return QString( "%1 parameters" ).arg( xAxisParams.size() );
}
return xAxisParams.join(", ");
return xAxisParams.join( ", " );
}
//--------------------------------------------------------------------------------------------------
@ -744,35 +746,35 @@ QString RimGridCrossPlot::xAxisParameterString() const
QString RimGridCrossPlot::yAxisParameterString() const
{
QStringList yAxisParams;
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
if (dataSet->isChecked() && dataSet->sampleCount() > 0u)
if ( dataSet->isChecked() && dataSet->sampleCount() > 0u )
{
yAxisParams.push_back(dataSet->yAxisName());
yAxisParams.push_back( dataSet->yAxisName() );
}
}
yAxisParams.removeDuplicates();
if (yAxisParams.size() > 4)
if ( yAxisParams.size() > 4 )
{
return QString("%1 parameters").arg(yAxisParams.size());
return QString( "%1 parameters" ).arg( yAxisParams.size() );
}
return yAxisParams.join(", ");
return yAxisParams.join( ", " );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
{
if (!m_qwtPlot) return;
if ( !m_qwtPlot ) return;
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QString axisParameterString = xAxisParameterString();
if (axisType == RiaDefines::PLOT_AXIS_LEFT)
if ( axisType == RiaDefines::PLOT_AXIS_LEFT )
{
axisProperties = m_yAxisProperties();
axisParameterString = yAxisParameterString();
@ -780,110 +782,110 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType();
if (axisProperties->isActive())
if ( axisProperties->isActive() )
{
m_qwtPlot->enableAxis(qwtAxisId, true);
m_qwtPlot->enableAxis( qwtAxisId, true );
QwtText axisTitle(axisParameterString);
QFont titleFont = m_qwtPlot->axisTitle(qwtAxisId).font();
titleFont.setBold(true);
titleFont.setPointSize(axisProperties->titleFontSize());
axisTitle.setFont(titleFont);
QwtText axisTitle( axisParameterString );
QFont titleFont = m_qwtPlot->axisTitle( qwtAxisId ).font();
titleFont.setBold( true );
titleFont.setPointSize( axisProperties->titleFontSize() );
axisTitle.setFont( titleFont );
QFont valuesFont = m_qwtPlot->axisFont(qwtAxisId);
valuesFont.setPointSize(axisProperties->valuesFontSize());
m_qwtPlot->setAxisFont(qwtAxisId, valuesFont);
QFont valuesFont = m_qwtPlot->axisFont( qwtAxisId );
valuesFont.setPointSize( axisProperties->valuesFontSize() );
m_qwtPlot->setAxisFont( qwtAxisId, valuesFont );
switch (axisProperties->titlePosition())
switch ( axisProperties->titlePosition() )
{
case RimPlotAxisProperties::AXIS_TITLE_CENTER:
axisTitle.setRenderFlags(Qt::AlignCenter);
axisTitle.setRenderFlags( Qt::AlignCenter );
break;
case RimPlotAxisProperties::AXIS_TITLE_END:
axisTitle.setRenderFlags(Qt::AlignRight);
axisTitle.setRenderFlags( Qt::AlignRight );
break;
}
m_qwtPlot->setAxisTitle(qwtAxisId, axisTitle);
m_qwtPlot->setAxisTitle( qwtAxisId, axisTitle );
if (axisProperties->isLogarithmicScaleEnabled)
if ( axisProperties->isLogarithmicScaleEnabled )
{
QwtLogScaleEngine* currentScaleEngine =
dynamic_cast<QwtLogScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()));
if (!currentScaleEngine)
QwtLogScaleEngine* currentScaleEngine = dynamic_cast<QwtLogScaleEngine*>(
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if ( !currentScaleEngine )
{
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine);
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5);
m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine );
m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 );
}
if (axisProperties->isAutoZoom())
if ( axisProperties->isAutoZoom() )
{
std::vector<const QwtPlotCurve*> plotCurves = visibleQwtCurves();
double min, max;
RimPlotAxisLogRangeCalculator logRangeCalculator(qwtAxisId, plotCurves);
logRangeCalculator.computeAxisRange(&min, &max);
if (axisProperties->isAxisInverted())
RimPlotAxisLogRangeCalculator logRangeCalculator( qwtAxisId, plotCurves );
logRangeCalculator.computeAxisRange( &min, &max );
if ( axisProperties->isAxisInverted() )
{
std::swap(min, max);
std::swap( min, max );
}
m_qwtPlot->setAxisScale(qwtAxisId, min, max);
m_qwtPlot->setAxisScale( qwtAxisId, min, max );
}
else
{
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
}
}
else
{
QwtLinearScaleEngine* currentScaleEngine =
dynamic_cast<QwtLinearScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()));
if (!currentScaleEngine)
QwtLinearScaleEngine* currentScaleEngine = dynamic_cast<QwtLinearScaleEngine*>(
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if ( !currentScaleEngine )
{
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine);
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3);
m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine );
m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 );
}
if (axisProperties->isAutoZoom())
if ( axisProperties->isAutoZoom() )
{
m_qwtPlot->setAxisAutoScale(qwtAxisId);
m_qwtPlot->setAxisAutoScale( qwtAxisId );
}
else
{
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax);
m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
}
}
m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())
->setAttribute(QwtScaleEngine::Inverted, axisProperties->isAxisInverted());
m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() )
->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() );
}
else
{
m_qwtPlot->enableAxis(qwtAxisId, false);
m_qwtPlot->enableAxis( qwtAxisId, false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType)
void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
{
CVF_ASSERT(m_qwtPlot);
CVF_ASSERT( m_qwtPlot );
QwtInterval xAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::xBottom);
QwtInterval yAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::yLeft);
QwtInterval xAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::xBottom );
QwtInterval yAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::yLeft );
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QwtInterval axisRange = xAxisRange;
if (axisType == RiaDefines::PLOT_AXIS_LEFT)
if ( axisType == RiaDefines::PLOT_AXIS_LEFT )
{
axisProperties = m_yAxisProperties();
axisRange = yAxisRange;
}
axisProperties->visibleRangeMin = std::min(axisRange.minValue(), axisRange.maxValue());
axisProperties->visibleRangeMax = std::max(axisRange.minValue(), axisRange.maxValue());
axisProperties->visibleRangeMin = std::min( axisRange.minValue(), axisRange.maxValue() );
axisProperties->visibleRangeMax = std::max( axisRange.minValue(), axisRange.maxValue() );
axisProperties->updateConnectedEditors();
}
@ -894,15 +896,15 @@ void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType)
std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
{
std::vector<const QwtPlotCurve*> plotCurves;
for (auto dataSet : m_crossPlotDataSets)
for ( auto dataSet : m_crossPlotDataSets )
{
if (dataSet->isChecked())
if ( dataSet->isChecked() )
{
for (auto curve : dataSet->curves())
for ( auto curve : dataSet->curves() )
{
if (curve->isCurveVisible())
if ( curve->isCurveVisible() )
{
plotCurves.push_back(curve->qwtPlotCurve());
plotCurves.push_back( curve->qwtPlotCurve() );
}
}
}
@ -937,7 +939,7 @@ RimGridCrossPlotNameConfig* RimGridCrossPlot::nameConfig()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setShowInfoBox(bool enable)
void RimGridCrossPlot::setShowInfoBox( bool enable )
{
m_showInfoBox = enable;
}
@ -947,7 +949,7 @@ void RimGridCrossPlot::setShowInfoBox(bool enable)
//--------------------------------------------------------------------------------------------------
std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
{
return { m_xAxisProperties, m_yAxisProperties };
return {m_xAxisProperties, m_yAxisProperties};
}
//--------------------------------------------------------------------------------------------------
@ -955,7 +957,7 @@ std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
///
//--------------------------------------------------------------------------------------------------
CAF_PDM_SOURCE_INIT(RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig");
CAF_PDM_SOURCE_INIT( RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig" );
//--------------------------------------------------------------------------------------------------
///
@ -963,18 +965,18 @@ CAF_PDM_SOURCE_INIT(RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig");
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Cross Plot Name Generator", "", "", "");
CAF_PDM_InitObject( "Cross Plot Name Generator", "", "", "" );
CAF_PDM_InitField(&addDataSetNames, "AddDataSetNames", true, "Add Data Set Names", "", "", "");
CAF_PDM_InitField( &addDataSetNames, "AddDataSetNames", true, "Add Data Set Names", "", "", "" );
setCustomName("Cross Plot");
setCustomName( "Cross Plot" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimGridCrossPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering);
uiOrdering.add(&addDataSetNames);
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &addDataSetNames );
}

View File

@ -22,8 +22,8 @@
#include "cafPdmObject.h"
#include "RiaDefines.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimNameConfig.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimViewWindow.h"
#include <QPointer>
@ -38,28 +38,29 @@ class RiuGridCrossQwtPlot;
class RimGridCrossPlotNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlotNameConfig();
public:
caf::PdmField<bool> addDataSetNames;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
};
class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
{
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlot();
~RimGridCrossPlot();
RimGridCrossPlotDataSet* createDataSet();
int indexOfDataSet(const RimGridCrossPlotDataSet* dataSet) const;
void addDataSet(RimGridCrossPlotDataSet* dataSet);
int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
void addDataSet( RimGridCrossPlotDataSet* dataSet );
std::vector<RimGridCrossPlotDataSet*> dataSets() const;
QWidget* viewWidget() override;
@ -68,74 +69,76 @@ public:
void calculateZoomRangeAndUpdateQwt();
void reattachCurvesToQwtAndReplot();
QString createAutoName() const override;
bool showInfoBox() const;
caf::PdmFieldHandle* userDescriptionField() override;
void detachAllCurves();
void performAutoNameUpdate() override;
void updateCurveNamesAndPlotTitle();
void swapAxes();
QString asciiTitleForPlotExport(int dataSetIndex) const;
QString asciiDataForPlotExport(int dataSetIndex) const;
QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForPlotExport( int dataSetIndex ) const;
RiuGridCrossQwtPlot* qwtPlot() const;
bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const;
void setYAxisInverted(bool inverted);
void setYAxisInverted( bool inverted );
int legendFontSize() const;
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override;
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override;
bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange = false ) override;
public:
// Rim2dPlotInterface overrides
void updateAxisScaling() override;
void updateAxisDisplay() override;
void updateZoomWindowFromQwt() override;
void selectAxisInPropertyEditor(int axis) override;
void setAutoZoomForAllAxes(bool enableAutoZoom) override;
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const override;
void updateAxisScaling() override;
void updateAxisDisplay() override;
void updateZoomWindowFromQwt() override;
void selectAxisInPropertyEditor( int axis ) override;
void setAutoZoomForAllAxes( bool enableAutoZoom ) override;
caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
protected:
QWidget* createViewWidget(QWidget* mainWindowParent) override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void updatePlot();
virtual QString xAxisParameterString() const;
QString yAxisParameterString() const;
QString yAxisParameterString() const;
void updateAxisInQwt(RiaDefines::PlotAxis axisType);
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
void updateAxisInQwt( RiaDefines::PlotAxis axisType );
void updateAxisFromQwt( RiaDefines::PlotAxis axisType );
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
RimPlotAxisProperties* xAxisProperties();
RimPlotAxisProperties* yAxisProperties();
RimGridCrossPlotNameConfig* nameConfig();
void setShowInfoBox(bool enable);
void setShowInfoBox( bool enable );
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
};

View File

@ -17,8 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigGridCrossPlotCurveGrouping.h"
#include "RigEclipseCrossPlotDataExtractor.h"
#include "RigGridCrossPlotCurveGrouping.h"
#include "RimCheckableNamedObject.h"
#include "RimNameConfig.h"
@ -31,7 +31,7 @@
#include "cafPdmPtrField.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfColor.h"
#include <cvfArray.h>
@ -66,7 +66,7 @@ public:
caf::PdmField<bool> addGrouping;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
};
//==================================================================================================
@ -92,9 +92,9 @@ public:
RimGridCrossPlotDataSet();
~RimGridCrossPlotDataSet() = default;
void setCellFilterView(RimGridView* cellFilterView);
void loadDataAndUpdate(bool updateParentPlot);
void setParentQwtPlotNoReplot(QwtPlot* parent);
void setCellFilterView( RimGridView* cellFilterView );
void loadDataAndUpdate( bool updateParentPlot );
void setParentQwtPlotNoReplot( QwtPlot* parent );
QString xAxisName() const;
QString yAxisName() const;
QString infoText() const;
@ -105,66 +105,69 @@ public:
QString groupParameter() const;
void detachAllCurves();
void cellFilterViewUpdated();
RimRegularLegendConfig* legendConfig() const;
std::vector< RimGridCrossPlotCurve*> curves() const;
std::vector<RimGridCrossPlotCurve*> curves() const;
QString caseNameString() const;
QString axisVariableString() const;
QString timeStepString() const;
QString caseNameString() const;
QString axisVariableString() const;
QString timeStepString() const;
std::map<NameComponents, QString> nameComponents() const;
void updateCurveNames(size_t dataSetIndex, size_t dataSetCount);
void updateCurveNames( size_t dataSetIndex, size_t dataSetCount );
void updateLegendRange();
void updateLegendIcons();
bool groupingByCategoryResult() const;
bool groupingEnabled() const;
void swapAxisProperties(bool updatePlot);
void exportFormattedData(RifEclipseDataTableFormatter& formatter) const;
void swapAxisProperties( bool updatePlot );
void exportFormattedData( RifEclipseDataTableFormatter& formatter ) const;
bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const;
void configureForPressureSaturationCurves(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName);
void addCellFilter(RimPlotCellFilter* cellFilter);
void setCustomColor(const cvf::Color3f color);
void configureForPressureSaturationCurves( RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName );
void addCellFilter( RimPlotCellFilter* cellFilter );
void setCustomColor( const cvf::Color3f color );
void destroyCurves();
size_t visibleCurveCount() const;
size_t sampleCount() const;
size_t sampleCount() const;
protected:
void initAfterRead() override;
void onLoadDataAndUpdate(bool updateParentPlot);
void onLoadDataAndUpdate( bool updateParentPlot );
void assignCurveDataGroups(const RigEclipseCrossPlotResult& result);
void createCurves(const RigEclipseCrossPlotResult& result);
void fillCurveDataInExistingCurves(const RigEclipseCrossPlotResult& result);
QString createGroupName(size_t curveIndex) const;
void assignCurveDataGroups( const RigEclipseCrossPlotResult& result );
void createCurves( const RigEclipseCrossPlotResult& result );
void fillCurveDataInExistingCurves( const RigEclipseCrossPlotResult& result );
QString createGroupName( size_t curveIndex ) const;
std::map<int, cvf::UByteArray> calculateCellVisibility(RimEclipseCase* eclipseCase) const;
std::map<int, cvf::UByteArray> calculateCellVisibility( RimEclipseCase* eclipseCase ) const;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void childFieldChangedByUi(const caf::PdmFieldHandle* changedChildField) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
void triggerPlotNameUpdateAndReplot();
void updateDataSetName();
void performAutoNameUpdate() override;
void setDefaults();
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void triggerPlotNameUpdateAndReplot();
void updateDataSetName();
void performAutoNameUpdate() override;
void setDefaults();
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
bool hasMultipleTimeSteps() const;
void filterInvalidCurveValues(RigEclipseCrossPlotResult* result);
void filterInvalidCurveValues( RigEclipseCrossPlotResult* result );
private:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimGridView*> m_cellFilterView;
@ -177,10 +180,10 @@ private:
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
caf::PdmField<bool> m_useCustomColor;
caf::PdmField<cvf::Color3f> m_customColor;
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;;
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
caf::PdmField<bool> m_useCustomColor;
caf::PdmField<cvf::Color3f> m_customColor;
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;
;
};

File diff suppressed because it is too large Load Diff

View File

@ -20,20 +20,17 @@
#include "RigWellLogFile.h"
#include "RiaExtractionTools.h"
#include "RiaCurveDataTools.h"
#include "RiaExtractionTools.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigGeoMechCaseData.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h"
#include "RigResultAccessorFactory.h"
#include "RigCaseCellResultsData.h"
#include "RigFemPartResultsCollection.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "Rim3dView.h"
#include "RimWellLogExtractionCurveNameConfig.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
@ -43,9 +40,10 @@
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimTools.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogExtractionCurveNameConfig.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h"
#include "cafUtils.h"
@ -59,41 +57,41 @@
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve");
CAF_PDM_SOURCE_INIT( Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
{
CAF_PDM_InitObject("3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitObject( "3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", "");
m_case.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" );
m_case.uiCapability()->setUiTreeChildrenHidden( true );
m_case = nullptr;
CAF_PDM_InitField(&m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "");
CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "");
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" );
m_eclipseResultDefinition.uiCapability()->setUiHidden( true );
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->findField("MResultType")->uiCapability()->setUiName("Result Type");
m_eclipseResultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result Type" );
CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", "");
m_geomResultDefinition.uiCapability()->setUiHidden(true);
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" );
m_geomResultDefinition.uiCapability()->setUiHidden( true );
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_geomResultDefinition = new RimGeoMechResultDefinition;
m_geomResultDefinition->setAddWellPathDerivedResults(true);
m_geomResultDefinition->setAddWellPathDerivedResults( true );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogExtractionCurveNameConfig();
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogExtractionCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve()
Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve()
{
delete m_geomResultDefinition;
delete m_eclipseResultDefinition;
@ -101,29 +99,29 @@ Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view)
void Rim3dWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{
if (!view) return;
if ( !view ) return;
m_case = view->ownerCase();
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_geomResultDefinition->setGeoMechCase(geomCase);
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
if (eclipseView)
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view );
if ( eclipseView )
{
m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult());
m_eclipseResultDefinition->simpleCopy( eclipseView->cellResult() );
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
if (geoMechView)
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( geoMechView )
{
m_geomResultDefinition->setResultAddress(geoMechView->cellResultResultDefinition()->resultAddress());
m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() );
}
}
@ -132,18 +130,18 @@ void Rim3dWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view)
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::resultPropertyString() const
{
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QString name;
if (eclipseCase)
if ( eclipseCase )
{
name = caf::Utils::makeValidFileBasename(m_eclipseResultDefinition->resultVariableUiShortName());
name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiShortName() );
}
else if (geoMechCase)
else if ( geoMechCase )
{
QString resCompName = m_geomResultDefinition->resultComponentUiName();
if (resCompName.isEmpty())
if ( resCompName.isEmpty() )
{
name = m_geomResultDefinition->resultFieldUiName();
}
@ -167,66 +165,70 @@ bool Rim3dWellLogExtractionCurve::followAnimationTimeStep() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const
void Rim3dWellLogExtractionCurve::curveValuesAndMds( std::vector<double>* values,
std::vector<double>* measuredDepthValues ) const
{
CVF_ASSERT(m_timeStep() >= 0);
CVF_ASSERT( m_timeStep() >= 0 );
return this->curveValuesAndMdsAtTimeStep(values, measuredDepthValues, m_timeStep());
return this->curveValuesAndMdsAtTimeStep( values, measuredDepthValues, m_timeStep() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep(std::vector<double>* values, std::vector<double>* measuredDepthValues, int timeStep) const
void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const
{
CAF_ASSERT(values != nullptr);
CAF_ASSERT(measuredDepthValues != nullptr);
CAF_ASSERT( values != nullptr );
CAF_ASSERT( measuredDepthValues != nullptr );
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor;
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
firstAncestorOrThisOfType( wellPath );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
if (eclipseCase)
if ( eclipseCase )
{
eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase(wellPath, eclipseCase);
eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase( wellPath, eclipseCase );
}
else
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case());
if (geomCase)
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if ( geomCase )
{
geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase(wellPath, geomCase);
geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, geomCase );
}
}
if (eclExtractor.notNull() && eclipseCase)
if ( eclExtractor.notNull() && eclipseCase )
{
*measuredDepthValues = eclExtractor->cellIntersectionMDs();
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(),
0,
timeStep,
m_eclipseResultDefinition);
if (resAcc.notNull())
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
timeStep,
m_eclipseResultDefinition );
if ( resAcc.notNull() )
{
eclExtractor->curveData(resAcc.p(), values);
eclExtractor->curveData( resAcc.p(), values );
}
}
else if (geomExtractor.notNull())
else if ( geomExtractor.notNull() )
{
*measuredDepthValues = geomExtractor->cellIntersectionMDs();
RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles(wellPath, geomExtractor.p());
RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geomExtractor.p() );
m_geomResultDefinition->loadResult();
geomExtractor->setRkbDiff(rkbDiff());
geomExtractor->curveData(m_geomResultDefinition->resultAddress(), timeStep, values);
geomExtractor->setRkbDiff( rkbDiff() );
geomExtractor->curveData( m_geomResultDefinition->resultAddress(), timeStep, values );
}
}
@ -237,39 +239,39 @@ std::pair<double, double> Rim3dWellLogExtractionCurve::findCurveValueRange()
{
double foundMinValue = std::numeric_limits<float>::infinity();
double foundMaxValue = -std::numeric_limits<float>::infinity();
if (m_case())
if ( m_case() )
{
std::set<int> timeStepsToCheck;
if (followAnimationTimeStep())
if ( followAnimationTimeStep() )
{
// Check all time steps to avoid range changing during animation.
for (int i = 0; i < m_case->timeStepStrings().size(); ++i)
for ( int i = 0; i < m_case->timeStepStrings().size(); ++i )
{
timeStepsToCheck.insert(i);
timeStepsToCheck.insert( i );
}
}
else
{
timeStepsToCheck.insert(m_timeStep());
timeStepsToCheck.insert( m_timeStep() );
}
for (int timeStep : timeStepsToCheck)
for ( int timeStep : timeStepsToCheck )
{
std::vector<double> values;
std::vector<double> measuredDepths;
this->curveValuesAndMdsAtTimeStep(&values, &measuredDepths, timeStep);
this->curveValuesAndMdsAtTimeStep( &values, &measuredDepths, timeStep );
for (double value : values)
for ( double value : values )
{
if (RiaCurveDataTools::isValidValue(value, false))
if ( RiaCurveDataTools::isValidValue( value, false ) )
{
foundMinValue = std::min(foundMinValue, value);
foundMaxValue = std::max(foundMaxValue, value);
foundMinValue = std::min( foundMinValue, value );
foundMaxValue = std::max( foundMaxValue, value );
}
}
}
}
return std::make_pair(foundMinValue, foundMaxValue);
return std::make_pair( foundMinValue, foundMaxValue );
}
QString Rim3dWellLogExtractionCurve::name() const
@ -282,91 +284,91 @@ QString Rim3dWellLogExtractionCurve::name() const
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::createAutoName() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList autoName;
if (!m_nameConfig->customName().isEmpty())
if ( !m_nameConfig->customName().isEmpty() )
{
autoName.push_back(m_nameConfig->customName());
autoName.push_back( m_nameConfig->customName() );
}
QStringList generatedAutoTags;
if (m_nameConfig->addWellName())
if ( m_nameConfig->addWellName() )
{
RimWellPath* wellPath;
this->firstAncestorOrThisOfTypeAsserted(wellPath);
if (!wellPath->name().isEmpty())
this->firstAncestorOrThisOfTypeAsserted( wellPath );
if ( !wellPath->name().isEmpty() )
{
generatedAutoTags += wellPath->name();
}
}
if (m_nameConfig->addCaseName() && m_case())
if ( m_nameConfig->addCaseName() && m_case() )
{
generatedAutoTags.push_back(m_case->caseUserDescription());
generatedAutoTags.push_back( m_case->caseUserDescription() );
}
if (m_nameConfig->addProperty() && !resultPropertyString().isEmpty())
if ( m_nameConfig->addProperty() && !resultPropertyString().isEmpty() )
{
generatedAutoTags.push_back(resultPropertyString());
generatedAutoTags.push_back( resultPropertyString() );
}
if (m_nameConfig->addTimeStep() || m_nameConfig->addDate())
if ( m_nameConfig->addTimeStep() || m_nameConfig->addDate() )
{
bool addTimeStep = m_nameConfig->addTimeStep() && m_timeStep() != -1;
bool addTimeStep = m_nameConfig->addTimeStep() && m_timeStep() != -1;
size_t maxTimeStep = 0;
if (eclipseCase)
if ( eclipseCase )
{
addTimeStep = addTimeStep && m_eclipseResultDefinition->resultType() != RiaDefines::STATIC_NATIVE;
RigEclipseCaseData* data = eclipseCase->eclipseCaseData();
if (data)
if ( data )
{
maxTimeStep = data->results(m_eclipseResultDefinition->porosityModel())->maxTimeStepCount();
maxTimeStep = data->results( m_eclipseResultDefinition->porosityModel() )->maxTimeStepCount();
}
}
else if (geomCase)
else if ( geomCase )
{
RigGeoMechCaseData* data = geomCase->geoMechData();
if (data)
if ( data )
{
maxTimeStep = data->femPartResults()->frameCount();
}
}
if (m_nameConfig->addDate())
if ( m_nameConfig->addDate() )
{
QString dateString = wellDate();
if (!dateString.isEmpty())
if ( !dateString.isEmpty() )
{
generatedAutoTags.push_back(dateString);
generatedAutoTags.push_back( dateString );
}
}
if (addTimeStep)
if ( addTimeStep )
{
generatedAutoTags.push_back(QString("[%1/%2]").arg(m_timeStep() + 1).arg(maxTimeStep));
generatedAutoTags.push_back( QString( "[%1/%2]" ).arg( m_timeStep() + 1 ).arg( maxTimeStep ) );
}
}
if (!generatedAutoTags.empty())
if ( !generatedAutoTags.empty() )
{
autoName.push_back(generatedAutoTags.join(", "));
autoName.push_back( generatedAutoTags.join( ", " ) );
}
return autoName.join(": ");
return autoName.join( ": " );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
double Rim3dWellLogExtractionCurve::rkbDiff() const
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
firstAncestorOrThisOfType( wellPath );
if (wellPath && wellPath->wellPathGeometry())
if ( wellPath && wellPath->wellPathGeometry() )
{
return wellPath->wellPathGeometry()->rkbDiff();
}
@ -374,17 +376,16 @@ double Rim3dWellLogExtractionCurve::rkbDiff() const
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const
{
if (dynamic_cast<const RimEclipseCase*>(m_case()))
if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{
return m_eclipseResultDefinition->hasDynamicResult();
}
else if (dynamic_cast<const RimGeoMechCase*>(m_case()))
else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{
return m_geomResultDefinition->hasResult();
}
@ -394,17 +395,17 @@ bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::showInView(const Rim3dView* gridView) const
bool Rim3dWellLogExtractionCurve::showInView( const Rim3dView* gridView ) const
{
if (isShowingCurve())
if ( isShowingCurve() )
{
if (dynamic_cast<const RimEclipseCase*>(m_case()))
if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{
return dynamic_cast<const RimEclipseView*>(gridView) != nullptr;
return dynamic_cast<const RimEclipseView*>( gridView ) != nullptr;
}
else if (dynamic_cast<const RimGeoMechCase*>(m_case()))
else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{
return dynamic_cast<const RimGeoMechView*>(gridView) != nullptr;
return dynamic_cast<const RimGeoMechView*>( gridView ) != nullptr;
}
}
return false;
@ -421,58 +422,61 @@ caf::PdmFieldHandle* Rim3dWellLogExtractionCurve::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_case)
void Rim3dWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_case )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case());
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_case());
if (eclipseCase)
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if ( eclipseCase )
{
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
}
else if (geoMechCase)
else if ( geoMechCase )
{
m_geomResultDefinition->setGeoMechCase(geoMechCase);
m_geomResultDefinition->setGeoMechCase( geoMechCase );
}
this->resetMinMaxValuesAndUpdateUI();
}
else if (changedField == &m_timeStep)
else if ( changedField == &m_timeStep )
{
this->resetMinMaxValuesAndUpdateUI();
}
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo>
Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if (fieldNeedingOptions == &m_case)
if ( fieldNeedingOptions == &m_case )
{
RimTools::caseOptionItems(&options);
RimTools::caseOptionItems( &options );
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if (fieldNeedingOptions == &m_timeStep)
else if ( fieldNeedingOptions == &m_timeStep )
{
QStringList timeStepNames;
if (m_case)
if ( m_case )
{
timeStepNames = m_case->timeStepStrings();
}
options.push_back(caf::PdmOptionItemInfo(QString("Follow Animation Time Step"), -1));
for (int i = 0; i < timeStepNames.size(); i++)
options.push_back( caf::PdmOptionItemInfo( QString( "Follow Animation Time Step" ), -1 ) );
for ( int i = 0; i < timeStepNames.size(); i++ )
{
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
}
}
@ -482,81 +486,80 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void Rim3dWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add(&m_case);
curveDataGroup->add( &m_case );
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
if (eclipseCase)
if ( eclipseCase )
{
m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
m_eclipseResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
}
else if (geomCase)
else if ( geomCase )
{
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
m_geomResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
}
if ((eclipseCase && m_eclipseResultDefinition->hasDynamicResult())
|| geomCase)
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase )
{
curveDataGroup->add(&m_timeStep);
curveDataGroup->add( &m_timeStep );
}
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
m_nameConfig->uiOrdering(uiConfigName, *nameGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::initAfterRead()
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_geomResultDefinition->setGeoMechCase(geomCase);
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase( geomCase );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::wellDate() const
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList timeStepNames;
if (eclipseCase)
if ( eclipseCase )
{
if (m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE)
if ( m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE )
{
return QString();
}
if (eclipseCase->eclipseCaseData())
if ( eclipseCase->eclipseCaseData() )
{
timeStepNames = eclipseCase->timeStepStrings();
}
}
else if (geomCase)
else if ( geomCase )
{
if (geomCase->geoMechData())
if ( geomCase->geoMechData() )
{
timeStepNames = geomCase->timeStepStrings();
}
}
if (m_timeStep == -1)
if ( m_timeStep == -1 )
{
return QString("Animation Time Step");
return QString( "Animation Time Step" );
}
return (m_timeStep >= 0 && m_timeStep < timeStepNames.size()) ? timeStepNames[m_timeStep] : "";
return ( m_timeStep >= 0 && m_timeStep < timeStepNames.size() ) ? timeStepNames[m_timeStep] : "";
}

View File

@ -20,9 +20,9 @@
#include "RigWellLogFile.h"
#include "RimWellLogFileCurveNameConfig.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurveNameConfig.h"
#include "RimWellPath.h"
#include <QFileInfo>
@ -32,29 +32,27 @@
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve");
CAF_PDM_SOURCE_INIT( Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
{
CAF_PDM_InitObject("3d Well Log File Curve", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitObject( "3d Well Log File Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogFileCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
{
}
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() {}
//--------------------------------------------------------------------------------------------------
///
@ -62,18 +60,18 @@ Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo()
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath);
firstAncestorOrThisOfType( wellPath );
if (wellPath && !wellPath->wellLogFiles().empty())
if ( wellPath && !wellPath->wellLogFiles().empty() )
{
m_wellLogFile = wellPath->wellLogFiles()[0];
}
if (m_wellLogFile)
if ( m_wellLogFile )
{
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
if (!fileLogs.empty())
if ( !fileLogs.empty() )
{
m_wellLogChannelName = fileLogs[0]->name();
}
@ -83,17 +81,17 @@ void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const
void Rim3dWellLogFileCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{
CAF_ASSERT(values != nullptr);
CAF_ASSERT(measuredDepthValues != nullptr);
CAF_ASSERT( values != nullptr );
CAF_ASSERT( measuredDepthValues != nullptr );
if (m_wellLogFile)
if ( m_wellLogFile )
{
RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData();
if (wellLogFile)
if ( wellLogFile )
{
*values = wellLogFile->values(m_wellLogChannelName);
*values = wellLogFile->values( m_wellLogChannelName );
*measuredDepthValues = wellLogFile->depthValues();
}
}
@ -121,49 +119,48 @@ QString Rim3dWellLogFileCurve::name() const
QString Rim3dWellLogFileCurve::createAutoName() const
{
QStringList name;
QString unit;
bool channelNameAvailable = false;
QString unit;
bool channelNameAvailable = false;
RimWellPath* wellPath;
this->firstAncestorOrThisOfType(wellPath);
this->firstAncestorOrThisOfType( wellPath );
if (wellPath)
if ( wellPath )
{
name.push_back(wellPath->name());
name.push_back("LAS");
name.push_back( wellPath->name() );
name.push_back( "LAS" );
if (!m_wellLogChannelName().isEmpty())
if ( !m_wellLogChannelName().isEmpty() )
{
name.push_back(m_wellLogChannelName);
name.push_back( m_wellLogChannelName );
channelNameAvailable = true;
}
RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr;
if (wellLogFile)
if ( wellLogFile )
{
if (channelNameAvailable)
if ( channelNameAvailable )
{
/* RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot);
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit());
/* RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot);
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit());
if (!unitName.isEmpty())
{
name.back() += QString(" [%1]").arg(unitName);
} */
if (!unitName.isEmpty())
{
name.back() += QString(" [%1]").arg(unitName);
} */
}
QString date = wellLogFile->date();
if (!date.isEmpty())
if ( !date.isEmpty() )
{
name.push_back(wellLogFile->date());
name.push_back( wellLogFile->date() );
}
}
return name.join(", ");
return name.join( ", " );
}
return "Empty curve";
@ -180,59 +177,59 @@ caf::PdmFieldHandle* Rim3dWellLogFileCurve::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void Rim3dWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &m_wellLogFile || changedField == &m_wellLogChannelName)
if ( changedField == &m_wellLogFile || changedField == &m_wellLogChannelName )
{
this->resetMinMaxValuesAndUpdateUI();
}
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo>
Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if (!options.empty()) return options;
if ( !options.empty() ) return options;
if (fieldNeedingOptions == &m_wellLogChannelName)
if ( fieldNeedingOptions == &m_wellLogChannelName )
{
if (m_wellLogFile)
if ( m_wellLogFile )
{
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
for (size_t i = 0; i < fileLogs.size(); i++)
for ( size_t i = 0; i < fileLogs.size(); i++ )
{
QString wellLogChannelName = fileLogs[i]->name();
options.push_back(caf::PdmOptionItemInfo(wellLogChannelName, wellLogChannelName));
options.push_back( caf::PdmOptionItemInfo( wellLogChannelName, wellLogChannelName ) );
}
}
if (options.size() == 0)
if ( options.size() == 0 )
{
options.push_back(caf::PdmOptionItemInfo("None", "None"));
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
}
}
if (fieldNeedingOptions == &m_wellLogFile)
if ( fieldNeedingOptions == &m_wellLogFile )
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath);
firstAncestorOrThisOfType( wellPath );
if (wellPath && !wellPath->wellLogFiles().empty())
if ( wellPath && !wellPath->wellLogFiles().empty() )
{
for (RimWellLogFile* const wellLogFile : wellPath->wellLogFiles())
for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
{
QFileInfo fileInfo(wellLogFile->fileName());
options.push_back(caf::PdmOptionItemInfo(fileInfo.baseName(), wellLogFile));
QFileInfo fileInfo( wellLogFile->fileName() );
options.push_back( caf::PdmOptionItemInfo( fileInfo.baseName(), wellLogFile ) );
}
}
}
@ -243,16 +240,16 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogFileCurve::calculateValueOptions(const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void Rim3dWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellLogFile);
curveDataGroup->add(&m_wellLogChannelName);
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_wellLogFile );
curveDataGroup->add( &m_wellLogChannelName );
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
m_nameConfig->uiOrdering(uiConfigName, *nameGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}

View File

@ -24,37 +24,37 @@
#include "RigWellLogCurveData.h"
#include "RimWellLogRftCurveNameConfig.h"
#include "RimEclipseResultCase.h"
#include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellLogCurve.h"
#include "RimWellLogRftCurveNameConfig.h"
#include "RimWellPath.h"
//==================================================================================================
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve");
CAF_PDM_SOURCE_INIT( Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogRftCurve::Rim3dWellLogRftCurve()
{
CAF_PDM_InitObject("3d Well Log RFT Curve", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitObject( "3d Well Log RFT Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_eclipseResultCase, "eclipseResultCase", "", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_timeStep, "timeStep", "", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "eclipseResultCase", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_timeStep, "timeStep", "", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "wellLogChannelName", "", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "wellLogChannelName", "", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_2dWellLogRftCurve, "my2dWellLogRftCurve", "", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_2dWellLogRftCurve, "my2dWellLogRftCurve", "", "", "", "" );
m_2dWellLogRftCurve = new RimWellLogRftCurve();
m_2dWellLogRftCurve.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogRftCurveNameConfig();
}
@ -67,19 +67,19 @@ Rim3dWellLogRftCurve::~Rim3dWellLogRftCurve()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const
void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{
if (m_2dWellLogRftCurve->wellName() == QString())
if ( m_2dWellLogRftCurve->wellName() == QString() )
{
m_2dWellLogRftCurve->setDefaultAddress(wellName());
m_2dWellLogRftCurve->setDefaultAddress( wellName() );
}
const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData();
//These values are for a simulation well
*values = curveData->xValues();
// These values are for a simulation well
*values = curveData->xValues();
*measuredDepthValues = curveData->measuredDepths();
}
@ -88,7 +88,7 @@ void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector<double>* values, std::v
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::resultPropertyString() const
{
return caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(m_wellLogChannelName());
return caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( m_wellLogChannelName() );
}
//--------------------------------------------------------------------------------------------------
@ -106,28 +106,29 @@ QString Rim3dWellLogRftCurve::createAutoName() const
{
QStringList name;
if (!wellName().isEmpty())
if ( !wellName().isEmpty() )
{
name.push_back(wellName());
name.push_back( wellName() );
}
name.push_back("RFT");
name.push_back( "RFT" );
if (m_eclipseResultCase)
if ( m_eclipseResultCase )
{
name.push_back(m_eclipseResultCase->caseUserDescription());
name.push_back( m_eclipseResultCase->caseUserDescription() );
}
if (m_wellLogChannelName().text() != caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text(RifEclipseRftAddress::NONE))
if ( m_wellLogChannelName().text() !=
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text( RifEclipseRftAddress::NONE ) )
{
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName();
name.push_back(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelNameEnum));
name.push_back( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum ) );
}
if (!m_timeStep().isNull())
if ( !m_timeStep().isNull() )
{
name.push_back(m_timeStep().toString(RiaQDateTimeTools::dateFormatString()));
name.push_back( m_timeStep().toString( RiaQDateTimeTools::dateFormatString() ) );
}
return name.join(", ");
return name.join( ", " );
}
//--------------------------------------------------------------------------------------------------
@ -141,96 +142,104 @@ caf::PdmFieldHandle* Rim3dWellLogRftCurve::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void Rim3dWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if (changedField == &m_wellLogChannelName || changedField == &m_timeStep)
if ( changedField == &m_wellLogChannelName || changedField == &m_timeStep )
{
this->resetMinMaxValuesAndUpdateUI();
}
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogRftCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
QList<caf::PdmOptionItemInfo> Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_eclipseResultCase)
if ( fieldNeedingOptions == &m_eclipseResultCase )
{
RimTools::caseOptionItems(&options);
RimTools::caseOptionItems( &options );
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
}
else if (fieldNeedingOptions == &m_wellLogChannelName)
else if ( fieldNeedingOptions == &m_wellLogChannelName )
{
if (m_eclipseResultCase)
if ( m_eclipseResultCase )
{
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if (reader)
if ( reader )
{
for (const RifEclipseRftAddress::RftWellLogChannelType& channelName : reader->availableWellLogChannels(wellName()))
for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
reader->availableWellLogChannels( wellName() ) )
{
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelName), channelName));
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
channelName ),
channelName ) );
}
}
if (options.empty())
if ( options.empty() )
{
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE));
options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::NONE ),
RifEclipseRftAddress::NONE ) );
}
}
}
else if (fieldNeedingOptions == &m_timeStep)
else if ( fieldNeedingOptions == &m_timeStep )
{
if (m_eclipseResultCase)
if ( m_eclipseResultCase )
{
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if (reader)
if ( reader )
{
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps(wellName(), m_wellLogChannelName());
for (const QDateTime& dt : timeStamps)
QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() );
for ( const QDateTime& dt : timeStamps )
{
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale(dt, dateFormat);
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back(caf::PdmOptionItemInfo(dateString, dt));
options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
}
}
options.push_back(caf::PdmOptionItemInfo("None", QDateTime()));
options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void Rim3dWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_eclipseResultCase);
curveDataGroup->add(&m_wellLogChannelName);
curveDataGroup->add(&m_timeStep);
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add( &m_eclipseResultCase );
curveDataGroup->add( &m_wellLogChannelName );
curveDataGroup->add( &m_timeStep );
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering);
Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
m_nameConfig->uiOrdering(uiConfigName, *nameGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::wellName() const
{
RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath);
firstAncestorOrThisOfType( wellPath );
return wellPath->name();
}

View File

@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor 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
@ -11,45 +11,43 @@
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimProject.h"
#include "RimNameConfig.h"
#include "Rim3dWellLogCurve.h"
#include "RimProject.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimNameConfig, "RimCurveNameConfig");
CAF_PDM_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimNameConfig::RimNameConfig()
{
CAF_PDM_InitObject("Curve Name Generator", "", "", "");
CAF_PDM_InitObject( "Curve Name Generator", "", "", "" );
CAF_PDM_InitField(&m_isUsingAutoName_OBSOLETE, "IsUsingAutoName", true, "Add Automatic Name Tags", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_customName, "CustomCurveName", "Custom Name Part", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_autoName, "AutoCurveName", "Full Name", "", "", "");
m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable(false);
m_autoName.registerGetMethod(this, &RimNameConfig::autoName);
CAF_PDM_InitField( &m_isUsingAutoName_OBSOLETE, "IsUsingAutoName", true, "Add Automatic Name Tags", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_customName, "CustomCurveName", "Custom Name Part", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_autoName, "AutoCurveName", "Full Name", "", "", "" );
m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable( false );
m_autoName.registerGetMethod( this, &RimNameConfig::autoName );
m_autoName.xmlCapability()->disableIO();
m_autoName.uiCapability()->setUiReadOnly(true);
m_autoName.uiCapability()->setUiReadOnly( true );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimNameConfig::~RimNameConfig()
{
}
RimNameConfig::~RimNameConfig() {}
//--------------------------------------------------------------------------------------------------
///
@ -60,7 +58,7 @@ QString RimNameConfig::customName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimNameConfig::nameField()
{
@ -68,58 +66,60 @@ caf::PdmFieldHandle* RimNameConfig::nameField()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimNameConfig::name() const
{
return m_autoName();
return m_autoName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::uiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimNameConfig::uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
defineUiOrdering(uiConfigName, uiOrdering);
defineUiOrdering( uiConfigName, uiOrdering );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add(&m_customName);
uiOrdering.add(&m_autoName);
uiOrdering.add( &m_customName );
uiOrdering.add( &m_autoName );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimNameConfig::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
updateAllSettings();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QString RimNameConfig::autoName() const
{
RimNameConfigHolderInterface* plotHolder;
this->firstAncestorOrThisOfTypeAsserted(plotHolder);
this->firstAncestorOrThisOfTypeAsserted( plotHolder );
return plotHolder->createAutoName();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::setCustomName(const QString& name)
void RimNameConfig::setCustomName( const QString& name )
{
m_customName = name;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimNameConfig::updateAllSettings()
{
@ -127,12 +127,12 @@ void RimNameConfig::updateAllSettings()
m_customName.uiCapability()->updateConnectedEditors();
RimNameConfigHolderInterface* holder;
this->firstAncestorOrThisOfTypeAsserted(holder);
this->firstAncestorOrThisOfTypeAsserted( holder );
holder->updateHolder();
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>(holder);
if (pdmObject)
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( holder );
if ( pdmObject )
{
pdmObject->updateConnectedEditors();
pdmObject->updateConnectedEditors();
}
}
@ -142,8 +142,8 @@ void RimNameConfig::updateAllSettings()
void RimNameConfig::initAfterRead()
{
// Now we just switch them all individually.
if (!m_isUsingAutoName_OBSOLETE())
if ( !m_isUsingAutoName_OBSOLETE() )
{
enableAllAutoNameTags(false);
enableAllAutoNameTags( false );
}
}

View File

@ -30,7 +30,11 @@ class RimNameConfigHolderInterface
{
public:
virtual QString createAutoName() const = 0;
void updateHolder() { performAutoNameUpdate(); }
void updateHolder()
{
performAutoNameUpdate();
}
protected:
virtual void performAutoNameUpdate() {}
};
@ -47,26 +51,25 @@ public:
RimNameConfig();
~RimNameConfig() override;
QString customName() const;
void setCustomName(const QString& name);
virtual void enableAllAutoNameTags(bool enable) {}
QString customName() const;
void setCustomName( const QString& name );
virtual void enableAllAutoNameTags( bool enable ) {}
caf::PdmFieldHandle* nameField();
QString name() const;
void uiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
caf::PdmFieldHandle* nameField();
QString name() const;
void uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QString autoName() const;
virtual void updateAllSettings();
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
QString autoName() const;
virtual void updateAllSettings();
void initAfterRead() override;
protected:
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
caf::PdmField<QString> m_customName;
caf::PdmProxyValueField<QString> m_autoName;
};

View File

@ -23,24 +23,24 @@
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimViewNameConfig, "RimViewNameConfig");
CAF_PDM_SOURCE_INIT( RimViewNameConfig, "RimViewNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewNameConfig::RimViewNameConfig()
: RimNameConfig()
, m_hideCaseNameField(false)
, m_hideAggregationTypeField(false)
, m_hidePropertyField(false)
, m_hideSampleSpacingField(false)
, m_hideCaseNameField( false )
, m_hideAggregationTypeField( false )
, m_hidePropertyField( false )
, m_hideSampleSpacingField( false )
{
CAF_PDM_InitObject("View Name Generator", "", "", "");
CAF_PDM_InitObject( "View Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "");
CAF_PDM_InitField(&m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", "");
CAF_PDM_InitField(&m_addProperty, "AddProperty", true, "Add Property Type", "", "", "");
CAF_PDM_InitField(&m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", "");
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "" );
CAF_PDM_InitField( &m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", "" );
CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField( &m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", "" );
m_customName = "";
}
@ -48,7 +48,7 @@ RimViewNameConfig::RimViewNameConfig()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddCaseName(bool add)
void RimViewNameConfig::setAddCaseName( bool add )
{
m_addCaseName = add;
}
@ -64,7 +64,7 @@ bool RimViewNameConfig::addCaseName() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddAggregationType(bool add)
void RimViewNameConfig::setAddAggregationType( bool add )
{
m_addAggregationType = add;
}
@ -80,7 +80,7 @@ bool RimViewNameConfig::addAggregationType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddProperty(bool add)
void RimViewNameConfig::setAddProperty( bool add )
{
m_addProperty = add;
}
@ -96,7 +96,7 @@ bool RimViewNameConfig::addProperty() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddSampleSpacing(bool add)
void RimViewNameConfig::setAddSampleSpacing( bool add )
{
m_addSampleSpacing = add;
}
@ -112,7 +112,7 @@ bool RimViewNameConfig::addSampleSpacing() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::enableAllAutoNameTags(bool enable)
void RimViewNameConfig::enableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addAggregationType = enable;
@ -123,7 +123,7 @@ void RimViewNameConfig::enableAllAutoNameTags(bool enable)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideCaseNameField(bool hide)
void RimViewNameConfig::hideCaseNameField( bool hide )
{
m_hideCaseNameField = hide;
}
@ -131,7 +131,7 @@ void RimViewNameConfig::hideCaseNameField(bool hide)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideAggregationTypeField(bool hide)
void RimViewNameConfig::hideAggregationTypeField( bool hide )
{
m_hideAggregationTypeField = hide;
}
@ -139,7 +139,7 @@ void RimViewNameConfig::hideAggregationTypeField(bool hide)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hidePropertyField(bool hide)
void RimViewNameConfig::hidePropertyField( bool hide )
{
m_hidePropertyField = hide;
}
@ -147,7 +147,7 @@ void RimViewNameConfig::hidePropertyField(bool hide)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideSampleSpacingField(bool hide)
void RimViewNameConfig::hideSampleSpacingField( bool hide )
{
m_hideSampleSpacingField = hide;
}
@ -155,11 +155,11 @@ void RimViewNameConfig::hideSampleSpacingField(bool hide)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimViewNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering);
if (!m_hideCaseNameField) uiOrdering.add(&m_addCaseName);
if (!m_hideAggregationTypeField) uiOrdering.add(&m_addAggregationType);
if (!m_hidePropertyField) uiOrdering.add(&m_addProperty);
if (!m_hideSampleSpacingField) uiOrdering.add(&m_addSampleSpacing);
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
if ( !m_hideCaseNameField ) uiOrdering.add( &m_addCaseName );
if ( !m_hideAggregationTypeField ) uiOrdering.add( &m_addAggregationType );
if ( !m_hidePropertyField ) uiOrdering.add( &m_addProperty );
if ( !m_hideSampleSpacingField ) uiOrdering.add( &m_addSampleSpacing );
}

View File

@ -31,35 +31,33 @@ class RimViewNameConfig : public RimNameConfig
public:
explicit RimViewNameConfig();
void setAddCaseName(bool add);
bool addCaseName() const;
void setAddAggregationType(bool add);
bool addAggregationType() const;
void setAddProperty(bool add);
bool addProperty() const;
void setAddSampleSpacing(bool add);
bool addSampleSpacing() const;
void setAddCaseName( bool add );
bool addCaseName() const;
void setAddAggregationType( bool add );
bool addAggregationType() const;
void setAddProperty( bool add );
bool addProperty() const;
void setAddSampleSpacing( bool add );
bool addSampleSpacing() const;
void enableAllAutoNameTags(bool enable) override;
void enableAllAutoNameTags( bool enable ) override;
void hideCaseNameField(bool hide);
void hideAggregationTypeField(bool hide);
void hidePropertyField(bool hide);
void hideSampleSpacingField(bool hide);
void hideCaseNameField( bool hide );
void hideAggregationTypeField( bool hide );
void hidePropertyField( bool hide );
void hideSampleSpacingField( bool hide );
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addAggregationType;
caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addSampleSpacing;
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addAggregationType;
caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addSampleSpacing;
bool m_hideCaseNameField;
bool m_hideAggregationTypeField;
bool m_hidePropertyField;
bool m_hideSampleSpacingField;
bool m_hideCaseNameField;
bool m_hideAggregationTypeField;
bool m_hidePropertyField;
bool m_hideSampleSpacingField;
};

View File

@ -19,31 +19,31 @@
#include "RimWellLogExtractionCurveNameConfig.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig");
CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Extraction Curve Name Generator", "", "", "");
CAF_PDM_InitObject( "Well Log Extraction Curve Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", "");
CAF_PDM_InitField(&m_addProperty, "AddProperty", true, "Add Property Type", "", "", "");
CAF_PDM_InitField(&m_addWellName, "AddWellName", true, "Add Well Name", "", "", "");
CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "");
CAF_PDM_InitField(&m_addDate, "AddDate", true, "Add Date", "", "", "");
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", "" );
CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField( &m_addWellName, "AddWellName", true, "Add Well Name", "", "", "" );
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" );
CAF_PDM_InitField( &m_addDate, "AddDate", true, "Add Date", "", "", "" );
m_customName = "Log Extraction";
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addCaseName() const
{
@ -51,7 +51,7 @@ bool RimWellLogExtractionCurveNameConfig::addCaseName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addProperty() const
{
@ -59,7 +59,7 @@ bool RimWellLogExtractionCurveNameConfig::addProperty() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addWellName() const
{
@ -67,7 +67,7 @@ bool RimWellLogExtractionCurveNameConfig::addWellName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addTimeStep() const
{
@ -75,7 +75,7 @@ bool RimWellLogExtractionCurveNameConfig::addTimeStep() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogExtractionCurveNameConfig::addDate() const
{
@ -85,7 +85,7 @@ bool RimWellLogExtractionCurveNameConfig::addDate() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags(bool enable)
void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addProperty = enable;
@ -97,12 +97,12 @@ void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags(bool enable)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimWellLogExtractionCurveNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering);
uiOrdering.add(&m_addCaseName);
uiOrdering.add(&m_addProperty);
uiOrdering.add(&m_addWellName);
uiOrdering.add(&m_addTimestep);
uiOrdering.add(&m_addDate);
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_addCaseName );
uiOrdering.add( &m_addProperty );
uiOrdering.add( &m_addWellName );
uiOrdering.add( &m_addTimestep );
uiOrdering.add( &m_addDate );
}

View File

@ -31,23 +31,21 @@ class RimWellLogExtractionCurveNameConfig : public RimNameConfig
public:
RimWellLogExtractionCurveNameConfig();
bool addCaseName() const;
bool addProperty() const;
bool addWellName() const;
bool addTimeStep() const;
bool addDate() const;
bool addCaseName() const;
bool addProperty() const;
bool addWellName() const;
bool addTimeStep() const;
bool addDate() const;
void enableAllAutoNameTags(bool enable) override;
void enableAllAutoNameTags( bool enable ) override;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addDate;
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addDate;
};

View File

@ -19,19 +19,18 @@
#include "RimWellLogFileCurveNameConfig.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig");
CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log File Curve Name Generator", "", "", "");
CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" );
m_customName = "Las Curve";
}

View File

@ -31,4 +31,3 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig
public:
RimWellLogFileCurveNameConfig();
};

File diff suppressed because it is too large Load Diff

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -39,8 +39,8 @@ class RimWellLogTrack;
class QKeyEvent;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimWellLogPlot : public RimViewWindow, public RimNameConfigHolderInterface
{
@ -55,7 +55,12 @@ public:
CONNECTION_NUMBER
};
enum AxisGridVisibility { AXIS_GRID_NONE, AXIS_GRID_MAJOR, AXIS_GRID_MAJOR_AND_MINOR };
enum AxisGridVisibility
{
AXIS_GRID_NONE,
AXIS_GRID_MAJOR,
AXIS_GRID_MAJOR_AND_MINOR
};
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
@ -63,88 +68,95 @@ public:
RimWellLogPlot();
~RimWellLogPlot() override;
RimWellLogPlot& operator=(RimWellLogPlot&& rhs);
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
QWidget* createPlotWidget();
QWidget* viewWidget() override;
QWidget* createPlotWidget();
QWidget* viewWidget() override;
void setDescription(const QString& description);
QString description() const;
void setDescription( const QString& description );
QString description() const;
DepthTypeEnum depthType() const;
void setDepthType(DepthTypeEnum depthType);
DepthTypeEnum depthType() const;
void setDepthType( DepthTypeEnum depthType );
RiaDefines::DepthUnitType depthUnit() const;
void setDepthUnit(RiaDefines::DepthUnitType depthUnit);
RiaDefines::DepthUnitType depthUnit() const;
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
QString depthPlotTitle() const;
void enableDepthGridLines(AxisGridVisibility gridVisibility);
AxisGridVisibility depthGridLinesVisibility() const;
QString depthPlotTitle() const;
void enableDepthGridLines( AxisGridVisibility gridVisibility );
AxisGridVisibility depthGridLinesVisibility() const;
bool isPlotTitleVisible() const;
void setPlotTitleVisible(bool visible);
bool areTrackLegendsVisible() const;
void setTrackLegendsVisible(bool doShow);
bool areTrackLegendsHorizontal() const;
void setTrackLegendsHorizontal(bool horizontal);
bool isPlotTitleVisible() const;
void setPlotTitleVisible( bool visible );
bool areTrackLegendsVisible() const;
void setTrackLegendsVisible( bool doShow );
bool areTrackLegendsHorizontal() const;
void setTrackLegendsHorizontal( bool horizontal );
void addTrack(RimWellLogTrack* track);
void insertTrack(RimWellLogTrack* track, size_t index);
size_t trackCount() const { return m_tracks.size();}
void addTrack( RimWellLogTrack* track );
void insertTrack( RimWellLogTrack* track, size_t index );
size_t trackCount() const
{
return m_tracks.size();
}
void removeTrack(RimWellLogTrack* track);
size_t trackIndex(const RimWellLogTrack* track) const;
RimWellLogTrack* trackByIndex(size_t index) const;
size_t firstVisibleTrackIndex() const;
std::vector<RimWellLogTrack*> tracks() const;
void updateTracks(bool autoScaleXAxis = false);
void updateTrackNames();
void removeTrack( RimWellLogTrack* track );
size_t trackIndex( const RimWellLogTrack* track ) const;
RimWellLogTrack* trackByIndex( size_t index ) const;
size_t firstVisibleTrackIndex() const;
std::vector<RimWellLogTrack*> tracks() const;
void updateTracks( bool autoScaleXAxis = false );
void updateTrackNames();
void updateDepthZoom();
void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter);
void panDepth(double panFactor);
void setDepthZoomMinMax(double minimumDepth, double maximumDepth);
void depthZoomMinMax(double* minimumDepth, double* maximumDepth) const;
void updateDepthZoom();
void setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter );
void panDepth( double panFactor );
void setDepthZoomMinMax( double minimumDepth, double maximumDepth );
void depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const;
void calculateAvailableDepthRange();
void availableDepthRange(double* minimumDepth, double* maximumDepth) const;
bool hasAvailableDepthRange() const;
void calculateAvailableDepthRange();
void availableDepthRange( double* minimumDepth, double* maximumDepth ) const;
bool hasAvailableDepthRange() const;
void zoomAll() override;
void setDepthAutoZoom(bool on);
void enableAllAutoNameTags(bool enable);
void zoomAll() override;
void setDepthAutoZoom( bool on );
void enableAllAutoNameTags( bool enable );
QString asciiDataForPlotExport() const;
QString asciiDataForPlotExport() const;
void uiOrderingForDepthAxis(caf::PdmUiOrdering& uiOrdering);
void uiOrderingForPlotSettings(caf::PdmUiOrdering& uiOrdering);
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering );
QString createAutoName() const override;
QString createAutoName() const override;
void handleKeyPressEvent( QKeyEvent* keyEvent );
RimWellLogCurveCommonDataSource* commonDataSource() const;
void handleKeyPressEvent(QKeyEvent* keyEvent);
RimWellLogCurveCommonDataSource* commonDataSource() const;
protected:
void performAutoNameUpdate() override;
void performAutoNameUpdate() override;
// Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
caf::PdmFieldHandle* userDescriptionField() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
void onLoadDataAndUpdate() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
caf::PdmFieldHandle* userDescriptionField() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override;
QImage snapshotWindowContent() override;
QWidget* createViewWidget(QWidget* mainWindowParent) override;
void deleteViewWidget() override;
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void initAfterRead() override;
void initAfterRead() override;
private:
void applyZoomAllDepths();
void applyDepthZoomFromVisibleDepth();
void recreateTrackPlots();
void detachAllCurves();
void applyZoomAllDepths();
void applyDepthZoomFromVisibleDepth();
void recreateTrackPlots();
void detachAllCurves();
virtual std::set<RiaDefines::DepthUnitType> availableDepthUnits() const;
virtual std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const;
@ -152,22 +164,22 @@ private:
virtual void onDepthTypeChanged();
protected:
caf::PdmField<QString> m_userName_OBSOLETE;
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField<QString> m_userName_OBSOLETE;
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField< caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField< caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth;
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
caf::PdmField<bool> m_showTitleInPlot;
caf::PdmField<bool> m_showTrackLegends;
caf::PdmField<bool> m_trackLegendsHorizontal;
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth;
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
caf::PdmField<bool> m_isAutoScaleDepthEnabled;
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
caf::PdmField<bool> m_showTitleInPlot;
caf::PdmField<bool> m_showTrackLegends;
caf::PdmField<bool> m_trackLegendsHorizontal;
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
double m_minAvailableDepth;
double m_maxAvailableDepth;

View File

@ -19,31 +19,31 @@
#include "RimWellLogPlotNameConfig.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig");
CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Plot Name Generator", "", "", "");
CAF_PDM_InitObject( "Well Log Plot Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "");
CAF_PDM_InitField(&m_addWellName, "AddWellName", false, "Add Well Name", "", "", "");
CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", false, "Add Time Step", "", "", "");
CAF_PDM_InitField(&m_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", "");
CAF_PDM_InitField(&m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", "");
CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "" );
CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Add Well Name", "", "", "" );
CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Add Time Step", "", "", "" );
CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", "" );
CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", "" );
m_customName = "Well Log Plot";
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addCaseName() const
{
@ -51,7 +51,7 @@ bool RimWellLogPlotNameConfig::addCaseName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addWellName() const
{
@ -59,7 +59,7 @@ bool RimWellLogPlotNameConfig::addWellName() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotNameConfig::addTimeStep() const
{
@ -85,7 +85,7 @@ bool RimWellLogPlotNameConfig::addWaterDepth() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::enableAllAutoNameTags(bool enable)
void RimWellLogPlotNameConfig::enableAllAutoNameTags( bool enable )
{
m_addCaseName = enable;
m_addWellName = enable;
@ -97,13 +97,12 @@ void RimWellLogPlotNameConfig::enableAllAutoNameTags(bool enable)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimWellLogPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering);
uiOrdering.add(&m_addCaseName);
uiOrdering.add(&m_addWellName);
uiOrdering.add(&m_addTimestep);
uiOrdering.add(&m_addAirGap);
uiOrdering.add(&m_addWaterDepth);
RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add( &m_addCaseName );
uiOrdering.add( &m_addWellName );
uiOrdering.add( &m_addTimestep );
uiOrdering.add( &m_addAirGap );
uiOrdering.add( &m_addWaterDepth );
}

View File

@ -36,17 +36,15 @@ public:
bool addTimeStep() const;
bool addAirGap() const;
bool addWaterDepth() const;
void enableAllAutoNameTags(bool enable) override;
void enableAllAutoNameTags( bool enable ) override;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addAirGap;
caf::PdmField<bool> m_addWaterDepth;
caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addAirGap;
caf::PdmField<bool> m_addWaterDepth;
};

View File

@ -19,19 +19,18 @@
#include "RimWellLogRftCurveNameConfig.h"
//==================================================================================================
///
///
///
///
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig");
CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Rft Curve Name Generator", "", "", "");
CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" );
m_customName = "Rft Curve";
}

View File

@ -31,4 +31,3 @@ class RimWellLogRftCurveNameConfig : public RimNameConfig
public:
RimWellLogRftCurveNameConfig();
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -21,11 +21,11 @@
#include "RiaApplication.h"
#include "RimContextCommandBuilder.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h"
@ -38,126 +38,120 @@
#include <QLabel>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: RiuWellLogPlot(plotDefinition, parent)
RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent )
: RiuWellLogPlot( plotDefinition, parent )
{
Q_ASSERT(m_plotDefinition);
Q_ASSERT( m_plotDefinition );
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout(mainLayout);
this->layout()->setMargin(0);
this->layout()->setSpacing(2);
this->setLayout( mainLayout );
this->layout()->setMargin( 0 );
this->layout()->setSpacing( 2 );
new RiuPlotObjectPicker(m_plotTitle, m_plotDefinition);
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
mainLayout->addWidget(m_plotTitle, 0, Qt::AlignCenter);
mainLayout->addWidget( m_plotTitle, 0, Qt::AlignCenter );
auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout(plotWidgetsLayout);
plotWidgetsLayout->addLayout(rightColumnLayout);
m_legendWidget = new RiuNightchartsWidget(this);
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(m_plotDefinition.p());
new RiuPlotObjectPicker(m_legendWidget, wellAllocationPlot->plotLegend());
mainLayout->addLayout( plotWidgetsLayout );
plotWidgetsLayout->addLayout( rightColumnLayout );
m_legendWidget = new RiuNightchartsWidget( this );
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>( m_plotDefinition.p() );
new RiuPlotObjectPicker( m_legendWidget, wellAllocationPlot->plotLegend() );
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher(m_legendWidget, menuBuilder);
new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
rightColumnLayout->addWidget(m_legendWidget);
m_legendWidget->showPie(false);
rightColumnLayout->addWidget( m_legendWidget );
m_legendWidget->showPie( false );
QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget(this);
new RiuPlotObjectPicker(totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot());
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder);
QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget( this );
new RiuPlotObjectPicker( totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot() );
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
rightColumnLayout->addWidget(wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
rightColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
rightColumnLayout->addWidget( wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
Qt::AlignTop );
rightColumnLayout->addStretch();
QWidget* wellFlowWidget = m_plotDefinition->createPlotWidget();
plotWidgetsLayout->addWidget(wellFlowWidget);
plotWidgetsLayout->addWidget( wellFlowWidget );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::~RiuWellAllocationPlot()
{
}
RiuWellAllocationPlot::~RiuWellAllocationPlot() {}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showLegend(bool doShow)
void RiuWellAllocationPlot::showLegend( bool doShow )
{
if (doShow)
if ( doShow )
m_legendWidget->show();
else
m_legendWidget->hide();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::addLegendItem(const QString& name, const cvf::Color3f& color, float value)
void RiuWellAllocationPlot::addLegendItem( const QString& name, const cvf::Color3f& color, float value )
{
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
m_legendWidget->addItem(name, sliceColor, value);
m_legendWidget->addItem( name, sliceColor, value );
m_legendWidget->updateGeometry();
m_legendWidget->update();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::clearLegend()
{
m_legendWidget->clear();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::minimumSizeHint() const
{
return QSize(0, 100);
return QSize( 0, 100 );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowContributingWellsFromPlotFeature";
menuBuilder.appendToMenu(&menu);
menuBuilder.appendToMenu( &menu );
if (menu.actions().size() > 0)
if ( menu.actions().size() > 0 )
{
menu.exec(event->globalPos());
menu.exec( event->globalPos() );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::sizeHint() const
{
return QSize(0, 0);
return QSize( 0, 0 );
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -24,16 +24,17 @@
#include "qwt_plot.h"
#include <QPointer>
#include <QFrame>
#include <QPointer>
class RimWellAllocationPlot;
class RiuNightchartsWidget;
class QLabel;
namespace cvf {
class Color3f;
namespace cvf
{
class Color3f;
}
//==================================================================================================
@ -44,19 +45,20 @@ namespace cvf {
class RiuWellAllocationPlot : public RiuWellLogPlot
{
Q_OBJECT;
public:
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr);
RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellAllocationPlot() override;
void showLegend(bool doShow);
void addLegendItem(const QString& name, const cvf::Color3f& color, float value);
void clearLegend();
void showLegend( bool doShow );
void addLegendItem( const QString& name, const cvf::Color3f& color, float value );
void clearLegend();
protected:
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void contextMenuEvent(QContextMenuEvent *) override;
void contextMenuEvent( QContextMenuEvent* ) override;
private:
QPointer<RiuNightchartsWidget> m_legendWidget;

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -30,8 +30,8 @@
#include "RiuPlotObjectPicker.h"
#include "RiuWellLogTrack.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
@ -48,92 +48,97 @@
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent)
: QWidget(parent), m_scheduleUpdateChildrenLayoutTimer(nullptr)
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: QWidget( parent )
, m_scheduleUpdateChildrenLayoutTimer( nullptr )
{
Q_ASSERT(plotDefinition);
Q_ASSERT( plotDefinition );
m_plotDefinition = plotDefinition;
QPalette newPalette(palette());
newPalette.setColor(QPalette::Background, Qt::white);
setPalette(newPalette);
QPalette newPalette( palette() );
newPalette.setColor( QPalette::Background, Qt::white );
setPalette( newPalette );
setAutoFillBackground(true);
setAutoFillBackground( true );
m_plotTitle = new QLabel("PLOT TITLE HERE", this);
QFont font = m_plotTitle->font();
font.setPointSize(14);
font.setBold(true);
m_plotTitle->setFont(font);
m_plotTitle = new QLabel( "PLOT TITLE HERE", this );
QFont font = m_plotTitle->font();
font.setPointSize( 14 );
font.setBold( true );
m_plotTitle->setFont( font );
m_plotTitle->hide();
m_scrollBar = new QScrollBar(this);
m_scrollBar->setOrientation(Qt::Vertical);
m_scrollBar->setVisible(true);
m_scrollBar = new QScrollBar( this );
m_scrollBar->setOrientation( Qt::Vertical );
m_scrollBar->setVisible( true );
new RiuPlotObjectPicker(m_plotTitle, m_plotDefinition);
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setFocusPolicy(Qt::StrongFocus);
connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int)));
this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
setFocusPolicy( Qt::StrongFocus );
connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellLogPlot::~RiuWellLogPlot()
{
if (m_plotDefinition)
if ( m_plotDefinition )
{
m_plotDefinition->detachAllCurves();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::addTrackPlot(RiuWellLogTrack* trackPlot)
void RiuWellLogPlot::addTrackPlot( RiuWellLogTrack* trackPlot )
{
// Insert the plot to the left of the scroll bar
insertTrackPlot(trackPlot, m_trackPlots.size());
insertTrackPlot( trackPlot, m_trackPlots.size() );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
{
trackPlot->setParent(this);
m_trackPlots.insert(static_cast<int>(index), trackPlot);
trackPlot->setParent( this );
QwtLegend* legend = new QwtLegend(this);
int legendColumns = 1;
if (m_plotDefinition->areTrackLegendsHorizontal())
m_trackPlots.insert( static_cast<int>( index ), trackPlot );
QwtLegend* legend = new QwtLegend( this );
int legendColumns = 1;
if ( m_plotDefinition->areTrackLegendsHorizontal() )
{
legendColumns = 0; // unlimited
}
legend->setMaxColumns(legendColumns);
legend->horizontalScrollBar()->setVisible(false);
legend->verticalScrollBar()->setVisible(false);
legend->setMaxColumns( legendColumns );
legend->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(updateLegend(const QVariant &, const QList< QwtLegendData > &)));
legend->contentsWidget()->layout()->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
m_legends.insert(static_cast<int>(index), legend);
this->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(scheduleUpdateChildrenLayout()));
legend->horizontalScrollBar()->setVisible( false );
legend->verticalScrollBar()->setVisible( false );
if (!m_plotDefinition->areTrackLegendsVisible())
legend->connect( trackPlot,
SIGNAL( legendDataChanged( const QVariant&, const QList<QwtLegendData>& ) ),
SLOT( updateLegend( const QVariant&, const QList<QwtLegendData>& ) ) );
legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
m_legends.insert( static_cast<int>( index ), legend );
this->connect( trackPlot,
SIGNAL( legendDataChanged( const QVariant&, const QList<QwtLegendData>& ) ),
SLOT( scheduleUpdateChildrenLayout() ) );
if ( !m_plotDefinition->areTrackLegendsVisible() )
{
legend->hide();
}
trackPlot->updateLegend();
if (trackPlot->isRimTrackVisible())
if ( trackPlot->isRimTrackVisible() )
{
trackPlot->show();
}
@ -144,67 +149,67 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot)
void RiuWellLogPlot::removeTrackPlot( RiuWellLogTrack* trackPlot )
{
if (!trackPlot) return;
if ( !trackPlot ) return;
int trackIdx = m_trackPlots.indexOf(trackPlot);
CVF_ASSERT(trackIdx >= 0);
int trackIdx = m_trackPlots.indexOf( trackPlot );
CVF_ASSERT( trackIdx >= 0 );
m_trackPlots.removeAt(trackIdx);
trackPlot->setParent(nullptr);
m_trackPlots.removeAt( trackIdx );
trackPlot->setParent( nullptr );
QwtLegend* legend = m_legends[trackIdx];
m_legends.removeAt(trackIdx);
m_legends.removeAt( trackIdx );
delete legend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setDepthZoomAndReplot(double minDepth, double maxDepth)
{
for (int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++)
{
m_trackPlots[tpIdx]->setDepthZoom(minDepth, maxDepth);
m_trackPlots[tpIdx]->replot();
}
updateScrollBar(minDepth, maxDepth);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setPlotTitle(const QString& plotTitle)
void RiuWellLogPlot::setDepthZoomAndReplot( double minDepth, double maxDepth )
{
m_plotTitle->setText(plotTitle);
for ( int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++ )
{
m_trackPlots[tpIdx]->setDepthZoom( minDepth, maxDepth );
m_trackPlots[tpIdx]->replot();
}
updateScrollBar( minDepth, maxDepth );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setPlotTitle( const QString& plotTitle )
{
m_plotTitle->setText( plotTitle );
this->updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellLogPlot::preferredSize() const
{
int titleWidth = 0;
int titleHeight = 0;
if (m_plotTitle && m_plotTitle->isVisible())
if ( m_plotTitle && m_plotTitle->isVisible() )
{
titleWidth = m_plotTitle->width();
titleHeight = m_plotTitle->height() + 10;
}
int sumTrackWidth = 0;
int sumTrackWidth = 0;
int maxTrackHeight = 0;
for (QPointer<RiuWellLogTrack> track : m_trackPlots)
for ( QPointer<RiuWellLogTrack> track : m_trackPlots )
{
sumTrackWidth += track->width();
maxTrackHeight = std::max(maxTrackHeight, track->height());
maxTrackHeight = std::max( maxTrackHeight, track->height() );
}
return QSize(std::max(titleWidth, sumTrackWidth), titleHeight + maxTrackHeight);
return QSize( std::max( titleWidth, sumTrackWidth ), titleHeight + maxTrackHeight );
}
//--------------------------------------------------------------------------------------------------
@ -224,23 +229,23 @@ void RiuWellLogPlot::hideTitle()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
void RiuWellLogPlot::contextMenuEvent( QContextMenuEvent* event )
{
QMenu menu;
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
caf::SelectionManager::instance()->setSelectedItem( ownerPlotDefinition() );
menuBuilder << "RicShowPlotDataFeature";
menuBuilder << "RicShowContributingWellsFromPlotFeature";
menuBuilder.appendToMenu(&menu);
menuBuilder.appendToMenu( &menu );
if (menu.actions().size() > 0)
if ( menu.actions().size() > 0 )
{
menu.exec(event->globalPos());
menu.exec( event->globalPos() );
}
}
@ -249,56 +254,56 @@ void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
//--------------------------------------------------------------------------------------------------
QSize RiuWellLogPlot::sizeHint() const
{
return QSize(1, 1);
return QSize( 1, 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent(QKeyEvent* keyEvent)
void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent )
{
m_plotDefinition->handleKeyPressEvent(keyEvent);
m_plotDefinition->handleKeyPressEvent( keyEvent );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateScrollBar(double minDepth, double maxDepth)
void RiuWellLogPlot::updateScrollBar( double minDepth, double maxDepth )
{
double availableMinDepth;
double availableMaxDepth;
m_plotDefinition->availableDepthRange(&availableMinDepth, &availableMaxDepth);
availableMaxDepth += 0.01*(availableMaxDepth-availableMinDepth);
m_plotDefinition->availableDepthRange( &availableMinDepth, &availableMaxDepth );
availableMaxDepth += 0.01 * ( availableMaxDepth - availableMinDepth );
double visibleDepth = maxDepth - minDepth;
m_scrollBar->blockSignals(true);
m_scrollBar->blockSignals( true );
{
m_scrollBar->setRange((int) availableMinDepth, (int) ((availableMaxDepth - visibleDepth)));
m_scrollBar->setPageStep((int) visibleDepth);
m_scrollBar->setValue((int) minDepth);
m_scrollBar->setRange( (int)availableMinDepth, (int)( ( availableMaxDepth - visibleDepth ) ) );
m_scrollBar->setPageStep( (int)visibleDepth );
m_scrollBar->setValue( (int)minDepth );
m_scrollBar->setVisible(true);
m_scrollBar->setVisible( true );
}
m_scrollBar->blockSignals(false);
m_scrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::slotSetMinDepth(int value)
void RiuWellLogPlot::slotSetMinDepth( int value )
{
double minimumDepth;
double maximumDepth;
m_plotDefinition->depthZoomMinMax(&minimumDepth, &maximumDepth);
m_plotDefinition->depthZoomMinMax( &minimumDepth, &maximumDepth );
double delta = value - minimumDepth;
m_plotDefinition->setDepthZoomMinMax(minimumDepth + delta, maximumDepth + delta);
m_plotDefinition->setDepthAutoZoom(false);
m_plotDefinition->setDepthZoomMinMax( minimumDepth + delta, maximumDepth + delta );
m_plotDefinition->setDepthAutoZoom( false );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RiuWellLogPlot::ownerPlotDefinition()
{
@ -306,7 +311,7 @@ RimWellLogPlot* RiuWellLogPlot::ownerPlotDefinition()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellLogPlot::ownerViewWindow() const
{
@ -314,77 +319,77 @@ RimViewWindow* RiuWellLogPlot::ownerViewWindow() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::resizeEvent(QResizeEvent *event)
void RiuWellLogPlot::resizeEvent( QResizeEvent* event )
{
int height = event->size().height();
int width = event->size().width();
placeChildWidgets(height, width);
QWidget::resizeEvent(event);
placeChildWidgets( height, width );
QWidget::resizeEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWidth) const
std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame( int frameWidth ) const
{
int trackCount = m_trackPlots.size();
int visibleTrackCount = 0;
int visibleTrackCount = 0;
int firstTrackAxisOffset = 0; // Account for first track having the y-axis labels and markers
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
if (visibleTrackCount == 0)
if ( visibleTrackCount == 0 )
{
firstTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left());
firstTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
}
else if (visibleTrackCount == 1)
else if ( visibleTrackCount == 1 )
{
// The others axes also have markers, and so we need to subtract for this to get the shift due to labels and title
int otherTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left());
int otherTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
firstTrackAxisOffset -= otherTrackAxisOffset;
}
++visibleTrackCount;
++visibleTrackCount;
}
}
int scrollBarWidth = 0;
if (m_scrollBar->isVisible()) scrollBarWidth = m_scrollBar->sizeHint().width();
if ( m_scrollBar->isVisible() ) scrollBarWidth = m_scrollBar->sizeHint().width();
std::map<int, int> trackWidths;
if (visibleTrackCount)
if ( visibleTrackCount )
{
int totalTrackWidth = (frameWidth - firstTrackAxisOffset - scrollBarWidth);
int trackWidthExtra = (frameWidth - firstTrackAxisOffset - scrollBarWidth) % visibleTrackCount;
int totalTrackWidth = ( frameWidth - firstTrackAxisOffset - scrollBarWidth );
int trackWidthExtra = ( frameWidth - firstTrackAxisOffset - scrollBarWidth ) % visibleTrackCount;
int totalWidthWeights = 0;
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
totalWidthWeights += m_trackPlots[tIdx]->widthScaleFactor();
}
}
bool firstVisible = true;
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
int realTrackWidth = (totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor()) / totalWidthWeights;
if (firstVisible)
int realTrackWidth = ( totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor() ) / totalWidthWeights;
if ( firstVisible )
{
realTrackWidth += firstTrackAxisOffset;
firstVisible = false;
}
if (trackWidthExtra > 0)
if ( trackWidthExtra > 0 )
{
realTrackWidth += 1;
--trackWidthExtra;
@ -399,100 +404,104 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWid
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::placeChildWidgets(int frameHeight, int frameWidth)
void RiuWellLogPlot::placeChildWidgets( int frameHeight, int frameWidth )
{
CVF_ASSERT(m_legends.size() == m_trackPlots.size());
CVF_ASSERT( m_legends.size() == m_trackPlots.size() );
positionTitle(frameWidth);
positionTitle( frameWidth );
const int trackPadding = 2;
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame(frameWidth);
size_t visibleTrackCount = trackWidths.size();
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame( frameWidth );
size_t visibleTrackCount = trackWidths.size();
int maxLegendHeight = 0;
if (m_plotDefinition && m_plotDefinition->areTrackLegendsVisible())
if ( m_plotDefinition && m_plotDefinition->areTrackLegendsVisible() )
{
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
int legendHeight = m_legends[tIdx]->heightForWidth(trackWidths[tIdx] - 2 * trackPadding);
int legendHeight = m_legends[tIdx]->heightForWidth( trackWidths[tIdx] - 2 * trackPadding );
if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight;
}
}
}
int titleHeight = 0;
if (m_plotTitle && m_plotTitle->isVisible())
if ( m_plotTitle && m_plotTitle->isVisible() )
{
titleHeight = m_plotTitle->height() + 2;
}
int trackHeight = frameHeight - maxLegendHeight - titleHeight;
int trackX = 0;
int trackX = 0;
if (visibleTrackCount)
if ( visibleTrackCount )
{
int maxCanvasOffset = 0;
for (int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx)
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
// Hack to align QWT plots. See below.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
maxCanvasOffset = std::max(maxCanvasOffset, static_cast<int>(canvasRect.top()));
maxCanvasOffset = std::max( maxCanvasOffset, static_cast<int>( canvasRect.top() ) );
}
}
for (int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx)
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
int adjustedVerticalPosition = titleHeight + maxLegendHeight + 10;
int adjustedTrackHeight = trackHeight;
int adjustedTrackHeight = trackHeight;
{
// Hack to align QWT plots which doesn't have an x-axis with the other tracks.
// Since they are missing the axis, QWT will shift them upwards.
// So we shift the plot downwards and resize to match the others.
// TODO: Look into subclassing QwtPlotLayout instead.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int myCanvasOffset = static_cast<int>(canvasRect.top());
int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin(QwtPlot::xTop);
int canvasShift = std::max(0, maxCanvasOffset - myCanvasOffset);
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int myCanvasOffset = static_cast<int>( canvasRect.top() );
int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop );
int canvasShift = std::max( 0, maxCanvasOffset - myCanvasOffset );
adjustedVerticalPosition += canvasShift - myMargins;
adjustedTrackHeight -= canvasShift;
}
int realTrackWidth = trackWidths[tIdx];
m_legends[tIdx]->setGeometry(trackX + trackPadding, titleHeight, realTrackWidth - 2 * trackPadding, maxLegendHeight);
m_trackPlots[tIdx]->setGeometry(trackX + trackPadding, adjustedVerticalPosition, realTrackWidth - 2 * trackPadding, adjustedTrackHeight);
m_legends[tIdx]->setGeometry( trackX + trackPadding,
titleHeight,
realTrackWidth - 2 * trackPadding,
maxLegendHeight );
m_trackPlots[tIdx]->setGeometry( trackX + trackPadding,
adjustedVerticalPosition,
realTrackWidth - 2 * trackPadding,
adjustedTrackHeight );
trackX += realTrackWidth;
}
}
}
if (m_scrollBar->isVisible())
if ( m_scrollBar->isVisible() )
{
m_scrollBar->setGeometry(trackX, titleHeight + maxLegendHeight, m_scrollBar->sizeHint().width(), trackHeight);
m_scrollBar->setGeometry( trackX, titleHeight + maxLegendHeight, m_scrollBar->sizeHint().width(), trackHeight );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::positionTitle(int frameWidth)
void RiuWellLogPlot::positionTitle( int frameWidth )
{
if (m_plotDefinition && m_plotDefinition->isPlotTitleVisible())
if ( m_plotDefinition && m_plotDefinition->isPlotTitleVisible() )
{
int textWidth = m_plotTitle->sizeHint().width();
m_plotTitle->setGeometry(frameWidth/2 - textWidth/2, 0, textWidth, m_plotTitle->sizeHint().height());
m_plotTitle->setGeometry( frameWidth / 2 - textWidth / 2, 0, textWidth, m_plotTitle->sizeHint().height() );
m_plotTitle->show();
}
else
@ -502,25 +511,25 @@ void RiuWellLogPlot::positionTitle(int frameWidth)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateChildrenLayout()
{
int trackCount = m_trackPlots.size();
{
int trackCount = m_trackPlots.size();
int numTracksAlreadyShown = 0;
for (int tIdx = 0; tIdx < trackCount; ++tIdx)
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if (m_trackPlots[tIdx]->isVisible())
if ( m_trackPlots[tIdx]->isVisible() )
{
int legendColumns = 1;
if (m_plotDefinition->areTrackLegendsHorizontal())
if ( m_plotDefinition->areTrackLegendsHorizontal() )
{
legendColumns = 0; // unlimited
}
m_legends[tIdx]->setMaxColumns(legendColumns);
m_legends[tIdx]->setMaxColumns( legendColumns );
m_legends[tIdx]->show();
m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle(numTracksAlreadyShown == 0);
m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle( numTracksAlreadyShown == 0 );
numTracksAlreadyShown++;
}
else
@ -529,23 +538,23 @@ void RiuWellLogPlot::updateChildrenLayout()
}
}
placeChildWidgets(this->height(), this->width());
placeChildWidgets( this->height(), this->width() );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::showEvent(QShowEvent *)
void RiuWellLogPlot::showEvent( QShowEvent* )
{
updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::changeEvent(QEvent *event)
void RiuWellLogPlot::changeEvent( QEvent* event )
{
if (event->type() == QEvent::WindowStateChange)
if ( event->type() == QEvent::WindowStateChange )
{
updateChildrenLayout();
}
@ -558,15 +567,15 @@ void RiuWellLogPlot::changeEvent(QEvent *event)
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::scheduleUpdateChildrenLayout()
{
if (!m_scheduleUpdateChildrenLayoutTimer)
if ( !m_scheduleUpdateChildrenLayoutTimer )
{
m_scheduleUpdateChildrenLayoutTimer = new QTimer(this);
connect(m_scheduleUpdateChildrenLayoutTimer, SIGNAL(timeout()), this, SLOT(updateChildrenLayout()));
m_scheduleUpdateChildrenLayoutTimer = new QTimer( this );
connect( m_scheduleUpdateChildrenLayoutTimer, SIGNAL( timeout() ), this, SLOT( updateChildrenLayout() ) );
}
if (!m_scheduleUpdateChildrenLayoutTimer->isActive())
if ( !m_scheduleUpdateChildrenLayoutTimer->isActive() )
{
m_scheduleUpdateChildrenLayoutTimer->setSingleShot(true);
m_scheduleUpdateChildrenLayoutTimer->start(100);
m_scheduleUpdateChildrenLayoutTimer->setSingleShot( true );
m_scheduleUpdateChildrenLayoutTimer->start( 100 );
}
}

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -47,45 +47,44 @@ class RiuWellLogPlot : public QWidget, public RiuInterfaceToViewWindow
Q_OBJECT
public:
RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent = nullptr);
RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellLogPlot() override;
RimWellLogPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
RimWellLogPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void addTrackPlot(RiuWellLogTrack* trackPlot);
void insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index);
void removeTrackPlot(RiuWellLogTrack* trackPlot);
void addTrackPlot( RiuWellLogTrack* trackPlot );
void insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index );
void removeTrackPlot( RiuWellLogTrack* trackPlot );
void setDepthZoomAndReplot(double minDepth, double maxDepth);
void setPlotTitle(const QString& plotTitle);
virtual QSize preferredSize() const;
void setDepthZoomAndReplot( double minDepth, double maxDepth );
void setPlotTitle( const QString& plotTitle );
virtual QSize preferredSize() const;
void showTitle();
void hideTitle();
void showTitle();
void hideTitle();
public slots:
void updateChildrenLayout();
void updateChildrenLayout();
protected:
void resizeEvent(QResizeEvent *event) override;
void showEvent(QShowEvent *) override;
void changeEvent(QEvent *) override;
void contextMenuEvent(QContextMenuEvent *) override;
QSize sizeHint() const override;
void resizeEvent( QResizeEvent* event ) override;
void showEvent( QShowEvent* ) override;
void changeEvent( QEvent* ) override;
void contextMenuEvent( QContextMenuEvent* ) override;
QSize sizeHint() const override;
void keyPressEvent(QKeyEvent* keyEvent) override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
private:
void updateScrollBar(double minDepth, double maxDepth);
std::map<int, int> calculateTrackWidthsToMatchFrame(int frameWidth) const;
void placeChildWidgets(int frameHeight, int frameWidth);
void positionTitle(int frameWidth);
void updateScrollBar( double minDepth, double maxDepth );
std::map<int, int> calculateTrackWidthsToMatchFrame( int frameWidth ) const;
void placeChildWidgets( int frameHeight, int frameWidth );
void positionTitle( int frameWidth );
private slots:
void slotSetMinDepth(int value);
void scheduleUpdateChildrenLayout();
void slotSetMinDepth( int value );
void scheduleUpdateChildrenLayout();
protected:
QPointer<QLabel> m_plotTitle;
@ -95,4 +94,3 @@ protected:
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
QTimer* m_scheduleUpdateChildrenLayoutTimer;
};