Skip to content

Commit 3fbc939

Browse files
committed
Use copyObject
1 parent 64f777b commit 3fbc939

File tree

42 files changed

+56
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+56
-120
lines changed

ApplicationLibCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ void RicEditPreferencesFeature::setupActionLook( QAction* actionToSetup )
103103
//--------------------------------------------------------------------------------------------------
104104
std::unique_ptr<RiaPreferences> RicEditPreferencesFeature::clonePreferences( const RiaPreferences* preferences )
105105
{
106-
caf::PdmObjectHandle* pdmClone = preferences->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() );
107-
108-
return std::unique_ptr<RiaPreferences>( dynamic_cast<RiaPreferences*>( pdmClone ) );
106+
return std::unique_ptr<RiaPreferences>( preferences->copyObject<RiaPreferences>() );
109107
}
110108

111109
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/Commands/ColorLegendCommands/RicCopyStandardLegendFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ void RicCopyStandardLegendFeature::onActionTriggered( bool isChecked )
4949
if ( standardLegend )
5050
{
5151
// perform deep copy of standard legend object via XML
52-
RimColorLegend* customLegend = dynamic_cast<RimColorLegend*>(
53-
standardLegend->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
54-
52+
auto customLegend = standardLegend->copyObject<RimColorLegend>();
5553
customLegend->setColorLegendName( "Copy of " + standardLegend->colorLegendName() );
5654

5755
RimColorLegendCollection* colorLegendCollection = RimProject::current()->colorLegendCollection;

ApplicationLibCode/Commands/CrossSectionCommands/RicCopyIntersectionsToAllViewsInCaseFeature.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(
119119
{
120120
RimIntersectionCollection* destCollection = currGridView->intersectionCollection();
121121

122-
RimExtrudedCurveIntersection* copy = dynamic_cast<RimExtrudedCurveIntersection*>(
123-
intersection->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
122+
auto copy = intersection->copyObject<RimExtrudedCurveIntersection>();
124123
CVF_ASSERT( copy );
125124

126125
destCollection->appendIntersectionAndUpdate( copy, false );
@@ -150,8 +149,7 @@ void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionBoxesToOtherVi
150149
{
151150
RimIntersectionCollection* destCollection = currGridView->intersectionCollection();
152151

153-
RimBoxIntersection* copy = dynamic_cast<RimBoxIntersection*>(
154-
intersectionBox->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
152+
auto copy = intersectionBox->copyObject<RimBoxIntersection>();
155153
CVF_ASSERT( copy );
156154

157155
destCollection->appendIntersectionBoxAndUpdate( copy );

ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ void RicAdvancedSnapshotExportFeature::exportMultipleSnapshots( const QString& f
157157
RimGeoMechView* sourceGeoMechView = dynamic_cast<RimGeoMechView*>( sourceView );
158158
if ( geomCase && sourceGeoMechView )
159159
{
160-
RimGeoMechView* copyOfGeoMechView = dynamic_cast<RimGeoMechView*>(
161-
sourceGeoMechView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
160+
auto copyOfGeoMechView = sourceGeoMechView->copyObject<RimGeoMechView>();
162161
CVF_ASSERT( copyOfGeoMechView );
163162

164163
geomCase->geoMechViews().push_back( copyOfGeoMechView );

ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isCheck
6363
RimFlowCharacteristicsPlot* sourceObject =
6464
dynamic_cast<RimFlowCharacteristicsPlot*>( caf::SelectionManager::instance()->selectedItem() );
6565

66-
RimFlowCharacteristicsPlot* flowCharacteristicsPlot =
67-
dynamic_cast<RimFlowCharacteristicsPlot*>( sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
66+
auto flowCharacteristicsPlot = sourceObject->copyObject<RimFlowCharacteristicsPlot>();
6867
CVF_ASSERT( flowCharacteristicsPlot );
6968

7069
flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot );

ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked )
6262
{
6363
RimWellAllocationPlot* sourceObject = dynamic_cast<RimWellAllocationPlot*>( caf::SelectionManager::instance()->selectedItem() );
6464

65-
RimWellAllocationPlot* wellAllocationPlot =
66-
dynamic_cast<RimWellAllocationPlot*>( sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
67-
65+
auto wellAllocationPlot = sourceObject->copyObject<RimWellAllocationPlot>();
6866
CVF_ASSERT( wellAllocationPlot );
6967

7068
flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot );

ApplicationLibCode/Commands/FractureCommands/RicCreateDuplicateTemplateInOtherUnitSystemFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ void RicCreateDuplicateTemplateInOtherUnitSystemFeature::onActionTriggered( bool
5454
RimFractureTemplate* fractureTemplate = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplate>();
5555
if ( !fractureTemplate ) return;
5656

57-
auto copyOfTemplate = dynamic_cast<RimFractureTemplate*>(
58-
fractureTemplate->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
57+
auto copyOfTemplate = fractureTemplate->copyObject<RimFractureTemplate>();
5958

6059
RimFractureTemplateCollection* fractureTemplateCollection = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
6160
fractureTemplateCollection->addFractureTemplate( copyOfTemplate );

ApplicationLibCode/Commands/FractureCommands/RicPasteEllipseFractureFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ void RicPasteEllipseFractureFeature::onActionTriggered( bool isChecked )
7474

7575
for ( const auto& source : typedObjects )
7676
{
77-
auto templ = dynamic_cast<RimEllipseFractureTemplate*>(
78-
source->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
79-
77+
auto templ = source->copyObject<RimEllipseFractureTemplate>();
8078
fractureTemplateColl->addFractureTemplate( templ );
8179

8280
RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate( templ );

ApplicationLibCode/Commands/FractureCommands/RicPasteStimPlanFractureFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ void RicPasteStimPlanFractureFeature::onActionTriggered( bool isChecked )
7474

7575
for ( const auto& source : typedObjects )
7676
{
77-
auto copyOfStimPlanTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(
78-
source->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
79-
77+
auto copyOfStimPlanTemplate = source->copyObject<RimStimPlanFractureTemplate>();
8078
fractureTemplateColl->addFractureTemplate( copyOfStimPlanTemplate );
8179

8280
RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate( copyOfStimPlanTemplate );

ApplicationLibCode/Commands/GridCrossPlotCommands/RicPasteGridCrossPlotDataSetFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ void RicPasteGridCrossPlotDataSetFeature::onActionTriggered( bool isChecked )
5959

6060
for ( RimGridCrossPlotDataSet* dataSet : gridCrossPlotDataSetsOnClipboard() )
6161
{
62-
RimGridCrossPlotDataSet* newDataSet = dynamic_cast<RimGridCrossPlotDataSet*>(
63-
dataSet->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
64-
62+
auto newDataSet = dataSet->copyObject<RimGridCrossPlotDataSet>();
6563
crossPlot->addDataSet( newDataSet );
6664
newDataSet->resolveReferencesRecursively();
6765
newDataSet->initAfterReadRecursively();

ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteCellFiltersFeature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ void RicPasteCellFiltersFeature::onActionTriggered( bool isChecked )
6767

6868
for ( auto obj : objectGroup.objects )
6969
{
70-
auto duplicatedObject =
71-
dynamic_cast<RimCellFilter*>( obj->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
72-
70+
auto duplicatedObject = obj->copyObject<RimCellFilter>();
7371
if ( duplicatedObject )
7472
{
7573
cellFilterCollection->addFilterAndNotifyChanges( duplicatedObject, eclipseCase );

ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ void RicPasteEclipseViewsFeature::onActionTriggered( bool isChecked )
8686
// Add cases to case group
8787
for ( const auto& eclipseView : eclipseViews )
8888
{
89-
auto* rimReservoirView =
90-
dynamic_cast<RimEclipseView*>( eclipseView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
89+
auto* rimReservoirView = eclipseView->copyObject<RimEclipseView>();
9190
CVF_ASSERT( rimReservoirView );
9291

9392
QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name();

ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ void RicPasteGeoMechViewsFeature::onActionTriggered( bool isChecked )
8080
// Add cases to case group
8181
for ( size_t i = 0; i < geomViews.size(); i++ )
8282
{
83-
RimGeoMechView* rimReservoirView =
84-
dynamic_cast<RimGeoMechView*>( geomViews[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
85-
QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name();
83+
auto rimReservoirView = geomViews[i]->copyObject<RimGeoMechView>();
84+
QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name();
8685
rimReservoirView->setName( nameOfCopy );
8786
geomCase->geoMechViews().push_back( rimReservoirView );
8887

ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
7878

7979
for ( size_t i = 0; i < intersectionObjects.size(); i++ )
8080
{
81-
RimExtrudedCurveIntersection* intersection = dynamic_cast<RimExtrudedCurveIntersection*>(
82-
intersectionObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
83-
84-
QString nameOfCopy = QString( "Copy of " ) + intersection->name();
81+
auto intersection = intersectionObjects[i]->copyObject<RimExtrudedCurveIntersection>();
82+
QString nameOfCopy = QString( "Copy of " ) + intersection->name();
8583
intersection->setName( nameOfCopy );
8684

8785
if ( i == intersectionObjects.size() - 1 )
@@ -99,10 +97,8 @@ void RicPasteIntersectionsFeature::onActionTriggered( bool isChecked )
9997

10098
for ( size_t i = 0; i < intersectionBoxObjects.size(); i++ )
10199
{
102-
RimBoxIntersection* intersectionBox = dynamic_cast<RimBoxIntersection*>(
103-
intersectionBoxObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
104-
105-
QString nameOfCopy = QString( "Copy of " ) + intersectionBox->name();
100+
RimBoxIntersection* intersectionBox = intersectionBoxObjects[i]->copyObject<RimBoxIntersection>();
101+
QString nameOfCopy = QString( "Copy of " ) + intersectionBox->name();
106102
intersectionBox->setName( nameOfCopy );
107103

108104
if ( i == intersectionBoxObjects.size() - 1 )

ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ void RicNewSummaryPlotFromCurveFeature::onActionTriggered( bool isChecked )
3838
{
3939
RimSummaryCurve* curve = static_cast<RimSummaryCurve*>( userData.value<void*>() );
4040

41-
auto curveCopy = dynamic_cast<RimSummaryCurve*>( curve->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
42-
41+
auto curveCopy = curve->copyObject<RimSummaryCurve>();
4342
curveCopy->setShowInLegend( true );
4443

4544
RimSummaryPlot* plot = RicSummaryPlotBuilder::createPlot( { curveCopy } );

ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ std::vector<RimPlot*> RicSummaryPlotBuilder::duplicatePlots( const std::vector<R
278278

279279
for ( auto plot : sourcePlots )
280280
{
281-
auto copy = dynamic_cast<RimPlot*>( plot->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
282-
281+
auto copy = plot->copyObject<RimPlot>();
283282
{
284283
// TODO: Workaround for fixing the PdmPointer in RimEclipseResultDefinition
285284
// caf::PdmPointer<RimEclipseCase> m_eclipseCase;
@@ -308,8 +307,7 @@ std::vector<RimSummaryPlot*> RicSummaryPlotBuilder::duplicateSummaryPlots( const
308307

309308
for ( auto plot : sourcePlots )
310309
{
311-
auto copy = dynamic_cast<RimSummaryPlot*>( plot->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
312-
310+
auto copy = plot->copyObject<RimSummaryPlot>();
313311
if ( copy )
314312
{
315313
plots.push_back( copy );

ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
8787

8888
for ( const auto sumCase : selection )
8989
{
90-
auto copy = dynamic_cast<RimSummaryCase*>( sumCase->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
91-
90+
auto copy = sumCase->copyObject<RimSummaryCase>();
9291
duplicates.push_back( copy );
9392
}
9493

ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,8 @@ RimEclipseContourMapView*
210210
RicNewContourMapViewFeature::createEclipseContourMapFromExistingContourMap( RimEclipseCase* eclipseCase,
211211
RimEclipseContourMapView* existingContourMap )
212212
{
213-
RimEclipseContourMapView* contourMap = dynamic_cast<RimEclipseContourMapView*>(
214-
existingContourMap->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
213+
auto contourMap = existingContourMap->copyObject<RimEclipseContourMapView>();
215214
CVF_ASSERT( contourMap );
216-
217215
contourMap->setEclipseCase( eclipseCase );
218216

219217
auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" );
@@ -358,10 +356,8 @@ RimGeoMechContourMapView*
358356
RicNewContourMapViewFeature::createGeoMechContourMapFromExistingContourMap( RimGeoMechCase* geoMechCase,
359357
RimGeoMechContourMapView* existingContourMap )
360358
{
361-
RimGeoMechContourMapView* contourMap = dynamic_cast<RimGeoMechContourMapView*>(
362-
existingContourMap->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
359+
auto contourMap = existingContourMap->copyObject<RimGeoMechContourMapView>();
363360
CVF_ASSERT( contourMap );
364-
365361
contourMap->setGeoMechCase( geoMechCase );
366362

367363
auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" );

ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryTableFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ void RicDuplicateSummaryTableFeature::copyTableAndAddToCollection( RimSummaryTab
6363
RimSummaryTableCollection* summaryTableColl = RimMainPlotCollection::current()->summaryTableCollection();
6464
if ( !summaryTableColl ) return;
6565

66-
RimSummaryTable* newSummaryTable =
67-
dynamic_cast<RimSummaryTable*>( sourceTable->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
66+
auto newSummaryTable = sourceTable->copyObject<RimSummaryTable>();
6867
CVF_ASSERT( newSummaryTable );
6968

7069
// Add table to collection

ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ void RicPasteAsciiDataCurveFeature::onActionTriggered( bool isChecked )
6464

6565
for ( size_t i = 0; i < sourceObjects.size(); i++ )
6666
{
67-
RimAsciiDataCurve* newObject = dynamic_cast<RimAsciiDataCurve*>(
68-
sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
67+
auto newObject = sourceObjects[i]->copyObject<RimAsciiDataCurve>();
6968
CVF_ASSERT( newObject );
7069

7170
summaryPlot->addAsciiDataCruve( newObject );

ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteEnsembleCurveSetFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ RimEnsembleCurveSet* RicPasteEnsembleCurveSetFeature::copyCurveSetAndAddToCollec
4545
{
4646
CVF_ASSERT( curveSetCollection );
4747

48-
RimEnsembleCurveSet* newCurveSet = dynamic_cast<RimEnsembleCurveSet*>(
49-
sourceCurveSet->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
48+
auto newCurveSet = sourceCurveSet->copyObject<RimEnsembleCurveSet>();
5049
CVF_ASSERT( newCurveSet );
5150

5251
curveSetCollection->addCurveSet( newCurveSet );

ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC
4545
{
4646
RimSummaryPlot* summaryPlot = caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>();
4747

48-
RimSummaryCurve* newCurve =
49-
dynamic_cast<RimSummaryCurve*>( sourceCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
50-
CVF_ASSERT( newCurve );
51-
48+
auto newCurve = sourceCurve->copyObject<RimSummaryCurve>();
5249
summaryPlot->addCurveAndUpdate( newCurve );
5350

5451
// Resolve references after object has been inserted into the project data model

ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ void RicPasteTimeHistoryCurveFeature::onActionTriggered( bool isChecked )
7272

7373
for ( size_t i = 0; i < sourceObjects.size(); i++ )
7474
{
75-
RimGridTimeHistoryCurve* newObject = dynamic_cast<RimGridTimeHistoryCurve*>(
76-
sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
75+
auto newObject = sourceObjects[i]->copyObject<RimGridTimeHistoryCurve>();
7776
CVF_ASSERT( newObject );
7877

7978
summaryPlot->addGridTimeHistoryCurve( newObject );

ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,7 @@ void RicSummaryPlotEditorUi::updateTargetPlot()
705705
//--------------------------------------------------------------------------------------------------
706706
void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve, RimSummaryPlot* plot, bool forceVisible )
707707
{
708-
auto curveCopy =
709-
dynamic_cast<RimSummaryCurve*>( curve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
708+
auto curveCopy = curve->copyObject<RimSummaryCurve>();
710709
CVF_ASSERT( curveCopy );
711710

712711
if ( forceVisible )
@@ -728,8 +727,7 @@ void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve
728727
//--------------------------------------------------------------------------------------------------
729728
void RicSummaryPlotEditorUi::copyEnsembleCurveAndAddToCurveSet( const RimSummaryCurve* curve, RimEnsembleCurveSet* curveSet, bool forceVisible )
730729
{
731-
RimSummaryCurve* curveCopy =
732-
dynamic_cast<RimSummaryCurve*>( curve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
730+
auto curveCopy = curve->copyObject<RimSummaryCurve>();
733731
CVF_ASSERT( curveCopy );
734732

735733
if ( forceVisible )

ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ void RicCreateRftPlotsFeature::appendRftPlotForWell( const QString& wellName, Ri
102102

103103
// Create a RFT plot based on wellName, and reuse the data source selection in sourcePlot
104104

105-
auto rftPlot =
106-
dynamic_cast<RimWellRftPlot*>( sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
105+
auto rftPlot = sourcePlot->copyObject<RimWellRftPlot>();
107106
if ( !rftPlot ) return;
108107

109108
rftPlot->setSimWellOrWellPathName( wellName );

ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ void RicPasteWellLogCurveFeature::onActionTriggered( bool isChecked )
105105
auto* rftCurve = dynamic_cast<RimWellLogRftCurve*>( sourceObject.p() );
106106
if ( fileCurve || measurementCurve || extractionCurve || rftCurve )
107107
{
108-
auto* newObject = dynamic_cast<RimWellLogCurve*>(
109-
sourceObject->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
108+
auto* newObject = sourceObject->copyObject<RimWellLogCurve>();
110109
CVF_ASSERT( newObject );
111110

112111
wellLogTrack->addCurve( newObject );

ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
7272
RimWellLogPlot* fileCurve = sourceObjects[i];
7373
if ( fileCurve )
7474
{
75-
RimWellLogPlot* newObject = dynamic_cast<RimWellLogPlot*>(
76-
fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
75+
auto newObject = fileCurve->copyObject<RimWellLogPlot>();
7776
CVF_ASSERT( newObject );
7877

7978
wellLogPlotCollection->addWellLogPlot( newObject );

ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ void RicPasteWellLogTrackFeature::onActionTriggered( bool isChecked )
7373
RimWellLogTrack* fileCurve = sourceObjects[i];
7474
if ( fileCurve )
7575
{
76-
RimWellLogTrack* newObject = dynamic_cast<RimWellLogTrack*>(
77-
fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
76+
auto newObject = fileCurve->copyObject<RimWellLogTrack>();
7877
CVF_ASSERT( newObject );
7978

8079
wellLogPlot->addPlot( newObject );

0 commit comments

Comments
 (0)