mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Temp work
This commit is contained in:
parent
f202f4b8a7
commit
d861af44b6
@ -598,11 +598,17 @@ caf::ColorTable RiaColorTables::createBrightnessBasedColorTable( cvf::Color3ub b
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<RiaDefines::PhaseType, cvf::Color3f> RiaColorTables::phaseColors()
|
||||
std::map<RiaDefines::PhaseType, caf::ColorTable> RiaColorTables::phaseColors()
|
||||
{
|
||||
return {{RiaDefines::PhaseType::WATER_PHASE, cvf::Color3f( cvf::Color3::DARK_BLUE )},
|
||||
{RiaDefines::PhaseType::GAS_PHASE, cvf::Color3f( cvf::Color3::DARK_GREEN )},
|
||||
{RiaDefines::PhaseType::OIL_PHASE, cvf::Color3f( cvf::Color3::DARK_RED )}};
|
||||
static std::vector<cvf::Color3ub> waterColors{cvf::Color3ub( cvf::Color3::DARK_BLUE ),
|
||||
cvf::Color3ub( cvf::Color3::SKY_BLUE )};
|
||||
static std::vector<cvf::Color3ub> gasColors{cvf::Color3ub( cvf::Color3::DARK_GREEN ),
|
||||
cvf::Color3ub( cvf::Color3::YELLOW_GREEN )};
|
||||
static std::vector<cvf::Color3ub> oilColors{cvf::Color3ub( cvf::Color3::DARK_RED ), cvf::Color3ub( cvf::Color3::PINK )};
|
||||
|
||||
return {{RiaDefines::PhaseType::WATER_PHASE, caf::ColorTable( waterColors )},
|
||||
{RiaDefines::PhaseType::GAS_PHASE, caf::ColorTable( gasColors )},
|
||||
{RiaDefines::PhaseType::OIL_PHASE, caf::ColorTable( oilColors )}};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount );
|
||||
|
||||
static std::map<RiaDefines::PhaseType, cvf::Color3f> phaseColors();
|
||||
static std::map<RiaDefines::PhaseType, caf::ColorTable> phaseColors();
|
||||
|
||||
private:
|
||||
static std::vector<cvf::Color3ub> categoryColors();
|
||||
|
@ -1594,6 +1594,31 @@ std::set<RimPlotAxisPropertiesInterface*> RimAnalysisPlot::allPlotAxes() const
|
||||
return {m_valueAxisProperties};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::connectAxisSignals( RimPlotAxisProperties* axis )
|
||||
{
|
||||
axis->settingsChanged.connect( this, &RimAnalysisPlot::axisSettingsChanged );
|
||||
axis->logarithmicChanged.connect( this, &RimAnalysisPlot::axisLogarithmicChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::axisSettingsChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -160,6 +160,10 @@ private:
|
||||
|
||||
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
|
||||
private:
|
||||
|
@ -74,6 +74,9 @@ RimGridCrossPlot::RimGridCrossPlot()
|
||||
m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft );
|
||||
m_yAxisProperties->setEnableTitleTextSettings( false );
|
||||
|
||||
connectAxisSignals( m_xAxisProperties() );
|
||||
connectAxisSignals( m_yAxisProperties() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "" );
|
||||
m_crossPlotDataSets.uiCapability()->setUiHidden( true );
|
||||
|
||||
@ -434,6 +437,31 @@ QString RimGridCrossPlot::generateInfoBoxText() const
|
||||
return infoText.join( "\n" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::connectAxisSignals( RimPlotAxisProperties* axis )
|
||||
{
|
||||
axis->settingsChanged.connect( this, &RimGridCrossPlot::axisSettingsChanged );
|
||||
axis->logarithmicChanged.connect( this, &RimGridCrossPlot::axisLogarithmicChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::axisSettingsChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -144,6 +144,10 @@ private:
|
||||
void doRemoveFromCollection() override;
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
|
||||
private slots:
|
||||
void onPlotZoomed();
|
||||
|
||||
|
@ -169,7 +169,6 @@ void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion( RiaDefines::Poro
|
||||
}
|
||||
|
||||
RimPlotAxisProperties* yAxisProps = yAxisProperties();
|
||||
|
||||
yAxisProps->setInvertedAxis( true );
|
||||
|
||||
{
|
||||
|
@ -56,7 +56,11 @@ CAF_PDM_SOURCE_INIT(RimPlotAxisProperties, "SummaryYAxisProperties");
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
: m_enableTitleTextSettings(true)
|
||||
: settingsChanged(this)
|
||||
, logarithmicChanged(this)
|
||||
, stackingChanged(this)
|
||||
, stackingColorsChanged(this)
|
||||
, m_enableTitleTextSettings(true)
|
||||
, m_isRangeSettingsEnabled(true)
|
||||
{
|
||||
CAF_PDM_InitObject("Axis Properties", ":/LeftAxis16x16.png", "", "");
|
||||
@ -88,6 +92,7 @@ RimPlotAxisProperties::RimPlotAxisProperties()
|
||||
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
|
||||
CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis", "", "", "");
|
||||
CAF_PDM_InitField(&m_stackCurves, "StackCurves", false, "Stack Curves", "", "", "");
|
||||
CAF_PDM_InitField(&m_stackWithPhaseColors, "StackPhaseColors", false, " with Phase Colors", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position", "", "", "");
|
||||
|
||||
@ -189,6 +194,10 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
scaleGroup.add( &m_isAxisInverted );
|
||||
}
|
||||
scaleGroup.add( &m_stackCurves );
|
||||
if ( m_stackCurves )
|
||||
{
|
||||
scaleGroup.add( &m_stackWithPhaseColors );
|
||||
}
|
||||
scaleGroup.add( &numberFormat );
|
||||
|
||||
if ( numberFormat() != NUMBER_FORMAT_AUTO )
|
||||
@ -357,6 +366,14 @@ bool RimPlotAxisProperties::stackCurves() const
|
||||
return m_stackCurves();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotAxisProperties::stackWithPhaseColors() const
|
||||
{
|
||||
return m_stackWithPhaseColors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -405,18 +422,21 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
m_isAutoZoom = false;
|
||||
}
|
||||
|
||||
RimPlot* parentPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( parentPlot );
|
||||
if ( parentPlot )
|
||||
if ( changedField == &isLogarithmicScaleEnabled )
|
||||
{
|
||||
if ( changedField == &isLogarithmicScaleEnabled || changedField == &m_stackCurves )
|
||||
{
|
||||
parentPlot->loadDataAndUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
parentPlot->updateAxes();
|
||||
}
|
||||
logarithmicChanged.send( isLogarithmicScaleEnabled() );
|
||||
}
|
||||
else if ( changedField == &m_stackCurves )
|
||||
{
|
||||
stackingChanged.send( m_stackCurves() );
|
||||
}
|
||||
else if ( changedField == &m_stackWithPhaseColors )
|
||||
{
|
||||
stackingColorsChanged.send( m_stackWithPhaseColors() );
|
||||
}
|
||||
else
|
||||
{
|
||||
settingsChanged.send();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,12 @@ public:
|
||||
NUMBER_FORMAT_SCIENTIFIC
|
||||
};
|
||||
|
||||
public:
|
||||
caf::Signal<> settingsChanged;
|
||||
caf::Signal<bool> logarithmicChanged;
|
||||
caf::Signal<bool> stackingChanged;
|
||||
caf::Signal<bool> stackingColorsChanged;
|
||||
|
||||
public:
|
||||
RimPlotAxisProperties();
|
||||
|
||||
@ -73,6 +79,7 @@ public:
|
||||
bool isAxisInverted() const;
|
||||
void setAxisInverted( bool inverted );
|
||||
bool stackCurves() const;
|
||||
bool stackWithPhaseColors() const;
|
||||
|
||||
std::vector<RimPlotAxisAnnotation*> annotations() const;
|
||||
void appendAnnotation( RimPlotAxisAnnotation* annotation );
|
||||
@ -116,6 +123,7 @@ private:
|
||||
caf::PdmField<bool> m_isAutoZoom;
|
||||
caf::PdmField<bool> m_isAxisInverted;
|
||||
caf::PdmField<bool> m_stackCurves;
|
||||
caf::PdmField<bool> m_stackWithPhaseColors;
|
||||
|
||||
caf::PdmField<QString> m_name;
|
||||
QwtPlot::Axis m_axis;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "RimPlotCurve.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaCurveDataTools.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
@ -676,6 +677,31 @@ void RimPlotCurve::updateUiIconFromPlotSymbol()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimPlotCurve::phaseType() const
|
||||
{
|
||||
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::assignStackColor( size_t index, size_t count )
|
||||
{
|
||||
auto allPhaseColors = RiaColorTables::phaseColors();
|
||||
auto it = allPhaseColors.find( phaseType() );
|
||||
if ( it != allPhaseColors.end() )
|
||||
{
|
||||
caf::ColorTable interpolatedPhaseColors = it->second.interpolated( count );
|
||||
|
||||
auto color = interpolatedPhaseColors.cycledColor3f( index );
|
||||
this->setColor( color );
|
||||
this->setFillColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1013,6 +1039,14 @@ void RimPlotCurve::setFillStyle( Qt::BrushStyle brushStyle )
|
||||
m_fillStyle = brushStyle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::setFillColor( const cvf::Color3f& fillColor )
|
||||
{
|
||||
m_fillColor = fillColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
|
||||
#include "RiaCurveDataTools.h"
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
@ -88,6 +89,7 @@ public:
|
||||
void resetAppearance();
|
||||
Qt::BrushStyle fillStyle() const;
|
||||
void setFillStyle( Qt::BrushStyle brushStyle );
|
||||
void setFillColor( const cvf::Color3f& fillColor );
|
||||
|
||||
bool isCurveVisible() const;
|
||||
void setCurveVisibility( bool visible );
|
||||
@ -117,6 +119,9 @@ public:
|
||||
bool isCrossPlotCurve() const;
|
||||
void updateUiIconFromPlotSymbol();
|
||||
|
||||
virtual RiaDefines::PhaseType phaseType() const;
|
||||
void assignStackColor( size_t index, size_t count );
|
||||
|
||||
protected:
|
||||
virtual QString createCurveAutoName() = 0;
|
||||
virtual void updateZoomInParentPlot() = 0;
|
||||
@ -155,9 +160,9 @@ protected:
|
||||
void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
private:
|
||||
bool canCurveBeAttached() const;
|
||||
void attachCurveAndErrorBars();
|
||||
virtual void checkAndApplyDefaultFillColor();
|
||||
bool canCurveBeAttached() const;
|
||||
void attachCurveAndErrorBars();
|
||||
void checkAndApplyDefaultFillColor();
|
||||
|
||||
protected:
|
||||
QPointer<QwtPlot> m_parentQwtPlot;
|
||||
|
@ -211,6 +211,21 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector<double>&
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimWellLogCurve::resultPhase() const
|
||||
{
|
||||
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogCurve::assignStackColor( size_t index, size_t count )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -80,6 +80,9 @@ public:
|
||||
const std::vector<double>& depthValues,
|
||||
const RiaCurveDataTools::CurveIntervals& curveIntervals );
|
||||
|
||||
virtual RiaDefines::PhaseType resultPhase() const;
|
||||
virtual void assignStackColor( size_t index, size_t count );
|
||||
|
||||
protected:
|
||||
void updateZoomInParentPlot() override;
|
||||
void updateLegendsInPlot() override;
|
||||
|
@ -359,7 +359,6 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
checkAndApplyDefaultFillColor();
|
||||
|
||||
if ( isUsingPseudoLength )
|
||||
{
|
||||
@ -592,6 +591,20 @@ void RimWellLogExtractionCurve::setAutoNameComponents( bool addCaseName,
|
||||
m_addDateToCurveName = addDate;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimWellLogExtractionCurve::phaseType() const
|
||||
{
|
||||
auto phase = RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
|
||||
|
||||
if ( m_eclipseResultDefinition )
|
||||
{
|
||||
phase = m_eclipseResultDefinition->resultPhaseType();
|
||||
}
|
||||
return phase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -629,47 +642,6 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
|
||||
m_wellPathsWithExtractors.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogExtractionCurve::isDefaultColor( const cvf::Color3f& color ) const
|
||||
{
|
||||
if ( RiaColorTables::wellLogPlotPaletteColors().contains( color ) ) return true;
|
||||
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
for ( auto phaseColorPair : phaseColors )
|
||||
{
|
||||
if ( phaseColorPair.second == color ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Certain data types can have a predefined color. Apply this if the curve currently has
|
||||
/// a default cycled color.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::checkAndApplyDefaultFillColor()
|
||||
{
|
||||
if ( !m_fillColor().isValid() )
|
||||
{
|
||||
m_fillColor = m_curveColor;
|
||||
}
|
||||
|
||||
if ( m_eclipseResultDefinition && m_fillStyle != Qt::BrushStyle::NoBrush )
|
||||
{
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
auto it = phaseColors.find( m_eclipseResultDefinition->resultPhaseType() );
|
||||
cvf::Color3f phaseColor;
|
||||
if ( it != phaseColors.end() )
|
||||
{
|
||||
phaseColor = it->second;
|
||||
}
|
||||
|
||||
if ( isDefaultColor( m_curveColor() ) ) m_curveColor = phaseColor;
|
||||
if ( isDefaultColor( m_fillColor() ) ) m_fillColor = phaseColor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
RigGeoMechWellLogExtractor* geomExtractor );
|
||||
|
||||
void setAutoNameComponents( bool addCaseName, bool addProperty, bool addWellname, bool addTimeStep, bool addDate );
|
||||
RiaDefines::PhaseType phaseType() const override;
|
||||
|
||||
protected:
|
||||
QString createCurveAutoName() override;
|
||||
@ -112,8 +113,6 @@ protected:
|
||||
void clampBranchIndex();
|
||||
std::set<QString> sortedSimWellNames();
|
||||
void clearGeneratedSimWellPaths();
|
||||
bool isDefaultColor( const cvf::Color3f& color ) const;
|
||||
void checkAndApplyDefaultFillColor() override;
|
||||
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<caf::AppEnum<TrajectoryType>> m_trajectoryType;
|
||||
|
@ -188,6 +188,7 @@ RimWellLogTrack::RimWellLogTrack()
|
||||
m_visibleDepthRangeMax.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_stackCurves, "StackCurves", false, "Stack Curves", "", "", "" );
|
||||
CAF_PDM_InitField( &m_stackWithPhaseColors, "StackWithPhaseColors", false, " with phase colors", "", "", "" );
|
||||
CAF_PDM_InitField( &m_isAutoScaleXEnabled, "AutoScaleX", true, "Auto Scale", "", "", "" );
|
||||
m_isAutoScaleXEnabled.uiCapability()->setUiHidden( true );
|
||||
|
||||
@ -719,7 +720,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
updateParentLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
else if ( changedField == &m_stackCurves )
|
||||
else if ( changedField == &m_stackCurves || changedField == &m_stackWithPhaseColors )
|
||||
{
|
||||
updateStackedCurveData();
|
||||
|
||||
@ -2161,6 +2162,10 @@ void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering
|
||||
gridGroup->add( &m_visibleXRangeMax );
|
||||
gridGroup->add( &m_xAxisGridVisibility );
|
||||
gridGroup->add( &m_stackCurves );
|
||||
if ( m_stackCurves )
|
||||
{
|
||||
gridGroup->add( &m_stackWithPhaseColors );
|
||||
}
|
||||
|
||||
// TODO Revisit if these settings are required
|
||||
// See issue https://github.com/OPM/ResInsight/issues/4367
|
||||
@ -2352,10 +2357,13 @@ void RimWellLogTrack::updateStackedCurveData()
|
||||
reverseOrder = true;
|
||||
}
|
||||
|
||||
std::map<RiaDefines::PhaseType, size_t> curvePhaseCount;
|
||||
|
||||
// Reset all curves
|
||||
for ( auto curve : visibleCurves() )
|
||||
{
|
||||
curve->loadDataAndUpdate( false );
|
||||
curvePhaseCount[curve->phaseType()]++;
|
||||
}
|
||||
|
||||
// Stack the curves that are meant to be stacked
|
||||
@ -2402,6 +2410,7 @@ void RimWellLogTrack::updateStackedCurveData()
|
||||
}
|
||||
if ( allDepthValues.empty() ) continue;
|
||||
|
||||
size_t stackIndex = 0u;
|
||||
std::vector<double> allStackedValues( allDepthValues.size(), 0.0 );
|
||||
for ( auto curve : stackedCurvesInGroup )
|
||||
{
|
||||
@ -2428,6 +2437,10 @@ void RimWellLogTrack::updateStackedCurveData()
|
||||
|
||||
curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices );
|
||||
curve->setZOrder( zPos );
|
||||
if ( m_stackWithPhaseColors() )
|
||||
{
|
||||
curve->assignStackColor( stackIndex, curvePhaseCount[curve->phaseType()] );
|
||||
}
|
||||
zPos -= 1.0;
|
||||
}
|
||||
}
|
||||
|
@ -312,6 +312,7 @@ private:
|
||||
caf::PdmField<double> m_visibleDepthRangeMax;
|
||||
|
||||
caf::PdmField<bool> m_stackCurves;
|
||||
caf::PdmField<bool> m_stackWithPhaseColors;
|
||||
caf::PdmField<bool> m_isAutoScaleXEnabled;
|
||||
caf::PdmField<bool> m_isLogarithmicScaleEnabled;
|
||||
caf::PdmField<RimWellLogPlot::AxisGridEnum> m_xAxisGridVisibility;
|
||||
|
@ -511,7 +511,6 @@ void RimSummaryCurve::updateZoomInParentPlot()
|
||||
void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
checkAndApplyDefaultFillColor();
|
||||
|
||||
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
|
||||
m_xValuesSummaryAddressUiField = m_xValuesSummaryAddress->address();
|
||||
@ -756,46 +755,6 @@ void RimSummaryCurve::appendOptionItemsForSummaryAddresses( QList<caf::PdmOption
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCurve::isDefaultColor( const cvf::Color3f& color ) const
|
||||
{
|
||||
if ( RiaColorTables::summaryCurveDefaultPaletteColors().contains( color ) ) return true;
|
||||
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
for ( auto phaseColorPair : phaseColors )
|
||||
{
|
||||
if ( phaseColorPair.second == color ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::checkAndApplyDefaultFillColor()
|
||||
{
|
||||
if ( !m_fillColor().isValid() )
|
||||
{
|
||||
m_fillColor = m_curveColor;
|
||||
}
|
||||
|
||||
if ( m_yValuesSummaryAddress && m_fillStyle != Qt::BrushStyle::NoBrush )
|
||||
{
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
auto it = phaseColors.find( m_yValuesSummaryAddress->addressPhaseType() );
|
||||
cvf::Color3f phaseColor;
|
||||
if ( it != phaseColors.end() )
|
||||
{
|
||||
phaseColor = it->second;
|
||||
}
|
||||
|
||||
if ( isDefaultColor( m_curveColor() ) ) m_curveColor = phaseColor;
|
||||
if ( isDefaultColor( m_fillColor() ) ) m_fillColor = phaseColor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -834,6 +793,14 @@ void RimSummaryCurve::setZIndexFromCurveInfo()
|
||||
setZOrder( zOrder );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimSummaryCurve::phaseType() const
|
||||
{
|
||||
return m_yValuesSummaryAddress->addressPhaseType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
void setAsTopZWithinCategory( bool enable );
|
||||
void setZIndexFromCurveInfo();
|
||||
|
||||
RiaDefines::PhaseType phaseType() const override;
|
||||
|
||||
protected:
|
||||
// RimPlotCurve overrides
|
||||
QString createCurveAutoName() override;
|
||||
@ -113,8 +115,6 @@ private:
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
static void appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options, RimSummaryCase* summaryCase );
|
||||
bool isDefaultColor( const cvf::Color3f& color ) const;
|
||||
void checkAndApplyDefaultFillColor() override;
|
||||
|
||||
private:
|
||||
// Y values
|
||||
|
@ -190,6 +190,10 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
m_bottomAxisProperties = new RimPlotAxisProperties;
|
||||
m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", QwtPlot::xBottom );
|
||||
|
||||
connectAxisSignals( m_leftYAxisProperties() );
|
||||
connectAxisSignals( m_rightYAxisProperties() );
|
||||
connectAxisSignals( m_bottomAxisProperties() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties, "TimeAxisProperties", "Time Axis", "", "", "" );
|
||||
m_timeAxisProperties.uiCapability()->setUiTreeHidden( true );
|
||||
m_timeAxisProperties = new RimSummaryTimeAxisProperties;
|
||||
@ -1356,6 +1360,10 @@ void RimSummaryPlot::updateStackedCurveData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxis )
|
||||
{
|
||||
RimPlotAxisProperties* axisProperties = yAxisPropertiesLeftOrRight( plotAxis );
|
||||
|
||||
std::map<RiaDefines::PhaseType, size_t> curvePhaseCount;
|
||||
|
||||
// Reset all curves
|
||||
for ( RimSummaryCurve* curve : visibleSummaryCurvesForAxis( plotAxis ) )
|
||||
{
|
||||
@ -1366,9 +1374,10 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi
|
||||
}
|
||||
|
||||
curve->loadDataAndUpdate( false );
|
||||
|
||||
curvePhaseCount[curve->phaseType()]++;
|
||||
}
|
||||
|
||||
RimPlotAxisProperties* axisProperties = yAxisPropertiesLeftOrRight( plotAxis );
|
||||
if ( axisProperties->stackCurves() )
|
||||
{
|
||||
// Z-position of curve, to draw them in correct order
|
||||
@ -1383,6 +1392,8 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi
|
||||
allTimeSteps.erase( std::unique( allTimeSteps.begin(), allTimeSteps.end() ), allTimeSteps.end() );
|
||||
|
||||
std::vector<double> allStackedValues( allTimeSteps.size(), 0.0 );
|
||||
|
||||
size_t stackIndex = 0u;
|
||||
for ( RimSummaryCurve* curve : visibleSummaryCurvesForAxis( plotAxis ) )
|
||||
{
|
||||
for ( size_t i = 0; i < allTimeSteps.size(); ++i )
|
||||
@ -1396,6 +1407,10 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi
|
||||
|
||||
curve->setOverrideCurveDataY( allTimeSteps, allStackedValues );
|
||||
curve->setZOrder( zPos );
|
||||
if ( axisProperties->stackWithPhaseColors() )
|
||||
{
|
||||
curve->assignStackColor( stackIndex, curvePhaseCount[curve->phaseType()] );
|
||||
}
|
||||
zPos -= 1.0;
|
||||
}
|
||||
}
|
||||
@ -1620,6 +1635,57 @@ void RimSummaryPlot::curveAppearanceChanged( const caf::SignalEmitter* emitter )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::connectAxisSignals( RimPlotAxisProperties* axis )
|
||||
{
|
||||
axis->settingsChanged.connect( this, &RimSummaryPlot::axisSettingsChanged );
|
||||
axis->logarithmicChanged.connect( this, &RimSummaryPlot::axisLogarithmicChanged );
|
||||
axis->stackingChanged.connect( this, &RimSummaryPlot::axisStackingChanged );
|
||||
axis->stackingColorsChanged.connect( this, &RimSummaryPlot::axisStackingColorsChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::axisSettingsChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateAxes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::axisStackingChanged( const caf::SignalEmitter* emitter, bool stackCurves )
|
||||
{
|
||||
auto axisProps = dynamic_cast<const RimPlotAxisProperties*>( emitter );
|
||||
if ( axisProps )
|
||||
{
|
||||
updateStackedCurveDataForAxis( axisProps->plotAxisType() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::axisStackingColorsChanged( const caf::SignalEmitter* emitter, bool stackWithPhaseColors )
|
||||
{
|
||||
auto axisProps = dynamic_cast<const RimPlotAxisProperties*>( emitter );
|
||||
if ( axisProps )
|
||||
{
|
||||
updateStackedCurveDataForAxis( axisProps->plotAxisType() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -233,6 +233,12 @@ private:
|
||||
void curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible );
|
||||
void curveAppearanceChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
void axisStackingChanged( const caf::SignalEmitter* emitter, bool stackCurves );
|
||||
void axisStackingColorsChanged( const caf::SignalEmitter* emitter, bool stackWithPhaseColors );
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_normalizeCurveYValues;
|
||||
|
||||
|
@ -160,7 +160,11 @@ cvf::Color3ub ColorTable::fromQColor( const QColor& color )
|
||||
cvf::Color3ubArray ColorTable::interpolateColorArray( const cvf::Color3ubArray& colorArray, size_t targetColorCount )
|
||||
{
|
||||
size_t inputColorCount = colorArray.size();
|
||||
|
||||
CVF_ASSERT( inputColorCount > 1 );
|
||||
|
||||
if ( targetColorCount <= inputColorCount ) return colorArray;
|
||||
|
||||
CVF_ASSERT( targetColorCount > 1 );
|
||||
|
||||
cvf::Color3ubArray colors;
|
||||
@ -199,4 +203,13 @@ cvf::Color3ubArray ColorTable::interpolateColorArray( const cvf::Color3ubArray&
|
||||
return colors;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ColorTable ColorTable::interpolated( size_t targetColorCount )
|
||||
{
|
||||
auto colorArray = interpolateColorArray( color3ubArray(), targetColorCount );
|
||||
return ColorTable( colorArray );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
static cvf::Color3ub fromQColor( const QColor& color );
|
||||
static cvf::Color3ubArray interpolateColorArray( const cvf::Color3ubArray& colorArray, size_t targetColorCount );
|
||||
|
||||
ColorTable interpolated( size_t targetColorCount );
|
||||
|
||||
private:
|
||||
const std::vector<cvf::Color3ub> m_colors;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user