Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotSourceStepping::applyNextCase()
{
    RimProject* proj = RiaApplication::instance()->project();

    auto summaryCases = proj->allSummaryCases();
    if (summaryCases.size() < 1) return;

    auto currentCase = std::find(summaryCases.begin(), summaryCases.end(), m_summaryCase());

    if (currentCase != summaryCases.end())
    {
        currentCase++;
        if (currentCase != summaryCases.end())
        {
            m_summaryCase = *currentCase;
        }
    }
    else
    {
        m_summaryCase = summaryCases[0];
    }

    fieldChangedByUi(&m_summaryCase, QVariant(), QVariant());
    m_summaryCase.uiCapability()->updateConnectedEditors();

    RimSummaryCurveCollection* curveCollection = nullptr;
    this->firstAncestorOrThisOfTypeAsserted(curveCollection);

    curveCollection->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
{
    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
    CVF_ASSERT(mainPlotColl);

    RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
    CVF_ASSERT(summaryPlotColl);

    RimSummaryCase* summaryCase = nullptr;
    std::vector<RimSummaryCase*> selection;
    caf::SelectionManager::instance()->objectsByType(&selection);
    if (selection.size() == 1)
    {
        summaryCase = selection[0];
    }
    else
    {
        std::vector<RimSummaryCase*> cases;
        project->allSummaryCases(cases);
        if (cases.size() > 0)
        {
            summaryCase = cases[0];
        }
    }

    createNewSummaryPlot(summaryPlotColl, summaryCase);
}
Exemplo n.º 3
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
{
    std::set<std::string> summaryWellNames;
    RimProject*           proj = RiaApplication::instance()->project();

    std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
    for (RimSummaryCase* rimCase : cases)
    {
        RifSummaryReaderInterface* reader = nullptr;
        if (rimCase)
        {
            reader = rimCase->summaryReader();
        }

        if (reader)
        {
            const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();

            for (size_t i = 0; i < allAddresses.size(); i++)
            {
                if (allAddresses[i].category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    summaryWellNames.insert(allAddresses[i].wellName());
                }
            }
        }
    }
    return summaryWellNames;
}
Exemplo n.º 4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> optionList = this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
    if (!optionList.isEmpty()) return optionList;


    if (fieldNeedingOptions == &m_summaryCase)
    {
        RimProject* proj = RiaApplication::instance()->project();
        std::vector<RimSummaryCase*> cases;

        proj->allSummaryCases(cases);

        for (size_t i = 0; i < cases.size(); i++)
        {
            RimSummaryCase* rimCase = cases[i];

            optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
        }

        if (optionList.size() > 0)
        {
            optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
        }
    }
    else if(fieldNeedingOptions == &m_uiFilterResultSelection)
    {
        if(m_summaryCase)
        {
            RifReaderEclipseSummary* reader = summaryReader();
            int addressCount = 0;
            if(reader)
            {
                const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
                addressCount = static_cast<int>(allAddresses.size());
                std::map<RifEclipseSummaryAddress, int> addrToIdxMap;
                for(int i = 0; i <addressCount; i++)
                {
                    if (!m_summaryFilter->isIncludedByFilter(allAddresses[i] )) continue;
                    addrToIdxMap[allAddresses[i]] = i;
                }

                for (const auto& addrIntPair: addrToIdxMap)
                {
                    std::string name = addrIntPair.first.uiText();
                    QString s = QString::fromStdString(name);
                    optionList.push_back(caf::PdmOptionItemInfo(s, addrIntPair.second));
                }
            }

            optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), addressCount));

            if(useOptionsOnly) *useOptionsOnly = true;
        }
    }
    return optionList;

}
Exemplo n.º 5
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RicSummaryCurveCreator::getAllSummaryCaseNames()
{
    std::set<std::string> summaryCaseHashes;
    RimProject*           proj = RiaApplication::instance()->project();

    std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
    for (RimSummaryCase* rimCase : cases)
    {
        summaryCaseHashes.insert(rimCase->summaryHeaderFilename().toUtf8().constData());
    }

    return summaryCaseHashes;
}
Exemplo n.º 6
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimSummaryPlotSourceStepping::computeVisibleFieldsAndSetFieldVisibility()
{
    m_summaryCase.uiCapability()->setUiHidden(true);
    m_wellName.uiCapability()->setUiHidden(true);
    m_wellGroupName.uiCapability()->setUiHidden(true);
    m_region.uiCapability()->setUiHidden(true);
    m_quantity.uiCapability()->setUiHidden(true);

    std::vector<caf::PdmFieldHandle*> fields;

    auto sumCases = summaryCasesCurveCollection();
    if (sumCases.size() == 1)
    {
        RimProject* proj = RiaApplication::instance()->project();
        if (proj->allSummaryCases().size() > 1)
        {
            m_summaryCase = *(sumCases.begin());

            m_summaryCase.uiCapability()->setUiHidden(false);

            fields.push_back(&m_summaryCase);
        }
    }

    RiaSummaryCurveAnalyzer analyzer;
    analyzer.appendAdresses(addressesCurveCollection());

    RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID;
    {
        if (analyzer.categories().size() == 1)
        {
            category = *(analyzer.categories().begin());
        }
    }

    if (category != RifEclipseSummaryAddress::SUMMARY_INVALID)
    {
        if (analyzer.wellNames().size() == 1)
        {
            QString txt = QString::fromStdString(*(analyzer.wellNames().begin()));
            m_wellName  = txt;
            m_wellName.uiCapability()->setUiHidden(false);

            fields.push_back(&m_wellName);
        }

        if (analyzer.wellGroupNames().size() == 1)
        {
            QString txt     = QString::fromStdString(*(analyzer.wellGroupNames().begin()));
            m_wellGroupName = txt;
            m_wellGroupName.uiCapability()->setUiHidden(false);

            fields.push_back(&m_wellGroupName);
        }

        if (analyzer.regionNumbers().size() == 1)
        {
            m_region = *(analyzer.regionNumbers().begin());
            m_region.uiCapability()->setUiHidden(false);

            fields.push_back(&m_region);
        }

        if (analyzer.quantities().size() == 1)
        {
            QString txt = QString::fromStdString(*(analyzer.quantities().begin()));
            m_quantity  = txt;
            m_quantity.uiCapability()->setUiHidden(false);

            fields.push_back(&m_quantity);
        }
    }

    return fields;
}
Exemplo n.º 7
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryPlotSourceStepping::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
                                                                                  bool*                      useOptionsOnly)
{
    if (fieldNeedingOptions == &m_placeholderForLabel)
    {
        return QList<caf::PdmOptionItemInfo>();
    }

    if (fieldNeedingOptions == &m_summaryCase)
    {
        QList<caf::PdmOptionItemInfo> options;

        RimProject* proj = RiaApplication::instance()->project();
        for (auto sumCase : proj->allSummaryCases())
        {
            options.append(caf::PdmOptionItemInfo(sumCase->caseName(), sumCase));
        }

        return options;
    }

    std::vector<QString> identifierTexts;

    RifSummaryReaderInterface* reader = firstSummaryReaderForCurves();
    if (reader)
    {
        RiaSummaryCurveAnalyzer* analyzer = analyzerForReader(reader);

        if (fieldNeedingOptions == &m_wellName)
        {
            identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL);
        }
        else if (fieldNeedingOptions == &m_region)
        {
            identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_REGION);
        }
        else if (fieldNeedingOptions == &m_wellGroupName)
        {
            identifierTexts = analyzer->identifierTexts(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP);
        }
        else if (fieldNeedingOptions == &m_quantity)
        {
            RimSummaryCurveCollection* curveCollection = nullptr;
            this->firstAncestorOrThisOfTypeAsserted(curveCollection);

            RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD;

            if (curveCollection->curves().size() > 0)
            {
                category = curveCollection->curves()[0]->summaryAddressY().category();
            }

            RiaSummaryCurveAnalyzer quantityAnalyzer;

            auto subset = RiaSummaryCurveAnalyzer::addressesForCategory(reader->allResultAddresses(), category);

            quantityAnalyzer.appendAdresses(subset);
            for (const auto& quantity : quantityAnalyzer.quantities())
            {
                identifierTexts.push_back(QString::fromStdString(quantity));
            }
        }
    }

    QList<caf::PdmOptionItemInfo> options;
    if (identifierTexts.size() > 0)
    {
        for (const auto& text : identifierTexts)
        {
            options.append(caf::PdmOptionItemInfo(text, text));
        }
    }
    else
    {
        options.push_back(caf::PdmOptionItemInfo("None", "None"));
    }

    return options;
}