Add copyObject to PdmObjectHandle

New syntax to copy an object

    auto curveCopy = curve->copyObject<RimSummaryCurve>();

Previous deprecated syntax

    RimColorLegend* customLegend = dynamic_cast<RimColorLegend*>(
            standardLegend->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
This commit is contained in:
Magne Sjaastad
2024-06-14 17:18:28 +02:00
committed by GitHub
parent 7efefbb93a
commit a0ebb6e496
46 changed files with 126 additions and 131 deletions

View File

@@ -146,10 +146,8 @@ void RicCreateMultipleWellPathLaterals::slotAppendFractures()
{
for ( auto measuredDepth : m_ui->locationConfig()->locations() )
{
RimModeledWellPath* newModeledWellPath = dynamic_cast<RimModeledWellPath*>(
sourceLateral->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
auto nameOfNewWell = RicNewWellPathLateralAtDepthFeature::updateNameOfParentAndFindNameOfSideStep( parentWellPath );
auto newModeledWellPath = sourceLateral->copyObject<RimModeledWellPath>();
auto nameOfNewWell = RicNewWellPathLateralAtDepthFeature::updateNameOfParentAndFindNameOfSideStep( parentWellPath );
newModeledWellPath->setName( nameOfNewWell );
newModeledWellPath->wellPathTieIn()->setTieInMeasuredDepth( measuredDepth );

View File

@@ -148,10 +148,8 @@ RimModeledWellPath* RicPasteModeledWellPathFeature::duplicateAndInitializeWellPa
auto wpc = RimTools::wellPathCollection();
auto* destinationWellPath = dynamic_cast<RimModeledWellPath*>(
sourceWellPath->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
QString name = sourceWellPath->name() + "(copy)";
auto* destinationWellPath = sourceWellPath->copyObject<RimModeledWellPath>();
QString name = sourceWellPath->name() + "(copy)";
destinationWellPath->setName( name );
wpc->addWellPath( destinationWellPath );