diff --git a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp index cefcf451a9..80c45e900a 100644 --- a/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp +++ b/ApplicationCode/ModelVisualization/Riv3dWellLogCurveGeomertyGenerator.cpp @@ -103,10 +103,13 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim std::vector* vertices, std::vector* indices) const { + if (m_wellPathGeometry.isNull()) return; + std::vector resultValues; std::vector mds; - rim3dWellLogCurve->resultValuesAndMds(&resultValues, &mds); + rim3dWellLogCurve->curveValuesAndMds(&resultValues, &mds); + if (resultValues.empty()) return; CVF_ASSERT(resultValues.size() == mds.size()); cvf::Vec3d globalDirection = diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 72cedbe3d8..09a3273bc0 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -99,6 +99,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationVariable.h ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanLegendConfig.h ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanColors.h ${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogCurve.h +${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.h ) @@ -203,6 +204,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationVariable.cpp ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanLegendConfig.cpp ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanColors.cpp ${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogCurve.cpp +${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.cpp ) diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp index 5c66693d08..69fb630440 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.cpp @@ -178,9 +178,9 @@ bool Rim3dWellLogCurve::toggleState() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogCurve::resultValuesAndMds(std::vector* resultValues, std::vector* measuredDepthValues) const +void Rim3dWellLogCurve::curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const { - CAF_ASSERT(resultValues != nullptr); + CAF_ASSERT(values != nullptr); CAF_ASSERT(measuredDepthValues != nullptr); cvf::ref eclExtractor; @@ -216,7 +216,7 @@ void Rim3dWellLogCurve::resultValuesAndMds(std::vector* resultValues, st m_eclipseResultDefinition); if (resAcc.notNull()) { - eclExtractor->curveData(resAcc.p(), resultValues); + eclExtractor->curveData(resAcc.p(), values); } } else if (geomExtractor.notNull()) @@ -225,7 +225,7 @@ void Rim3dWellLogCurve::resultValuesAndMds(std::vector* resultValues, st m_geomResultDefinition->loadResult(); - geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, resultValues); + geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, values); } } @@ -321,9 +321,7 @@ void Rim3dWellLogCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin } caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance"); - appearanceGroup->add(&m_drawPlane); - appearanceGroup->add(&m_drawStyle); - appearanceGroup->add(&m_coloringStyle); + appearanceUiOrdering(*appearanceGroup); uiOrdering.skipRemainingFields(); } @@ -340,3 +338,13 @@ void Rim3dWellLogCurve::initAfterRead() m_geomResultDefinition->setGeoMechCase(geomCase); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dWellLogCurve::appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering) +{ + uiOrdering.add(&m_drawPlane); + uiOrdering.add(&m_drawStyle); + uiOrdering.add(&m_coloringStyle); +} + diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h index 0276569ed6..9affdfb4e8 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogCurve.h @@ -71,9 +71,9 @@ public: DrawPlane drawPlane() const; bool toggleState() const; - void resultValuesAndMds(std::vector* resultValues, std::vector* measuredDepthValues) const; + virtual void curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const; -private: +protected: virtual caf::PdmFieldHandle* objectToggleField() override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; @@ -82,9 +82,13 @@ private: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void initAfterRead() override; + void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering); + +protected: + caf::PdmField m_name; + private: caf::PdmField m_showCurve; - caf::PdmField m_name; caf::PdmPtrField m_case; caf::PdmField m_timeStep; diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp new file mode 100644 index 0000000000..afc1c4c54d --- /dev/null +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp @@ -0,0 +1,158 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "Rim3dWellLogFileCurve.h" + +#include "RigWellLogFile.h" + +#include "RimWellLogFile.h" +#include "RimWellLogFileChannel.h" +#include "RimWellPath.h" + +#include + +//================================================================================================== +/// +/// +//================================================================================================== + +CAF_PDM_SOURCE_INIT(Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Rim3dWellLogFileCurve::Rim3dWellLogFileCurve() +{ + CAF_PDM_InitObject("3d Well Log File Curve", ":/WellLogCurve16x16.png", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", ""); + + m_name = "3D Well Log LAS Curve"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() {} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo() +{ + RimWellPath* wellPath = nullptr; + firstAncestorOrThisOfType(wellPath); + + if (wellPath && !wellPath->wellLogFiles().empty()) + { + m_wellLogFile = wellPath->wellLogFiles()[0]; + } + + if (m_wellLogFile) + { + std::vector fileLogs = m_wellLogFile->wellLogChannels(); + + if (!fileLogs.empty()) + { + m_wellLogChannnelName = fileLogs[0]->name(); + m_name = "LAS: " + m_wellLogChannnelName; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dWellLogFileCurve::curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const +{ + if (m_wellLogFile) + { + RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData(); + if (wellLogFile) + { + *values = wellLogFile->values(m_wellLogChannnelName); + *measuredDepthValues = wellLogFile->depthValues(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList Rim3dWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly) +{ + QList options; + + options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); + + if (!options.empty()) return options; + + if (fieldNeedingOptions == &m_wellLogChannnelName) + { + if (m_wellLogFile) + { + std::vector fileLogs = m_wellLogFile->wellLogChannels(); + + for (size_t i = 0; i < fileLogs.size(); i++) + { + QString wellLogChannelName = fileLogs[i]->name(); + options.push_back(caf::PdmOptionItemInfo(wellLogChannelName, wellLogChannelName)); + } + } + + if (options.size() == 0) + { + options.push_back(caf::PdmOptionItemInfo("None", "None")); + } + } + + if (fieldNeedingOptions == &m_wellLogFile) + { + RimWellPath* wellPath = nullptr; + firstAncestorOrThisOfType(wellPath); + + if (wellPath && !wellPath->wellLogFiles().empty()) + { + for (RimWellLogFile* const wellLogFile : wellPath->wellLogFiles()) + { + QFileInfo fileInfo(wellLogFile->fileName()); + options.push_back(caf::PdmOptionItemInfo(fileInfo.baseName(), wellLogFile)); + } + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +{ + caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); + curveDataGroup->add(&m_wellLogFile); + curveDataGroup->add(&m_wellLogChannnelName); + + caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance"); + Rim3dWellLogCurve::appearanceUiOrdering(*appearanceGroup); + + uiOrdering.skipRemainingFields(true); +} diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.h b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.h new file mode 100644 index 0000000000..5423406f46 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Rim3dWellLogCurve.h" + +#include "cafPdmChildField.h" +#include "cafPdmField.h" + +class RimWellLogFile; + +//================================================================================================== +/// +/// +//================================================================================================== +class Rim3dWellLogFileCurve : public Rim3dWellLogCurve +{ + CAF_PDM_HEADER_INIT; + +public: + Rim3dWellLogFileCurve(); + virtual ~Rim3dWellLogFileCurve(); + + void setDefaultFileCurveDataInfo(); + virtual void curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const override; + +private: + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly) override; + + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + +private: + caf::PdmPtrField m_wellLogFile; + caf::PdmField m_wellLogChannnelName; +};