#5837 Well Measurements : Create new well measurement curves

This commit is contained in:
Magne Sjaastad 2020-04-27 21:31:56 +02:00
parent 34803b76be
commit eb46552e60
5 changed files with 131 additions and 6 deletions

View File

@ -28,6 +28,7 @@ ${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
@ -59,6 +60,7 @@ ${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 CODE_HEADER_FILES

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

@ -576,6 +576,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicNewWellLogCurveExtractionFeature";
menuBuilder << "RicNewWellLogRftCurveFeature";
menuBuilder << "RicNewWellLogFileCurveFeature";
menuBuilder << "RicNewWellMeasurementCurveFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeleteSubPlotFeature";
}

View File

@ -260,7 +260,7 @@ QList<caf::PdmOptionItemInfo>
m_wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
}
std::set<QString> names;
std::set<QString> kindNames;
if ( wellPathCollection )
{
@ -269,14 +269,16 @@ QList<caf::PdmOptionItemInfo>
{
if ( measurement->wellName() == m_wellPath->name() )
{
names.insert( measurement->kind() );
kindNames.insert( measurement->kind() );
}
}
}
for ( const auto& kind : names )
{
options.push_back( caf::PdmOptionItemInfo( kind, kind ) );
}
options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
for ( const auto& kind : kindNames )
{
options.push_back( caf::PdmOptionItemInfo( kind, kind ) );
}
}