mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8237 Make sure fracture location is recomputed during copy/paste
This commit is contained in:
parent
8b36ec9925
commit
e5874f08e8
@ -27,6 +27,7 @@ CAF_CMD_SOURCE_INIT( RicPasteModeledWellPathFeature, "RicPasteModeledWellPathFea
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
|
#include "RimWellPathFracture.h"
|
||||||
#include "RimWellPathTieIn.h"
|
#include "RimWellPathTieIn.h"
|
||||||
|
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
@ -73,16 +74,9 @@ void RicPasteModeledWellPathFeature::onActionTriggered( bool isChecked )
|
|||||||
RimModeledWellPath* wellPathToSelect = nullptr;
|
RimModeledWellPath* wellPathToSelect = nullptr;
|
||||||
for ( auto sourceWellPath : modeledWellPathsFromClipboard() )
|
for ( auto sourceWellPath : modeledWellPathsFromClipboard() )
|
||||||
{
|
{
|
||||||
RimModeledWellPath* destinationWellPath = dynamic_cast<RimModeledWellPath*>(
|
auto destinationWellPath = duplicateAndInitializeWellPath( sourceWellPath );
|
||||||
sourceWellPath->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
|
||||||
|
|
||||||
QString name = sourceWellPath->name() + " (copy)";
|
|
||||||
destinationWellPath->setName( name );
|
|
||||||
|
|
||||||
wellPathCollection->addWellPath( destinationWellPath, false );
|
|
||||||
wellPathToSelect = destinationWellPath;
|
wellPathToSelect = destinationWellPath;
|
||||||
|
|
||||||
duplicateLaterals( sourceWellPath, destinationWellPath );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RimTools::wellPathCollection()->rebuildWellPathNodes();
|
RimTools::wellPathCollection()->rebuildWellPathNodes();
|
||||||
@ -128,7 +122,7 @@ std::vector<RimModeledWellPath*> RicPasteModeledWellPathFeature::modeledWellPath
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicPasteModeledWellPathFeature::duplicateLaterals( RimModeledWellPath* source, RimModeledWellPath* destination )
|
void RicPasteModeledWellPathFeature::duplicateLaterals( const RimModeledWellPath* source, RimModeledWellPath* destination )
|
||||||
{
|
{
|
||||||
auto wpc = RimTools::wellPathCollection();
|
auto wpc = RimTools::wellPathCollection();
|
||||||
|
|
||||||
@ -140,16 +134,42 @@ void RicPasteModeledWellPathFeature::duplicateLaterals( RimModeledWellPath* sour
|
|||||||
auto sourceLateral = dynamic_cast<RimModeledWellPath*>( lateral );
|
auto sourceLateral = dynamic_cast<RimModeledWellPath*>( lateral );
|
||||||
if ( !sourceLateral ) continue;
|
if ( !sourceLateral ) continue;
|
||||||
|
|
||||||
auto* destinationLateral = dynamic_cast<RimModeledWellPath*>(
|
auto destinationLateral = duplicateAndInitializeWellPath( sourceLateral );
|
||||||
sourceLateral->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
|
||||||
|
|
||||||
QString name = sourceLateral->name() + " (copy)";
|
|
||||||
destinationLateral->setName( name );
|
|
||||||
|
|
||||||
wpc->addWellPath( destinationLateral, false );
|
|
||||||
|
|
||||||
destinationLateral->connectWellPaths( destination, sourceLateral->wellPathTieIn()->tieInMeasuredDepth() );
|
destinationLateral->connectWellPaths( destination, sourceLateral->wellPathTieIn()->tieInMeasuredDepth() );
|
||||||
|
|
||||||
duplicateLaterals( sourceLateral, destinationLateral );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimModeledWellPath* RicPasteModeledWellPathFeature::duplicateAndInitializeWellPath( const RimModeledWellPath* sourceWellPath )
|
||||||
|
{
|
||||||
|
if ( !sourceWellPath ) return nullptr;
|
||||||
|
|
||||||
|
auto wpc = RimTools::wellPathCollection();
|
||||||
|
|
||||||
|
auto* destinationWellPath = dynamic_cast<RimModeledWellPath*>(
|
||||||
|
sourceWellPath->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||||
|
|
||||||
|
QString name = sourceWellPath->name() + " (copy)";
|
||||||
|
destinationWellPath->setName( name );
|
||||||
|
|
||||||
|
wpc->addWellPath( destinationWellPath, false );
|
||||||
|
|
||||||
|
// Resolve references, will connect to the fracture template
|
||||||
|
destinationWellPath->resolveReferencesRecursively();
|
||||||
|
|
||||||
|
std::vector<RimWellPathFracture*> wellPathFractures;
|
||||||
|
destinationWellPath->descendantsIncludingThisOfType( wellPathFractures );
|
||||||
|
destinationWellPath->createWellPathGeometry();
|
||||||
|
|
||||||
|
for ( auto fracture : wellPathFractures )
|
||||||
|
{
|
||||||
|
fracture->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
duplicateLaterals( sourceWellPath, destinationWellPath );
|
||||||
|
|
||||||
|
return destinationWellPath;
|
||||||
|
}
|
||||||
|
@ -35,6 +35,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<RimModeledWellPath*> modeledWellPathsFromClipboard();
|
static std::vector<RimModeledWellPath*> modeledWellPathsFromClipboard();
|
||||||
|
static void duplicateLaterals( const RimModeledWellPath* source, RimModeledWellPath* destination );
|
||||||
void duplicateLaterals( RimModeledWellPath* source, RimModeledWellPath* destination );
|
static RimModeledWellPath* duplicateAndInitializeWellPath( const RimModeledWellPath* source );
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user