2017-02-20 02:13:44 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-02-20 02:13:44 -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
|
|
|
//
|
2017-02-20 02:13:44 -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>
|
2017-02-20 02:13:44 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicConvertAllFractureTemplatesToMetricFeature.h"
|
|
|
|
|
2021-01-21 05:58:46 -06:00
|
|
|
#include "RiaDefines.h"
|
2017-02-20 02:13:44 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "Rim3dView.h"
|
2017-02-20 02:13:44 -06:00
|
|
|
#include "RimEclipseCase.h"
|
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimEllipseFractureTemplate.h"
|
|
|
|
#include "RimFracture.h"
|
|
|
|
#include "RimFractureExportSettings.h"
|
|
|
|
#include "RimFractureTemplateCollection.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
|
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
|
|
|
#include "cafPdmObjectHandle.h"
|
|
|
|
#include "cafPdmUiPropertyViewDialog.h"
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QString>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicConvertAllFractureTemplatesToMetricFeature, "RicConvertAllFractureTemplatesToMetricFeature" );
|
2017-02-20 02:13:44 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-02-20 02:13:44 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicConvertAllFractureTemplatesToMetricFeature::onActionTriggered( bool isChecked )
|
2017-02-20 02:13:44 -06:00
|
|
|
{
|
2019-11-03 04:43:46 -06:00
|
|
|
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !objHandle ) return;
|
2017-02-20 02:13:44 -06:00
|
|
|
|
|
|
|
RimFractureTemplateCollection* fracTempColl = nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
objHandle->firstAncestorOrThisOfType( fracTempColl );
|
2019-11-03 04:43:46 -06:00
|
|
|
if ( !fracTempColl ) return;
|
2017-02-20 02:13:44 -06:00
|
|
|
|
|
|
|
std::vector<RimEllipseFractureTemplate*> ellipseFracTemplates;
|
2019-09-06 03:40:57 -05:00
|
|
|
fracTempColl->descendantsIncludingThisOfType( ellipseFracTemplates );
|
2017-02-20 02:13:44 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto ellipseFracTemplate : ellipseFracTemplates )
|
2017-02-20 02:13:44 -06:00
|
|
|
{
|
2021-01-21 05:58:46 -06:00
|
|
|
if ( ellipseFracTemplate->fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
|
2017-02-20 02:13:44 -06:00
|
|
|
{
|
|
|
|
ellipseFracTemplate->changeUnits();
|
2018-02-21 12:07:03 -06:00
|
|
|
|
|
|
|
ellipseFracTemplate->disconnectAllFracturesAndRedrawViews();
|
2017-02-20 02:13:44 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-02-20 02:13:44 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicConvertAllFractureTemplatesToMetricFeature::setupActionLook( QAction* actionToSetup )
|
2017-02-20 02:13:44 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setText( "Convert All Ellipse Fracture Templates to Metric" );
|
2017-02-20 02:13:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-02-20 02:13:44 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicConvertAllFractureTemplatesToMetricFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|