예제 #1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RimGeoMechView* RimGeoMechCase::createAndAddReservoirView()
{
    RimGeoMechView* gmv = new RimGeoMechView();
    size_t i = geoMechViews().size();
    gmv->name = QString("View %1").arg(i + 1);
    
    gmv->setGeoMechCase(this);

    geoMechViews.push_back(gmv);
    return gmv;
}
예제 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimGeoMechCase::initAfterRead()
{
    size_t j;
    for (j = 0; j < geoMechViews().size(); j++)
    {
        RimGeoMechView* riv = geoMechViews()[j];
        CVF_ASSERT(riv);

        riv->setGeoMechCase(this);
    }

}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicPasteGeoMechViewsFeature::onActionTriggered(bool isChecked)
{
    caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>(caf::SelectionManager::instance()->selectedItem());

    RimGeoMechCase* geomCase = RicPasteFeatureImpl::findGeoMechCase(destinationObject);
    assert(geomCase);

    caf::PdmObjectGroup objectGroup;
    RicPasteFeatureImpl::findObjectsFromClipboardRefs(&objectGroup);

    if (objectGroup.objects.size() == 0) return;

    std::vector<caf::PdmPointer<RimGeoMechView> > geomViews;
    objectGroup.objectsByType(&geomViews);

    RimGeoMechView* lastViewCopy = nullptr;

    // Add cases to case group
    for (size_t i = 0; i < geomViews.size(); i++)
    {
        RimGeoMechView* rimReservoirView = dynamic_cast<RimGeoMechView*>(geomViews[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
        QString nameOfCopy = QString("Copy of ") + rimReservoirView->name();
        rimReservoirView->setName(nameOfCopy);
        geomCase->geoMechViews().push_back(rimReservoirView);

        rimReservoirView->setGeoMechCase(geomCase);

        // Resolve references after reservoir view has been inserted into Rim structures
        // Intersections referencing a well path requires this
        rimReservoirView->resolveReferencesRecursively();
        rimReservoirView->initAfterReadRecursively();

        caf::PdmDocument::updateUiIconStateRecursively(rimReservoirView);

        rimReservoirView->loadDataAndUpdate();

        geomCase->intersectionViewCollection()->syncFromExistingIntersections(false);
        geomCase->updateConnectedEditors();

        lastViewCopy = rimReservoirView;
    }

    if (lastViewCopy) Riu3DMainWindowTools::selectAsCurrentItem(lastViewCopy);
}