Fix crashes related to name config and make name correct for old plots when loading

This commit is contained in:
Gaute Lindkvist 2019-09-06 10:59:04 +02:00
parent c0f7f4e056
commit 45103da354
24 changed files with 48 additions and 44 deletions

View File

@ -113,6 +113,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden(true);
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
m_nameConfig->setCustomName("Well Allocation Plot");
this->setAsPlotMdiWindow();
}

View File

@ -107,8 +107,6 @@ RimWellPltPlot::RimWellPltPlot()
CAF_PDM_InitFieldNoDefault(&m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "");
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden(true);
m_wellLogPlot_OBSOLETE = new RimWellLogPlot();
m_wellLogPlot_OBSOLETE->setDepthType(RimWellLogPlot::MEASURED_DEPTH);
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable(false);
CAF_PDM_InitFieldNoDefault(&m_wellPathName, "WellName", "Well Name", "", "", "");
@ -135,6 +133,8 @@ RimWellPltPlot::RimWellPltPlot()
m_phases = std::vector<caf::AppEnum<FlowPhase>>({FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER});
m_phases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_nameConfig->setCustomName("PLT Plot");
this->setAsPlotMdiWindow();
m_doInitAfterLoad = false;
m_isOnLoad = true;

View File

@ -74,7 +74,7 @@ const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1";
RimWellRftPlot::RimWellRftPlot()
: RimWellLogPlot()
{
CAF_PDM_InitObject("Well Allocation Plot", ":/RFTPlot16x16.png", "", "");
CAF_PDM_InitObject("RFT Plot", ":/RFTPlot16x16.png", "", "");
CAF_PDM_InitField(&m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "");
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false);
@ -84,8 +84,6 @@ RimWellRftPlot::RimWellRftPlot()
CAF_PDM_InitFieldNoDefault(&m_wellLogPlot_OBSOLETE, "WellLog", "Well Log", "", "", "");
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden(true);
m_wellLogPlot_OBSOLETE = new RimWellLogPlot();
m_wellLogPlot_OBSOLETE->setDepthType(RimWellLogPlot::TRUE_VERTICAL_DEPTH);
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable(false);
m_depthType = RimWellLogPlot::TRUE_VERTICAL_DEPTH;
@ -112,6 +110,9 @@ RimWellRftPlot::RimWellRftPlot()
m_selectedTimeSteps.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue(false);
m_nameConfig->setCustomName("RFT Plot");
m_trackLegendsHorizontal = true;
this->setAsPlotMdiWindow();
m_isOnLoad = true;
}

View File

@ -60,6 +60,7 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name Config", "", "", "");
m_nameConfig.uiCapability()->setUiTreeHidden(true);
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
m_nameConfig = new RimGridCrossPlotNameConfig();
CAF_PDM_InitFieldNoDefault(&m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "");
m_xAxisProperties.uiCapability()->setUiTreeHidden(true);
@ -76,7 +77,7 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault(&m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "");
m_crossPlotDataSets.uiCapability()->setUiHidden(true);
m_nameConfig = new RimGridCrossPlotNameConfig(this);
}
//--------------------------------------------------------------------------------------------------
@ -959,8 +960,8 @@ CAF_PDM_SOURCE_INIT(RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig(RimNameConfigHolderInterface* holder /*= nullptr*/)
: RimNameConfig(holder)
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Cross Plot Name Generator", "", "", "");

View File

@ -39,7 +39,7 @@ class RimGridCrossPlotNameConfig : public RimNameConfig
{
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlotNameConfig(RimNameConfigHolderInterface* holder = nullptr);
RimGridCrossPlotNameConfig();
public:
caf::PdmField<bool> addDataSetNames;

View File

@ -114,7 +114,7 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet()
m_groupingProperty->setTernaryEnabled(false);
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name", "", "", "");
m_nameConfig = new RimGridCrossPlotDataSetNameConfig(this);
m_nameConfig = new RimGridCrossPlotDataSetNameConfig();
m_nameConfig.uiCapability()->setUiTreeHidden(true);
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
@ -1367,8 +1367,8 @@ CAF_PDM_SOURCE_INIT(RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSet
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig(RimNameConfigHolderInterface* parent)
: RimNameConfig(parent)
RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Cross Plot Data Set NameGenerator", "", "", "");

View File

@ -58,7 +58,7 @@ class RimGridCrossPlotDataSetNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlotDataSetNameConfig(RimNameConfigHolderInterface* parent = nullptr);
RimGridCrossPlotDataSetNameConfig();
caf::PdmField<bool> addCaseName;
caf::PdmField<bool> addAxisVariables;

View File

@ -86,7 +86,7 @@ Rim3dView::Rim3dView(void)
CVF_ASSERT(preferences);
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimViewNameConfig(this);
m_nameConfig = new RimViewNameConfig();
CAF_PDM_InitField(&m_name_OBSOLETE, "UserDescription", QString(""), "Name", "", "", "");
m_name_OBSOLETE.xmlCapability()->setIOWritable(false);

View File

@ -87,7 +87,7 @@ Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
m_geomResultDefinition->setAddWellPathDerivedResults(true);
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogExtractionCurveNameConfig(this);
m_nameConfig = new RimWellLogExtractionCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------

View File

@ -46,7 +46,7 @@ Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogFileCurveNameConfig(this);
m_nameConfig = new RimWellLogFileCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
@ -54,7 +54,6 @@ Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
{
delete m_nameConfig;
}
//--------------------------------------------------------------------------------------------------

View File

@ -55,7 +55,7 @@ Rim3dWellLogRftCurve::Rim3dWellLogRftCurve()
m_2dWellLogRftCurve.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogRftCurveNameConfig(this);
m_nameConfig = new RimWellLogRftCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------

View File

@ -31,8 +31,7 @@ CAF_PDM_SOURCE_INIT(RimNameConfig, "RimCurveNameConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNameConfig::RimNameConfig(const RimNameConfigHolderInterface* configHolder /*= nullptr*/)
: m_configHolder(configHolder)
RimNameConfig::RimNameConfig()
{
CAF_PDM_InitObject("Curve Name Generator", "", "", "");
@ -106,7 +105,9 @@ void RimNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co
//--------------------------------------------------------------------------------------------------
QString RimNameConfig::autoName() const
{
return m_configHolder->createAutoName();
RimNameConfigHolderInterface* plotHolder;
this->firstAncestorOrThisOfTypeAsserted(plotHolder);
return plotHolder->createAutoName();
}
//--------------------------------------------------------------------------------------------------

View File

@ -44,8 +44,9 @@ class RimNameConfig : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
RimNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
RimNameConfig();
~RimNameConfig() override;
QString customName() const;
void setCustomName(const QString& name);
virtual void enableAllAutoNameTags(bool enable) {}
@ -66,7 +67,6 @@ protected:
caf::PdmField<QString> m_customName;
caf::PdmProxyValueField<QString> m_autoName;
const RimNameConfigHolderInterface* m_configHolder;
};

View File

@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT(RimViewNameConfig, "RimViewNameConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewNameConfig::RimViewNameConfig(const RimNameConfigHolderInterface* configHolder)
: RimNameConfig(configHolder)
RimViewNameConfig::RimViewNameConfig()
: RimNameConfig()
, m_hideCaseNameField(false)
, m_hideAggregationTypeField(false)
, m_hidePropertyField(false)

View File

@ -29,7 +29,7 @@ class RimViewNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
explicit RimViewNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
explicit RimViewNameConfig();
void setAddCaseName(bool add);
bool addCaseName() const;

View File

@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig(const RimNameConfigHolderInterface* configHolder)
: RimNameConfig(configHolder)
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Extraction Curve Name Generator", "", "", "");

View File

@ -29,7 +29,7 @@ class RimWellLogExtractionCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogExtractionCurveNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
RimWellLogExtractionCurveNameConfig();
bool addCaseName() const;
bool addProperty() const;

View File

@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig(const RimNameConfigHolderInterface* configHolder)
: RimNameConfig(configHolder)
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log File Curve Name Generator", "", "", "");
m_customName = "Las Curve";

View File

@ -29,6 +29,6 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogFileCurveNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
RimWellLogFileCurveNameConfig();
};

View File

@ -83,10 +83,10 @@ RimWellLogPlot::RimWellLogPlot()
m_userName_OBSOLETE.xmlCapability()->setIOWritable(false);
CAF_PDM_InitFieldNoDefault(&m_commonDataSource, "CommonDataSource", "Data Source", "", "Change the Data Source of All Curves in the Plot", "");
m_commonDataSource = new RimWellLogCurveCommonDataSource;
m_commonDataSource.uiCapability()->setUiTreeHidden(true);
m_commonDataSource.uiCapability()->setUiTreeChildrenHidden(true);
m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource;
caf::AppEnum< RimWellLogPlot::DepthTypeEnum > depthType = MEASURED_DEPTH;
CAF_PDM_InitField(&m_depthType, "DepthType", depthType, "Type", "", "", "");
@ -108,9 +108,9 @@ RimWellLogPlot::RimWellLogPlot()
m_tracks.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
m_nameConfig = new RimWellLogPlotNameConfig(this);
m_nameConfig.uiCapability()->setUiTreeHidden(true);
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true);
m_nameConfig = new RimWellLogPlotNameConfig();
m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL;
@ -121,7 +121,9 @@ RimWellLogPlot::RimWellLogPlot()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=(RimWellLogPlot&& rhs)
{
m_userName_OBSOLETE = rhs.m_userName_OBSOLETE();
// Don't copy the obsoleted m_userName_OBSOLETE
// It had its own implementation in the RFT/PLT/WAP plots
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject(dataSource);
m_commonDataSource = dataSource;
@ -146,7 +148,7 @@ RimWellLogPlot& RimWellLogPlot::operator=(RimWellLogPlot&& rhs)
auto nameConfig = rhs.m_nameConfig();
rhs.m_nameConfig.removeChildObject(nameConfig);
m_nameConfig = nameConfig;
m_nameConfig = nameConfig;
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
@ -587,8 +589,6 @@ void RimWellLogPlot::uiOrderingForPlotSettings(caf::PdmUiOrdering& uiOrdering)
titleAndLegendsGroup->add(&m_trackLegendsHorizontal);
titleAndLegendsGroup->add(&m_showTitleInPlot);
m_nameConfig->uiOrdering("", *titleAndLegendsGroup);
}
//--------------------------------------------------------------------------------------------------

View File

@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT(RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig(const RimNameConfigHolderInterface* configHolder)
: RimNameConfig(configHolder)
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Plot Name Generator", "", "", "");

View File

@ -29,7 +29,7 @@ class RimWellLogPlotNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
RimWellLogPlotNameConfig();
bool addCaseName() const;
bool addWellName() const;

View File

@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig(const RimNameConfigHolderInterface* configHolder)
: RimNameConfig(configHolder)
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject("Well Log Rft Curve Name Generator", "", "", "");
m_customName = "Rft Curve";

View File

@ -29,6 +29,6 @@ class RimWellLogRftCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogRftCurveNameConfig(const RimNameConfigHolderInterface* configHolder = nullptr);
RimWellLogRftCurveNameConfig();
};