From 3a5247e357b45522ecb231023dd73c9aff9f798f Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 31 Jan 2017 15:54:04 +0100 Subject: [PATCH] #1147 - pre-proto - Adding index number to names for new fractures --- .../Commands/RicNewSimWellFractureAtPosFeature.cpp | 7 ++++++- .../Commands/RicNewSimWellFractureFeature.cpp | 9 +++++++-- .../Commands/RicNewWellPathFractureAtPosFeature.cpp | 8 +++++++- .../Commands/RicNewWellPathFractureFeature.cpp | 8 ++++++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp index 99fcd204a7..928652060b 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureAtPosFeature.cpp @@ -74,13 +74,18 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked) RimSimWellFracture* fracture = new RimSimWellFracture(); fractureCollection->simwellFractures.push_back(fracture); - fracture->name = "Simulation Well Fracture"; fracture->setClosestWellCoord(simWellItem->m_domainCoord, simWellItem->m_branchIndex); RimOilField* oilfield = nullptr; objHandle->firstAncestorOrThisOfType(oilfield); if (!oilfield) return; + std::vector oldFractures; + oilfield->descendantsIncludingThisOfType(oldFractures); + QString fracNum = QString("%1").arg(oldFractures.size(), 2, 10, QChar('0')); + + fracture->name = QString("Fracture_") + fracNum; + if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0) { RimEllipseFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0]; diff --git a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp index c3c44a8db4..2949e83ca2 100644 --- a/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp +++ b/ApplicationCode/Commands/RicNewSimWellFractureFeature.cpp @@ -60,12 +60,17 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked) RimSimWellFracture* fracture = new RimSimWellFracture(); fractureCollection->simwellFractures.push_back(fracture); - - fracture->name = "Simulation Well Fracture"; + RimOilField* oilfield = nullptr; objHandle->firstAncestorOrThisOfType(oilfield); if (!oilfield) return; + std::vector oldFractures; + oilfield->descendantsIncludingThisOfType(oldFractures); + QString fracNum = QString("%1").arg(oldFractures.size(), 2, 10, QChar('0')); + + fracture->name = QString("Fracture_") + fracNum; + if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0) { RimEllipseFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0]; diff --git a/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp b/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp index 894d2a3047..c31c5c1292 100644 --- a/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp +++ b/ApplicationCode/Commands/RicNewWellPathFractureAtPosFeature.cpp @@ -80,13 +80,19 @@ void RicNewWellPathFractureAtPosFeature::onActionTriggered(bool isChecked) RimWellPathFracture* fracture = new RimWellPathFracture(); fractureCollection->fractures.push_back(fracture); - fracture->name = "Well Path Fracture"; fracture->setAnchorPosition(wellPathItem->m_pipeCenterlineIntersectionInDomainCoords); fracture->measuredDepth = wellPathItem->m_measuredDepth; RimOilField* oilfield = nullptr; objHandle->firstAncestorOrThisOfType(oilfield); if (!oilfield) return; + + std::vector oldFractures; + oilfield->descendantsIncludingThisOfType(oldFractures); + QString fracNum = QString("%1").arg(oldFractures.size(), 2, 10, QChar('0')); + + fracture->name = QString("Fracture_") + fracNum; + if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0) { diff --git a/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp b/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp index b3972dadfb..c7e500b494 100644 --- a/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationCode/Commands/RicNewWellPathFractureFeature.cpp @@ -62,8 +62,6 @@ void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked) RimWellPathFracture* fracture = new RimWellPathFracture(); fractureCollection->fractures.push_back(fracture); - fracture->name = "Well Path Fracture"; - float md_default = 0.0f; fracture->measuredDepth = md_default; @@ -79,6 +77,12 @@ void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked) objHandle->firstAncestorOrThisOfType(oilfield); if (!oilfield) return; + std::vector oldFractures; + oilfield->descendantsIncludingThisOfType(oldFractures); + QString fracNum = QString("%1").arg(oldFractures.size(), 2, 10, QChar('0')); + + fracture->name = QString("Fracture_") + fracNum; + if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0) { RimEllipseFractureTemplate* fracDef = oilfield->fractureDefinitionCollection->fractureDefinitions[0];