2017-05-16 02:43:41 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
2017-05-30 07:37:51 -05:00
# include "RicExportCompletionDataSettingsUi.h"
2017-05-16 02:43:41 -05:00
2017-06-14 08:30:50 -05:00
namespace caf
{
template < >
void RicExportCompletionDataSettingsUi : : ExportSplitType : : setUp ( )
{
addItem ( RicExportCompletionDataSettingsUi : : UNIFIED_FILE , " UNIFIED_FILE " , " Unified File " ) ;
addItem ( RicExportCompletionDataSettingsUi : : SPLIT_ON_WELL , " SPLIT_ON_WELL " , " Split on Well " ) ;
addItem ( RicExportCompletionDataSettingsUi : : SPLIT_ON_WELL_AND_COMPLETION_TYPE , " SPLIT_ON_WELL_AND_COMPLETION_TYPE " , " Split on Well and Completion Type " ) ;
setDefault ( RicExportCompletionDataSettingsUi : : UNIFIED_FILE ) ;
}
2017-06-15 04:37:00 -05:00
template < >
void RicExportCompletionDataSettingsUi : : WellSelectionType : : setUp ( )
{
addItem ( RicExportCompletionDataSettingsUi : : ALL_WELLS , " ALL_WELLS " , " All Wells " ) ;
addItem ( RicExportCompletionDataSettingsUi : : CHECKED_WELLS , " CHECKED_WELLS " , " Checked Wells " ) ;
2017-06-22 06:39:30 -05:00
addItem ( RicExportCompletionDataSettingsUi : : SELECTED_WELLS , " SELECTED_WELLS " , " Selected Wells " ) ;
2017-06-15 04:37:00 -05:00
setDefault ( RicExportCompletionDataSettingsUi : : ALL_WELLS ) ;
}
2017-06-21 03:58:02 -05:00
template < >
void RicExportCompletionDataSettingsUi : : CompdatExportType : : setUp ( )
{
2017-06-21 08:54:18 -05:00
addItem ( RicExportCompletionDataSettingsUi : : TRANSMISSIBILITIES , " TRANSMISSIBILITIES " , " Calculated Transmissibilities " ) ;
2017-06-23 08:45:22 -05:00
addItem ( RicExportCompletionDataSettingsUi : : WPIMULT_AND_DEFAULT_CONNECTION_FACTORS , " WPIMULT_AND_DEFAULT_CONNECTION_FACTORS " , " Default Connection Factors and WPIMULT (Fractures Not Supported) " ) ;
2017-06-21 03:58:02 -05:00
setDefault ( RicExportCompletionDataSettingsUi : : TRANSMISSIBILITIES ) ;
}
2017-06-14 08:30:50 -05:00
}
2017-05-30 07:37:51 -05:00
CAF_PDM_SOURCE_INIT ( RicExportCompletionDataSettingsUi , " RicExportCompletionDataSettingsUi " ) ;
2017-05-16 02:43:41 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2017-05-30 07:37:51 -05:00
RicExportCompletionDataSettingsUi : : RicExportCompletionDataSettingsUi ( )
2017-06-22 06:39:30 -05:00
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicExportCompletionDataSettingsUi : : RicExportCompletionDataSettingsUi ( bool onlyWellPathCollectionSelected )
2017-05-16 02:43:41 -05:00
{
CAF_PDM_InitObject ( " RimExportCompletionDataSettings " , " " , " " , " " ) ;
2017-06-14 08:30:50 -05:00
CAF_PDM_InitFieldNoDefault ( & fileSplit , " FileSplit " , " File Split " , " " , " " , " " ) ;
2017-06-15 04:37:00 -05:00
CAF_PDM_InitFieldNoDefault ( & wellSelection , " WellSelection " , " Well Selection " , " " , " " , " " ) ;
2017-06-21 08:54:18 -05:00
CAF_PDM_InitFieldNoDefault ( & compdatExport , " compdatExport " , " Export " , " " , " " , " " ) ;
2017-06-14 08:30:50 -05:00
2017-05-30 08:42:05 -05:00
CAF_PDM_InitField ( & timeStep , " TimeStepIndex " , 0 , " Time Step " , " " , " " , " " ) ;
2017-09-20 08:24:29 -05:00
CAF_PDM_InitField ( & useLateralNTG , " UseLateralNTG " , false , " Use NTG Horizontally " , " " , " " , " " ) ;
2017-05-30 08:42:05 -05:00
2017-05-29 06:13:25 -05:00
CAF_PDM_InitField ( & includePerforations , " IncludePerforations " , true , " Include Perforations " , " " , " " , " " ) ;
CAF_PDM_InitField ( & includeFishbones , " IncludeFishbones " , true , " Include Fishbones " , " " , " " , " " ) ;
2017-08-21 08:24:20 -05:00
# ifdef USE_PROTOTYPE_FEATURE_FRACTURES
2017-06-01 09:34:30 -05:00
CAF_PDM_InitField ( & includeFractures , " IncludeFractures " , true , " Include Fractures " , " " , " " , " " ) ;
2017-08-21 08:24:20 -05:00
# endif // USE_PROTOTYPE_FEATURE_FRACTURES
2017-05-29 06:13:25 -05:00
2017-06-21 08:54:18 -05:00
CAF_PDM_InitField ( & excludeMainBoreForFishbones , " ExcludeMainBoreForFishbones " , false , " Exclude Main Bore Transmissibility For Fishbones " , " " , " " , " " ) ;
2017-06-22 06:39:30 -05:00
m_onlyWellPathCollectionSelected = onlyWellPathCollectionSelected ;
2017-09-07 13:43:01 -05:00
m_displayForSimWell = true ;
2017-05-30 08:42:05 -05:00
}
2017-12-19 06:27:18 -06:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : setOnlyWellPathCollectionSelected ( bool onlyWellPathCollectionSelected )
{
m_onlyWellPathCollectionSelected = onlyWellPathCollectionSelected ;
}
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : showForSimWells ( )
{
m_displayForSimWell = true ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : showForWellPath ( )
{
m_displayForSimWell = false ;
}
2017-08-14 15:30:22 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
2017-08-21 08:24:20 -05:00
# ifdef USE_PROTOTYPE_FEATURE_FRACTURES
2017-08-14 15:30:22 -05:00
if ( changedField = = & compdatExport )
{
if ( compdatExport = = WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
includeFractures = false ;
includeFractures . uiCapability ( ) - > setUiReadOnly ( true ) ;
}
else if ( compdatExport = = TRANSMISSIBILITIES )
{
includeFractures = true ;
includeFractures . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
}
2017-08-21 08:24:20 -05:00
# endif // USE_PROTOTYPE_FEATURE_FRACTURES
2017-08-14 15:30:22 -05:00
}
2017-05-30 08:42:05 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList < caf : : PdmOptionItemInfo > RicExportCompletionDataSettingsUi : : calculateValueOptions ( const caf : : PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
{
QList < caf : : PdmOptionItemInfo > options ;
if ( fieldNeedingOptions = = & timeStep )
{
QStringList timeStepNames ;
if ( caseToApply )
{
timeStepNames = caseToApply - > timeStepStrings ( ) ;
}
for ( int i = 0 ; i < timeStepNames . size ( ) ; i + + )
{
options . push_back ( caf : : PdmOptionItemInfo ( timeStepNames [ i ] , i ) ) ;
}
}
2017-06-22 06:39:30 -05:00
else if ( fieldNeedingOptions = = & wellSelection )
{
if ( m_onlyWellPathCollectionSelected )
{
options . push_back ( caf : : PdmOptionItemInfo ( " All Wells " , ALL_WELLS ) ) ;
options . push_back ( caf : : PdmOptionItemInfo ( " Checked Wells " , CHECKED_WELLS ) ) ;
}
else
{
options . push_back ( caf : : PdmOptionItemInfo ( " Selected Wells " , SELECTED_WELLS ) ) ;
}
}
2017-05-30 08:42:05 -05:00
else
{
options = RicCaseAndFileExportSettingsUi : : calculateValueOptions ( fieldNeedingOptions , useOptionsOnly ) ;
}
return options ;
2017-05-16 02:43:41 -05:00
}
2017-06-12 05:03:42 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
2017-06-21 08:54:18 -05:00
caf : : PdmUiGroup * generalExportSettings = uiOrdering . addNewGroup ( " General Export Settings " ) ;
generalExportSettings - > add ( & folder ) ;
generalExportSettings - > add ( & caseToApply ) ;
generalExportSettings - > add ( & compdatExport ) ;
2017-09-20 08:24:29 -05:00
generalExportSettings - > add ( & useLateralNTG ) ;
2017-06-21 08:54:18 -05:00
generalExportSettings - > add ( & wellSelection ) ;
2017-06-22 06:39:30 -05:00
if ( ! m_onlyWellPathCollectionSelected ) wellSelection . setValue ( SELECTED_WELLS ) ;
2017-06-21 08:54:18 -05:00
generalExportSettings - > add ( & fileSplit ) ;
2017-06-12 05:03:42 -05:00
if ( ! m_displayForSimWell )
{
2017-06-21 09:38:57 -05:00
caf : : PdmUiGroup * fishboneGroup = uiOrdering . addNewGroup ( " Export of Fishbone Completions " ) ;
fishboneGroup - > add ( & includeFishbones ) ;
fishboneGroup - > add ( & excludeMainBoreForFishbones ) ;
2017-06-23 08:45:22 -05:00
if ( ! includeFishbones ) excludeMainBoreForFishbones . uiCapability ( ) - > setUiReadOnly ( true ) ;
else excludeMainBoreForFishbones . uiCapability ( ) - > setUiReadOnly ( false ) ;
2017-06-21 08:54:18 -05:00
2017-06-21 09:38:57 -05:00
caf : : PdmUiGroup * perfIntervalGroup = uiOrdering . addNewGroup ( " Export of Perforation Completions " ) ;
perfIntervalGroup - > add ( & includePerforations ) ;
2017-06-23 06:21:34 -05:00
perfIntervalGroup - > add ( & timeStep ) ;
2017-06-23 08:45:22 -05:00
if ( ! includePerforations ) timeStep . uiCapability ( ) - > setUiReadOnly ( true ) ;
else timeStep . uiCapability ( ) - > setUiReadOnly ( false ) ;
2017-08-21 08:24:20 -05:00
# ifdef USE_PROTOTYPE_FEATURE_FRACTURES
2017-06-21 09:38:57 -05:00
caf : : PdmUiGroup * fractureGroup = uiOrdering . addNewGroup ( " Export of Fracture Completions " ) ;
fractureGroup - > add ( & includeFractures ) ;
2017-06-23 08:45:22 -05:00
if ( compdatExport = = WPIMULT_AND_DEFAULT_CONNECTION_FACTORS )
{
includeFractures . uiCapability ( ) - > setUiReadOnly ( true ) ;
}
else if ( compdatExport = = TRANSMISSIBILITIES )
{
includeFractures . uiCapability ( ) - > setUiReadOnly ( false ) ;
}
2017-08-21 08:24:20 -05:00
# endif // USE_PROTOTYPE_FEATURE_FRACTURES
2017-06-21 09:38:57 -05:00
}
2017-08-14 15:30:22 -05:00
2017-06-12 05:03:42 -05:00
uiOrdering . skipRemainingFields ( ) ;
}