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 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);
    }
}