2018-03-07 05:02:13 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-09 08:21:38 -06:00
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-03-07 05:02:13 -06:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-03-07 05:02:13 -06:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-03-07 05:02:13 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicAdd3dWellLogCurveFeature.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RicWellLogTools.h"
|
|
|
|
|
2018-03-15 08:17:56 -05:00
|
|
|
#include "Rim3dWellLogExtractionCurve.h"
|
2018-03-07 05:02:13 -06:00
|
|
|
#include "RimCase.h"
|
2019-10-29 02:22:03 -05:00
|
|
|
#include "RimGridView.h"
|
2018-03-07 05:02:13 -06:00
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
2018-03-07 06:03:27 -06:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
|
|
|
|
2018-08-22 05:04:42 -05:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
2018-03-07 05:02:13 -06:00
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicAdd3dWellLogCurveFeature, "RicAdd3dWellLogCurveFeature" );
|
2018-03-07 05:02:13 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicAdd3dWellLogCurveFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
std::vector<RimCase*> cases;
|
2019-09-06 03:40:57 -05:00
|
|
|
RiaApplication::instance()->project()->allCases( cases );
|
|
|
|
if ( cases.empty() ) return false;
|
2018-03-07 05:02:13 -06:00
|
|
|
|
2018-08-22 05:04:42 -05:00
|
|
|
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
|
2018-03-07 05:02:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicAdd3dWellLogCurveFeature::onActionTriggered( bool isChecked )
|
2018-03-07 05:02:13 -06:00
|
|
|
{
|
2018-08-22 05:04:42 -05:00
|
|
|
RimWellPath* selectedWellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !selectedWellPath ) return;
|
2018-03-07 06:03:27 -06:00
|
|
|
|
2018-03-15 08:17:56 -05:00
|
|
|
Rim3dWellLogExtractionCurve* rim3dWellLogExtractionCurve = new Rim3dWellLogExtractionCurve();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-10-29 02:22:03 -05:00
|
|
|
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( view )
|
2018-03-07 07:24:18 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
rim3dWellLogExtractionCurve->setPropertiesFromView( view );
|
2018-03-07 07:24:18 -06:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
selectedWellPath->add3dWellLogCurve( rim3dWellLogExtractionCurve );
|
|
|
|
|
2018-09-11 05:41:45 -05:00
|
|
|
RiaApplication::instance()->project()->scheduleCreateDisplayModelAndRedrawAllViews();
|
2018-04-05 07:14:53 -05:00
|
|
|
|
2018-03-07 06:03:27 -06:00
|
|
|
RiaApplication::instance()->project()->updateConnectedEditors();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogExtractionCurve );
|
|
|
|
Riu3DMainWindowTools::setExpanded( selectedWellPath );
|
2018-03-07 05:02:13 -06:00
|
|
|
|
2018-03-07 06:03:27 -06:00
|
|
|
selectedWellPath->updateConnectedEditors();
|
2018-03-07 05:02:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicAdd3dWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
|
2018-03-07 05:02:13 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
|
|
|
actionToSetup->setText( "Create 3D Well Log Curve" );
|
2018-03-07 05:02:13 -06:00
|
|
|
}
|