mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2609 Well Path Creation: Create duplicate of well target
This commit is contained in:
@@ -61,10 +61,12 @@ void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
|||||||
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT);
|
||||||
if (targets.size() > 0)
|
if (targets.size() > 0)
|
||||||
{
|
{
|
||||||
|
auto firstTarget = targets.front();
|
||||||
RimWellPathGeometryDef* wellGeomDef = nullptr;
|
RimWellPathGeometryDef* wellGeomDef = nullptr;
|
||||||
targets[0]->firstAncestorOrThisOfTypeAsserted(wellGeomDef);
|
firstTarget->firstAncestorOrThisOfTypeAsserted(wellGeomDef);
|
||||||
|
|
||||||
wellGeomDef->insertTarget(targets[0], new RimWellPathTarget);
|
RimWellPathTarget* duplicate = dynamic_cast<RimWellPathTarget*>(firstTarget->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||||
|
wellGeomDef->insertTarget(firstTarget, duplicate);
|
||||||
wellGeomDef->updateConnectedEditors();
|
wellGeomDef->updateConnectedEditors();
|
||||||
wellGeomDef->updateWellPathVisualization();
|
wellGeomDef->updateWellPathVisualization();
|
||||||
return;
|
return;
|
||||||
@@ -76,7 +78,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
RimWellPathGeometryDef* wellGeomDef = geomDefs[0];
|
RimWellPathGeometryDef* wellGeomDef = geomDefs[0];
|
||||||
|
|
||||||
wellGeomDef->insertTarget(nullptr, new RimWellPathTarget);
|
wellGeomDef->appendTarget();
|
||||||
wellGeomDef->updateConnectedEditors();
|
wellGeomDef->updateConnectedEditors();
|
||||||
wellGeomDef->updateWellPathVisualization();
|
wellGeomDef->updateWellPathVisualization();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,29 @@ void RimWellPathGeometryDef::deleteTarget(RimWellPathTarget* targetTodelete)
|
|||||||
delete targetTodelete;
|
delete targetTodelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathGeometryDef::appendTarget()
|
||||||
|
{
|
||||||
|
RimWellPathTarget* wellPathTarget = nullptr;
|
||||||
|
|
||||||
|
auto targets = m_wellTargets.childObjects();
|
||||||
|
if (targets.empty())
|
||||||
|
{
|
||||||
|
wellPathTarget = new RimWellPathTarget;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wellPathTarget = dynamic_cast<RimWellPathTarget*>(targets.back()->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wellPathTarget)
|
||||||
|
{
|
||||||
|
m_wellTargets.push_back(wellPathTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
|
|
||||||
void insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert);
|
void insertTarget(RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert);
|
||||||
void deleteTarget(RimWellPathTarget* targetTodelete);
|
void deleteTarget(RimWellPathTarget* targetTodelete);
|
||||||
|
void appendTarget();
|
||||||
|
|
||||||
|
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user