Пример #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (changedField == &m_showCurve)
    {
        this->updateCurveVisibility(true);
        if (m_showCurve()) loadDataAndUpdate(true);
    }
    else if (changedField == &m_curveName)
    {
        m_customCurveName = m_curveName;
        updateCurveNameAndUpdatePlotLegendAndTitle();
    }
    else if (&m_curveColor == changedField
             || &m_curveThickness == changedField
             || &m_pointSymbol == changedField
             || &m_lineStyle == changedField
             || &m_symbolSkipPixelDistance == changedField
             || &m_curveInterpolation == changedField
             || &m_symbolSize == changedField
             || &m_symbolEdgeColor == changedField)
    {
        updateCurveAppearance();

        if (&m_pointSymbol == changedField)
        {
            m_symbolSize.uiCapability()->setUiReadOnly(m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE);
            m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly(m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE);
        }
        else if (&m_lineStyle == changedField)
        {
            m_curveThickness.uiCapability()->setUiReadOnly(m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE);
            m_curveInterpolation.uiCapability()->setUiReadOnly(m_lineStyle() == RiuQwtPlotCurve::STYLE_NONE);
        }
    }
    else if (changedField == &m_isUsingAutoName)
    {
        if (!m_isUsingAutoName)
        {
            m_customCurveName = createCurveAutoName();
        }

        updateCurveNameAndUpdatePlotLegendAndTitle();
    }
    else if (changedField == &m_showLegend)
    {
        updateLegendEntryVisibilityAndPlotLegend();
    }
    else if (changedField == &m_showErrorBars)
    {
        m_qwtPlotCurve->showErrorBars(m_showErrorBars);
        updateCurveAppearance();
    }
    RiuPlotMainWindowTools::refreshToolbars();
    if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
Пример #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (changedField == &m_showCurve)
    {
        this->updateCurveVisibility(true);
        if (m_showCurve()) loadDataAndUpdate(true);
    }
    else if (changedField == &m_curveName)
    {
        m_customCurveName = m_curveName;
        updateCurveNameAndUpdatePlotLegend();
    }
    else if (&m_curveColor == changedField
             || &m_curveThickness == changedField
             || &m_pointSymbol == changedField
             || &m_lineStyle == changedField
             || &m_symbolSkipPixelDistance == changedField
             || &m_curveInterpolation == changedField)
    {
        updateCurveAppearance();
    }
    else if (changedField == &m_isUsingAutoName)
    {
        if (!m_isUsingAutoName)
        {
            m_customCurveName = createCurveAutoName();
        }

        updateCurveNameAndUpdatePlotLegend();
    }
    else if (changedField == &m_showLegend)
    {
        updateLegendEntryVisibilityAndPlotLegend();
    }

    if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
Пример #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot)
{
    this->RimPlotCurve::updateCurvePresentation(updateParentPlot);

    if (isCurveVisible())
    {
        m_curveData = new RigWellLogCurveData;

        RimWellLogPlot* wellLogPlot;
        firstAncestorOrThisOfType(wellLogPlot);
        CVF_ASSERT(wellLogPlot);

        if (m_wellPath && m_wellLogFile)
        {
            RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData();
            if (wellLogFile)
            {
                std::vector<double> values = wellLogFile->values(m_wellLogChannnelName);
                std::vector<double> measuredDepthValues = wellLogFile->depthValues();

                if (wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
                {
                    bool canUseTvd = false;
                    if (wellLogFile->hasTvdChannel())
                    {
                        std::vector<double> tvdMslValues = wellLogFile->tvdMslValues();

                        if (values.size() == measuredDepthValues.size() && values.size() == tvdMslValues.size())
                        {
                            m_curveData->setValuesWithTVD(values, measuredDepthValues, tvdMslValues, wellLogFile->depthUnit(), false);
                            canUseTvd = true;
                        }
                    }

                    if (!canUseTvd)
                    {
                        RigWellPath* rigWellPath = m_wellPath->wellPathGeometry();
                        if (rigWellPath)
                        {
                            std::vector<double> trueVerticeldepthValues;

                            for (double measuredDepthValue : measuredDepthValues)
                            {
                                trueVerticeldepthValues.push_back(-rigWellPath->interpolatedPointAlongWellPath(measuredDepthValue).z());
                            }
                            if (values.size() == trueVerticeldepthValues.size() && values.size() == measuredDepthValues.size())
                            {
                                m_curveData->setValuesWithTVD(values, measuredDepthValues, trueVerticeldepthValues, wellLogFile->depthUnit(), false);
                                canUseTvd = true;
                            }
                        }
                    }

                    if (!canUseTvd)
                    {
                        if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning())
                        {
                            QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves is not possible without a well log path, and the LAS curve will be hidden in this mode.\n\n");
                            tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\"";

                            QMessageBox::warning(nullptr, "LAS curve without TVD", tmp);
                        }
                    }
                }
                else
                {
                    if (values.size() == measuredDepthValues.size())
                    {
                        m_curveData->setValuesAndMD(values, measuredDepthValues, wellLogFile->depthUnit(), false);
                    }
                }
            }

            if (m_isUsingAutoName)
            {
                m_qwtPlotCurve->setTitle(createCurveAutoName());
            }
        }

        RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
        if (wellLogPlot)
        {
            displayUnit = wellLogPlot->depthUnit();
        }
        if (wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
        {
            m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
        }
        else
        {
            m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
        }
        m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());

        updateZoomInParentPlot();

        if (m_parentQwtPlot) m_parentQwtPlot->replot();
    }
}