//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray) { caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file"); const caf::ColorTable& colorTable = RiaColorTables::wellLogPlotPaletteColors(); cvf::Color3ubArray wellColors = colorTable.color3ubArray(); cvf::Color3ubArray interpolatedWellColors = wellColors; if (wellPathArray.size() > 1) { interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellPathArray.size()); } for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++) { RimWellPath* wellPath = wellPathArray[wpIdx]; wellPath->readWellPathFile(nullptr, m_wellPathImporter); progress.setProgressDescription(QString("Reading file %1").arg(wellPath->name())); // If a well path with this name exists already, make it read the well path file RimWellPath* existingWellPath = tryFindMatchingWellPath(wellPath->name()); if (existingWellPath) { existingWellPath->filepath = wellPath->filepath; existingWellPath->wellPathIndexInFile = wellPath->wellPathIndexInFile; existingWellPath->readWellPathFile(nullptr, m_wellPathImporter); // Let name from well path file override name from well log file existingWellPath->setName(wellPath->name()); m_mostRecentlyUpdatedWellPath = existingWellPath; delete wellPath; } else { wellPath->wellPathColor = cvf::Color3f(interpolatedWellColors[wpIdx]); wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath)); m_mostRecentlyUpdatedWellPath = wellPath; wellPaths.push_back(wellPath); } progress.incrementProgress(); } this->sortWellsByName(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewPltPlotFeature::onActionTriggered(bool isChecked) { RimProject* proj = RiaApplication::instance()->project(); RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection(); if (pltPlotColl) { QString wellPathName; RimWellPath* wellPath = nullptr; RimSimWellInView* eclipseWell = nullptr; if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr) { wellPathName = wellPath->name(); } else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr) { RimWellPath* wellPath = proj->wellPathFromSimWellName(eclipseWell->name()); if (!wellPath ) return; wellPathName = wellPath->name(); } QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName); RimWellPltPlot* pltPlot = new RimWellPltPlot(); pltPlot->setCurrentWellName(wellPathName); RimWellLogTrack* plotTrack = new RimWellLogTrack(); pltPlot->wellLogPlot()->addTrack(plotTrack); plotTrack->setDescription(QString("Track %1").arg(pltPlot->wellLogPlot()->trackCount())); pltPlotColl->addPlot(pltPlot); pltPlot->setDescription(plotName); //pltPlot->applyInitialSelections(); pltPlot->loadDataAndUpdate(); pltPlotColl->updateConnectedEditors(); RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::setExpanded(plotTrack); RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimWellPathFracture::compareByWellPathNameAndMD(const RimWellPathFracture* lhs, const RimWellPathFracture* rhs) { CVF_TIGHT_ASSERT(lhs && rhs); RimWellPath* lhsWellPath = nullptr; lhs->firstAncestorOrThisOfType(lhsWellPath); RimWellPath* rhsWellPath = nullptr; rhs->firstAncestorOrThisOfType(rhsWellPath); if (lhsWellPath && rhsWellPath) { if (lhsWellPath->name() != rhsWellPath->name()) { return lhsWellPath->name() < rhsWellPath->name(); } } return lhs->fractureMD() < rhs->fractureMD(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool Ric3dWellLogCurveViewerEventHandler::handleEvent(const RicViewerEventObject& eventObject) { if (eventObject.m_partAndTriangleIndexPairs.empty()) return false; cvf::uint triangleIndex = cvf::UNDEFINED_UINT; const auto& partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front(); const cvf::Part* part = partAndTriangleIndexPair.first; const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo()); if (sourceInfo) { Rim3dWellLogCurveCollection* curveCollection = dynamic_cast<Rim3dWellLogCurveCollection*>(sourceInfo->object()); if (curveCollection) { RimWellPath* wellPath; curveCollection->firstAncestorOrThisOfTypeAsserted(wellPath); QString wellPathName = wellPath->name(); cvf::Vec3d closestPoint; double measuredDepthAtPoint; double valueAtPoint; Rim3dWellLogCurve* curve = curveCollection->checkForCurveIntersection( eventObject.m_globalIntersectionPoint, &closestPoint, &measuredDepthAtPoint, &valueAtPoint); if (curve) { RiuMainWindow::instance()->selectAsCurrentItem(curve); QString curveText; curveText += QString("Curve name : %1\n").arg(curve->name());; curveText += QString("Well path name: %1\n").arg(wellPathName); curveText += QString("Measured depth: %1\n").arg(measuredDepthAtPoint); curveText += QString("%1 at depth: %2\n").arg(curve->resultPropertyString()).arg(valueAtPoint); RiuMainWindow::instance()->setResultInfo(curveText); } else { RiuMainWindow::instance()->selectAsCurrentItem(curveCollection); } return true; } } return false; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString Rim3dWellLogExtractionCurve::createCurveAutoName() const { RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); QStringList generatedCurveName; if (m_nameConfig->addWellName()) { RimWellPath* wellPath; this->firstAncestorOrThisOfTypeAsserted(wellPath); if (!wellPath->name().isEmpty()) { generatedCurveName += wellPath->name(); } } if (m_nameConfig->addCaseName() && m_case()) { generatedCurveName.push_back(m_case->caseUserDescription()); } if (m_nameConfig->addProperty() && !resultPropertyString().isEmpty()) { generatedCurveName.push_back(resultPropertyString()); } if (m_nameConfig->addTimeStep() || m_nameConfig->addDate()) { size_t maxTimeStep = 0; if (eclipseCase) { RigEclipseCaseData* data = eclipseCase->eclipseCaseData(); if (data) { maxTimeStep = data->results(m_eclipseResultDefinition->porosityModel())->maxTimeStepCount(); } } else if (geomCase) { RigGeoMechCaseData* data = geomCase->geoMechData(); if (data) { maxTimeStep = data->femPartResults()->frameCount(); } } if (m_nameConfig->addDate()) { QString dateString = wellDate(); if (!dateString.isEmpty()) { generatedCurveName.push_back(dateString); } } if (m_nameConfig->addTimeStep()) { generatedCurveName.push_back(QString("[%1/%2]").arg(m_timeStep()).arg(maxTimeStep)); } } return generatedCurveName.join(", "); }