diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 1cddba839e..b3a35dae2c 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -119,6 +119,7 @@ list( APPEND REFERENCED_CMAKE_FILES Commands/ApplicationCommands/CMakeLists_files.cmake Commands/CrossSectionCommands/CMakeLists_files.cmake Commands/EclipseCommands/CMakeLists_files.cmake + Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake Commands/FlowCommands/CMakeLists_files.cmake Commands/IntersectionBoxCommands/CMakeLists_files.cmake Commands/OctaveScriptCommands/CMakeLists_files.cmake diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake b/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake new file mode 100644 index 0000000000..27f3295bad --- /dev/null +++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake @@ -0,0 +1,25 @@ + +# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly +if (${CMAKE_VERSION} VERSION_GREATER "2.8.2") + set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/) +endif() + +set (SOURCE_GROUP_HEADER_FILES +${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.h +${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.h +) + +set (SOURCE_GROUP_SOURCE_FILES +${CEE_CURRENT_LIST_DIR}RicEclipseWellFeatureImpl.cpp +${CEE_CURRENT_LIST_DIR}RicEclipseWellShowFeatures.cpp +) + +list(APPEND CODE_HEADER_FILES +${SOURCE_GROUP_HEADER_FILES} +) + +list(APPEND CODE_SOURCE_FILES +${SOURCE_GROUP_SOURCE_FILES} +) + +source_group( "CommandFeature\\Eclipse\\Well" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake ) diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp new file mode 100644 index 0000000000..24caf44c5c --- /dev/null +++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.cpp @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 "RicEclipseWellFeatureImpl.h" + +#include "RimEclipseWell.h" +#include "RimEclipseWellCollection.h" + +#include "cafSelectionManager.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellFeatureImpl::isAnyWellSelected() +{ + std::vector selection = selectedWells(); + if (selection.size() > 0) + { + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicEclipseWellFeatureImpl::selectedWells() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType(&selection); + + return selection; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseWellCollection* RicEclipseWellFeatureImpl::wellCollectionFromSelection() +{ + std::vector selection = selectedWells(); + if (selection.size() > 0) + { + RimEclipseWell* firstWell = selection[0]; + + RimEclipseWellCollection* wellCollection = nullptr; + firstWell->firstAncestorOrThisOfType(wellCollection); + + return wellCollection; + } + + return nullptr; +} + diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h new file mode 100644 index 0000000000..3986e77bf5 --- /dev/null +++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellFeatureImpl.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 + +class RimEclipseWell; +class RimEclipseWellCollection; + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseWellFeatureImpl +{ +public: + static bool isAnyWellSelected(); + static std::vector selectedWells(); + static RimEclipseWellCollection* wellCollectionFromSelection(); +}; diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp new file mode 100644 index 0000000000..3d325545fa --- /dev/null +++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.cpp @@ -0,0 +1,269 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 "RicEclipseWellShowFeatures.h" + +#include "RicEclipseWellFeatureImpl.h" + +#include "RimEclipseWell.h" +#include "RimEclipseWellCollection.h" + +#include + + + +CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked) +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + for (RimEclipseWell* w : selection) + { + w->showWellLabel.setValueWithFieldChanged(isChecked); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowLabelFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Show Well Label"); + actionToSetup->setCheckable(true); + actionToSetup->setChecked(isCommandChecked()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowLabelFeature::isCommandEnabled() +{ + RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection(); + if (wellColl && !wellColl->showWellLabel()) + { + return false; + } + + return RicEclipseWellFeatureImpl::isAnyWellSelected(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowLabelFeature::isCommandChecked() +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + if (selection.size() > 0) + { + RimEclipseWell* well = selection[0]; + + return well->showWellLabel(); + } + + return false; +} + + + + + + + + +CAF_CMD_SOURCE_INIT(RicEclipseWellShowHeadFeature, "RicEclipseWellShowHeadFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowHeadFeature::onActionTriggered(bool isChecked) +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + for (RimEclipseWell* w : selection) + { + w->showWellHead.setValueWithFieldChanged(isChecked); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowHeadFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Show Well Head"); + actionToSetup->setCheckable(true); + actionToSetup->setChecked(isCommandChecked()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowHeadFeature::isCommandEnabled() +{ + RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection(); + if (wellColl && !wellColl->showWellHead()) + { + return false; + } + + return RicEclipseWellFeatureImpl::isAnyWellSelected(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowHeadFeature::isCommandChecked() +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + if (selection.size() > 0) + { + RimEclipseWell* well = selection[0]; + + return well->showWellHead(); + } + + return false; +} + + + + + + + + + +CAF_CMD_SOURCE_INIT(RicEclipseWellShowPipeFeature, "RicEclipseWellShowPipeFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowPipeFeature::onActionTriggered(bool isChecked) +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + for (RimEclipseWell* w : selection) + { + w->showWellPipe.setValueWithFieldChanged(isChecked); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowPipeFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Show Well Pipes"); + actionToSetup->setCheckable(true); + actionToSetup->setChecked(isCommandChecked()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowPipeFeature::isCommandEnabled() +{ + RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection(); + if (wellColl && !wellColl->showWellPipe()) + { + return false; + } + + return RicEclipseWellFeatureImpl::isAnyWellSelected(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowPipeFeature::isCommandChecked() +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + if (selection.size() > 0) + { + RimEclipseWell* well = selection[0]; + + return well->showWellPipe(); + } + + return false; +} + + + + + + + + +CAF_CMD_SOURCE_INIT(RicEclipseWellShowSpheresFeature, "RicEclipseWellShowSpheresFeature"); + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowSpheresFeature::onActionTriggered(bool isChecked) +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + for (RimEclipseWell* w : selection) + { + w->showWellSpheres.setValueWithFieldChanged(isChecked); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseWellShowSpheresFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("Show Well Spheres"); + actionToSetup->setCheckable(true); + actionToSetup->setChecked(isCommandChecked()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowSpheresFeature::isCommandEnabled() +{ + RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection(); + if (wellColl && !wellColl->showWellSpheres()) + { + return false; + } + + return RicEclipseWellFeatureImpl::isAnyWellSelected(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseWellShowSpheresFeature::isCommandChecked() +{ + std::vector selection = RicEclipseWellFeatureImpl::selectedWells(); + if (selection.size() > 0) + { + RimEclipseWell* well = selection[0]; + + return well->showWellSpheres(); + } + + return false; +} + + diff --git a/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h new file mode 100644 index 0000000000..590f706a39 --- /dev/null +++ b/ApplicationCode/Commands/EclipseCommands/EclipseWell/RicEclipseWellShowFeatures.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017 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 "cafCmdFeature.h" + + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseWellShowLabelFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + virtual bool isCommandChecked() override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseWellShowHeadFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + virtual bool isCommandChecked() override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseWellShowPipeFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + virtual bool isCommandChecked() override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseWellShowSpheresFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + virtual void onActionTriggered(bool isChecked) override; + virtual void setupActionLook(QAction* actionToSetup) override; + virtual bool isCommandEnabled() override; + virtual bool isCommandChecked() override; +}; + diff --git a/ApplicationCode/ModelVisualization/RivReservoirPipesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirPipesPartMgr.cpp index d93e1ed198..4b7ca654a5 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirPipesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirPipesPartMgr.cpp @@ -103,8 +103,6 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic { if (!m_reservoirView->wellCollection()->isActive()) return; - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return; - if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size()) { clearGeometryCache(); diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp index 60a707dd50..de77351996 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp @@ -61,8 +61,6 @@ void RivReservoirWellSpheresPartMgr::clearGeometryCache() //-------------------------------------------------------------------------------------------------- void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) { - if (m_reservoirView->wellCollection()->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return; - if (!m_reservoirView->wellCollection()->isActive()) return; if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size()) diff --git a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index bc196b7cf0..5edcf01327 100644 --- a/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -85,7 +85,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts() m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds); double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize(); - double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize; + double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize; for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx) @@ -241,49 +241,57 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex) wellCellStates.clear(); wellCellStates.resize(brIt->m_cellIds.size(), closed); - const std::vector & cellIds = brIt->m_cellIds; - - for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx) + RimEclipseWellCollection* wellColl = nullptr; + if (m_rimWell) { - // we need a faster lookup, I guess - const RigWellResultPoint* wResCell = NULL; + m_rimWell->firstAncestorOrThisOfType(wellColl); + } + + if (wellColl && wellColl->showConnectionStatusColors()) + { + const std::vector & cellIds = brIt->m_cellIds; + for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx) + { + // we need a faster lookup, I guess + const RigWellResultPoint* wResCell = NULL; - if (cellIds[wcIdx].isCell()) - { - wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); - } - - if (wResCell == NULL) - { - // We cant find any state. This well cell is closed. - } - else - { - double cellState = closed; - - if (wResCell->m_isOpen) + if (cellIds[wcIdx].isCell()) { - switch (wResFrame.m_productionType) - { - case RigWellResultFrame::PRODUCER: - cellState = producing; - break; - case RigWellResultFrame::OIL_INJECTOR: - cellState = hcInjection; - break; - case RigWellResultFrame::GAS_INJECTOR: - cellState = hcInjection; - break; - case RigWellResultFrame::WATER_INJECTOR: - cellState = water; - break; - case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: - cellState = closed; - break; - } + wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); } - wellCellStates[wcIdx] = cellState; + if (wResCell == NULL) + { + // We cant find any state. This well cell is closed. + } + else + { + double cellState = closed; + + if (wResCell->m_isOpen) + { + switch (wResFrame.m_productionType) + { + case RigWellResultFrame::PRODUCER: + cellState = producing; + break; + case RigWellResultFrame::OIL_INJECTOR: + cellState = hcInjection; + break; + case RigWellResultFrame::GAS_INJECTOR: + cellState = hcInjection; + break; + case RigWellResultFrame::WATER_INJECTOR: + cellState = water; + break; + case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: + cellState = closed; + break; + } + } + + wellCellStates[wcIdx] = cellState; + } } } diff --git a/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp index 44d2114677..6517e91041 100644 --- a/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp @@ -160,7 +160,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) pipeGeomGenerator->setPipeColor(well->wellPipeColor()); pipeGeomGenerator->setCrossSectionVertexCount(m_rimReservoirView->wellCollection()->pipeCrossSectionVertexCount()); - double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() * m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize; + double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize; pipeGeomGenerator->setRadius(pipeRadius); cvf::ref pipeSurface = pipeGeomGenerator->createPipeSurface(); @@ -250,25 +250,39 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) part->setDrawable(geo1.p()); cvf::Color4f headColor(cvf::Color3::GRAY); - if (wellResultFrame.m_isOpen) + + RimEclipseWellCollection* wellColl = nullptr; + if (m_rimWell) { - if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER) + m_rimWell->firstAncestorOrThisOfType(wellColl); + } + + if (wellColl && wellColl->showConnectionStatusColors()) + { + if (wellResultFrame.m_isOpen) { - headColor = cvf::Color4f(cvf::Color3::GREEN); - } - else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR) - { - headColor = cvf::Color4f(cvf::Color3::ORANGE); - } - else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR) - { - headColor = cvf::Color4f(cvf::Color3::RED); - } - else if (wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) - { - headColor = cvf::Color4f(cvf::Color3::BLUE); + if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER) + { + headColor = cvf::Color4f(cvf::Color3::GREEN); + } + else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR) + { + headColor = cvf::Color4f(cvf::Color3::ORANGE); + } + else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR) + { + headColor = cvf::Color4f(cvf::Color3::RED); + } + else if (wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) + { + headColor = cvf::Color4f(cvf::Color3::BLUE); + } } } + else + { + headColor = cvf::Color4f(m_rimWell->wellPipeColor()); + } caf::SurfaceEffectGenerator surfaceGen(headColor, caf::PO_1); cvf::ref eff = surfaceGen.generateCachedEffect(); @@ -349,6 +363,7 @@ void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* } if (wellCollection->showWellHead() && + m_rimWell->showWellHead() && m_wellHeadArrowPart.notNull()) { model->addPart(m_wellHeadArrowPart.p()); diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 79ae8f2a03..47250bbf5a 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -153,7 +153,7 @@ cvf::ref RivWellSpheresPartMgr::createPart(std::vectormainGrid()->characteristicIJCellSize(); - double cellRadius = m_rimReservoirView->wellCollection()->cellCenterSpheresScaleFactor() * characteristicCellSize; + double cellRadius = m_rimReservoirView->wellCollection()->spheresScaleFactor() * characteristicCellSize; cvf::GeometryUtils::createSphere(cellRadius, 15, 15, &builder); vectorDrawable->setGlyph(builder.trianglesUShort().p(), builder.vertices().p()); @@ -186,29 +186,42 @@ cvf::Color3f RivWellSpheresPartMgr::wellCellColor(const RigWellResultFrame& well { // Colours should be synchronized with RivWellPipesPartMgr::updatePipeResultColor - cvf::Color3f cellColor(cvf::Color3f::GRAY); - - if (wellResultPoint.m_isOpen) + cvf::Color3f cellColor(m_rimWell->wellPipeColor()); + + RimEclipseWellCollection* wellColl = nullptr; + if (m_rimWell) { - switch (wellResultFrame.m_productionType) + m_rimWell->firstAncestorOrThisOfType(wellColl); + } + + if (wellColl && wellColl->showConnectionStatusColors()) + { + if (wellResultPoint.m_isOpen) { - case RigWellResultFrame::PRODUCER: - cellColor = cvf::Color3f::GREEN; - break; - case RigWellResultFrame::OIL_INJECTOR: - cellColor = cvf::Color3f::RED; - break; - case RigWellResultFrame::GAS_INJECTOR: - cellColor = cvf::Color3f::RED; - break; - case RigWellResultFrame::WATER_INJECTOR: - cellColor = cvf::Color3f::BLUE; - break; - case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: - cellColor = cvf::Color3f::GRAY; - break; + switch (wellResultFrame.m_productionType) + { + case RigWellResultFrame::PRODUCER: + cellColor = cvf::Color3f::GREEN; + break; + case RigWellResultFrame::OIL_INJECTOR: + cellColor = cvf::Color3f::RED; + break; + case RigWellResultFrame::GAS_INJECTOR: + cellColor = cvf::Color3f::RED; + break; + case RigWellResultFrame::WATER_INJECTOR: + cellColor = cvf::Color3f::BLUE; + break; + case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: + cellColor = cvf::Color3f::GRAY; + break; + } } } + else + { + cellColor = m_rimWell->wellPipeColor(); + } return cellColor; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index fdf341d81c..1c6743aec3 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -43,6 +43,133 @@ CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); +//================================================================================================== +/// +/// +//================================================================================================== + +class RigAccWellFlowCalculator +{ + +public: + RigAccWellFlowCalculator(const std::vector< std::vector >& pipeBranchesCLCoords, + const std::vector< std::vector >& pipeBranchesCellIds): + m_pipeBranchesCLCoords(pipeBranchesCLCoords), m_pipeBranchesCellIds(pipeBranchesCellIds) + { + m_accConnectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); + + calculateAccumulatedFlowPrConnection(0,1); + } + + // Returned pair is connection number from top of well with accumulated flow + + const std::vector >& accumulatedFlowPrConnection(size_t branchIdx) + { + return m_accConnectionFlowPrBranch[branchIdx]; + } + +private: + + + + const std::vector >& calculateAccumulatedFlowPrConnection(size_t branchIdx, size_t startConnectionNumberFromTop) + { + std::vector >& accConnectionFlow = m_accConnectionFlowPrBranch[branchIdx]; + + const std::vector& branchCells = m_pipeBranchesCellIds[branchIdx]; + int clSegIdx = static_cast( branchCells.size()) - 1; + double accFlow = 0.0; + + size_t prevGridIdx = -1; + size_t prevGridCellIdx = -1; + + std::vector resPointToConnectionIndexFromBottom; + resPointToConnectionIndexFromBottom.resize(branchCells.size(), -1); + + size_t connIdxFromBottom = 0; + + while (clSegIdx >= 0) + { + resPointToConnectionIndexFromBottom[clSegIdx] = connIdxFromBottom; + + if ( branchCells[clSegIdx].m_gridIndex != prevGridIdx + && branchCells[clSegIdx].m_gridCellIndex != prevGridIdx ) + { + ++connIdxFromBottom; + } + + prevGridIdx = branchCells[clSegIdx].m_gridIndex ; + prevGridCellIdx = branchCells[clSegIdx].m_gridCellIndex; + + --clSegIdx; + } + + size_t prevConnIndx = -1; + clSegIdx = static_cast( branchCells.size()) - 1; + + while (clSegIdx >= 0) + { + // Skip point if referring to the same cell as in the previous point did + { + if (resPointToConnectionIndexFromBottom[clSegIdx] == prevConnIndx) + { + --clSegIdx; + continue; + } + + prevConnIndx = resPointToConnectionIndexFromBottom[clSegIdx]; + } + + size_t connNumFromTop = connecionIdxFromTop(resPointToConnectionIndexFromBottom, clSegIdx) + startConnectionNumberFromTop; + + accFlow += branchCells[clSegIdx].m_flowRate; + std::vector downstreamBranches = findDownstreamBranchIdxs(branchCells[clSegIdx]); + for (size_t dsBidx : downstreamBranches ) + { + if ( dsBidx != branchIdx && m_accConnectionFlowPrBranch[dsBidx].size() == 0) // Not this branch or already calculated + { + const std::pair & brancFlowPair = calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop).back(); + accFlow += brancFlowPair.second; + } + } + + accConnectionFlow.push_back(std::make_pair(connNumFromTop, accFlow)); + + --clSegIdx; + } + + return m_accConnectionFlowPrBranch[branchIdx]; + } + + static size_t connecionIdxFromTop( std::vector resPointToConnectionIndexFromBottom, size_t clSegIdx) + { + return resPointToConnectionIndexFromBottom.front() - resPointToConnectionIndexFromBottom[clSegIdx]; + } + + std::vector findDownstreamBranchIdxs(const RigWellResultPoint& connectionPoint) + { + std::vector downStreamBranchIdxs; + + for (size_t bIdx = 0; bIdx < m_pipeBranchesCellIds.size(); ++bIdx) + { + if ( m_pipeBranchesCellIds[bIdx][0].m_gridIndex == connectionPoint.m_gridIndex + && m_pipeBranchesCellIds[bIdx][0].m_gridCellIndex == connectionPoint.m_gridCellIndex) + { + downStreamBranchIdxs.push_back(bIdx); + } + } + return downStreamBranchIdxs; + } + + + const std::vector< std::vector >& m_pipeBranchesCLCoords; + const std::vector< std::vector >& m_pipeBranchesCellIds; + + std::vector< std::vector > > m_accConnectionFlowPrBranch; + +}; + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -144,7 +271,8 @@ void RimWellAllocationPlot::updateFromWell() pipeBranchesCellIds); accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")"); - + + RigAccWellFlowCalculator wfCalculator(pipeBranchesCLCoords, pipeBranchesCellIds); // Delete existing tracks { @@ -171,6 +299,7 @@ void RimWellAllocationPlot::updateFromWell() accumulatedWellFlowPlot()->addTrack(plotTrack); + #if 0 std::vector curveCoords; std::vector flowRate; @@ -199,9 +328,21 @@ void RimWellAllocationPlot::updateFromWell() } RigSimulationWellCoordsAndMD helper(curveCoords); - + #endif + + const std::vector >& flowPrConnection = wfCalculator.accumulatedFlowPrConnection(brIdx); + + std::vector connNumbers; + std::vector accFlow; + + for (const std::pair & flowPair: flowPrConnection) + { + connNumbers.push_back(flowPair.first); + accFlow.push_back(flowPair.second); + } + RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValues(helper.measuredDepths(), flowRate); + curve->setFlowValues(connNumbers, accFlow); plotTrack->addCurve(curve); diff --git a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp index a9ecf1f5e1..1bbbc97e3e 100644 --- a/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -433,6 +433,13 @@ QStringList RimContextCommandBuilder::commandsFromSelection() { commandIds << "RicExportFaultsFeature"; } + else if (dynamic_cast(uiItem)) + { + commandIds << "RicEclipseWellShowLabelFeature"; + commandIds << "RicEclipseWellShowHeadFeature"; + commandIds << "RicEclipseWellShowPipeFeature"; + commandIds << "RicEclipseWellShowSpheresFeature"; + } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index 0472c00f78..8a984de45d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -20,6 +20,7 @@ #include "RimEclipseWell.h" +#include "RigSimulationWellCenterLineCalculator.h" #include "RigSingleWellResultsData.h" #include "RimEclipseView.h" @@ -28,7 +29,6 @@ #include "RimSimWellFractureCollection.h" #include "cvfMath.h" -#include "RigSimulationWellCenterLineCalculator.h" CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well"); @@ -39,16 +39,18 @@ RimEclipseWell::RimEclipseWell() { CAF_PDM_InitObject("Well", ":/Well.png", "", ""); - CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", ""); - CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", ""); + CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", ""); + + CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", ""); showWell.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", ""); + CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", ""); + CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well head", "", "", ""); + CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Show well pipe", "", "", ""); + CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Show well spheres", "", "", ""); - CAF_PDM_InitField(&showWellPipes, "ShowWellPipe", true, "Show well pipe", "", "", ""); - CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", ""); - CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale",1.0, "Pipe radius scale", "", "", ""); - CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", ""); + CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Well Pipe Scale Factor", "", "", ""); + CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", ""); CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", ""); CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", ""); @@ -89,7 +91,8 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c if (!m_reservoirView) return; if (&showWellLabel == changedField || - &showWellPipes == changedField || + &showWellHead == changedField || + &showWellPipe == changedField || &showWellSpheres == changedField || &wellPipeColor == changedField) { @@ -103,7 +106,7 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } - else if (&pipeRadiusScaleFactor == changedField) + else if (&pipeScaleFactor == changedField) { if (m_reservoirView) { @@ -205,15 +208,28 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex) void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance"); - pipeGroup->add(&showWellPipes); - pipeGroup->add(&showWellSpheres); pipeGroup->add(&showWellLabel); + pipeGroup->add(&showWellHead); + pipeGroup->add(&showWellPipe); + pipeGroup->add(&showWellSpheres); + + pipeGroup->add(&pipeScaleFactor); + pipeGroup->add(&wellPipeColor); - pipeGroup->add(&pipeRadiusScaleFactor); caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter"); filterGroup->add(&showWellCells); filterGroup->add(&showWellCellFence); + + RimEclipseWellCollection* wellColl = nullptr; + this->firstAncestorOrThisOfType(wellColl); + if (wellColl) + { + showWellLabel.uiCapability()->setUiReadOnly(!wellColl->showWellLabel()); + showWellHead.uiCapability()->setUiReadOnly(!wellColl->showWellHead()); + showWellPipe.uiCapability()->setUiReadOnly(!wellColl->showWellPipe()); + showWellSpheres.uiCapability()->setUiReadOnly(!wellColl->showWellSpheres()); + } } //-------------------------------------------------------------------------------------------------- @@ -221,10 +237,10 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) { - RimEclipseView* m_reservoirView = nullptr; - this->firstAncestorOrThisOfType(m_reservoirView); + RimEclipseView* reservoirView = nullptr; + this->firstAncestorOrThisOfType(reservoirView); - if (m_reservoirView == nullptr) return false; + if (reservoirView == nullptr) return false; if (this->wellResults() == nullptr) return false; if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) @@ -238,35 +254,29 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) return false; } - if (!m_reservoirView->wellCollection()->isActive()) + if (!reservoirView->wellCollection()->isActive()) return false; - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) + if (!this->showWell()) + return false; + + if (!this->showWellPipe()) + return false; + + if (!reservoirView->wellCollection()->showWellPipe()) + return false; + + if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) return true; - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) - return false; - - if (this->showWell() == false) - return false; - - if (this->showWellPipes() == false) - return false; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) - return true; - - if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) - return true; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) + if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells()) { return visibleCellsInstersectsWell(frameIndex); } - - CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? - - return false; + else + { + return true; + } } //-------------------------------------------------------------------------------------------------- @@ -294,28 +304,26 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex) if (!m_reservoirView->wellCollection()->isActive()) return false; - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) - return true; - - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) + if (!this->showWell()) return false; - if (this->showWell() == false) + if (!m_reservoirView->wellCollection()->showWellSpheres()) return false; - if (this->showWellSpheres() == false) + if (!this->showWellSpheres()) return false; - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) - return true; - if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) return true; - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) + if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells()) { return visibleCellsInstersectsWell(frameIndex); } + else + { + return true; + } CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index fe476aa153..a95622b5ec 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -70,15 +70,18 @@ public: caf::PdmField showWell; caf::PdmField name; + caf::PdmField showWellLabel; + caf::PdmField showWellHead; + caf::PdmField showWellPipe; + caf::PdmField showWellSpheres; + + caf::PdmField pipeScaleFactor; + + caf::PdmField wellPipeColor; caf::PdmField showWellCells; caf::PdmField showWellCellFence; - - caf::PdmField showWellPipes; - caf::PdmField showWellSpheres; - caf::PdmField wellPipeColor; - caf::PdmField pipeRadiusScaleFactor; caf::PdmChildField simwellFractureCollection; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index 5258d88ba3..b954a20af7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -22,14 +22,20 @@ #include "RiaApplication.h" #include "RiaPreferences.h" + #include "RigSingleWellResultsData.h" + #include "RimEclipseView.h" #include "RimEclipseWell.h" + #include "RivReservoirViewPartMgr.h" +#include "cafPdmUiPushButtonEditor.h" + namespace caf { + // OBSOLETE enum template<> void RimEclipseWellCollection::WellVisibilityEnum::setUp() { @@ -69,8 +75,8 @@ namespace caf template<> void RimEclipseWellCollection::WellHeadPositionEnum::setUp() { - addItem(RimEclipseWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "Top of active cells BB"); - addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column"); + addItem(RimEclipseWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "All Active Cells"); + addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Active Cell Column"); setDefault(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN); } } @@ -98,34 +104,59 @@ RimEclipseWellCollection::RimEclipseWellCollection() CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); isActive.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", ""); - CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", ""); - CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", ""); - CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", ""); + CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", true, "Show Wells Intersecting Visible Cells", "", "", ""); + + // Appearance + CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show Well Head", "", "", ""); + CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show Well Label", "", "", ""); + CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Show Well Pipe", "", "", ""); + CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show Well Spheres", "", "", ""); + + // Scaling + CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale Factor", "", "", ""); + CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 0.1, "Well Pipe Scale Factor", "", "", ""); + CAF_PDM_InitField(&spheresScaleFactor, "CellCenterSphereScale", 0.2, "Well Sphere Scale Factor", "", "", ""); + + // Color cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor(); CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", ""); - CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", ""); + CAF_PDM_InitField(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Show Connection Status Colors Along Well", "", "", ""); + + cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW; + CAF_PDM_InitField(&m_wellColorForApply, "WellColorForApply", defaultApplyColor, "Single Well Color", "", "", ""); + + CAF_PDM_InitField(&m_applySingleColorToWells, "ApplySingleColorToWells", false, "", "", "", ""); + m_applySingleColorToWells.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_applySingleColorToWells.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + m_applySingleColorToWells.xmlCapability()->setIOReadable(false); + m_applySingleColorToWells.xmlCapability()->setIOWritable(false); + + CAF_PDM_InitField(&m_applyIndividualColorsToWells, "ApplyIndividualColorsToWells", false, "", "", "", ""); + m_applyIndividualColorsToWells.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_applyIndividualColorsToWells.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + m_applyIndividualColorsToWells.xmlCapability()->setIOReadable(false); + m_applyIndividualColorsToWells.xmlCapability()->setIOWritable(false); - CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe radius scale", "", "", ""); CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", ""); pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Coords", "", "", ""); + CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Geometry", "", "", ""); CAF_PDM_InitField(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", ""); CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", ""); CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence direction", "", "", ""); - CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well cell transparency", "", "", ""); - - CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", ""); - - CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_FORCE_ALL_OFF), "Global well sphere visibility", "", "", ""); - CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", ""); + CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency", "", "", ""); + CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Branch Detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", ""); + CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well Head Position On Top Of", "", "", ""); CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); wells.uiCapability()->setUiHidden(true); + CAF_PDM_InitField(&obsoleteField_wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", ""); + obsoleteField_wellPipeVisibility.uiCapability()->setUiHidden(true); + obsoleteField_wellPipeVisibility.xmlCapability()->setIOWritable(false); + m_reservoirView = NULL; } @@ -188,15 +219,12 @@ bool RimEclipseWellCollection::hasVisibleWellCells() } //-------------------------------------------------------------------------------------------------- -/// Used to know if we need animation of timesteps due to the wells +/// Used to know if we need animation of time steps due to the wells //-------------------------------------------------------------------------------------------------- bool RimEclipseWellCollection::hasVisibleWellPipes() { if (!this->isActive()) return false; - if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF && this->wellSphereVisibility() == PIPES_FORCE_ALL_OFF ) return false; if (this->wells().size() == 0 ) return false; - if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true; - if (this->wellSphereVisibility() == PIPES_FORCE_ALL_ON) return true; return true; } @@ -206,77 +234,88 @@ bool RimEclipseWellCollection::hasVisibleWellPipes() //-------------------------------------------------------------------------------------------------- void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - if (&showWellLabel == changedField || &isActive == changedField) + if (&isActive == changedField) { this->updateUiIconFromToggleField(); - - if (m_reservoirView) - { - m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); - m_reservoirView->scheduleCreateDisplayModelAndRedraw(); - } - } - if (&wellCellsToRangeFilterMode == changedField) - { - if (m_reservoirView) - { - m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); - m_reservoirView->scheduleCreateDisplayModelAndRedraw(); - } - } - else if (&showWellCellFences == changedField) - { - if (m_reservoirView) - { - m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); - m_reservoirView->scheduleCreateDisplayModelAndRedraw(); - } - } - else if (&wellCellTransparencyLevel == changedField) - { - if (m_reservoirView) - { - m_reservoirView->scheduleCreateDisplayModelAndRedraw(); - } - } - else if ( &wellSphereVisibility == changedField - || &cellCenterSpheresScaleFactor == changedField) - { - if (m_reservoirView) - { - m_reservoirView->scheduleCreateDisplayModelAndRedraw(); - } } - else if (&wellCellFenceType == changedField) + if (m_reservoirView) { - if (m_reservoirView) - { + if ( &isActive == changedField + || &showWellLabel == changedField + || &wellCellsToRangeFilterMode == changedField + || &showWellCellFences == changedField + || &wellCellFenceType == changedField) + { m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } - } - else if (&wellPipeVisibility == changedField) - { - if (m_reservoirView) - { + else if (&wellCellTransparencyLevel == changedField) + { m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } - } - else if ( &pipeCrossSectionVertexCount == changedField - || &pipeRadiusScaleFactor == changedField - || &wellHeadScaleFactor == changedField - || &showWellHead == changedField - || &isAutoDetectingBranches == changedField - || &wellHeadPosition == changedField - || &wellLabelColor == changedField - || &wellPipeCoordType == changedField) - { - if (m_reservoirView) + else if ( &spheresScaleFactor == changedField + || &showWellSpheres == changedField + || &showConnectionStatusColors == changedField) { m_reservoirView->schedulePipeGeometryRegen(); m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } + else if ( &pipeCrossSectionVertexCount == changedField + || &pipeScaleFactor == changedField + || &wellHeadScaleFactor == changedField + || &showWellHead == changedField + || &isAutoDetectingBranches == changedField + || &wellHeadPosition == changedField + || &wellLabelColor == changedField + || &showWellsIntersectingVisibleCells == changedField + || &wellPipeCoordType == changedField + || &showWellPipe == changedField) + { + m_reservoirView->schedulePipeGeometryRegen(); + m_reservoirView->scheduleCreateDisplayModelAndRedraw(); + } + } + + if ( &showWellPipe == changedField + || &showWellSpheres == changedField + || &showWellHead == changedField + || &showWellLabel == changedField) + { + for (RimEclipseWell* w : wells) + { + w->updateConnectedEditors(); + } + } + + if (&m_applyIndividualColorsToWells == changedField) + { + for (size_t i = 0; i < wells.size(); i++) + { + cvf::Color3f col = cycledPaletteColor(i); + + wells[i]->wellPipeColor = col; + wells[i]->updateConnectedEditors(); + } + + if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); + + m_applyIndividualColorsToWells = false; + } + + if (&m_applySingleColorToWells == changedField) + { + cvf::Color3f col = m_wellColorForApply(); + + for (size_t i = 0; i < wells.size(); i++) + { + wells[i]->wellPipeColor = col; + wells[i]->updateConnectedEditors(); + } + + if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); + + m_applySingleColorToWells = false; } } @@ -293,30 +332,40 @@ void RimEclipseWellCollection::setReservoirView(RimEclipseView* ownerReservoirVi //-------------------------------------------------------------------------------------------------- void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { + uiOrdering.add(&showWellsIntersectingVisibleCells); + + caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance"); + appearanceGroup->add(&showWellLabel); + appearanceGroup->add(&showWellHead); + appearanceGroup->add(&showWellPipe); + appearanceGroup->add(&showWellSpheres); + + caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling"); + sizeScalingGroup->add(&wellHeadScaleFactor); + sizeScalingGroup->add(&pipeScaleFactor); + sizeScalingGroup->add(&spheresScaleFactor); + + caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Color"); + colorGroup->add(&wellLabelColor); + colorGroup->add(&m_applyIndividualColorsToWells); + + colorGroup->add(&m_wellColorForApply); + colorGroup->add(&m_applySingleColorToWells); + + colorGroup->add(&showConnectionStatusColors); + + uiOrdering.add(&wellPipeCoordType); + + caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced"); + advancedGroup->add(&isAutoDetectingBranches); + advancedGroup->add(&wellCellTransparencyLevel); + + uiOrdering.add(&wellHeadPosition); + caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter"); filterGroup->add(&wellCellsToRangeFilterMode); filterGroup->add(&showWellCellFences); filterGroup->add(&wellCellFenceType); - - caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well head"); - wellHeadGroup->add(&showWellHead); - wellHeadGroup->add(&wellHeadScaleFactor); - wellHeadGroup->add(&showWellLabel); - wellHeadGroup->add(&wellHeadPosition); - wellHeadGroup->add(&wellLabelColor); - - caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe"); - wellPipe->add(&wellPipeVisibility); - wellPipe->add(&pipeRadiusScaleFactor); - wellPipe->add(&wellPipeCoordType); - - caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres"); - cellCenterSpheres->add(&wellSphereVisibility); - cellCenterSpheres->add(&cellCenterSpheresScaleFactor); - - caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced"); - advancedGroup->add(&wellCellTransparencyLevel); - advancedGroup->add(&isAutoDetectingBranches); } //-------------------------------------------------------------------------------------------------- @@ -328,6 +377,72 @@ caf::PdmFieldHandle* RimEclipseWellCollection::objectToggleField() } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseWellCollection::initAfterRead() +{ + if (obsoleteField_wellPipeVisibility() == PIPES_OPEN_IN_VISIBLE_CELLS) + { + showWellsIntersectingVisibleCells = true; + } + else if (obsoleteField_wellPipeVisibility() == PIPES_FORCE_ALL_OFF) + { + showWellsIntersectingVisibleCells = false; + + for (RimEclipseWell* w : wells) + { + w->showWell = false; + } + } + else if (obsoleteField_wellPipeVisibility() == PIPES_FORCE_ALL_ON) + { + showWellsIntersectingVisibleCells = false; + + for (RimEclipseWell* w : wells) + { + w->showWell = true; + } + } + else if (obsoleteField_wellPipeVisibility() == PIPES_INDIVIDUALLY) + { + showWellsIntersectingVisibleCells = false; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseWellCollection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) +{ + if (&m_applyIndividualColorsToWells == field) + { + caf::PdmUiPushButtonEditorAttribute* editorAttr = dynamic_cast(attribute); + if (editorAttr) + { + editorAttr->m_buttonText = "Apply Individual Well Colors"; + } + } + + if (&m_applySingleColorToWells == field) + { + caf::PdmUiPushButtonEditorAttribute* editorAttr = dynamic_cast(attribute); + if (editorAttr) + { + QColor col; + col.setRgbF(m_wellColorForApply().r(), m_wellColorForApply().g(), m_wellColorForApply().b()); + + QPixmap pixmap(100, 100); + pixmap.fill(col); + + QIcon colorIcon(pixmap); + + editorAttr->m_buttonIcon = colorIcon; + editorAttr->m_buttonText = "Apply Single Well Color"; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -367,6 +482,39 @@ void RimEclipseWellCollection::calculateWellGeometryVisibility(size_t frameIndex } } +//-------------------------------------------------------------------------------------------------- +/// TODO: Consider creating a factory for colors, see also RimSummaryCurveAppearanceCalculator +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RimEclipseWellCollection::cycledPaletteColor(size_t colorIndex) +{ + static const size_t colorCount = 15; + static const cvf::ubyte colorData[][3] = + { + { 0, 112, 136 }, // Dark Green-Blue + { 202, 0, 0 }, // Red + { 78, 204, 0 }, // Clear Green + { 236, 118, 0 }, // Orange + { 0 , 0, 0 }, // Black + { 56, 56, 255 }, // Vivid Blue + { 248, 0, 170 }, // Magenta + { 169, 2, 240 }, // Purple + { 0, 221, 221 }, // Turquoise + { 201, 168, 206 }, // Light Violet + { 0, 205, 68 }, // Bluish Green + { 236, 188, 0 }, // Mid Yellow + { 51, 204, 255 }, // Bluer Turquoise + { 164, 193, 0 }, // Mid Yellowish Green + { 0, 143, 239 }, // Dark Light Blue + }; + + size_t paletteIdx = colorIndex % colorCount; + + cvf::Color3ub ubColor(colorData[paletteIdx][0], colorData[paletteIdx][1], colorData[paletteIdx][2]); + cvf::Color3f cvfColor(ubColor); + + return cvfColor; +} + bool lessEclipseWell(const caf::PdmPointer& w1, const caf::PdmPointer& w2) { if (w1.notNull() && w2.notNull()) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h index 348dc7ce85..5d2d31ab1b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h @@ -29,8 +29,6 @@ // Include to make Pdm work for cvf::Color #include "cafPdmFieldCvfColor.h" -#include - class RimEclipseView; class RimEclipseWell; @@ -88,31 +86,33 @@ public: typedef caf::AppEnum WellPipeCoordEnum; - caf::PdmField showWellLabel; - caf::PdmField wellLabelColor; - caf::PdmField isActive; + caf::PdmField showWellsIntersectingVisibleCells; + + caf::PdmField showWellLabel; + caf::PdmField showWellHead; + caf::PdmField showWellPipe; + caf::PdmField showWellSpheres; + + caf::PdmField wellHeadScaleFactor; + caf::PdmField pipeScaleFactor; + caf::PdmField spheresScaleFactor; + + caf::PdmField wellLabelColor; + caf::PdmField showConnectionStatusColors; + caf::PdmField wellCellsToRangeFilterMode; caf::PdmField showWellCellFences; caf::PdmField wellCellFenceType; caf::PdmField wellCellTransparencyLevel; - caf::PdmField wellPipeVisibility; - caf::PdmField pipeRadiusScaleFactor; caf::PdmField pipeCrossSectionVertexCount; caf::PdmField wellPipeCoordType; - caf::PdmField wellHeadScaleFactor; - caf::PdmField showWellHead; caf::PdmField wellHeadPosition; - caf::PdmField isAutoDetectingBranches; - - caf::PdmField wellSphereVisibility; - caf::PdmField cellCenterSpheresScaleFactor; - caf::PdmChildArrayField wells; @@ -125,14 +125,25 @@ public: void scheduleIsWellPipesVisibleRecalculation(); protected: - virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); - virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); - virtual caf::PdmFieldHandle* objectToggleField(); + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + virtual caf::PdmFieldHandle* objectToggleField() override; + virtual void initAfterRead() override; + virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; + private: - void calculateWellGeometryVisibility(size_t frameIndex); + static cvf::Color3f cycledPaletteColor(size_t colorIndex); - RimEclipseView* m_reservoirView; - std::vector< std::vector< cvf::ubyte > > - m_framesOfResultWellPipeVisibilities; +private: + RimEclipseView* m_reservoirView; + std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities; + + // Fields + caf::PdmField m_wellColorForApply; + caf::PdmField m_applySingleColorToWells; + caf::PdmField m_applyIndividualColorsToWells; + + // Obsolete fields + caf::PdmField obsoleteField_wellPipeVisibility; }; diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h index c03179d870..6e3d7a6ea7 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h @@ -42,7 +42,7 @@ struct RigWellResultPoint m_bottomPosition(cvf::Vec3d::UNDEFINED), m_flowRate(0.0) { } - + bool isPointValid() const { return m_bottomPosition != cvf::Vec3d::UNDEFINED; diff --git a/CMakeLists.txt b/CMakeLists.txt index 36e909ccbb..e5d9b28653 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,6 @@ else() ecl_well ert_geometry ert_util - ert_utilxx ) if (MSVC) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h index 3b67ad45ba..c724f6c255 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h @@ -34,7 +34,7 @@ public: /// For a specific field, return editor specific parameters used to customize the editor behavior. - void editorAttribute(const PdmFieldHandle* field, QString uiConfigName, PdmUiEditorAttribute * attribute); + void editorAttribute(const PdmFieldHandle* field, QString uiConfigName, PdmUiEditorAttribute* attribute); /// Return object editor specific parameters used to customize the editor behavior. void objectEditorAttribute(QString uiConfigName, PdmUiEditorAttribute* attribute); @@ -53,26 +53,26 @@ public: // Virtual virtual PdmFieldHandle* objectToggleField() { return NULL; } /// Method to reimplement to catch when the field has changed due to setUiValue() - virtual void fieldChangedByUi(const PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) {} + virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) {} /// Method to re-implement to supply option values for a specific field virtual QList - calculateValueOptions(const PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) { return QList(); } + calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { return QList(); } protected: /// Override to customize the order and grouping of the Gui. /// Fill up the uiOrdering object with groups and field references to create the gui structure /// If the uiOrdering is empty, it is interpreted as meaning all fields w/o grouping. - virtual void defineUiOrdering(QString uiConfigName, PdmUiOrdering& uiOrdering) {} + virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) {} /// Override to customize the tree representations of the object hierarchy. /// If the PdmUiTreeOrdering is empty, it is interpreted as meaning all fields containing child objects in order - virtual void defineUiTreeOrdering(PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") { } + virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") { } /// Override to provide editor specific data for the field and uiConfigName - virtual void defineEditorAttribute(const PdmFieldHandle* field, QString uiConfigName, PdmUiEditorAttribute * attribute) {} + virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) {} /// Override to provide editor specific data for the uiConfigName for the object - virtual void defineObjectEditorAttribute(QString uiConfigName, PdmUiEditorAttribute * attribute) {} + virtual void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute) {} /// This method is intended to be used in macros to make compile time errors // if user uses them on wrong type of objects diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp index 42108b0f76..0c6218809d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPushButtonEditor.cpp @@ -93,7 +93,8 @@ void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName) { m_pushButton->setIcon(attributes.m_buttonIcon); } - else if (!attributes.m_buttonText.isEmpty()) + + if (!attributes.m_buttonText.isEmpty()) { m_pushButton->setText(attributes.m_buttonText); }