Files
ResInsight/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp

128 lines
5.7 KiB
C++
Raw Normal View History

/////////////////////////////////////////////////////////////////////////////////
//
2019-01-09 15:15:34 +01:00
// Copyright (C) 2018- 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 "RiaOptionItemFactory.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimEnsembleCurveSet.h"
#include "RimMainPlotCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( Rim3dView* view, QList<caf::PdmOptionItemInfo>* optionItems )
{
if ( !view || !optionItems ) return;
QString displayName = view->autoName();
caf::IconProvider iconProvider = view->uiCapability()->uiIconProvider();
optionItems->push_back( caf::PdmOptionItemInfo( displayName, view, false, iconProvider ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( QList<caf::PdmOptionItemInfo>* options )
{
options->push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current();
std::vector<RimEnsembleCurveSet*> ensembleCurveSets = mainPlotColl->descendantsOfType<RimEnsembleCurveSet>();
for ( auto ensembleCurveSet : ensembleCurveSets )
{
options->push_back( caf::PdmOptionItemInfo( ensembleCurveSet->name(), ensembleCurveSet ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2023-09-18 09:28:29 +02:00
caf::PdmOptionItemInfo RiaOptionItemFactory::optionItemFromSummaryType( RifEclipseSummaryAddressDefines::SummaryCategory summaryType )
{
2023-09-18 09:28:29 +02:00
auto uiText = caf::AppEnum<RifEclipseSummaryAddressDefines::SummaryCategory>::uiText( summaryType );
// Use icons from https://github.com/equinor/webviz-subsurface-components
QString iconText;
switch ( summaryType )
{
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_INVALID:
iconText = ":/summary/components/images/invalid.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_FIELD:
iconText = ":/summary/components/images/field.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_AQUIFER:
iconText = ":/summary/components/images/aquifer.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_NETWORK:
iconText = ":/summary/components/images/network.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_MISC:
iconText = ":/summary/components/images/misc.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION:
iconText = ":/summary/components/images/region.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_REGION_2_REGION:
iconText = ":/summary/components/images/region-region.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_GROUP:
iconText = ":/summary/components/images/group.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL:
iconText = ":/summary/components/images/well.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL_COMPLETION:
iconText = ":/summary/components/images/well-completion.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL_LGR:
iconText = ":/summary/components/images/well.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL_COMPLETION_LGR:
iconText = ":/summary/components/images/well-completion.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL_SEGMENT:
iconText = ":/summary/components/images/segment.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_BLOCK:
iconText = ":/summary/components/images/block.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_BLOCK_LGR:
iconText = ":/summary/components/images/block.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_IMPORTED:
iconText = ":/summary/components/images/others.svg";
break;
2023-09-18 09:28:29 +02:00
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS:
break;
}
if ( iconText.isEmpty() )
{
return caf::PdmOptionItemInfo( uiText, summaryType );
}
caf::IconProvider iconProvider( iconText );
return caf::PdmOptionItemInfo( uiText, summaryType, false, iconProvider );
}