//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
{
    RiaApplication* app = RiaApplication::instance();

    RiuMainPlotWindow* mainPlotWindow = app->mainPlotWindow();
    if (!mainPlotWindow) return;

    RimProject* proj = app->project();
    if (!proj) return;

    // Save images in snapshot catalog relative to project directory
    QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath("snapshots");

    QDir snapshotPath(snapshotFolderName);
    if (!snapshotPath.exists())
    {
        if (!snapshotPath.mkpath(".")) return;
    }

    const QString absSnapshotPath = snapshotPath.absolutePath();

    // Well log plots
    {
        std::vector<RimWellLogPlot*> wellLogPlots;
        proj->descendantsIncludingThisOfType(wellLogPlots);
        for (RimWellLogPlot* wellLogPlot : wellLogPlots)
        {
            if (wellLogPlot && wellLogPlot->viewWidget())
            {
                QString fileName = wellLogPlot->description();
                fileName.replace(" ", "_");

                QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");

                RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, wellLogPlot);
            }
        }
    }

    // Summary plots
    {
        std::vector<RimSummaryPlot*> summaryPlots;
        proj->descendantsIncludingThisOfType(summaryPlots);
        for (RimSummaryPlot* summaryPlot : summaryPlots)
        {
            if (summaryPlot && summaryPlot->viewWidget())
            {
                QString fileName = summaryPlot->description();
                fileName.replace(" ", "_");

                QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");

                RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, summaryPlot);
            }
        }
    }
}
示例#2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSimWellInViewCollection::updateWellAllocationPlots()
{
    RimProject* proj = RiaApplication::instance()->project();

    std::vector<RimWellAllocationPlot*> wellAllocationPlots;
    proj->descendantsIncludingThisOfType(wellAllocationPlots);

    for (auto wap : wellAllocationPlots)
    {
        wap->loadDataAndUpdate();
    }
}
示例#3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    bool createDisplayModelAndRedraw = false;
    if (changedField == &m_azimuthAngle || changedField == &m_orientationType)
    {
        //Changes to one of these parameters should change all fractures with this fracture template attached. 
        RimProject* proj;
        this->firstAncestorOrThisOfType(proj);
        if (proj)
        {
            //Regenerate geometry
            std::vector<RimFracture*> fractures;
            proj->descendantsIncludingThisOfType(fractures);

            for (RimFracture* fracture : fractures)
            {
                if (fracture->fractureTemplate() == this)
                {
                    if (changedField == &m_azimuthAngle && (fabs(oldValue.toDouble() - fracture->m_azimuth()) < 1e-5))
                    {
                        fracture->m_azimuth = m_azimuthAngle;
                    }

                    if (changedField == &m_orientationType)
                    {
                        if (newValue == AZIMUTH)
                        {
                            fracture->m_azimuth = m_azimuthAngle;
                        }
                        else fracture->updateAzimuthBasedOnWellAzimuthAngle();
                    }
                }
            }

            createDisplayModelAndRedraw = true;
        }
    }

    if (changedField == &m_perforationLength || changedField == &m_perforationEfficiency || changedField == &m_wellDiameter)
    {
        RimProject* proj;
        this->firstAncestorOrThisOfType(proj);
        if (!proj) return;
        std::vector<RimFracture*> fractures;
        proj->descendantsIncludingThisOfType(fractures);

        for (RimFracture* fracture : fractures)
        {
            if (fracture->fractureTemplate() == this)
            {
                if (changedField == &m_perforationLength && (fabs(oldValue.toDouble() - fracture->m_perforationLength()) < 1e-5))
                {
                    fracture->m_perforationLength = m_perforationLength;
                }
                if (changedField == &m_perforationEfficiency && (fabs(oldValue.toDouble() - fracture->m_perforationEfficiency()) < 1e-5))
                {
                    fracture->m_perforationEfficiency = m_perforationEfficiency;
                }
                if (changedField == &m_wellDiameter && (fabs(oldValue.toDouble() - fracture->m_wellDiameter()) < 1e-5))
                {
                    fracture->m_wellDiameter = m_wellDiameter;
                }
            }
        }
    }

    if (changedField == &m_perforationLength)
    {
        createDisplayModelAndRedraw = true;
    }

    if (createDisplayModelAndRedraw)
    {
        RimProject* proj;
        this->firstAncestorOrThisOfType(proj);
        if (proj)
        {
            proj->reloadCompletionTypeResultsInAllViews();
        }
    }
}