Exemple #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
    if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;

    RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
    RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();

    bool enable = true;

    if (selectedWellPath)
    {
        if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath))
        {
            return false;
        }
    }

    if (simWell != nullptr)
    {
        RimProject* proj = RiaApplication::instance()->project();
        QString simWellName = simWell->name();

        RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName);
        enable = wellPath != nullptr;
    }
    return enable;
}
Exemple #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
    {
        RimWellPath* wellPath;
        firstAncestorOrThisOfType(wellPath);
        if (wellPath)
        {
            if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
            {
                m_startMD.uiCapability()->setUiName("Start MD [m]");
                m_endMD.uiCapability()->setUiName("End MD [m]");
                m_diameter.uiCapability()->setUiName("Diameter [m]");
            }
            else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
            {
                m_startMD.uiCapability()->setUiName("Start MD [ft]");
                m_endMD.uiCapability()->setUiName("End MD [ft]");
                m_diameter.uiCapability()->setUiName("Diameter [ft]");
            }
        }
    }
    m_date.uiCapability()->setUiReadOnly(m_startOfHistory());

    uiOrdering.add(&m_startMD);
    uiOrdering.add(&m_endMD);
    uiOrdering.add(&m_diameter);
    uiOrdering.add(&m_skinFactor);
    uiOrdering.add(&m_startOfHistory);
    uiOrdering.add(&m_date);

    uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::defineEditorAttribute(const caf::PdmFieldHandle* field,
                                                QString                    uiConfigName,
                                                caf::PdmUiEditorAttribute* attribute)
{
    RimFracture::defineEditorAttribute(field, uiConfigName, attribute);

    if (field == &m_measuredDepth)
    {
        caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);

        if (myAttr)
        {
            RimWellPath* rimWellPath = nullptr;
            this->firstAncestorOrThisOfType(rimWellPath);
            if (!rimWellPath) return;

            RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry();
            if (!wellPathGeo) return;

            if (wellPathGeo->m_measuredDepths.size() > 2)
            {
                myAttr->m_minimum = wellPathGeo->m_measuredDepths.front();
                myAttr->m_maximum = wellPathGeo->m_measuredDepths.back();
            }
        }
    }
}
Exemple #4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimWellLogFile::readFile(QString* errorMessage)
{
    if (!m_wellLogDataFile.p())
    {
        m_wellLogDataFile = new RigWellLogFile;
    }

    m_name = QFileInfo(m_fileName).fileName();

    if (!m_wellLogDataFile->open(m_fileName, errorMessage))
    {
        m_wellLogDataFile = nullptr;
        return false;
    }

    m_wellName = m_wellLogDataFile->wellName();

    QDateTime date = RiaDateStringParser::parseDateString(m_wellLogDataFile->date());
    m_lasFileHasValidDate = isDateValid(date);
    if (m_lasFileHasValidDate)
    {
        m_date = date;
    }
    else if(!isDateValid(m_date()))
    {
        QMessageBox msgBox;

        QString message = QString("The LAS-file '%1' contains no recognizable date. Please assign a date in the LAS-file property panel")
                                .arg(m_name());
        msgBox.setText(message);
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.exec();

        m_date = DEFAULT_DATE_TIME;
    }

    m_wellLogChannelNames.deleteAllChildObjects();

    QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames();
    for (int logIdx = 0; logIdx < wellLogNames.size(); logIdx++)
    {
        RimWellLogFileChannel* wellLog = new RimWellLogFileChannel();
        wellLog->setName(wellLogNames[logIdx]);
        m_wellLogChannelNames.push_back(wellLog);
    }

    RimWellPath* wellPath;
    firstAncestorOrThisOfType(wellPath);
    if (wellPath)
    {
        if (wellPath->filepath().isEmpty())
        {
            wellPath->setName(m_wellName);
        }
    }

    return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellFracturePartMgr::appendFracturePerforationLengthParts(const RimEclipseView& activeView, cvf::ModelBasicList* model)
{
    if (!m_rimFracture->isChecked()) return;

    if (!m_rimFracture->fractureTemplate()) return;
    if (m_rimFracture->fractureTemplate()->orientationType() != RimFractureTemplate::ALONG_WELL_PATH) return;

    auto displayCoordTransform = activeView.displayCoordTransform();
    if (displayCoordTransform.isNull()) return;

    double characteristicCellSize = activeView.ownerCase()->characteristicCellSize();
    double wellPathRadius         = 1.0;

    {
        RimWellPath* rimWellPath = nullptr;
        m_rimFracture->firstAncestorOrThisOfType(rimWellPath);
        if (rimWellPath)
        {
            wellPathRadius = rimWellPath->wellPathRadius(characteristicCellSize);
        }
    }

    {
        RimSimWellInView* simWell = nullptr;
        m_rimFracture->firstAncestorOrThisOfType(simWell);
        if (simWell)
        {
            wellPathRadius = simWell->pipeRadius();
        }
    }

    std::vector<cvf::Vec3d> displayCoords =
        displayCoordTransform->transformToDisplayCoords(m_rimFracture->perforationLengthCenterLineCoords());

    if (!displayCoords.empty())
    {
        cvf::ref<RivObjectSourceInfo> objectSourceInfo  = new RivObjectSourceInfo(m_rimFracture);
        double                        perforationRadius = wellPathRadius * 1.2;
        cvf::Collection<cvf::Part>    parts;

        RivPipeGeometryGenerator geoGenerator;
        geoGenerator.cylinderWithCenterLineParts(
            &parts, displayCoords, RiaColorTables::wellPathComponentColors()[RiaDefines::PERFORATION_INTERVAL], perforationRadius);

        for (auto part : parts)
        {
            part->setSourceInfo(objectSourceInfo.p());
            model->addPart(part.p());
        }
    }
}
Exemple #6
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
double RimPerforationInterval::diameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
    RimWellPath* wellPath;
    firstAncestorOrThisOfTypeAsserted(wellPath);
    if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
    {
        return RiaEclipseUnitTools::feetToMeter(m_diameter());
    }
    else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
    {
        return RiaEclipseUnitTools::meterToFeet(m_diameter());
    }
    return m_diameter();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewWellLogFileCurveFeature::selectedWellPathWithLogFile() const
{
    std::vector<RimWellPath*> selection;
    caf::SelectionManager::instance()->objectsByType(&selection);
    if (selection.size() > 0)
    {
        RimWellPath* wellPath = selection[0];
        if (wellPath->m_wellLogFile())
        {
            return wellPath;
        }
    }

    return NULL;
}
Exemple #8
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setUnitSystemSpecificDefaults()
{
    RimWellPath* wellPath;
    firstAncestorOrThisOfType(wellPath);
    if (wellPath)
    {
        if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
        {
            m_diameter = 0.216;
        }
        else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
        {
            m_diameter = 0.709;
        }
    }
}
Exemple #9
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords()
{
    cvf::BoundingBox bb;

    RimWellPath* wellPath = nullptr;
    this->firstAncestorOrThisOfTypeAsserted(wellPath);

    RigWellPath* rigWellPath = wellPath->wellPathGeometry();
    if (rigWellPath)
    {
        bb.add(rigWellPath->interpolatedPointAlongWellPath(startMD()));
        bb.add(rigWellPath->interpolatedPointAlongWellPath(endMD()));
    }

    return bb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RimWellPathFracture::perforationLengthCenterLineCoords() const
{
    std::vector<cvf::Vec3d> wellPathCoords;

    RimWellPath* wellPath = nullptr;
    this->firstAncestorOrThisOfType(wellPath);
    if (wellPath && wellPath->wellPathGeometry())
    {
        double startMd = m_measuredDepth - perforationLength() / 2.0;
        double endMd   = m_measuredDepth + perforationLength() / 2.0;

        auto coordsAndMd = wellPath->wellPathGeometry()->clippedPointSubset(startMd, endMd);

        wellPathCoords = coordsAndMd.first;
    }

    return wellPathCoords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathFracture::wellAzimuthAtFracturePosition() const
{
    RimWellPath* wellPath = nullptr;
    this->firstAncestorOrThisOfType(wellPath);
    if (!wellPath) return cvf::UNDEFINED_DOUBLE;

    double wellPathAzimuth = 0.0;

    RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
    if (wellPathGeometry)
    {
        wellPathAzimuth = wellPathGeometry->wellPathAzimuthAngle(fracturePosition());
    }

    if (wellPathAzimuth < 0) wellPathAzimuth += 360;

    return wellPathAzimuth;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicWellPathDeleteFeature::onActionTriggered(bool isChecked)
{
    std::vector<RimWellPath*> objects;
    caf::SelectionManager::instance()->objectsByType(&objects);

    if (objects.size() == 0) return;

    RimWellPath* wellPath = objects[0];

    RimWellPathCollection* wellPathCollection = NULL;
    wellPath->firstAncestorOrThisOfType(wellPathCollection);

    wellPathCollection->removeWellPath(wellPath);;
    delete wellPath;

    wellPathCollection->uiCapability()->updateConnectedEditors();
    wellPathCollection->scheduleGeometryRegenAndRedrawViews();
}
Exemple #13
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Ric3dWellLogCurveViewerEventHandler::handleEvent(const RicViewerEventObject& eventObject)
{
    if (eventObject.m_partAndTriangleIndexPairs.empty()) return false;

    cvf::uint triangleIndex = cvf::UNDEFINED_UINT;

    const auto&      partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front();
    const cvf::Part* part                     = partAndTriangleIndexPair.first;

    const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
    if (sourceInfo)
    {
        Rim3dWellLogCurveCollection* curveCollection = dynamic_cast<Rim3dWellLogCurveCollection*>(sourceInfo->object());
        if (curveCollection)
        {
            RimWellPath* wellPath;
            curveCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
            QString wellPathName = wellPath->name();
            cvf::Vec3d closestPoint;
            double measuredDepthAtPoint;
            double valueAtPoint;
            Rim3dWellLogCurve* curve = curveCollection->checkForCurveIntersection(
                eventObject.m_globalIntersectionPoint, &closestPoint, &measuredDepthAtPoint, &valueAtPoint);
            if (curve)
            {
                RiuMainWindow::instance()->selectAsCurrentItem(curve);

                QString curveText;
                curveText += QString("Curve name : %1\n").arg(curve->name());;
                curveText += QString("Well path name: %1\n").arg(wellPathName);
                curveText += QString("Measured depth: %1\n").arg(measuredDepthAtPoint);
                curveText += QString("%1 at depth: %2\n").arg(curve->resultPropertyString()).arg(valueAtPoint);

                RiuMainWindow::instance()->setResultInfo(curveText);
            }
            else
            {
                RiuMainWindow::instance()->selectAsCurrentItem(curveCollection);
            }
            return true;
        }
    }
    return false;
}
Exemple #14
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered(bool isChecked)
{
    RimProject* proj = RiaApplication::instance()->project();

    RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
    if (pltPlotColl)
    {
        QString wellPathName;
        RimWellPath* wellPath = nullptr;
        RimSimWellInView* eclipseWell = nullptr;

        if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr)
        {
            wellPathName = wellPath->name();
        }
        else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr)
        {
            RimWellPath* wellPath = proj->wellPathFromSimWellName(eclipseWell->name());
            if (!wellPath ) return;

            wellPathName = wellPath->name();
        }

        QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName);

        RimWellPltPlot* pltPlot = new RimWellPltPlot();
        pltPlot->setCurrentWellName(wellPathName);

        RimWellLogTrack* plotTrack = new RimWellLogTrack();
        pltPlot->wellLogPlot()->addTrack(plotTrack);
        plotTrack->setDescription(QString("Track %1").arg(pltPlot->wellLogPlot()->trackCount()));

        pltPlotColl->addPlot(pltPlot);
        pltPlot->setDescription(plotName);

        //pltPlot->applyInitialSelections();
        pltPlot->loadDataAndUpdate();
        pltPlotColl->updateConnectedEditors();

        RiuPlotMainWindowTools::showPlotMainWindow();
        RiuPlotMainWindowTools::setExpanded(plotTrack);
        RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot);
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::updatePositionFromMeasuredDepth()
{
    cvf::Vec3d positionAlongWellpath = cvf::Vec3d::ZERO;

    caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(this);
    if (!objHandle) return;

    RimWellPath* wellPath = nullptr;
    objHandle->firstAncestorOrThisOfType(wellPath);
    if (!wellPath) return;

    RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
    if (wellPathGeometry)
    {
        positionAlongWellpath = wellPathGeometry->interpolatedPointAlongWellPath(m_measuredDepth());
    }

    this->setAnchorPosition(positionAlongWellpath);
}
Exemple #16
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RimWellLogFile* RimWellPathCollection::addWellLogs(const QStringList& filePaths)
{
    RimWellLogFile* logFileInfo = nullptr;

    foreach (QString filePath, filePaths)
    {
        logFileInfo = RimWellLogFile::readWellLogFile(filePath);
        if (logFileInfo)
        {
            RimWellPath* wellPath = tryFindMatchingWellPath(logFileInfo->wellName());
            if (!wellPath)
            {
                wellPath = new RimWellPath();
                wellPaths.push_back(wellPath);
            }

            wellPath->addWellLogFile(logFileInfo);
        }
    }
Exemple #17
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray)
{
    caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file");

    const caf::ColorTable& colorTable = RiaColorTables::wellLogPlotPaletteColors();
    cvf::Color3ubArray wellColors = colorTable.color3ubArray();
    cvf::Color3ubArray interpolatedWellColors = wellColors;

    if (wellPathArray.size() > 1)
    {
        interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellPathArray.size());
    }

    for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++)
    {
        RimWellPath* wellPath = wellPathArray[wpIdx];
        wellPath->readWellPathFile(nullptr, m_wellPathImporter);

        progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name()));

        // If a well path with this name exists already, make it read the well path file
        RimWellPath* existingWellPath = tryFindMatchingWellPath(wellPath->name());
        if (existingWellPath)
        {
            existingWellPath->filepath = wellPath->filepath;
            existingWellPath->wellPathIndexInFile = wellPath->wellPathIndexInFile;
            existingWellPath->readWellPathFile(nullptr, m_wellPathImporter);

            // Let name from well path file override name from well log file
            existingWellPath->setName(wellPath->name());

            m_mostRecentlyUpdatedWellPath = existingWellPath;
            delete wellPath;
        }
        else
        {
            wellPath->wellPathColor = cvf::Color3f(interpolatedWellColors[wpIdx]);
            wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath));
            m_mostRecentlyUpdatedWellPath = wellPath;
            wellPaths.push_back(wellPath);
        }

        progress.incrementProgress();
    }

    this->sortWellsByName();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked)
{
    RimWellLogTrack* wellLogPlotTrack = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellLogTrack>();
    if (wellLogPlotTrack)
    {
        RicWellLogTools::addFileCurve(wellLogPlotTrack);
    }
    else
    {
        RimWellPath* wellPath = RicWellLogTools::selectedWellPathWithLogFile();
        if (wellPath)
        {
            RimWellLogTrack* newWellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
            RimWellLogFileCurve* plotCurve = RicWellLogTools::addFileCurve(newWellLogPlotTrack);
            plotCurve->setWellPath(wellPath);

            if (wellPath->wellLogFiles().size() == 1)
            {
                plotCurve->setWellLogFile(wellPath->wellLogFiles().front());
            }
            plotCurve->updateConnectedEditors();
        }
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isChecked)
{
    RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
    CVF_ASSERT(wellPathSelItem);

    RimWellPath* wellPath = wellPathSelItem->m_wellpath;
    CVF_ASSERT(wellPath);

    if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
    
    RimPerforationInterval* perforationInterval = new RimPerforationInterval;
    double measuredDepth = wellPathSelItem->m_measuredDepth;
    perforationInterval->setStartAndEndMD(measuredDepth, measuredDepth + 50);

    wellPath->perforationIntervalCollection()->appendPerforation(perforationInterval);

    RimWellPathCollection* wellPathCollection = nullptr;
    wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);

    wellPathCollection->uiCapability()->updateConnectedEditors();
    wellPathCollection->scheduleRedrawAffectedViews();

    Riu3DMainWindowTools::selectAsCurrentItem(perforationInterval);
}
    foreach (QString filePath, filePaths)
    {
        // Check if this file is already open
        bool alreadyOpen = false;
        for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
        {
            QFile f1;
            f1.setFileName(filePath);
            QString s1 = f1.fileName();
            QFile f2;
            f2.setFileName(wellPaths[wpIdx]->filepath());
            QString s2 = f2.fileName();
            if (s1 == s2)
            {
                //printf("Attempting to open well path JSON file that is already open:\n  %s\n", (const char*) filePath.toLocal8Bit());
                alreadyOpen = true;
                break;
            }
        }

        if (!alreadyOpen)
        {
            QFileInfo fi(filePath);

            if (fi.suffix().compare("json") == 0)
            {
                RimWellPath* wellPath = new RimWellPath();
                wellPath->setProject(m_project);
                wellPath->setCollection(this);
                wellPath->filepath = filePath;
                wellPaths.push_back(wellPath);
            }
            else
            {
                // Create Well path objects for all the paths in the assumed ascii file
                size_t wellPathCount = this->m_asciiFileReader->wellDataCount(filePath);
                for (size_t i = 0; i < wellPathCount; ++i)
                {
                    RimWellPath* wellPath = new RimWellPath();
                    wellPath->setProject(m_project);
                    wellPath->setCollection(this);
                    wellPath->filepath = filePath;
                    wellPath->wellPathIndexInFile = static_cast<int>(i);
                    wellPaths.push_back(wellPath);
                }
            }
        }
    }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathFracture::compareByWellPathNameAndMD(const RimWellPathFracture* lhs, const RimWellPathFracture* rhs)
{
    CVF_TIGHT_ASSERT(lhs && rhs);

    RimWellPath* lhsWellPath = nullptr;
    lhs->firstAncestorOrThisOfType(lhsWellPath);

    RimWellPath* rhsWellPath = nullptr;
    rhs->firstAncestorOrThisOfType(rhsWellPath);

    if (lhsWellPath && rhsWellPath)
    {
        if (lhsWellPath->name() != rhsWellPath->name())
        {
            return lhsWellPath->name() < rhsWellPath->name();
        }
    }

    return lhs->fractureMD() < rhs->fractureMD();
}
Exemple #22
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::createCurveAutoName() const
{
    RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
    RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());

    QStringList generatedCurveName;
    
    if (m_nameConfig->addWellName())
    {
        RimWellPath* wellPath;
        this->firstAncestorOrThisOfTypeAsserted(wellPath);
        if (!wellPath->name().isEmpty())
        {
            generatedCurveName += wellPath->name();
        }
    }

    if (m_nameConfig->addCaseName() && m_case())
    {
        generatedCurveName.push_back(m_case->caseUserDescription());
    }

    if (m_nameConfig->addProperty() && !resultPropertyString().isEmpty())
    {
        generatedCurveName.push_back(resultPropertyString());
    }

    if (m_nameConfig->addTimeStep() || m_nameConfig->addDate())
    {
        size_t maxTimeStep = 0;

        if (eclipseCase)
        {
            RigEclipseCaseData* data = eclipseCase->eclipseCaseData();
            if (data)
            {
                maxTimeStep = data->results(m_eclipseResultDefinition->porosityModel())->maxTimeStepCount();
            }
        }
        else if (geomCase)
        {
            RigGeoMechCaseData* data = geomCase->geoMechData();
            if (data)
            {
                maxTimeStep = data->femPartResults()->frameCount();
            }
        }

        if (m_nameConfig->addDate())
        {
            QString dateString = wellDate();
            if (!dateString.isEmpty())
            {
                generatedCurveName.push_back(dateString);
            }
        }

        if (m_nameConfig->addTimeStep())
        {
            generatedCurveName.push_back(QString("[%1/%2]").arg(m_timeStep()).arg(maxTimeStep));
        }
    }

    return generatedCurveName.join(", ");
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicDeleteItemExec::redo()
{
    caf::PdmFieldHandle* field = caf::PdmReferenceHelper::fieldFromReference(m_commandData->m_rootObject, m_commandData->m_pathToField);

    caf::PdmChildArrayFieldHandle* listField = dynamic_cast<caf::PdmChildArrayFieldHandle*>(field);
    if (listField)
    {
        std::vector<caf::PdmObjectHandle*> children;
        listField->childObjects(&children);

        caf::PdmObjectHandle* obj = children[m_commandData->m_indexToObject];
        caf::SelectionManager::instance()->removeObjectFromAllSelections(obj);

        std::vector<caf::PdmObjectHandle*> referringObjects;
        obj->objectsWithReferringPtrFields(referringObjects);

        if (m_commandData->m_deletedObjectAsXml().isEmpty())
        {
            m_commandData->m_deletedObjectAsXml = xmlObj(obj)->writeObjectToXmlString();
        }

        delete obj;

        listField->erase(m_commandData->m_indexToObject);

        caf::PdmObjectHandle* parentObj = listField->ownerObject();
        parentObj->uiCapability()->updateConnectedEditors();
        
        Rim3dView* view = nullptr;
        parentObj->firstAncestorOrThisOfType(view);

        // Range Filters

        RimCellRangeFilterCollection* rangeFilterColl;
        parentObj->firstAncestorOrThisOfType(rangeFilterColl);

        if (rangeFilterColl)
        {
            rangeFilterColl->updateDisplayModeNotifyManagedViews(nullptr);
        }

        // Prop Filter

        RimEclipsePropertyFilterCollection* eclipsePropColl;
        parentObj->firstAncestorOrThisOfType(eclipsePropColl);
        
        RimGeoMechPropertyFilterCollection* geoMechPropColl;
        parentObj->firstAncestorOrThisOfType(geoMechPropColl);

        if (view && (eclipsePropColl || geoMechPropColl))
        {
            view->scheduleGeometryRegen(PROPERTY_FILTERED);
            view->scheduleCreateDisplayModelAndRedraw();
        }

        // Intersections

        RimIntersectionCollection* crossSectionColl;
        parentObj->firstAncestorOrThisOfType(crossSectionColl);
        if (view && crossSectionColl)
        {
            crossSectionColl->syncronize2dIntersectionViews();
            view->scheduleCreateDisplayModelAndRedraw();
        }
        else
        {
            RimCase* parentCase = dynamic_cast<RimCase*>(parentObj);
            if ( parentCase ) // A view was deleted. Need to update the list of intersection views
            {
                parentCase->intersectionViewCollection()->syncFromExistingIntersections(true);
            }
        }

        // SimWell Fractures
        RimSimWellInView* simWell;
        parentObj->firstAncestorOrThisOfType(simWell);
        if (view && simWell)
        {
            view->scheduleCreateDisplayModelAndRedraw();
        }

        RimFractureTemplateCollection* fracTemplateColl;
        parentObj->firstAncestorOrThisOfType(fracTemplateColl);
        if (fracTemplateColl)
        {
            RimProject* proj = nullptr;
            parentObj->firstAncestorOrThisOfType(proj);
            if (proj)
            {
                proj->createDisplayModelAndRedrawAllViews();
            }

            std::vector<Rim3dView*> views;
            proj->allVisibleViews(views);
            for (Rim3dView* view : views)
            {
                if (dynamic_cast<RimEclipseView*>(view))
                {
                    view->updateConnectedEditors();
                }
            }
        }


        // Well paths

        RimWellPath* wellPath;
        parentObj->firstAncestorOrThisOfType(wellPath);

        if (wellPath)
        {
            wellPath->updateConnectedEditors();
        }

        RimWellPathCollection* wellPathColl;
        parentObj->firstAncestorOrThisOfType(wellPathColl);

        if (wellPathColl)
        {
            wellPathColl->scheduleRedrawAffectedViews();
            wellPathColl->uiCapability()->updateConnectedEditors();
        }

        // Update due to deletion of curves (not tracks, handled separatly)

        RimWellLogPlot* wellLogPlot;
        parentObj->firstAncestorOrThisOfType(wellLogPlot);
        if (wellLogPlot)
        {
            wellLogPlot->calculateAvailableDepthRange();
            wellLogPlot->updateDepthZoom();
        }

        RimWellLogTrack* wellLogPlotTrack;
        parentObj->firstAncestorOrThisOfType(wellLogPlotTrack);
        if (wellLogPlotTrack)
        {
            wellLogPlotTrack->updateXZoom();
        }
        
        // Update due to delete plots
        // Make sure the plot collection disappears with the last plot

        RimWellLogPlotCollection* wellLogPlotCollection = dynamic_cast<RimWellLogPlotCollection*>(parentObj);
        if (wellLogPlotCollection)
        {
            if (wellLogPlotCollection->wellLogPlots.empty())
            {
                RimProject* project = nullptr;
                parentObj->firstAncestorOrThisOfType(project);
                if (project)
                {
                    project->updateConnectedEditors();
                }
            }
        }
        
        // Linked views

        RimViewLinkerCollection* viewLinkerCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(viewLinkerCollection);
        if (viewLinkerCollection)
        {
            viewLinkerCollection->uiCapability()->updateConnectedEditors();

            RimProject* project = nullptr;
            parentObj->firstAncestorOrThisOfType(project);
            if (project)
            {
                // Update visibility of top level Linked Views item in the project tree
                // Not visible if no views are linked
                project->uiCapability()->updateConnectedEditors();
            }
        }

        // Formation names

        RimFormationNamesCollection* formationNamesCollection;
        parentObj->firstAncestorOrThisOfType(formationNamesCollection);
        if (formationNamesCollection)
        {
            for(caf::PdmObjectHandle* reffingObj :referringObjects)
            {
                RimCase* aCase = dynamic_cast<RimCase*>(reffingObj);
                if (aCase) aCase->updateFormationNamesData();
            }
        }


        RimSummaryPlotCollection* summaryPlotCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(summaryPlotCollection);
        if (summaryPlotCollection)
        {
            summaryPlotCollection->updateSummaryNameHasChanged();
            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }

        RimSummaryCrossPlotCollection* summaryCrossPlotCollection = nullptr;
        parentObj->firstAncestorOrThisOfType(summaryCrossPlotCollection);
        if (summaryCrossPlotCollection)
        {
            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }

        RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr;
        parentObj->firstAncestorOrThisOfType(ensembleCurveSetColl);
        if (ensembleCurveSetColl)
        {
            RimSummaryPlot* plot = nullptr;
            ensembleCurveSetColl->firstAncestorOrThisOfType(plot);
            if (plot) plot->updateConnectedEditors();
        }
    }
}