2016-12-19 04:23:02 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-16 07:57:43 -06:00
|
|
|
// Copyright (C) 2016-2018 Statoil ASA
|
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2018-02-20 00:20:25 -06:00
|
|
|
//
|
2016-12-19 04:23:02 -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.
|
2018-02-20 00:20:25 -06:00
|
|
|
//
|
2016-12-19 04:23:02 -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.
|
2018-02-20 00:20:25 -06:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2016-12-19 04:23:02 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-02-07 02:09:00 -06:00
|
|
|
#include "RicNewEllipseFractureTemplateFeature.h"
|
2016-12-19 04:23:02 -06:00
|
|
|
|
2018-01-18 04:42:29 -06:00
|
|
|
#include "RimEclipseView.h"
|
2017-01-12 06:29:18 -06:00
|
|
|
#include "RimEllipseFractureTemplate.h"
|
2017-02-07 04:08:56 -06:00
|
|
|
#include "RimFractureTemplateCollection.h"
|
2018-02-20 00:20:25 -06:00
|
|
|
#include "RimOilField.h"
|
2016-12-19 04:23:02 -06:00
|
|
|
#include "RimProject.h"
|
2019-01-16 07:57:43 -06:00
|
|
|
#include "RimWellPathFracture.h"
|
2016-12-19 04:23:02 -06:00
|
|
|
|
2018-02-27 08:21:14 -06:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2017-01-04 03:17:54 -06:00
|
|
|
|
2016-12-19 04:23:02 -06:00
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
2017-01-02 03:10:45 -06:00
|
|
|
#include <QAction>
|
2016-12-19 04:23:02 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewEllipseFractureTemplateFeature, "RicNewEllipseFractureTemplateFeature" );
|
2016-12-19 04:23:02 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-02-20 00:20:25 -06:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewEllipseFractureTemplateFeature::createNewTemplateForFractureAndUpdate( RimFracture* fracture )
|
2019-01-16 07:57:43 -06:00
|
|
|
{
|
|
|
|
RimEllipseFractureTemplate* fractureTemplate = createNewTemplate();
|
2019-09-06 03:40:57 -05:00
|
|
|
fracture->setFractureTemplate( fractureTemplate );
|
|
|
|
selectFractureTemplateAndUpdate( fractureTemplate );
|
2019-01-16 07:57:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate( RimFractureTemplate* fractureTemplate )
|
2018-02-20 00:20:25 -06:00
|
|
|
{
|
2018-02-21 02:50:50 -06:00
|
|
|
fractureTemplate->loadDataAndUpdate();
|
2018-02-20 00:20:25 -06:00
|
|
|
|
2019-01-16 07:57:43 -06:00
|
|
|
RimFractureTemplateCollection* templateCollection = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
fractureTemplate->firstAncestorOrThisOfTypeAsserted( templateCollection );
|
2018-02-20 00:20:25 -06:00
|
|
|
templateCollection->updateConnectedEditors();
|
|
|
|
|
2020-05-12 02:50:38 -05:00
|
|
|
RimProject* project = RimProject::current();
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2019-01-16 07:57:43 -06:00
|
|
|
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
2018-02-20 00:20:25 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( fractureTemplate );
|
2018-02-20 00:20:25 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
2016-12-19 04:23:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-01-16 07:57:43 -06:00
|
|
|
RimEllipseFractureTemplate* RicNewEllipseFractureTemplateFeature::createNewTemplate()
|
2016-12-19 04:23:02 -06:00
|
|
|
{
|
2020-05-12 02:50:38 -05:00
|
|
|
RimProject* project = RimProject::current();
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( project );
|
2016-12-19 04:23:02 -06:00
|
|
|
|
|
|
|
RimOilField* oilfield = project->activeOilField();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( oilfield == nullptr ) return nullptr;
|
2016-12-19 04:23:02 -06:00
|
|
|
|
2017-02-07 04:08:56 -06:00
|
|
|
RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();
|
2018-02-20 00:20:25 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( fracDefColl )
|
2016-12-19 04:23:02 -06:00
|
|
|
{
|
2019-04-16 06:30:03 -05:00
|
|
|
return fracDefColl->addDefaultEllipseTemplate();
|
2016-12-19 04:23:02 -06:00
|
|
|
}
|
2019-01-16 07:57:43 -06:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewEllipseFractureTemplateFeature::onActionTriggered( bool isChecked )
|
2019-01-16 07:57:43 -06:00
|
|
|
{
|
|
|
|
RimEllipseFractureTemplate* ellipseFractureTemplate = createNewTemplate();
|
2019-09-06 03:40:57 -05:00
|
|
|
selectFractureTemplateAndUpdate( ellipseFractureTemplate );
|
2016-12-19 04:23:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-02-20 00:20:25 -06:00
|
|
|
///
|
2016-12-19 04:23:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewEllipseFractureTemplateFeature::setupActionLook( QAction* actionToSetup )
|
2016-12-19 04:23:02 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/FractureTemplate16x16.png" ) );
|
|
|
|
actionToSetup->setText( "New Ellipse Fracture Template" );
|
2016-12-19 04:23:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-02-20 00:20:25 -06:00
|
|
|
///
|
2016-12-19 04:23:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-02-07 02:09:00 -06:00
|
|
|
bool RicNewEllipseFractureTemplateFeature::isCommandEnabled()
|
2016-12-19 04:23:02 -06:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|