//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPropertyFilterCollection::updateDisplayModelNotifyManagedViews() const
{
    RimView* view = NULL;
    this->firstAncestorOrThisOfType(view);
    CVF_ASSERT(view);

    view->scheduleGeometryRegen(PROPERTY_FILTERED);
    view->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (changedField == &isActive)
    {
        RimView* rimView = NULL;
        firstAnchestorOrThisOfType(rimView);
        if (rimView)
        {
            rimView->scheduleCreateDisplayModelAndRedraw();
        }
    }
}
示例#3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimGridCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (changedField == &isActive)
    {
        RimView* rimView = NULL;
        this->firstAnchestorOrThisOfType(rimView);
        CVF_ASSERT(rimView);

        rimView->showGridCells(isActive);

        updateUiIconFromState(isActive);
    }
}
示例#4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimCellRangeFilter::isRangeFilterControlled()
{
    RimView* rimView = NULL;
    firstAncestorOrThisOfType(rimView);
    CVF_ASSERT(rimView);

    bool isRangeFilterControlled = false;
    if (rimView->viewController() && rimView->viewController()->isRangeFiltersControlled())
    {
        isRangeFilterControlled = true;
    }

    return isRangeFilterControlled;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::appendCrossSection(RimCrossSection* crossSection)
{
    m_crossSections.push_back(crossSection);

    updateConnectedEditors();
    RiuMainWindow::instance()->selectAsCurrentItem(crossSection);

    RimView* rimView = NULL;
    firstAnchestorOrThisOfType(rimView);
    if (rimView)
    {
        rimView->scheduleCreateDisplayModelAndRedraw();
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
{
    RimView* rimView = NULL;
    firstAncestorOrThisOfType(rimView);
    CVF_ASSERT(rimView);

    bool isPropertyFilterControlled = false;
    RimViewController* vc = rimView->viewController();
    if (vc && vc->isPropertyFilterOveridden())
    {
        isPropertyFilterControlled = true;
    }

    return isPropertyFilterControlled;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RicSetMasterViewFeature::isCommandEnabled()
{
    RimView* activeView = RiaApplication::instance()->activeReservoirView();
    if (!activeView) return false;

    RimProject* proj = RiaApplication::instance()->project();
    RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
    if (viewLinker && viewLinker->masterView() == activeView)
    {
        return false;
    }

    if (!proj->viewLinkerCollection()->viewLinker())
    {
        return false;
    }

    return true;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPropertyFilterCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
{
    PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);

    RimView* rimView = NULL;
    this->firstAncestorOrThisOfType(rimView);
    RimViewController* viewController = rimView->viewController();
    if (viewController && (viewController->isPropertyFilterOveridden() 
                           || viewController->isVisibleCellsOveridden()))
    {
        isActive.uiCapability()->setUiReadOnly(true, uiConfigName);
    }
    else
    {
        isActive.uiCapability()->setUiReadOnly(false, uiConfigName);
    }

    updateIconState();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked)
{
    RimView* activeView = RiaApplication::instance()->activeReservoirView();
    if (activeView)
    {
        RimIntersectionCollection* coll = activeView->crossSectionCollection();
        CVF_ASSERT(coll);

        RimIntersectionBox* intersectionBox = new RimIntersectionBox();
        intersectionBox->name = QString("Z-slice (Intersection box)");

        coll->appendIntersectionBox(intersectionBox);
        cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
        intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord);

        coll->updateConnectedEditors();
        RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);

        RimView* rimView = NULL;
        coll->firstAncestorOrThisOfType(rimView);
        if (rimView)
        {
            rimView->showGridCells(false);
            RiuMainWindow::instance()->refreshDrawStyleActions();

            rimView->scheduleCreateDisplayModelAndRedraw();
        }
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimCellRangeFilterCollection::updateDisplayModeNotifyManagedViews(RimCellRangeFilter* changedRangeFilter)
{
    RimView* view = NULL;
    firstAncestorOrThisOfType(view);

    if (view->isMasterView())
    {
        RimViewLinker* viewLinker = view->assosiatedViewLinker();
        if (viewLinker)
        {
            // Update data for range filter
            // Update of display model is handled by view->scheduleGeometryRegen, also for managed views
            viewLinker->updateRangeFilters(changedRangeFilter);
        }
    }

    view->scheduleGeometryRegen(RANGE_FILTERED);
    view->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);

    view->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if(&m_resultPositionTypeUiField == changedField)
    {
        std::map<std::string, std::vector<std::string> >  fieldCompNames = getResultMetaDataForUIFieldSetting();
        QStringList uiVarNames;
        QStringList varNames;
        getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);

        if (m_resultPositionTypeUiField() == m_resultPositionType()
            && varNames.contains(composeFieldCompString(m_resultFieldName(), m_resultComponentName())))
        {
            m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName());
        }
        else
        {
            m_resultVariableUiField = "";
        }

    }

    // Get the possible property filter owner
    RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>(this->parentField()->ownerObject());
    RimView* view = NULL;
    this->firstAnchestorOrThisOfType(view);
    RimWellLogCurve* curve = NULL;
    this->firstAnchestorOrThisOfType(curve);


    if (&m_resultVariableUiField == changedField)
    {
        QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));
        if (fieldComponentNames.size() > 0)
        {
            m_resultPositionType = m_resultPositionTypeUiField;
            m_resultFieldName = fieldComponentNames[0];
            if (fieldComponentNames.size() > 1)
            {
                m_resultComponentName = fieldComponentNames[1];
            }
            else
            {
                m_resultComponentName = "";
            }


            if (m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded(this->resultAddress()))
            {
                if (view) view->hasUserRequestedAnimation = true;
            }
            
            if (propFilter)
            {
                propFilter->setToDefaultValues();

                if (view) view->scheduleGeometryRegen(PROPERTY_FILTERED);
            }

            if (view) view->scheduleCreateDisplayModelAndRedraw();

            if (dynamic_cast<RimGeoMechCellColors*>(this))
            {
                if (view)
                {
                    RimViewLinker* viewLinker = view->assosiatedViewLinker();
                    if (viewLinker)
                    {
                        viewLinker->updateCellResult();
                    }
                }
            }

            if (curve)
            {
                curve->updatePlotData();
            }
        }
    }
      
    if (propFilter)
    {
        propFilter->updateConnectedEditors();
    }

    if (curve)
    {
        curve->updateConnectedEditors();
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    if (   &m_resultTypeUiField == changedField 
        || &m_porosityModelUiField == changedField )
    {
        QStringList varList = getResultVariableListForCurrentUIFieldSettings();

        // If the user are seeing the list with the actually selected result, select that result in the list. Otherwise select nothing.
        if (   m_resultTypeUiField() == m_resultType() 
            && m_porosityModelUiField() == m_porosityModel() 
            && varList.contains(resultVariable()))
        {
            m_resultVariableUiField = resultVariable();
        }
        else
        {
            m_resultVariableUiField = "";
        }

    }

    RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
    RimView* view = NULL;
    this->firstAnchestorOrThisOfType(view);
    RimWellLogCurve* curve = NULL;
    this->firstAnchestorOrThisOfType(curve);

    if (&m_resultVariableUiField == changedField)
    {
        m_porosityModel  = m_porosityModelUiField;
        m_resultType     = m_resultTypeUiField;
        m_resultVariable = m_resultVariableUiField;
        
        loadResult();

        if (propFilter)
        {
            propFilter->setToDefaultValues();
            propFilter->updateFilterName();

            if (view)
            {
                view->scheduleGeometryRegen(PROPERTY_FILTERED);
                view->scheduleCreateDisplayModelAndRedraw();
            }
        }

        if (dynamic_cast<RimEclipseCellColors*>(this))
        {
            if (view)
            {
                RimViewLinker* viewLinker = view->assosiatedViewLinker();
                if (viewLinker)
                {
                    viewLinker->updateCellResult();
                }
            }
        }

        if (curve) 
        {
            curve->updatePlotData();
        }
    }

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

    RimEclipseFaultColors* faultColors = dynamic_cast<RimEclipseFaultColors*>(this->parentField()->ownerObject());
    if (faultColors)
    {
        faultColors->updateConnectedEditors();
    }

    if (curve)
    {
        curve->updateConnectedEditors();
    }
 
}
示例#13
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCellColors* cellResultColors)
{
    CVF_ASSERT(cellResultColors);

    cvf::ref<cvf::Color3ubArray> surfaceFacesColorArray;

    // Outer surface
    if (m_surfaceFaces.notNull())
    {

        const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();

        RigGeoMechCaseData* caseData = cellResultColors->ownerCaseData();
        
        if (!caseData) return;

        RigFemResultAddress resVarAddress = cellResultColors->resultAddress();

        // Do a "Hack" to show elm nodal and not nodal POR results
        if (resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar") resVarAddress.resultPosType = RIG_ELEMENT_NODAL;

        const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, (int)timeStepIndex);

        const std::vector<size_t>* vxToResultMapping = NULL;

        if (resVarAddress.resultPosType == RIG_NODAL)
        {
            vxToResultMapping = &(m_surfaceGenerator.quadVerticesToNodeIdxMapping());
        }
        else if (   resVarAddress.resultPosType == RIG_ELEMENT_NODAL 
                 || resVarAddress.resultPosType == RIG_INTEGRATION_POINT)
        {
            vxToResultMapping = &(m_surfaceGenerator.quadVerticesToGlobalElmNodeIdx());
        }

        m_surfaceFacesTextureCoords->resize(vxToResultMapping->size());

        if (resultValues.size() == 0)
        {
            m_surfaceFacesTextureCoords->setAll(cvf::Vec2f(0.0, 1.0f));
        }
        else
        {
            cvf::Vec2f* rawPtr = m_surfaceFacesTextureCoords->ptr();

            int vxCount = static_cast<int>(vxToResultMapping->size());

            #pragma omp parallel for schedule(dynamic)
            for (int quadStartIdx = 0; quadStartIdx < vxCount; quadStartIdx += 4)
            {
                float resultValue1 = resultValues[(*vxToResultMapping)[quadStartIdx]];
                float resultValue2 = resultValues[(*vxToResultMapping)[quadStartIdx + 1]];
                float resultValue3 = resultValues[(*vxToResultMapping)[quadStartIdx + 2]];
                float resultValue4 = resultValues[(*vxToResultMapping)[quadStartIdx + 3]];

                if (    resultValue1 == HUGE_VAL || resultValue1 != resultValue1    // a != a is true for NAN's
                    ||  resultValue2 == HUGE_VAL || resultValue2 != resultValue2 
                    ||  resultValue3 == HUGE_VAL || resultValue3 != resultValue3 
                    ||  resultValue4 == HUGE_VAL || resultValue4 != resultValue4)
                {
                    rawPtr[quadStartIdx][1]       = 1.0f;
                    rawPtr[quadStartIdx + 1][1]   = 1.0f;
                    rawPtr[quadStartIdx + 2][1]   = 1.0f;
                    rawPtr[quadStartIdx + 3][1]   = 1.0f;
                }
                else
                {
                    rawPtr[quadStartIdx]        = mapper->mapToTextureCoord(resultValue1);
                    rawPtr[quadStartIdx + 1]    = mapper->mapToTextureCoord(resultValue2);
                    rawPtr[quadStartIdx + 2]    = mapper->mapToTextureCoord(resultValue3);
                    rawPtr[quadStartIdx + 3]    = mapper->mapToTextureCoord(resultValue4);
                }
            }
        }

        RimView* view = NULL;
        cellResultColors->firstAnchestorOrThisOfType(view);
        CVF_ASSERT(view);

        RivScalarMapperUtils::applyTextureResultsToPart(m_surfaceFaces.p(), 
                                                        m_surfaceFacesTextureCoords.p(), 
                                                        mapper, 
                                                        m_opacityLevel, 
                                                        caf::FC_NONE, 
                                                        view->isLightingDisabled());
    }
}