//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
    RicCreateMultipleFracturesOptionItemUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
                                                                  bool*                      useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> options;

    RimProject* proj = RiaApplication::instance()->project();
    CVF_ASSERT(proj);

    if (fieldNeedingOptions == &m_fractureTemplate)
    {
        RimOilField* oilField = proj->activeOilField();
        if (oilField && oilField->fractureDefinitionCollection())
        {
            RimFractureTemplateCollection* fracDefColl = oilField->fractureDefinitionCollection();

            for (RimFractureTemplate* fracDef : fracDefColl->fractureTemplates())
            {
                QString displayText = fracDef->nameAndUnit();

                options.push_back(caf::PdmOptionItemInfo(displayText, fracDef));
            }
        }
    }

    return options;
}
Beispiel #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked)
{
    RiaApplication* app = RiaApplication::instance();
    QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
    QString fileName = QFileDialog::getOpenFileName(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)");

    if (fileName.isEmpty()) return;

    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimOilField* oilfield = project->activeOilField();
    if (oilfield == nullptr) return;

    RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();

    if (fracDefColl)
    {
        RimStimPlanFractureTemplate* fractureDef = new RimStimPlanFractureTemplate();
        fracDefColl->addFractureTemplate(fractureDef);

        QFileInfo stimplanfileFileInfo(fileName);
        QString name = stimplanfileFileInfo.baseName();
        if (name.isEmpty())
        {
            name = "StimPlan Fracture Template";
        }

        fractureDef->setName(name);

        fractureDef->setFileName(fileName);
        fractureDef->loadDataAndUpdate();
        fractureDef->setDefaultsBasedOnXMLfile();
        fractureDef->setDefaultWellDiameterFromUnit();
        fractureDef->updateFractureGrid();

        fracDefColl->updateConnectedEditors();

        std::vector<Rim3dView*> views;
        project->allVisibleViews(views);

        for (Rim3dView* view : views)
        {
            if (dynamic_cast<RimEclipseView*>(view))
            {
                view->updateConnectedEditors();
            }
        }

        Riu3DMainWindowTools::selectAsCurrentItem(fractureDef);
    }
}