Exemple #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::updateFormationNamesData()
{
    RigGeoMechCaseData* rigCaseData = geoMechData();
    if(rigCaseData && rigCaseData->femPartResults())
    {
        if(activeFormationNames())
        {
            rigCaseData->femPartResults()->setActiveFormationNames(activeFormationNames()->formationNamesData());
        }
        else
        {
            rigCaseData->femPartResults()->setActiveFormationNames(nullptr);
        }

        std::vector<Rim3dView*> views = this->views();
        for(Rim3dView* view : views)
        {
            RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(view);

            if ( geomView && geomView->isUsingFormationNames() )
            {
                if ( !activeFormationNames() )
                {
                    if ( geomView->cellResult()->resultPositionType() == RIG_FORMATION_NAMES )
                    {
                        geomView->cellResult()->setResultAddress(RigFemResultAddress(RIG_FORMATION_NAMES, "", ""));
                        geomView->cellResult()->updateConnectedEditors();
                    }

                    RimGeoMechPropertyFilterCollection* eclFilColl = geomView->geoMechPropertyFilterCollection();
                    for ( RimGeoMechPropertyFilter* propFilter : eclFilColl->propertyFilters )
                    {
                        if ( propFilter->resultDefinition()->resultPositionType() == RIG_FORMATION_NAMES )
                        {
                            propFilter->resultDefinition()->setResultAddress(RigFemResultAddress(RIG_FORMATION_NAMES, "", ""));
                        }
                    }
                }

                RimGeoMechPropertyFilterCollection* eclFilColl = geomView->geoMechPropertyFilterCollection();
                for ( RimGeoMechPropertyFilter* propFilter : eclFilColl->propertyFilters )
                {
                    if ( propFilter->resultDefinition->resultPositionType() == RIG_FORMATION_NAMES )
                    {
                        propFilter->setToDefaultValues();
                        propFilter->updateConnectedEditors();
                    }
                }

                geomView->cellResult()->updateConnectedEditors();

                view->scheduleGeometryRegen(PROPERTY_FILTERED);
                view->scheduleCreateDisplayModelAndRedraw();
                geomView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
            }
        }
    }
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RicGeoMechPropertyFilterNewInViewFeature::isCommandEnabled()
{
    Rim3dView* view = RiaApplication::instance()->activeReservoirView();
    if (!view) return false;
    
    RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
    if (!geoMechView) return false;

    RimGeoMechCellColors* cellColors = geoMechView->cellResult().p();
    if (!cellColors) return false;

    RimGeoMechPropertyFilterCollection* filterCollection = geoMechView->geoMechPropertyFilterCollection();
    if (filterCollection)
    {
        return RicGeoMechPropertyFilterFeatureImpl::isPropertyFilterCommandAvailable(filterCollection);
    }

    return false;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicGeoMechPropertyFilterNewInViewFeature::onActionTriggered(bool isChecked)
{
    Rim3dView* view = RiaApplication::instance()->activeReservoirView();
    if (!view) return;
    RimGeoMechView* eclView = dynamic_cast<RimGeoMechView*>(view);
    if (!eclView) return;

    RicGeoMechPropertyFilterNewExec* filterExec = new RicGeoMechPropertyFilterNewExec(eclView->geoMechPropertyFilterCollection());
    caf::CmdExecCommandManager::instance()->processExecuteCommand(filterExec);
}