Rename ApplicationCode to ApplicationLibCode

This commit is contained in:
Gaute Lindkvist
2021-01-06 14:55:29 +01:00
parent 751df1a421
commit 81699db187
3242 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAddWellLogToPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCurveExtractionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogRftCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteRftPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPltPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeletePltPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogFileCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotTrackFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogPlotCurveFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogsImportFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogPlotTrackFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogTrackFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicChangeDataSourceFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAsciiExportWellLogPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogFileCloseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicMoveWellLogFilesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogFileCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogRftCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurveDeleteFeature.h
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurvePickEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellBoreStabilityPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAddWellLogToPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogCurveExtractionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogRftCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteRftPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPltPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeletePltPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogFileCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellLogPlotTrackFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellLogPlotCurveFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellLogsImportFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellLogPlotTrackFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogTrackFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteWellLogPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicChangeDataSourceFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAsciiExportWellLogPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellLogFileCloseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMoveWellLogFilesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogFileCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAdd3dWellLogRftCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurveDeleteFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/Ric3dWellLogCurvePickEventHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellBoreStabilityPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND COMMAND_CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\WellLog" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "Ric3dWellLogCurveDeleteFeature.h"
#include "Rim3dWellLogCurve.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimProject.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( Ric3dWellLogCurveDeleteFeature, "Ric3dWellLogCurveDeleteFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Ric3dWellLogCurveDeleteFeature::isCommandEnabled()
{
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Ric3dWellLogCurveDeleteFeature::onActionTriggered( bool isChecked )
{
std::vector<Rim3dWellLogCurve*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() == 0 ) return;
Rim3dWellLogCurve* firstCurve = objects[0];
Rim3dWellLogCurveCollection* curveCollection = nullptr;
firstCurve->firstAncestorOrThisOfType( curveCollection );
if ( !curveCollection ) return;
for ( Rim3dWellLogCurve* curve : objects )
{
curveCollection->remove3dWellLogCurve( curve );
delete curve;
}
curveCollection->redrawAffectedViewsAndEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Ric3dWellLogCurveDeleteFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Delete 3D Well Log Curve(s)" );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class Ric3dWellLogCurveDeleteFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "Ric3dWellLogCurvePickEventHandler.h"
#include "Rim3dWellLogCurve.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimWellPath.h"
#include "RiuMainWindow.h"
#include "RivObjectSourceInfo.h"
#include "cvfPart.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Ric3dWellLogCurvePickEventHandler* Ric3dWellLogCurvePickEventHandler::instance()
{
static Ric3dWellLogCurvePickEventHandler* singleton = new Ric3dWellLogCurvePickEventHandler;
return singleton;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Ric3dWellLogCurvePickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eventObject )
{
if ( eventObject.m_pickItemInfos.empty() ) return false;
const auto& firstPickedItem = eventObject.m_pickItemInfos.front();
const cvf::Part* firstPickedPart = firstPickedItem.pickedPart();
const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>( firstPickedPart->sourceInfo() );
if ( sourceInfo )
{
Rim3dWellLogCurveCollection* curveCollection = dynamic_cast<Rim3dWellLogCurveCollection*>( sourceInfo->object() );
if ( curveCollection )
{
RimWellPath* wellPath;
curveCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
QString wellPathName = wellPath->name();
cvf::Vec3d closestPoint;
double measuredDepthAtPoint;
double valueAtPoint;
Rim3dWellLogCurve* curve = curveCollection->checkForCurveIntersection( firstPickedItem.globalPickedPoint(),
&closestPoint,
&measuredDepthAtPoint,
&valueAtPoint );
if ( curve )
{
RiuMainWindow::instance()->selectAsCurrentItem( curve );
QString curveText;
curveText += QString( "Curve name : %1\n" ).arg( curve->name() );
;
curveText += QString( "Well path name: %1\n" ).arg( wellPathName );
curveText += QString( "Measured depth: %1\n" ).arg( measuredDepthAtPoint );
curveText += QString( "%1 at depth: %2\n" ).arg( curve->resultPropertyString() ).arg( valueAtPoint );
RiuMainWindow::instance()->setResultInfo( curveText );
}
else
{
RiuMainWindow::instance()->selectAsCurrentItem( curveCollection );
}
return true;
}
}
return false;
}

View File

@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicPickEventHandler.h"
//==================================================================================================
///
//==================================================================================================
class Ric3dWellLogCurvePickEventHandler : public RicDefaultPickEventHandler
{
public:
static Ric3dWellLogCurvePickEventHandler* instance();
bool handle3dPickEvent( const Ric3dPickEvent& eventObject ) override;
};

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAdd3dWellLogCurveFeature.h"
#include "RiaApplication.h"
#include "RicWellLogTools.h"
#include "Rim3dWellLogExtractionCurve.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAdd3dWellLogCurveFeature, "RicAdd3dWellLogCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAdd3dWellLogCurveFeature::isCommandEnabled()
{
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
if ( cases.empty() ) return false;
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogCurveFeature::onActionTriggered( bool isChecked )
{
RimWellPath* selectedWellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( !selectedWellPath ) return;
Rim3dWellLogExtractionCurve* rim3dWellLogExtractionCurve = new Rim3dWellLogExtractionCurve();
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
if ( view )
{
rim3dWellLogExtractionCurve->setPropertiesFromView( view );
}
selectedWellPath->add3dWellLogCurve( rim3dWellLogExtractionCurve );
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogExtractionCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );
selectedWellPath->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
actionToSetup->setText( "Create 3D Well Log Curve" );
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicAdd3dWellLogCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAdd3dWellLogFileCurveFeature.h"
#include "RicWellLogTools.h"
#include "Rim3dWellLogFileCurve.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAdd3dWellLogFileCurveFeature, "RicAdd3dWellLogFileCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAdd3dWellLogFileCurveFeature::isCommandEnabled()
{
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
if ( cases.empty() ) return false;
return ( RicWellLogTools::findWellPathWithLogFileFromSelection() != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogFileCurveFeature::onActionTriggered( bool isChecked )
{
RimWellPath* selectedWellPath = RicWellLogTools::findWellPathWithLogFileFromSelection();
if ( !selectedWellPath ) return;
Rim3dWellLogFileCurve* rim3dWellLogFileCurve = new Rim3dWellLogFileCurve();
selectedWellPath->add3dWellLogCurve( rim3dWellLogFileCurve );
rim3dWellLogFileCurve->setDefaultFileCurveDataInfo();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogFileCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );
selectedWellPath->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogFileCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
actionToSetup->setText( "Create 3D Well Log LAS Curve" );
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicAdd3dWellLogFileCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAdd3dWellLogRftCurveFeature.h"
#include "RicWellLogTools.h"
#include "Rim3dWellLogRftCurve.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAdd3dWellLogRftCurveFeature, "RicAdd3dWellLogRftCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAdd3dWellLogRftCurveFeature::isCommandEnabled()
{
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
if ( cases.empty() ) return false;
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( wellPath )
{
return RicWellLogTools::wellHasRftData( wellPath->name() );
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogRftCurveFeature::onActionTriggered( bool isChecked )
{
RimWellPath* selectedWellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( !selectedWellPath ) return;
Rim3dWellLogRftCurve* rim3dWellLogRftCurve = new Rim3dWellLogRftCurve();
selectedWellPath->add3dWellLogCurve( rim3dWellLogRftCurve );
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogRftCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );
selectedWellPath->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAdd3dWellLogRftCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
actionToSetup->setText( "Create 3D Well Log RFT Curve" );
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicAdd3dWellLogRftCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAddWellLogToPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "RigWellLogFile.h"
#include "RiuQwtPlotWidget.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicAddWellLogToPlotFeature, "RicAddWellLogToPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAddWellLogToPlotFeature::isCommandEnabled()
{
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
return selection.size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellLogFileChannel*> selection = selectedWellLogs();
if ( selection.size() < 1 ) return;
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
plot->loadDataAndUpdate();
for ( size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++ )
{
RimWellLogFileChannel* wellLog = selection[wlIdx];
RimWellPath* wellPath = nullptr;
wellLog->firstAncestorOrThisOfType( wellPath );
RimWellLogFile* wellLogFile = nullptr;
wellLog->firstAncestorOrThisOfType( wellLogFile );
if ( wellLogFile )
{
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );
plotTrack->addCurve( curve );
RigWellLogFile* wellLogDataFile = wellLogFile->wellLogFileData();
CVF_ASSERT( wellLogDataFile );
if ( wlIdx == 0 )
{
// Initialize plot with depth unit from the first log file
plot->setDepthUnit( wellLogDataFile->depthUnit() );
}
curve->setWellPath( wellPath );
curve->setWellLogChannelName( wellLog->name() );
curve->setWellLogFile( wellLogFile );
curve->loadDataAndUpdate( true );
}
}
plot->updateLayout();
RimProject::current()->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
RiuPlotMainWindowTools::setExpanded( plotTrack );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAddWellLogToPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Add To New Plot" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFileChannel*> RicAddWellLogToPlotFeature::selectedWellLogs()
{
std::vector<RimWellLogFileChannel*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
return selection;
}

View File

@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
class RimMainPlotCollection;
class RimWellLogPlotCollection;
class RimWellLogPlot;
class RimWellLogFileChannel;
//==================================================================================================
///
//==================================================================================================
class RicAddWellLogToPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
std::vector<RimWellLogFileChannel*> selectedWellLogs();
};

View File

@@ -0,0 +1,152 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicAsciiExportWellLogPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimWellLogPlot.h"
#include "RiuFileDialogTools.h"
#include "RiuMainWindow.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cafUtils.h"
#include "cvfAssert.h"
#include <QAction>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicAsciiExportWellLogPlotFeature, "RicAsciiExportWellLogPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportWellLogPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportWellLogPlotFeature::onActionTriggered( bool isChecked )
{
this->disableModelChangeContribution();
std::vector<RimWellLogPlot*> selectedWellLogPlots;
caf::SelectionManager::instance()->objectsByType( &selectedWellLogPlots );
QString defaultDir =
RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "PLOT_ASCIIEXPORT_DIR" );
caf::ProgressInfo pi( selectedWellLogPlots.size(), QString( "Exporting plot data to ASCII" ) );
size_t progress = 0;
if ( selectedWellLogPlots.size() == 1 )
{
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at( 0 );
QString defaultFileName = defaultDir + "/" +
caf::Utils::makeValidFileBasename( ( wellLogPlot->description() ) ) + ".ascii";
QString fileName = RiuFileDialogTools::getSaveFileName( nullptr,
"Select File for Plot Data Export",
defaultFileName,
"Text File(*.ascii);;All files(*.*)" );
if ( fileName.isEmpty() ) return;
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( fileName, wellLogPlot );
progress++;
pi.setProgress( progress );
}
else if ( selectedWellLogPlots.size() > 1 )
{
std::vector<QString> fileNames;
for ( RimWellLogPlot* wellLogPlot : selectedWellLogPlots )
{
QString fileName = caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
fileNames.push_back( fileName );
}
QString saveDir;
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles( defaultDir, fileNames, &saveDir );
if ( !writeFiles ) return;
RiaLogging::info( QString( "Writing to directory %!" ).arg( saveDir ) );
for ( RimWellLogPlot* wellLogPlot : selectedWellLogPlots )
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( fileName, wellLogPlot );
progress++;
pi.setProgress( progress );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Export Plot Data to Text File" );
actionToSetup->setIcon( QIcon( ":/Save.svg" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicAsciiExportWellLogPlotFeature::makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
const QString& folder,
const QString& prefix,
bool capitalizeFileName )
{
QString fileName = folder + "/" + prefix + caf::Utils::makeValidFileBasename( wellLogPlot->description() ) + ".ascii";
if ( capitalizeFileName ) fileName = fileName.toUpper();
QDir dir( folder );
return dir.absoluteFilePath( fileName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot )
{
QFile file( fileName );
if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
return false;
}
RiaLogging::info( QString( "Writing values for plot(s) to file: %1" ).arg( fileName ) );
QTextStream out( &file );
out << wellLogPlot->description();
out << "\n";
out << wellLogPlot->asciiDataForPlotExport();
out << "\n\n";
RiaLogging::info( QString( "Competed writing values for plot(s) to file %1" ).arg( fileName ) );
return true;
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <QString>
class RimWellLogPlot;
//==================================================================================================
///
//==================================================================================================
class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static QString makeValidExportFileName( const RimWellLogPlot* wellLogPlot,
const QString& folder,
const QString& prefix,
bool capitalizeFileName );
static bool exportAsciiForWellLogPlot( const QString& fileName, const RimWellLogPlot* wellLogPlot );
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicChangeDataSourceFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RimCase.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <set>
CAF_CMD_SOURCE_INIT( RicChangeDataSourceFeature, "RicChangeDataSourceFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicChangeDataSourceFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
std::vector<RimWellLogCurve*> curves;
std::vector<RimWellLogTrack*> tracks;
return selectedTracksAndCurves( &curves, &tracks );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicChangeDataSourceFeature::onActionTriggered( bool isChecked )
{
std::vector<caf::PdmObject*> selectedObjects;
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
std::vector<RimWellLogCurve*> curves;
std::vector<RimWellLogTrack*> tracks;
if ( selectedTracksAndCurves( &curves, &tracks ) )
{
RimWellLogCurveCommonDataSource featureUi;
featureUi.updateDefaultOptions( curves, tracks );
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &featureUi, "Change Data Source for Multiple Curves", "" );
propertyDialog.resize( QSize( 500, 200 ) );
if ( propertyDialog.exec() == QDialog::Accepted )
{
featureUi.updateCurvesAndTracks( curves, tracks );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicChangeDataSourceFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Change Data Source" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicChangeDataSourceFeature::selectedTracksAndCurves( std::vector<RimWellLogCurve*>* curves,
std::vector<RimWellLogTrack*>* tracks )
{
CVF_ASSERT( curves && tracks );
std::vector<caf::PdmObject*> selectedObjects;
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
if ( selectedObjects.empty() ) return false;
for ( caf::PdmObject* selectedObject : selectedObjects )
{
RimWellLogTrack* wellLogTrack = dynamic_cast<RimWellLogTrack*>( selectedObject );
RimWellLogExtractionCurve* wellLogExtractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( selectedObject );
RimWellLogFileCurve* wellLogFileCurve = dynamic_cast<RimWellLogFileCurve*>( selectedObject );
if ( wellLogTrack )
{
tracks->push_back( wellLogTrack );
}
else if ( wellLogExtractionCurve )
{
curves->push_back( wellLogExtractionCurve );
}
else if ( wellLogFileCurve )
{
curves->push_back( wellLogFileCurve );
}
}
return selectedObjects.size() == ( curves->size() + tracks->size() );
}

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
class RimWellLogCurve;
class RimWellLogTrack;
//==================================================================================================
///
//==================================================================================================
class RicChangeDataSourceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static bool selectedTracksAndCurves( std::vector<RimWellLogCurve*>* curves, std::vector<RimWellLogTrack*>* tracks );
};

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicDeletePltPlotFeature.h"
#include "RimPltPlotCollection.h"
#include "RimWellPltPlot.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeletePltPlotFeature, "RicDeletePltPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeletePltPlotFeature::isCommandEnabled()
{
std::vector<RimWellPltPlot*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePltPlotFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellPltPlot*> selectedPlots;
caf::SelectionManager::instance()->objectsByType( &selectedPlots );
if ( selectedPlots.size() == 0 ) return;
RimWellPltPlot* firstPlot = selectedPlots[0];
RimPltPlotCollection* pltPlotCollection = nullptr;
firstPlot->firstAncestorOrThisOfType( pltPlotCollection );
if ( !pltPlotCollection ) return;
for ( RimWellPltPlot* plot : selectedPlots )
{
pltPlotCollection->removePlot( plot );
delete plot;
}
pltPlotCollection->uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePltPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Delete PLT Plot" );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicDeletePltPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicDeleteRftPlotFeature.h"
#include "RimRftPlotCollection.h"
#include "RimWellRftPlot.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeleteRftPlotFeature, "RicDeleteRftPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteRftPlotFeature::isCommandEnabled()
{
std::vector<RimWellRftPlot*> objects;
caf::SelectionManager::instance()->objectsByType( &objects );
if ( objects.size() > 0 )
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteRftPlotFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellRftPlot*> selectedPlots;
caf::SelectionManager::instance()->objectsByType( &selectedPlots );
if ( selectedPlots.size() == 0 ) return;
RimWellRftPlot* firstPlot = selectedPlots[0];
RimRftPlotCollection* rftPlotCollection = nullptr;
firstPlot->firstAncestorOrThisOfType( rftPlotCollection );
if ( !rftPlotCollection ) return;
for ( RimWellRftPlot* plot : selectedPlots )
{
rftPlotCollection->removePlot( plot );
delete plot;
}
rftPlotCollection->uiCapability()->updateConnectedEditors();
// rftPlotCollection->scheduleRedrawAffectedViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteRftPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Delete RFT Plot" );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicDeleteRftPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicDeleteSubPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaGuiApplication.h"
#include "RiuMultiPlotPage.h"
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RimMultiPlot.h"
#include "RimPlotWindow.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeleteSubPlotFeature, "RicDeleteSubPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteSubPlotFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
std::vector<caf::PdmObject*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
if ( selection.size() > 0 )
{
size_t plotsSelected = 0;
for ( caf::PdmObject* object : selection )
{
RimMultiPlot* multiPlot = nullptr;
RimWellLogPlot* wellLogPlot = nullptr;
object->firstAncestorOrThisOfType( multiPlot );
object->firstAncestorOrThisOfType( wellLogPlot );
if ( dynamic_cast<RimPlotWindow*>( object ) && ( multiPlot || wellLogPlot ) )
{
plotsSelected++;
}
}
return plotsSelected == selection.size();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
std::vector<RimPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
std::set<RimPlotWindow*> alteredPlotWindows;
for ( RimPlot* plot : selection )
{
if ( !plot ) continue;
RimMultiPlot* multiPlot = nullptr;
RimWellLogPlot* wellLogPlot = nullptr;
plot->firstAncestorOrThisOfType( multiPlot );
plot->firstAncestorOrThisOfType( wellLogPlot );
if ( multiPlot )
{
alteredPlotWindows.insert( multiPlot );
multiPlot->removePlot( plot );
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
multiPlot->updateConnectedEditors();
delete plot;
}
else if ( wellLogPlot )
{
alteredPlotWindows.insert( wellLogPlot );
wellLogPlot->removePlot( plot );
caf::SelectionManager::instance()->removeObjectFromAllSelections( plot );
wellLogPlot->updateConnectedEditors();
delete plot;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteSubPlotFeature::setupActionLook( QAction* actionToSetup )
{
QString actionText;
std::vector<caf::PdmObject*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
size_t tracksSelected = 0u;
for ( caf::PdmObject* object : selection )
{
if ( dynamic_cast<RimWellLogTrack*>( object ) )
{
tracksSelected++;
}
}
if ( tracksSelected == selection.size() )
{
actionText = "Delete Track";
}
else
{
actionText = "Delete Plot";
}
if ( selection.size() > 1u )
{
actionText += "s";
}
actionToSetup->setText( actionText );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicDeleteSubPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMoveWellLogFilesFeature.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RiuMainWindow.h"
#include "cafPdmUiObjectEditorHandle.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicMoveWellLogFilesFeature, "RicMoveWellLogFilesFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicMoveWellLogFilesFeature::isCommandEnabled()
{
RimWellLogFile* selectedWellLogFile = caf::firstAncestorOfTypeFromSelectedObject<RimWellLogFile*>();
if ( !selectedWellLogFile ) return false;
// If only one well path exists, the move command is not applicable
RimProject* proj = RimProject::current();
return proj->allWellPaths().size() > 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMoveWellLogFilesFeature::onActionTriggered( bool isChecked )
{
const QVariant userData = this->userData();
if ( !userData.isNull() && userData.type() == QVariant::String )
{
RimProject* proj = RimProject::current();
RimWellPath* destWellPath = proj->wellPathByName( userData.toString() );
RimWellLogFile* wellLogFile = caf::firstAncestorOfTypeFromSelectedObject<RimWellLogFile*>();
RimWellPath* sourceWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if ( !destWellPath || !wellLogFile || !sourceWellPath ) return;
sourceWellPath->detachWellLogFile( wellLogFile );
destWellPath->addWellLogFile( wellLogFile );
sourceWellPath->updateConnectedEditors();
destWellPath->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMoveWellLogFilesFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Move Well Log File(s)" );
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicMoveWellLogFilesFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,177 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewPltPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RigWellLogCurveData.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPltPlot.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewPltPlotFeature, "RicNewPltPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
bool enable = true;
if ( selectedWellPath )
{
if ( !selectedWellPath->wellPathGeometry() || !RimWellPlotTools::hasFlowData( selectedWellPath ) )
{
return false;
}
}
if ( simWell != nullptr )
{
RimProject* proj = RimProject::current();
QString simWellName = simWell->name();
RimWellPath* wellPath = proj->wellPathFromSimWellName( simWellName );
enable = wellPath != nullptr;
}
return enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RimProject::current();
RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
if ( pltPlotColl )
{
QString wellPathName;
RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr;
if ( ( wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() ) != nullptr )
{
wellPathName = wellPath->name();
}
else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>() ) != nullptr )
{
wellPath = proj->wellPathFromSimWellName( eclipseWell->name() );
if ( !wellPath ) return;
wellPathName = wellPath->name();
}
QString plotName = QString( RimWellPltPlot::plotNameFormatString() ).arg( wellPathName );
RimWellPltPlot* pltPlot = new RimWellPltPlot();
pltPlot->setCurrentWellName( wellPathName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->plotCount() ) );
pltPlotColl->addPlot( pltPlot );
pltPlot->nameConfig()->setCustomName( plotName );
// pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( pltPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New PLT Plot" );
actionToSetup->setIcon( QIcon( ":/WellFlowPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{
auto selection = caf::selectedObjectsByType<RimWellPath*>();
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex ) const
{
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>( selItem );
if ( simWellSelItem )
{
( *branchIndex ) = static_cast<int>( simWellSelItem->m_branchIndex );
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
return cases.size() > 0;
}

View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimSimWellInView;
class Rim3dView;
class RimWellLogExtractionCurve;
class RimWellLogTrack;
class RimWellPath;
class RimPltPlotCollection;
class RimWellPltPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewPltPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
RimWellPath* selectedWellPath() const;
RimSimWellInView* selectedSimulationWell( int* branchIndex ) const;
bool caseAvailable() const;
};

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewRftPlotFeature.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
#include "RimSimWellInView.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellRftPlot.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftPlotFeature::isCommandEnabled()
{
RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
if ( simWell ) return true;
if ( selectedWellName().isEmpty() )
{
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RimProject::current();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if ( rftPlotColl )
{
QString wellName = selectedWellName();
RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->plotCount() ) );
rftPlotColl->addPlot( rftPlot );
rftPlot->applyInitialSelections();
wellName = rftPlot->simWellOrWellPathName(); // We may have been given a default well name
QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
rftPlot->nameConfig()->setCustomName( plotName );
rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem( rftPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New RFT Plot" );
actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicNewRftPlotFeature::selectedWellName()
{
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
if ( simWell ) return simWell->name();
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if ( rimWellPath ) return rimWellPath->name();
return QString();
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewRftPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static QString selectedWellName();
};

View File

@@ -0,0 +1,434 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellBoreStabilityPlotFeature.h"
#include "RiaColorTables.h"
#include "RiaLogging.h"
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
#include "RigGeoMechCaseData.h"
#include "RigWellPath.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimProject.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellLogWbsCurve.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellMeasurementCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RicWellLogTools.h"
#include "RiuPlotMainWindowTools.h"
#include "RiaApplication.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include "cvfMath.h"
#include <QAction>
#include <QDateTime>
#include <QString>
#include <algorithm>
CAF_CMD_SOURCE_INIT( RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilityPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot*
RicNewWellBoreStabilityPlotFeature::createPlot( RimGeoMechCase* geoMechCase,
RimWellPath* wellPath,
int timeStep,
const RimWbsParameters* parameters /* = nullptr*/ )
{
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
RimWellBoreStabilityPlot* plot =
RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false, "Well Bore Stability", parameters );
plot->setCaseWellPathAndTimeStep( geoMechCase, wellPath, timeStep );
{
auto task = progInfo.task( "Creating formation track", 2 );
createFormationTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task( "Creating well design track", 3 );
createCasingShoeTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task( "Creating parameters track", 15 );
createParametersTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Creating stability curves track", 60 );
createStabilityCurvesTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Creating angles track", 15 );
createAnglesTrack( plot, wellPath, geoMechCase, timeStep );
}
{
auto task = progInfo.task( "Updating all tracks", 5 );
plot->nameConfig()->setAutoNameTags( true, true, true, true, true );
plot->setPlotTitleVisible( true );
plot->setLegendsVisible( true );
plot->setLegendsHorizontal( true );
plot->setDepthType( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB );
plot->setAutoScaleDepthEnabled( true );
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
}
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellBoreStabilityPlotFeature::isCommandEnabled()
{
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if ( !view ) return false;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
return geoMechView != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::onActionTriggered( bool isChecked )
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
RimWellLogPlotCollection* plotCollection =
caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlotCollection>();
if ( !wellPath )
{
if ( plotCollection )
{
RimProject* project = nullptr;
plotCollection->firstAncestorOrThisOfTypeAsserted( project );
std::vector<RimWellPath*> allWellPaths;
project->descendantsIncludingThisOfType( allWellPaths );
if ( !allWellPaths.empty() )
{
wellPath = allWellPaths.front();
}
}
}
if ( !wellPath )
{
return;
}
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if ( !view ) return;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( !geoMechView ) return;
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
if ( !geoMechCase )
{
return;
}
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry )
{
RiaLogging::error(
QString( "The well path %1 has no geometry. Cannot create a Well Bore Stability Plot" ).arg( wellPath->name() ) );
return;
}
if ( wellPathGeometry->rkbDiff() == HUGE_VAL )
{
RiaLogging::error( QString( "The well path %1 has no datum elevation and we cannot estimate TVDRKB. Cannot "
"create a Well Bore Stability Plot" )
.arg( wellPath->name() ) );
return;
}
createPlot( geoMechCase, wellPath, view->currentTimeStep() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Well Bore Stability Plot" );
actionToSetup->setIcon( QIcon( ":/WellBoreStability16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
formationTrack->setFormationWellPath( wellPath );
formationTrack->setFormationCase( geoMechCase );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setColSpan( RimPlot::ONE );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
casingShoeTrack->setColSpan( RimPlot::ONE );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
casingShoeTrack->setShowRegionLabels( false );
casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setShowBothSidesOfWell( false );
casingShoeTrack->setAnnotationTransparency( 90 );
casingShoeTrack->setWellPathAttributesSource( wellPath );
casingShoeTrack->setVisibleXRange( 0.0, 0.0 );
casingShoeTrack->setAutoScaleXEnabled( true );
casingShoeTrack->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* paramCurvesTrack =
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "WBS Parameters", plot );
paramCurvesTrack->setColSpan( RimPlot::TWO );
paramCurvesTrack->setVisibleXRange( 0.0, 2.0 );
paramCurvesTrack->setAutoScaleXEnabled( true );
paramCurvesTrack->setTickIntervals( 1.0, 0.2 );
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
paramCurvesTrack->setFormationWellPath( wellPath );
paramCurvesTrack->setFormationCase( geoMechCase );
paramCurvesTrack->setShowRegionLabels( true );
paramCurvesTrack->setShowWindow( false );
std::set<RigWbsParameter> parameters = RigWbsParameter::allParameters();
caf::ColorTable colors = RiaColorTables::contrastCategoryPaletteColors();
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles = { RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT };
size_t i = 0;
for ( const RigWbsParameter& param : parameters )
{
if ( !param.hasExternalSource() || param == RigWbsParameter::waterDensity() ) continue;
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, param.name().toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addWellLogExtractionCurve( paramCurvesTrack, geoMechCase, nullptr, wellPath, nullptr, -1, false, false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( timeStep );
curve->setColor( colors.cycledColor3f( i ) );
curve->setLineStyle( lineStyles[i % lineStyles.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
curve->setCustomName( param.name() );
i++;
}
paramCurvesTrack->setAutoScaleXEnabled( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves",
plot );
stabilityCurvesTrack->setVisibleXRange( 0.0, 2.5 );
stabilityCurvesTrack->setColSpan( RimPlot::THREE );
stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 1.0, 0.2 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechCase );
stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
stabilityCurvesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::LIGHT_LINES );
stabilityCurvesTrack->setShowRegionLabels( false );
std::vector<QString> resultNames = RiaDefines::wbsDerivedResultNames();
std::vector<cvf::Color3f> colors = { cvf::Color3f::BLUE,
cvf::Color3f::BROWN,
cvf::Color3f::RED,
cvf::Color3f::PURPLE,
cvf::Color3f::DARK_GREEN,
cvf::Color3f::OLIVE };
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles( resultNames.size(),
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
lineStyles.back() = RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH;
for ( size_t i = 0; i < resultNames.size(); ++i )
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogWbsCurve* curve =
RicWellLogTools::addWellLogWbsCurve( stabilityCurvesTrack, geoMechCase, nullptr, wellPath, -1, false, false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( timeStep );
curve->setAutoNameComponents( false, true, false, false, false );
curve->setColor( colors[i % colors.size()] );
curve->setLineStyle( lineStyles[i] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
curve->setSmoothCurve( true );
curve->setSmoothingThreshold( 0.002 );
if ( resultNames[i] == RiaDefines::wbsSHMkResult() )
{
curve->setCurveVisibility( false );
}
}
RimWellPathCollection* wellPathCollection = nullptr;
wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
for ( QString wbsMeasurementKind : RimWellMeasurement::measurementKindsForWellBoreStability() )
{
for ( RimWellMeasurement* measurement : measurementCollection->measurements() )
{
if ( measurement->wellName() == wellPath->name() && measurement->kind() == wbsMeasurementKind )
{
RimWellMeasurementCurve* curve =
RicWellLogTools::addWellMeasurementCurve( stabilityCurvesTrack, wellPath, wbsMeasurementKind );
curve->loadDataAndUpdate( false );
break; // Only one per measurement kind
}
}
}
stabilityCurvesTrack->setAutoScaleXEnabled( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep )
{
RimWellLogTrack* wellPathAnglesTrack =
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Path Angles", plot );
double minValue = 360.0, maxValue = 0.0;
const double angleIncrement = 90.0;
std::vector<QString> resultNames = RiaDefines::wbsAngleResultNames();
std::vector<cvf::Color3f> colors = { cvf::Color3f::GREEN, cvf::Color3f::DARK_ORANGE };
std::vector<RiuQwtPlotCurveDefines::LineStyleEnum> lineStyles = { RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH,
RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID };
for ( size_t i = 0; i < resultNames.size(); ++i )
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve = RicWellLogTools::addWellLogExtractionCurve( wellPathAnglesTrack,
geoMechCase,
nullptr,
wellPath,
nullptr,
-1,
false,
false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( timeStep );
curve->setCustomName( resultName );
curve->setColor( colors[i % colors.size()] );
curve->setLineStyle( lineStyles[i % lineStyles.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
double actualMinValue = minValue, actualMaxValue = maxValue;
curve->xValueRangeInQwt( &actualMinValue, &actualMaxValue );
while ( maxValue < actualMaxValue )
{
maxValue += angleIncrement;
}
while ( minValue > actualMinValue )
{
minValue -= angleIncrement;
}
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 720.0 );
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
}
wellPathAnglesTrack->setColSpan( RimPlot::TWO );
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
wellPathAnglesTrack->setTickIntervals( 180.0, 45.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechCase );
wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS );
wellPathAnglesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::LIGHT_LINES );
wellPathAnglesTrack->setShowRegionLabels( false );
}

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimGeoMechCase;
class RimGeoMechView;
class RimWbsParameters;
class RimWellBoreStabilityPlot;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static RimWellBoreStabilityPlot* createPlot( RimGeoMechCase* geoMechCase,
RimWellPath* wellPath,
int timeStep,
const RimWbsParameters* parameters = nullptr );
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
static void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
static void createParametersTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep );
static void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase,
int timeStep );
static void
createAnglesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase, int timeStep );
};

View File

@@ -0,0 +1,148 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RigWellLogCurveData.h"
#include "Rim3dView.h"
#include "RimGridView.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
int branchIndex;
return ( caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>() != nullptr ||
caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>() != nullptr ||
RicWellLogTools::selectedSimulationWell( &branchIndex ) != nullptr ) &&
caseAvailable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogCurveExtractionFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlot>();
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
RicWellLogTools::addWellLogExtractionCurve( wellLogPlotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
}
else
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
int branchIndex = -1;
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
bool useBranchDetection = true;
RimSimWellInViewCollection* simWellColl = nullptr;
if ( simWell )
{
simWell->firstAncestorOrThisOfTypeAsserted( simWellColl );
useBranchDetection = simWellColl->isAutoDetectingBranches;
}
if ( wellPath || simWell )
{
RimWellLogTrack* newWellLogPlotTrack =
RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( true, "", wellLogPlot );
if ( wellPath )
{
newWellLogPlotTrack->setFormationWellPath( wellPath );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else
{
newWellLogPlotTrack->setFormationSimWellName( simWell->name() );
newWellLogPlotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
newWellLogPlotTrack->setFormationBranchIndex( branchIndex );
newWellLogPlotTrack->setFormationBranchDetection( useBranchDetection );
}
RimCase* ownerCase = nullptr;
if ( view )
{
ownerCase = view->ownerCase();
newWellLogPlotTrack->setFormationCase( view->ownerCase() );
}
RicWellLogTools::addWellLogExtractionCurve( newWellLogPlotTrack,
ownerCase,
view,
wellPath,
simWell,
branchIndex,
useBranchDetection );
}
}
RiuPlotMainWindowTools::refreshToolbars();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogCurveExtractionFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Well Log Extraction Curve" );
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogCurveExtractionFeature::caseAvailable()
{
std::vector<RimCase*> cases;
RimProject::current()->allCases( cases );
return !cases.empty();
}

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static bool caseAvailable();
};

View File

@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuPlotMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewWellLogFileCurveFeature, "RicNewWellLogFileCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogFileCurveFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
return ( caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>() != nullptr &&
wellLogFilesAvailable() ) ||
RicWellLogTools::selectedWellPathWithLogFile() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
RicWellLogTools::addFileCurve( wellLogPlotTrack );
}
else
{
RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
if ( wellPath )
{
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve( newWellLogPlotTrack );
plotCurve->setWellPath( wellPath );
if ( wellPath->wellLogFiles().size() == 1 )
{
plotCurve->setWellLogFile( wellPath->wellLogFiles().front() );
}
plotCurve->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
actionToSetup->setText( "New Well Log LAS Curve" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable()
{
auto wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
for ( auto wellPath : wellPathCollection->allWellPaths() )
{
if ( !wellPath->wellLogFiles().empty() )
{
return true;
}
}
}
return false;
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogFileCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static bool wellLogFilesAvailable();
};

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogPlotFeature.h"
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimProject.h"
#include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RicWellLogTools.h"
#include <QAction>
#include "cvfAssert.h"
CAF_CMD_SOURCE_INIT( RicNewWellLogPlotFeature, "RicNewWellLogPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* curve =
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
curve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
plotTrack->firstAncestorOrThisOfTypeAsserted( plot );
plot->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Well Log Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,249 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimStimPlanModelPlot.h"
#include "RimStimPlanModelPlotCollection.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RiaGuiApplication.h"
#include "cvfAssert.h"
#include <QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot*
RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( bool showAfterCreation /*= true*/,
const QString& plotDescription /*= QString("")*/,
const RimWbsParameters* params /*= nullptr*/ )
{
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT( wellLogPlotColl );
// Make sure the summary plot window is created
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot();
if ( params )
{
plot->copyWbsParameters( params );
}
plot->setAsPlotMdiWindow();
wellLogPlotColl->addWellLogPlot( plot );
if ( !plotDescription.isEmpty() )
{
plot->nameConfig()->setCustomName( plotDescription );
}
else
{
plot->nameConfig()->setCustomName(
QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) );
}
if ( showAfterCreation )
{
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterCreation, const QString& plotDescription )
{
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT( wellLogPlotColl );
// Make sure the summary plot window is created
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow();
wellLogPlotColl->addWellLogPlot( plot );
if ( !plotDescription.isEmpty() )
{
plot->nameConfig()->setCustomName( plotDescription );
}
else
{
plot->nameConfig()->setCustomName(
QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) );
}
if ( showAfterCreation )
{
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool updateAfter,
const QString& trackDescription,
RimDepthTrackPlot* existingPlot )
{
RimDepthTrackPlot* plot = existingPlot;
if ( plot == nullptr )
{
plot = createWellLogPlot();
}
RimCase* caseToApply = nullptr;
RimWellPath* wellPathToApply = nullptr;
QString simWellToApply;
RimWellLogCurveCommonDataSource* commonDataSource = plot->commonDataSource();
caseToApply = commonDataSource->caseToApply();
wellPathToApply = commonDataSource->wellPathToApply();
simWellToApply = commonDataSource->simWellNameToApply();
caf::Tristate branchDetectionToApply = commonDataSource->branchDetectionToApply();
int branchIndexToApply = commonDataSource->branchIndexToApply();
if ( !caseToApply )
{
std::vector<RimCase*> allCases;
RimProject::current()->allCases( allCases );
if ( !allCases.empty() )
{
caseToApply = allCases.front();
}
}
if ( !wellPathToApply && caseToApply )
{
auto allWellPaths = RimProject::current()->allWellPaths();
if ( !allWellPaths.empty() )
{
wellPathToApply = allWellPaths.front();
}
}
if ( simWellToApply.isEmpty() && caseToApply )
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply );
if ( eclipseCase )
{
auto allSimWells = eclipseCase->sortedSimWellNames();
if ( !allSimWells.empty() )
{
simWellToApply = *allSimWells.begin();
}
}
}
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
if ( !trackDescription.isEmpty() )
{
plotTrack->setDescription( trackDescription );
}
else
{
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
}
if ( caseToApply )
{
plotTrack->setFormationCase( caseToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationWellPath( wellPathToApply );
}
if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationSimWellName( simWellToApply );
}
if ( wellPathToApply )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::WELL_PATH );
}
else if ( !simWellToApply.isEmpty() )
{
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
}
if ( !branchDetectionToApply.isPartiallyTrue() )
{
plotTrack->setFormationBranchDetection( branchDetectionToApply.isTrue() );
}
if ( branchIndexToApply >= 0 )
{
plotTrack->setFormationBranchIndex( branchIndexToApply );
}
if ( updateAfter )
{
updateAfterCreation( plot );
}
return plotTrack;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeatureImpl::updateAfterCreation( RimDepthTrackPlot* plot )
{
CVF_ASSERT( plot );
plot->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection* RicNewWellLogPlotFeatureImpl::wellLogPlotCollection()
{
RimProject* project = RimProject::current();
CVF_ASSERT( project );
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
CVF_ASSERT( mainPlotColl );
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
CVF_ASSERT( wellLogPlotColl );
return mainPlotColl->wellLogPlotCollection();
}

View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
class RimWbsParameters;
class RimWellBoreStabilityPlot;
class RimWellLogPlotCollection;
class RimWellLogPlot;
class RimWellLogTrack;
class RimDepthTrackPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogPlotFeatureImpl
{
public:
static RimWellBoreStabilityPlot* createWellBoreStabilityPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ),
const RimWbsParameters* params = nullptr );
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) );
static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true,
const QString& trackDescription = QString( "" ),
RimDepthTrackPlot* existingPlot = nullptr );
static void updateAfterCreation( RimDepthTrackPlot* plot );
private:
static RimWellLogPlotCollection* wellLogPlotCollection();
};

View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogPlotTrackFeature.h"
#include "RiaGuiApplication.h"
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellLogPlot.h"
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewWellLogPlotTrackFeature, "RicNewWellLogPlotTrackFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotTrackFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() || RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() )
{
return false;
}
return selectedWellLogPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
if ( wellLogPlot )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack;
wellLogPlot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->plotCount() ) );
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
wellLogPlot->updateConnectedEditors();
wellLogPlot->loadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotTrackFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Track" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotTrackFeature::selectedWellLogPlot()
{
std::vector<RimWellLogPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection );
return selection.size() > 0 ? selection[0] : nullptr;
}

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimWellLogPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogPlotTrackFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
RimWellLogPlot* selectedWellLogPlot();
};

View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellLogRftCurveFeature.h"
#include "RimEclipseResultCase.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RigWellLogCurveData.h"
#include "RiuPlotMainWindow.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include <QAction>
#include <QString>
#include "cafSelectionManager.h"
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewWellLogRftCurveFeature, "RicNewWellLogRftCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogRftCurveFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
if ( caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>() != nullptr )
{
return true;
}
int branchIdx;
RimSimWellInView* simulationWell = RicWellLogTools::selectedSimulationWell( &branchIdx );
if ( simulationWell != nullptr )
{
return RicWellLogTools::wellHasRftData( simulationWell->name() );
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogRftCurveFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
int branchIdx;
RicWellLogTools::addRftCurve( wellLogPlotTrack, RicWellLogTools::selectedSimulationWell( &branchIdx ) );
}
else
{
int branchIndex = -1;
RimSimWellInView* simWell = RicWellLogTools::selectedSimulationWell( &branchIndex );
if ( simWell )
{
RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogRftCurve* plotCurve = RicWellLogTools::addRftCurve( newWellLogPlotTrack, simWell );
plotCurve->loadDataAndUpdate( true );
RimWellLogPlot* plot = nullptr;
newWellLogPlotTrack->firstAncestorOrThisOfType( plot );
if ( plot && plotCurve->curveData() )
{
plot->setDepthUnit( plotCurve->curveData()->depthUnit() );
}
plotCurve->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogRftCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Well Log RFT Curve" );
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogRftCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellMeasurementCurveFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RimTools.h"
#include "RimWellLogTrack.h"
#include "RimWellMeasurement.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewWellMeasurementCurveFeature, "RicNewWellMeasurementCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellMeasurementCurveFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
return ( caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>() != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellMeasurementCurveFeature::onActionTriggered( bool isChecked )
{
RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>();
if ( wellLogPlotTrack )
{
RimWellPath* wellPath = nullptr;
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection();
QString measurementKind = "Unknown";
if ( measurementCollection && !measurementCollection->measurements().empty() )
{
RimWellMeasurement* firstMeasurement = measurementCollection->measurements().front();
wellPath = wellPathCollection->tryFindMatchingWellPath( firstMeasurement->wellName() );
measurementKind = firstMeasurement->kind();
}
RicWellLogTools::addWellMeasurementCurve( wellLogPlotTrack, wellPath, measurementKind );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellMeasurementCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
actionToSetup->setText( "New Well Measurement Curve" );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 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
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicNewWellMeasurementCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -0,0 +1,170 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicPasteWellLogCurveFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellMeasurementCurve.h"
#include "cafPdmObjectGroup.h"
#include "cafPdmObjectHandle.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicPasteWellLogCurveFeature, "RicPasteWellLogCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteWellLogCurveFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false;
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogTrack* wellLogTrack = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogTrack );
if ( !wellLogTrack )
{
return false;
}
RimWellBoreStabilityPlot* wbsPlotToPasteInto = nullptr;
wellLogTrack->firstAncestorOrThisOfType( wbsPlotToPasteInto );
std::vector<caf::PdmPointer<RimWellLogCurve>> sourceObjects = RicPasteWellLogCurveFeature::curves();
for ( size_t i = 0; i < sourceObjects.size(); i++ )
{
RimWellBoreStabilityPlot* originalWbsPlot = nullptr;
sourceObjects[i]->firstAncestorOrThisOfType( originalWbsPlot );
if ( originalWbsPlot && originalWbsPlot != wbsPlotToPasteInto )
{
return false;
}
}
return RicPasteWellLogCurveFeature::curves().size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogCurveFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return;
RimWellLogTrack* wellLogTrack = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogTrack );
if ( !wellLogTrack )
{
return;
}
RimWellBoreStabilityPlot* wbsPlotToPasteInto = nullptr;
wellLogTrack->firstAncestorOrThisOfType( wbsPlotToPasteInto );
std::vector<caf::PdmPointer<RimWellLogCurve>> sourceObjects = RicPasteWellLogCurveFeature::curves();
for ( size_t i = 0; i < sourceObjects.size(); i++ )
{
RimWellBoreStabilityPlot* originalWbsPlot = nullptr;
sourceObjects[i]->firstAncestorOrThisOfType( originalWbsPlot );
if ( originalWbsPlot && originalWbsPlot != wbsPlotToPasteInto )
{
continue;
}
RimWellLogFileCurve* fileCurve = dynamic_cast<RimWellLogFileCurve*>( sourceObjects[i].p() );
RimWellMeasurementCurve* measurementCurve = dynamic_cast<RimWellMeasurementCurve*>( sourceObjects[i].p() );
if ( fileCurve || measurementCurve )
{
RimWellLogFileCurve* newObject = dynamic_cast<RimWellLogFileCurve*>(
sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( newObject );
wellLogTrack->addCurve( newObject );
// Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively();
newObject->initAfterReadRecursively();
newObject->loadDataAndUpdate( true );
wellLogTrack->updateConnectedEditors();
}
RimWellLogExtractionCurve* extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( sourceObjects[i].p() );
if ( extractionCurve )
{
RimWellLogExtractionCurve* newObject = dynamic_cast<RimWellLogExtractionCurve*>(
sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( newObject );
wellLogTrack->addCurve( newObject );
// Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively();
newObject->initAfterReadRecursively();
newObject->loadDataAndUpdate( true );
wellLogTrack->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Paste Well Log Curve" );
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmPointer<RimWellLogCurve>> RicPasteWellLogCurveFeature::curves()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
std::vector<caf::PdmPointer<RimWellLogCurve>> typedObjects;
objectGroup.objectsByType( &typedObjects );
return typedObjects;
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
#include <vector>
class RimWellLogCurve;
//==================================================================================================
///
//==================================================================================================
class RicPasteWellLogCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static std::vector<caf::PdmPointer<RimWellLogCurve>> curves();
};

View File

@@ -0,0 +1,120 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicPasteWellLogPlotFeature.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "cafPdmObjectGroup.h"
#include "cafPdmObjectHandle.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicPasteWellLogPlotFeature, "RicPasteWellLogPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteWellLogPlotFeature::isCommandEnabled()
{
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogPlotCollection* wellLogPlotCollection = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogPlotCollection );
if ( !wellLogPlotCollection )
{
return false;
}
return RicPasteWellLogPlotFeature::plots().size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
{
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return;
RimWellLogPlotCollection* wellLogPlotCollection = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogPlotCollection );
if ( !wellLogPlotCollection )
{
return;
}
std::vector<caf::PdmPointer<RimWellLogPlot>> sourceObjects = RicPasteWellLogPlotFeature::plots();
for ( size_t i = 0; i < sourceObjects.size(); i++ )
{
RimWellLogPlot* fileCurve = sourceObjects[i];
if ( fileCurve )
{
RimWellLogPlot* newObject = dynamic_cast<RimWellLogPlot*>(
fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( newObject );
wellLogPlotCollection->addWellLogPlot( newObject );
// Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively();
newObject->initAfterReadRecursively();
QString customName = "Copy of " + newObject->nameConfig()->customName();
newObject->nameConfig()->setCustomName( customName );
newObject->loadDataAndUpdate();
wellLogPlotCollection->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Paste Well Log Plot" );
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmPointer<RimWellLogPlot>> RicPasteWellLogPlotFeature::plots()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
std::vector<caf::PdmPointer<RimWellLogPlot>> typedObjects;
objectGroup.objectsByType( &typedObjects );
return typedObjects;
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
#include <vector>
class RimWellLogPlot;
//==================================================================================================
///
//==================================================================================================
class RicPasteWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static std::vector<caf::PdmPointer<RimWellLogPlot>> plots();
};

View File

@@ -0,0 +1,122 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicPasteWellLogTrackFeature.h"
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellRftPlot.h"
#include "cafPdmObjectGroup.h"
#include "cafPdmObjectHandle.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicPasteWellLogTrackFeature, "RicPasteWellLogTrackFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPasteWellLogTrackFeature::isCommandEnabled()
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return false;
RimWellLogPlot* wellLogPlot = nullptr;
RimWellRftPlot* rftPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( wellLogPlot );
destinationObject->firstAncestorOrThisOfType( rftPlot );
if ( !wellLogPlot || rftPlot )
{
return false;
}
return RicPasteWellLogTrackFeature::tracks().size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogTrackFeature::onActionTriggered( bool isChecked )
{
if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return;
RimWellLogPlot* wellLogPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogPlot>();
if ( !wellLogPlot )
{
return;
}
std::vector<caf::PdmPointer<RimWellLogTrack>> sourceObjects = RicPasteWellLogTrackFeature::tracks();
for ( size_t i = 0; i < sourceObjects.size(); i++ )
{
RimWellLogTrack* fileCurve = sourceObjects[i];
if ( fileCurve )
{
RimWellLogTrack* newObject = dynamic_cast<RimWellLogTrack*>(
fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( newObject );
wellLogPlot->addPlot( newObject );
newObject->setDescription( QString( "Track %1" ).arg( wellLogPlot->plotCount() ) );
// Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively();
newObject->initAfterReadRecursively();
newObject->loadDataAndUpdate();
wellLogPlot->updateConnectedEditors();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPasteWellLogTrackFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Paste Well Log Track" );
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmPointer<RimWellLogTrack>> RicPasteWellLogTrackFeature::tracks()
{
caf::PdmObjectGroup objectGroup;
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
std::vector<caf::PdmPointer<RimWellLogTrack>> typedObjects;
objectGroup.objectsByType( &typedObjects );
return typedObjects;
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include "cafPdmPointer.h"
#include <vector>
class RimWellLogTrack;
//==================================================================================================
///
//==================================================================================================
class RicPasteWellLogTrackFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
static std::vector<caf::PdmPointer<RimWellLogTrack>> tracks();
};

View File

@@ -0,0 +1,122 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellLogFileCloseFeature.h"
#include "RimViewWindow.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RimWellPath.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiObjectEditorHandle.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicWellLogFileCloseFeature, "RicWellLogFileCloseFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellLogFileCloseFeature::isCommandEnabled()
{
std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>();
return objects.size() > 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogFileCloseFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellLogFile*> objects = caf::selectedObjectsByType<RimWellLogFile*>();
if ( objects.size() == 0 ) return;
for ( const auto& wellLogFile : objects )
{
RimWellPath* parentWellPath;
wellLogFile->firstAncestorOrThisOfType( parentWellPath );
if ( parentWellPath )
{
std::set<RimViewWindow*> referringPlots = referringWellLogPlots( wellLogFile );
parentWellPath->deleteWellLogFile( wellLogFile );
for ( RimViewWindow* plot : referringPlots )
{
plot->loadDataAndUpdate();
}
parentWellPath->updateConnectedEditors();
}
}
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogFileCloseFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Close Well Log File(s)" );
actionToSetup->setIcon( QIcon( ":/Close.svg" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<RimViewWindow*> RicWellLogFileCloseFeature::referringWellLogPlots( const RimWellLogFile* wellLogFile )
{
// Remove all curves displaying data from the specified wellLogFile
std::vector<caf::PdmObjectHandle*> referringObjects;
wellLogFile->objectsWithReferringPtrFields( referringObjects );
std::set<RimViewWindow*> plots;
for ( const auto& obj : referringObjects )
{
RimWellAllocationPlot* allocationPlot;
RimWellPltPlot* pltPlot;
RimWellRftPlot* rftPlot;
RimWellLogPlot* wellLogPlot;
obj->firstAncestorOrThisOfType( allocationPlot );
obj->firstAncestorOrThisOfType( pltPlot );
obj->firstAncestorOrThisOfType( rftPlot );
obj->firstAncestorOrThisOfType( wellLogPlot );
RimViewWindow* plot = allocationPlot
? dynamic_cast<RimViewWindow*>( allocationPlot )
: pltPlot
? dynamic_cast<RimViewWindow*>( pltPlot )
: rftPlot ? dynamic_cast<RimViewWindow*>( rftPlot )
: wellLogPlot ? dynamic_cast<RimViewWindow*>( wellLogPlot ) : nullptr;
if ( plot != nullptr )
{
plots.insert( plot );
}
}
return plots;
}

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <set>
class RimWellLogFile;
class RimViewWindow;
//==================================================================================================
///
//==================================================================================================
class RicWellLogFileCloseFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
std::set<RimViewWindow*> referringWellLogPlots( const RimWellLogFile* wellLogFile );
};

View File

@@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaColorTables.h"
#include "RimWellAllocationPlot.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellRftPlot.h"
#include "cafSelectionManager.h"
#include <QColor>
//--------------------------------------------------------------------------------------------------
/// Pick default curve color from an index based palette
//--------------------------------------------------------------------------------------------------
cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable( size_t index )
{
return RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( index );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves()
{
// Use std::set to determine uniqueness but a vector for inserting curves.
// This is to retain deterministic order.
std::vector<RimWellLogCurve*> allCurves;
std::set<RimWellLogCurve*> uniqueCurves;
{
std::vector<caf::PdmUiItem*> selectedItems;
caf::SelectionManager::instance()->selectedItems( selectedItems );
for ( caf::PdmUiItem* selectedItem : selectedItems )
{
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( selectedItem );
if ( objHandle )
{
std::vector<RimWellLogTrack*> childTracks;
objHandle->descendantsIncludingThisOfType( childTracks );
for ( auto track : childTracks )
{
if ( track->showWindow() )
{
for ( RimWellLogCurve* curve : track->visibleCurves() )
{
if ( !uniqueCurves.count( curve ) )
{
uniqueCurves.insert( curve );
allCurves.push_back( curve );
}
}
}
}
}
}
}
return allCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()
{
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return nullptr;
RimWellAllocationPlot* wellAllocationPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( wellAllocationPlot );
return wellAllocationPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()
{
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return nullptr;
RimWellRftPlot* wellRftPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( wellRftPlot );
return wellRftPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot* RicWellLogPlotCurveFeatureImpl::parentWellBoreStabilityPlot()
{
caf::PdmObjectHandle* destinationObject =
dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
if ( !destinationObject ) return nullptr;
RimWellBoreStabilityPlot* wbsPlot = nullptr;
destinationObject->firstAncestorOrThisOfType( wbsPlot );
return wbsPlot;
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmFieldCvfColor.h"
class RimWellBoreStabilityPlot;
class RimWellLogCurve;
class RimWellAllocationPlot;
class RimWellRftPlot;
//==================================================================================================
///
//==================================================================================================
class RicWellLogPlotCurveFeatureImpl
{
public:
static cvf::Color3f curveColorFromTable( size_t index );
static std::vector<RimWellLogCurve*> selectedWellLogCurves();
static RimWellAllocationPlot* parentWellAllocationPlot();
static RimWellRftPlot* parentWellRftPlot();
static RimWellBoreStabilityPlot* parentWellBoreStabilityPlot();
};

View File

@@ -0,0 +1,126 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellLogPlotTrackFeatureImpl.h"
#include "RiaGuiApplication.h"
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellLogPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "cvfAssert.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTrack* destTrack,
const std::vector<RimWellLogCurve*>& curves,
int insertAtPosition )
{
CVF_ASSERT( destTrack );
std::set<RimWellLogTrack*> srcTracks;
std::set<RimWellLogPlot*> srcPlots;
for ( size_t cIdx = 0; cIdx < curves.size(); cIdx++ )
{
RimWellLogCurve* curve = curves[cIdx];
RimWellLogTrack* wellLogPlotTrack;
curve->firstAncestorOrThisOfType( wellLogPlotTrack );
if ( wellLogPlotTrack )
{
wellLogPlotTrack->removeCurve( curve );
srcTracks.insert( wellLogPlotTrack );
RimWellLogPlot* plot;
wellLogPlotTrack->firstAncestorOrThisOfType( plot );
if ( plot ) srcPlots.insert( plot );
}
}
for ( size_t cIdx = 0; cIdx < curves.size(); cIdx++ )
{
if ( insertAtPosition >= 0 )
{
size_t position = (size_t)insertAtPosition + cIdx;
destTrack->insertCurve( curves[cIdx], position );
}
else
{
destTrack->addCurve( curves[cIdx] );
}
}
for ( auto track : srcTracks )
{
track->setAutoScaleXEnabled( true );
track->updateParentPlotZoom();
track->updateStackedCurveData();
track->updateConnectedEditors();
}
for ( auto plot : srcPlots )
{
plot->calculateAvailableDepthRange();
}
destTrack->loadDataAndUpdate();
destTrack->updateStackedCurveData();
destTrack->setAutoScaleXEnabled( true );
destTrack->updateParentPlotZoom();
destTrack->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot( RimWellLogPlot* wellLogPlot,
const std::vector<RimWellLogTrack*>& tracksToMove,
int insertAtPosition )
{
CVF_ASSERT( wellLogPlot );
for ( size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++ )
{
RimWellLogTrack* plot = tracksToMove[tIdx];
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( plot );
RimWellLogPlot* srcPlot;
pdmObject->firstAncestorOrThisOfType( srcPlot );
if ( srcPlot )
{
srcPlot->removePlot( plot );
}
}
for ( size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++ )
{
if ( insertAtPosition >= 0 )
{
wellLogPlot->insertPlot( tracksToMove[tIdx], (size_t)insertAtPosition + tIdx );
}
else
{
wellLogPlot->addPlot( tracksToMove[tIdx] );
}
}
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimWellLogPlot;
class RimWellLogTrack;
class RimWellLogCurve;
//==================================================================================================
///
//==================================================================================================
class RicWellLogPlotTrackFeatureImpl
{
public:
static void moveCurvesToWellLogPlotTrack( RimWellLogTrack* dstTrack,
const std::vector<RimWellLogCurve*>& curves,
int insertAtPosition );
static void moveTracksToWellLogPlot( RimWellLogPlot* wellLogPlot,
const std::vector<RimWellLogTrack*>& tracks,
int insertAtPosition );
};

View File

@@ -0,0 +1,107 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellLogsImportFileFeature.h"
#include "RiaApplication.h"
#include "RiaGuiApplication.h"
#include "RiaLogging.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
#include "cafPdmUiObjectEditorHandle.h"
#include <QAction>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT( RicWellLogsImportFileFeature, "RicWellLogsImportFileFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogFile*> RicWellLogsImportFileFeature::importWellLogFiles( const QStringList& wellLogFilePaths,
QStringList* errorMessages )
{
RiaApplication* app = RiaApplication::instance();
// Remember the path to next time
app->setLastUsedDialogDirectory( "WELL_LOGS_DIR", QFileInfo( wellLogFilePaths.last() ).absolutePath() );
std::vector<RimWellLogFile*> wellLogFiles = app->addWellLogsToModel( wellLogFilePaths, errorMessages );
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
return wellLogFiles;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RicWellLogsImportFileFeature::wellLogFileNameFilters()
{
QStringList nameFilters;
nameFilters << "*.las"
<< "*.LAS";
return nameFilters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellLogsImportFileFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogsImportFileFeature::onActionTriggered( bool isChecked )
{
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory( "WELL_LOGS_DIR" );
QString nameFilterString = QString( "Well Logs (%1);;All Files (*.*)" ).arg( wellLogFileNameFilters().join( " " ) );
QStringList wellLogFilePaths = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
"Import Well Logs",
defaultDir,
nameFilterString );
if ( wellLogFilePaths.size() >= 1 )
{
QStringList errorMessages;
importWellLogFiles( wellLogFilePaths, &errorMessages );
if ( !errorMessages.empty() )
{
QString displayMessage = "Errors opening the LAS files: \n" + errorMessages.join( "\n" );
RiaLogging::errorInMessageBox( Riu3DMainWindowTools::mainWindowWidget(), "File open error", displayMessage );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogsImportFileFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Import Well &Logs from File" );
actionToSetup->setIcon( QIcon( ":/LasFile16x16.png" ) );
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
class RimWellLogFile;
//==================================================================================================
///
//==================================================================================================
class RicWellLogsImportFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
static std::vector<RimWellLogFile*> importWellLogFiles( const QStringList& wellLogFilePaths,
QStringList* errorMessages );
static QStringList wellLogFileNameFilters();
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};