mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9126 Improve plot and curve handling for ensembles
Add append plots and append curves to context menu of ensembles Make sure we create an unique color when adding multiple ensembles
This commit is contained in:
parent
ee715a86e0
commit
f80fde85ca
@ -196,8 +196,10 @@ cvf::Color3f RiaColorTools::makeLighter( const cvf::Color3f& color, float normal
|
|||||||
double l = 0.0;
|
double l = 0.0;
|
||||||
qColor.getHslF( &h, &s, &l );
|
qColor.getHslF( &h, &s, &l );
|
||||||
|
|
||||||
|
// A negative value will make the color darker
|
||||||
l = l + ( 1.0 - l ) * normalizedScalingFactor;
|
l = l + ( 1.0 - l ) * normalizedScalingFactor;
|
||||||
l = std::min( 1.0, l );
|
|
||||||
|
l = std::clamp( l, 0.0, 1.0 );
|
||||||
|
|
||||||
qColor.setHslF( h, s, l );
|
qColor.setHslF( h, s, l );
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "RimSummaryAddressCollection.h"
|
#include "RimSummaryAddressCollection.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryMultiPlot.h"
|
#include "RimSummaryMultiPlot.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
@ -76,13 +77,22 @@ void RicAppendSummaryCurvesForSummaryCasesFeature::setupActionLook( QAction* act
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryCasesFeature::selectedCases()
|
std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryCasesFeature::selectedCases()
|
||||||
|
{
|
||||||
|
// Make the object type general to match the expected type for handleDroppedObjects();
|
||||||
|
std::vector<caf::PdmObjectHandle*> generalObjects;
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<RimSummaryCase*> objects;
|
std::vector<RimSummaryCase*> objects;
|
||||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||||
|
|
||||||
// Make the object type general to match the expected type for handleDroppedObjects();
|
|
||||||
std::vector<caf::PdmObjectHandle*> generalObjects;
|
|
||||||
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
|
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCaseCollection*> objects;
|
||||||
|
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||||
|
|
||||||
|
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
|
||||||
|
}
|
||||||
|
|
||||||
return generalObjects;
|
return generalObjects;
|
||||||
}
|
}
|
||||||
|
@ -77,11 +77,23 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s
|
|||||||
summaryMultiPlot->addPlot( duplicatedPlot );
|
summaryMultiPlot->addPlot( duplicatedPlot );
|
||||||
|
|
||||||
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdrCollection->caseId() );
|
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdrCollection->caseId() );
|
||||||
|
if ( summaryCase )
|
||||||
|
{
|
||||||
for ( auto c : duplicatedPlot->summaryCurves() )
|
for ( auto c : duplicatedPlot->summaryCurves() )
|
||||||
{
|
{
|
||||||
c->setSummaryCaseY( summaryCase );
|
c->setSummaryCaseY( summaryCase );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto ensemble = RiaSummaryTools::ensembleById( summaryAdrCollection->ensembleId() );
|
||||||
|
if ( ensemble )
|
||||||
|
{
|
||||||
|
for ( auto c : duplicatedPlot->curveSets() )
|
||||||
|
{
|
||||||
|
c->setSummaryCaseCollection( ensemble );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot );
|
auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot );
|
||||||
@ -102,6 +114,51 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* summaryMultiPlot,
|
||||||
|
const std::vector<RimSummaryCase*>& cases,
|
||||||
|
const std::vector<RimSummaryCaseCollection*>& ensembles )
|
||||||
|
{
|
||||||
|
auto addressCollectionsToBeDeleted =
|
||||||
|
RicAppendSummaryPlotsForObjectsFeature::createAddressCollections( cases, ensembles );
|
||||||
|
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, addressCollectionsToBeDeleted );
|
||||||
|
|
||||||
|
for ( auto obj : addressCollectionsToBeDeleted )
|
||||||
|
{
|
||||||
|
delete obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimSummaryAddressCollection*>
|
||||||
|
RicAppendSummaryPlotsForObjectsFeature::createAddressCollections( const std::vector<RimSummaryCase*>& cases,
|
||||||
|
const std::vector<RimSummaryCaseCollection*>& ensembles )
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryAddressCollection*> addresses;
|
||||||
|
|
||||||
|
for ( auto c : cases )
|
||||||
|
{
|
||||||
|
auto myColl = new RimSummaryAddressCollection;
|
||||||
|
myColl->setContentType( RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE );
|
||||||
|
myColl->setCaseId( c->caseId() );
|
||||||
|
addresses.push_back( myColl );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto c : ensembles )
|
||||||
|
{
|
||||||
|
auto myColl = new RimSummaryAddressCollection;
|
||||||
|
myColl->setContentType( RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE );
|
||||||
|
myColl->setEnsembleId( c->ensembleId() );
|
||||||
|
addresses.push_back( myColl );
|
||||||
|
}
|
||||||
|
|
||||||
|
return addresses;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -278,6 +335,7 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
|
|||||||
std::string groupNameToMatch;
|
std::string groupNameToMatch;
|
||||||
int regionToMatch = -1;
|
int regionToMatch = -1;
|
||||||
int caseIdToMatch = -1;
|
int caseIdToMatch = -1;
|
||||||
|
int ensembleIdToMatch = -1;
|
||||||
|
|
||||||
RiaSummaryAddressAnalyzer myAnalyser;
|
RiaSummaryAddressAnalyzer myAnalyser;
|
||||||
for ( auto sourcePlot : sourcePlots )
|
for ( auto sourcePlot : sourcePlots )
|
||||||
@ -307,6 +365,11 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
|
|||||||
{
|
{
|
||||||
caseIdToMatch = curves.front()->summaryCaseY()->caseId();
|
caseIdToMatch = curves.front()->summaryCaseY()->caseId();
|
||||||
}
|
}
|
||||||
|
auto curveSets = sourcePlots.back()->curveSets();
|
||||||
|
if ( !curveSets.empty() )
|
||||||
|
{
|
||||||
|
ensembleIdToMatch = curveSets.front()->ensembleId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,6 +385,14 @@ std::vector<RimSummaryPlot*> RicAppendSummaryPlotsForObjectsFeature::plotsForOne
|
|||||||
if ( c->summaryCaseY()->caseId() == caseIdToMatch ) isMatching = true;
|
if ( c->summaryCaseY()->caseId() == caseIdToMatch ) isMatching = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( ensembleIdToMatch != -1 )
|
||||||
|
{
|
||||||
|
auto curveSets = sourcePlot->curveSets();
|
||||||
|
for ( auto c : curveSets )
|
||||||
|
{
|
||||||
|
if ( c->summaryCaseCollection()->ensembleId() == ensembleIdToMatch ) isMatching = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot );
|
auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot );
|
||||||
|
@ -29,6 +29,8 @@ class RimSummaryAddressCollection;
|
|||||||
class RimSummaryMultiPlot;
|
class RimSummaryMultiPlot;
|
||||||
class RifEclipseSummaryAddress;
|
class RifEclipseSummaryAddress;
|
||||||
class RimSummaryPlot;
|
class RimSummaryPlot;
|
||||||
|
class RimSummaryCase;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -39,21 +41,31 @@ class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static std::vector<RimSummaryAddressCollection*> selectedCollections();
|
static std::vector<RimSummaryAddressCollection*> selectedCollections();
|
||||||
|
|
||||||
static std::vector<RimSummaryPlot*>
|
static std::vector<RimSummaryPlot*>
|
||||||
plotsForOneInstanceOfObjectType( const std::vector<RimSummaryPlot*>& sourcePlots,
|
plotsForOneInstanceOfObjectType( const std::vector<RimSummaryPlot*>& sourcePlots,
|
||||||
RimSummaryAddressCollection::CollectionContentType objectType );
|
RimSummaryAddressCollection::CollectionContentType objectType );
|
||||||
|
|
||||||
static bool isSelectionCompatibleWithPlot( const std::vector<RimSummaryAddressCollection*>& selection,
|
static bool isSelectionCompatibleWithPlot( const std::vector<RimSummaryAddressCollection*>& selection,
|
||||||
RimSummaryMultiPlot* summaryMultiPlot );
|
RimSummaryMultiPlot* summaryMultiPlot );
|
||||||
|
|
||||||
static void appendPlots( RimSummaryMultiPlot* summaryMultiPlot,
|
static void appendPlots( RimSummaryMultiPlot* summaryMultiPlot,
|
||||||
const std::vector<RimSummaryAddressCollection*>& selection );
|
const std::vector<RimSummaryAddressCollection*>& selection );
|
||||||
|
|
||||||
|
static void appendPlots( RimSummaryMultiPlot* summaryMultiPlot,
|
||||||
|
const std::vector<RimSummaryCase*>& cases,
|
||||||
|
const std::vector<RimSummaryCaseCollection*>& ensembles );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static std::vector<RimSummaryAddressCollection*>
|
||||||
|
createAddressCollections( const std::vector<RimSummaryCase*>& cases,
|
||||||
|
const std::vector<RimSummaryCaseCollection*>& ensembles );
|
||||||
|
|
||||||
static RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress,
|
static RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress,
|
||||||
RimSummaryAddressCollection* summaryAddressCollection );
|
RimSummaryAddressCollection* summaryAddressCollection );
|
||||||
};
|
};
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "RimSummaryAddressCollection.h"
|
#include "RimSummaryAddressCollection.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryMultiPlot.h"
|
#include "RimSummaryMultiPlot.h"
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
@ -32,39 +33,17 @@
|
|||||||
|
|
||||||
CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForSummaryCasesFeature, "RicAppendSummaryPlotsForSummaryCasesFeature" );
|
CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForSummaryCasesFeature, "RicAppendSummaryPlotsForSummaryCasesFeature" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicAppendSummaryPlotsForSummaryCasesFeature::appendPlotsForCases( RimSummaryMultiPlot* summaryMultiPlot,
|
|
||||||
const std::vector<RimSummaryCase*>& cases )
|
|
||||||
{
|
|
||||||
if ( !summaryMultiPlot ) return;
|
|
||||||
if ( cases.empty() ) return;
|
|
||||||
|
|
||||||
std::vector<RimSummaryAddressCollection*> tmp;
|
|
||||||
|
|
||||||
for ( auto c : cases )
|
|
||||||
{
|
|
||||||
auto myColl = new RimSummaryAddressCollection;
|
|
||||||
myColl->setContentType( RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE );
|
|
||||||
myColl->setCaseId( c->caseId() );
|
|
||||||
tmp.push_back( myColl );
|
|
||||||
}
|
|
||||||
|
|
||||||
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, tmp );
|
|
||||||
|
|
||||||
for ( auto obj : tmp )
|
|
||||||
{
|
|
||||||
delete obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled()
|
bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
return !selectedCases().empty();
|
auto cases = selectedCases();
|
||||||
|
auto ensembles = selectedEnsembles();
|
||||||
|
|
||||||
|
if ( cases.empty() && ensembles.empty() ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -78,9 +57,9 @@ void RicAppendSummaryPlotsForSummaryCasesFeature::onActionTriggered( bool isChec
|
|||||||
if ( !summaryMultiPlot ) return;
|
if ( !summaryMultiPlot ) return;
|
||||||
|
|
||||||
auto cases = selectedCases();
|
auto cases = selectedCases();
|
||||||
if ( cases.empty() ) return;
|
auto ensembles = selectedEnsembles();
|
||||||
|
|
||||||
appendPlotsForCases( summaryMultiPlot, cases );
|
RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, cases, ensembles );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -105,3 +84,14 @@ std::vector<RimSummaryCase*> RicAppendSummaryPlotsForSummaryCasesFeature::select
|
|||||||
|
|
||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RimSummaryCaseCollection*> RicAppendSummaryPlotsForSummaryCasesFeature::selectedEnsembles()
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryCaseCollection*> objects;
|
||||||
|
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||||
|
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
class RimSummaryMultiPlot;
|
class RimSummaryMultiPlot;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -32,9 +33,6 @@ class RicAppendSummaryPlotsForSummaryCasesFeature : public caf::CmdFeature
|
|||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
public:
|
|
||||||
static void appendPlotsForCases( RimSummaryMultiPlot* summaryMultiPlot, const std::vector<RimSummaryCase*>& cases );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
@ -42,4 +40,5 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<RimSummaryCase*> selectedCases();
|
static std::vector<RimSummaryCase*> selectedCases();
|
||||||
|
static std::vector<RimSummaryCaseCollection*> selectedEnsembles();
|
||||||
};
|
};
|
||||||
|
@ -777,6 +777,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||||
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
||||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||||
|
menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature";
|
||||||
|
menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature";
|
||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicConvertGroupToEnsembleFeature";
|
menuBuilder << "RicConvertGroupToEnsembleFeature";
|
||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
|
@ -396,9 +396,13 @@ cvf::Color3f RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddr
|
|||||||
{
|
{
|
||||||
bool usePhaseColor = RiaPreferencesSummary::current()->colorCurvesByPhase();
|
bool usePhaseColor = RiaPreferencesSummary::current()->colorCurvesByPhase();
|
||||||
|
|
||||||
|
float scalingFactor = 0.25;
|
||||||
cvf::Color3f curveColor;
|
cvf::Color3f curveColor;
|
||||||
|
|
||||||
if ( usePhaseColor )
|
if ( usePhaseColor )
|
||||||
{
|
{
|
||||||
|
// A negative scaling factor will make the color darker
|
||||||
|
scalingFactor = -0.1 * colorIndex;
|
||||||
curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( address );
|
curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( address );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -406,7 +410,6 @@ cvf::Color3f RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddr
|
|||||||
curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex );
|
curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
float scalingFactor = 0.25;
|
|
||||||
curveColor = RiaColorTools::makeLighter( curveColor, scalingFactor );
|
curveColor = RiaColorTools::makeLighter( curveColor, scalingFactor );
|
||||||
return curveColor;
|
return curveColor;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,7 @@ void RimSummaryMultiPlot::handleDroppedObjects( const std::vector<caf::PdmObject
|
|||||||
std::vector<RimSummaryAddress*> addresses;
|
std::vector<RimSummaryAddress*> addresses;
|
||||||
std::vector<RimSummaryAddressCollection*> addressCollections;
|
std::vector<RimSummaryAddressCollection*> addressCollections;
|
||||||
std::vector<RimSummaryCase*> cases;
|
std::vector<RimSummaryCase*> cases;
|
||||||
|
std::vector<RimSummaryCaseCollection*> ensembles;
|
||||||
|
|
||||||
for ( auto o : objects )
|
for ( auto o : objects )
|
||||||
{
|
{
|
||||||
@ -243,11 +244,13 @@ void RimSummaryMultiPlot::handleDroppedObjects( const std::vector<caf::PdmObject
|
|||||||
|
|
||||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( o );
|
auto summaryCase = dynamic_cast<RimSummaryCase*>( o );
|
||||||
if ( summaryCase ) cases.push_back( summaryCase );
|
if ( summaryCase ) cases.push_back( summaryCase );
|
||||||
|
auto ensemble = dynamic_cast<RimSummaryCaseCollection*>( o );
|
||||||
|
if ( ensemble ) ensembles.push_back( ensemble );
|
||||||
}
|
}
|
||||||
|
|
||||||
RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( this, addresses );
|
RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( this, addresses );
|
||||||
RicAppendSummaryPlotsForObjectsFeature::appendPlots( this, addressCollections );
|
RicAppendSummaryPlotsForObjectsFeature::appendPlots( this, addressCollections );
|
||||||
RicAppendSummaryPlotsForSummaryCasesFeature::appendPlotsForCases( this, cases );
|
RicAppendSummaryPlotsForObjectsFeature::appendPlots( this, cases, ensembles );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -770,22 +770,7 @@ size_t RimSummaryPlot::singleColorCurveCount() const
|
|||||||
void RimSummaryPlot::applyDefaultCurveAppearances()
|
void RimSummaryPlot::applyDefaultCurveAppearances()
|
||||||
{
|
{
|
||||||
applyDefaultCurveAppearances( summaryCurves() );
|
applyDefaultCurveAppearances( summaryCurves() );
|
||||||
|
applyDefaultCurveAppearances( ensembleCurveSetCollection()->curveSets() );
|
||||||
// Ensemble curve sets
|
|
||||||
int colorIndex = 0;
|
|
||||||
for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() )
|
|
||||||
{
|
|
||||||
if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue;
|
|
||||||
|
|
||||||
cvf::Color3f curveColor =
|
|
||||||
RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( curveSet->summaryAddress(),
|
|
||||||
colorIndex++ );
|
|
||||||
|
|
||||||
auto adr = curveSet->summaryAddress();
|
|
||||||
if ( adr.isHistoryVector() ) curveColor = RiaPreferencesSummary::current()->historyCurveContrastColor();
|
|
||||||
|
|
||||||
curveSet->setColor( curveColor );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -803,6 +788,36 @@ void RimSummaryPlot::applyDefaultCurveAppearances( std::vector<RimSummaryCurve*>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::applyDefaultCurveAppearances( std::vector<RimEnsembleCurveSet*> ensembleCurvesToUpdate )
|
||||||
|
{
|
||||||
|
auto allCurveSets = ensembleCurveSetCollection()->curveSets();
|
||||||
|
|
||||||
|
for ( auto curveSet : ensembleCurvesToUpdate )
|
||||||
|
{
|
||||||
|
size_t colorIndex = 0;
|
||||||
|
|
||||||
|
auto it = std::find( allCurveSets.begin(), allCurveSets.end(), curveSet );
|
||||||
|
if ( it != allCurveSets.end() )
|
||||||
|
{
|
||||||
|
colorIndex = std::distance( allCurveSets.begin(), it );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue;
|
||||||
|
|
||||||
|
cvf::Color3f curveColor =
|
||||||
|
RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( curveSet->summaryAddress(),
|
||||||
|
static_cast<int>( colorIndex ) );
|
||||||
|
|
||||||
|
auto adr = curveSet->summaryAddress();
|
||||||
|
if ( adr.isHistoryVector() ) curveColor = RiaPreferencesSummary::current()->historyCurveContrastColor();
|
||||||
|
|
||||||
|
curveSet->setColor( curveColor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1997,6 +2012,34 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryCaseD
|
|||||||
return { newCurves, curves };
|
return { newCurves, curves };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::pair<int, std::vector<RimEnsembleCurveSet*>> RimSummaryPlot::handleEnsembleDrop( RimSummaryCaseCollection* ensemble )
|
||||||
|
{
|
||||||
|
int newCurves = 0;
|
||||||
|
std::vector<RimEnsembleCurveSet*> curveSetsToUpdate;
|
||||||
|
|
||||||
|
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCaseCollection*>> dataVectorMap;
|
||||||
|
|
||||||
|
for ( auto& curve : curveSets() )
|
||||||
|
{
|
||||||
|
const auto addr = curve->summaryAddress();
|
||||||
|
dataVectorMap[addr].insert( curve->summaryCaseCollection() );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( const auto& [addr, ensembles] : dataVectorMap )
|
||||||
|
{
|
||||||
|
if ( ensembles.count( ensemble ) > 0 ) continue;
|
||||||
|
|
||||||
|
auto curveSet = addNewEnsembleCurveY( addr, ensemble );
|
||||||
|
curveSetsToUpdate.push_back( curveSet );
|
||||||
|
newCurves++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { newCurves, curveSetsToUpdate };
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -2197,6 +2240,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
|||||||
{
|
{
|
||||||
int accumulatedCurveCount = 0;
|
int accumulatedCurveCount = 0;
|
||||||
std::vector<RimSummaryCurve*> curvesToUpdate;
|
std::vector<RimSummaryCurve*> curvesToUpdate;
|
||||||
|
std::vector<RimEnsembleCurveSet*> curveSetsToUpdate;
|
||||||
|
|
||||||
for ( auto obj : objects )
|
for ( auto obj : objects )
|
||||||
{
|
{
|
||||||
@ -2208,6 +2252,14 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
|||||||
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
auto ensemble = dynamic_cast<RimSummaryCaseCollection*>( obj );
|
||||||
|
if ( ensemble )
|
||||||
|
{
|
||||||
|
auto [curveCount, curvesCreated] = handleEnsembleDrop( ensemble );
|
||||||
|
accumulatedCurveCount += curveCount;
|
||||||
|
curveSetsToUpdate.insert( curveSetsToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto summaryAddr = dynamic_cast<RimSummaryAddress*>( obj );
|
auto summaryAddr = dynamic_cast<RimSummaryAddress*>( obj );
|
||||||
if ( summaryAddr )
|
if ( summaryAddr )
|
||||||
@ -2244,6 +2296,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
|||||||
if ( accumulatedCurveCount > 0 )
|
if ( accumulatedCurveCount > 0 )
|
||||||
{
|
{
|
||||||
applyDefaultCurveAppearances( curvesToUpdate );
|
applyDefaultCurveAppearances( curvesToUpdate );
|
||||||
|
applyDefaultCurveAppearances( curveSetsToUpdate );
|
||||||
|
|
||||||
loadDataAndUpdate();
|
loadDataAndUpdate();
|
||||||
|
|
||||||
@ -2269,7 +2322,8 @@ RimSummaryCurve* RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& a
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble )
|
RimEnsembleCurveSet* RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& address,
|
||||||
|
RimSummaryCaseCollection* ensemble )
|
||||||
{
|
{
|
||||||
auto* curveSet = new RimEnsembleCurveSet();
|
auto* curveSet = new RimEnsembleCurveSet();
|
||||||
|
|
||||||
@ -2288,6 +2342,8 @@ void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& addre
|
|||||||
curveSet->setColor( curveColor );
|
curveSet->setColor( curveColor );
|
||||||
|
|
||||||
ensembleCurveSetCollection()->addCurveSet( curveSet );
|
ensembleCurveSetCollection()->addCurveSet( curveSet );
|
||||||
|
|
||||||
|
return curveSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -165,6 +165,7 @@ public:
|
|||||||
size_t singleColorCurveCount() const;
|
size_t singleColorCurveCount() const;
|
||||||
void applyDefaultCurveAppearances();
|
void applyDefaultCurveAppearances();
|
||||||
void applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate );
|
void applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate );
|
||||||
|
void applyDefaultCurveAppearances( std::vector<RimEnsembleCurveSet*> ensembleCurvesToUpdate );
|
||||||
|
|
||||||
void setNormalizationEnabled( bool enable );
|
void setNormalizationEnabled( bool enable );
|
||||||
bool isNormalizationEnabled();
|
bool isNormalizationEnabled();
|
||||||
@ -288,13 +289,14 @@ private:
|
|||||||
void assignPlotAxis( RimSummaryCurve* curve );
|
void assignPlotAxis( RimSummaryCurve* curve );
|
||||||
|
|
||||||
RimSummaryCurve* addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase );
|
RimSummaryCurve* addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase );
|
||||||
void addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble );
|
RimEnsembleCurveSet* addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble );
|
||||||
|
|
||||||
void updateStackedCurveData();
|
void updateStackedCurveData();
|
||||||
bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
||||||
bool updateStackedCurveDataForRelevantAxes();
|
bool updateStackedCurveDataForRelevantAxes();
|
||||||
|
|
||||||
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
||||||
|
std::pair<int, std::vector<RimEnsembleCurveSet*>> handleEnsembleDrop( RimSummaryCaseCollection* ensemble );
|
||||||
std::pair<int, std::vector<RimSummaryCurve*>> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
||||||
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user