Merge remote-tracking branch 'refs/remotes/origin/dev'

Conflicts:
	ApplicationCode/ProjectDataModel/RimEclipseWell.cpp
This commit is contained in:
Magne Sjaastad 2017-01-26 14:30:13 +01:00
commit aedf184d14
21 changed files with 1092 additions and 262 deletions

View File

@ -119,6 +119,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/ApplicationCommands/CMakeLists_files.cmake Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake Commands/OctaveScriptCommands/CMakeLists_files.cmake

View File

@ -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 )

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicEclipseWellFeatureImpl::isAnyWellSelected()
{
std::vector<RimEclipseWell*> selection = selectedWells();
if (selection.size() > 0)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseWell*> RicEclipseWellFeatureImpl::selectedWells()
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWellCollection* RicEclipseWellFeatureImpl::wellCollectionFromSelection()
{
std::vector<RimEclipseWell*> selection = selectedWells();
if (selection.size() > 0)
{
RimEclipseWell* firstWell = selection[0];
RimEclipseWellCollection* wellCollection = nullptr;
firstWell->firstAncestorOrThisOfType(wellCollection);
return wellCollection;
}
return nullptr;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimEclipseWell;
class RimEclipseWellCollection;
//==================================================================================================
///
//==================================================================================================
class RicEclipseWellFeatureImpl
{
public:
static bool isAnyWellSelected();
static std::vector<RimEclipseWell*> selectedWells();
static RimEclipseWellCollection* wellCollectionFromSelection();
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicEclipseWellShowFeatures.h"
#include "RicEclipseWellFeatureImpl.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicEclipseWellShowLabelFeature, "RicEclipseWellShowLabelFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicEclipseWellShowLabelFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> 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<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
if (selection.size() > 0)
{
RimEclipseWell* well = selection[0];
return well->showWellSpheres();
}
return false;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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;
};

View File

@ -103,8 +103,6 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
{ {
if (!m_reservoirView->wellCollection()->isActive()) return; 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()) if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
{ {
clearGeometryCache(); clearGeometryCache();

View File

@ -61,8 +61,6 @@ void RivReservoirWellSpheresPartMgr::clearGeometryCache()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) 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()->isActive()) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size()) if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())

View File

@ -85,7 +85,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds); m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize(); 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) for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
@ -241,49 +241,57 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
wellCellStates.clear(); wellCellStates.clear();
wellCellStates.resize(brIt->m_cellIds.size(), closed); wellCellStates.resize(brIt->m_cellIds.size(), closed);
const std::vector <RigWellResultPoint>& cellIds = brIt->m_cellIds; RimEclipseWellCollection* wellColl = nullptr;
if (m_rimWell)
for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx)
{ {
// we need a faster lookup, I guess m_rimWell->firstAncestorOrThisOfType(wellColl);
const RigWellResultPoint* wResCell = NULL; }
if (wellColl && wellColl->showConnectionStatusColors())
{
const std::vector <RigWellResultPoint>& 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()) 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)
{ {
switch (wResFrame.m_productionType) wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex);
{
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; 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;
}
} }
} }

View File

@ -160,7 +160,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
pipeGeomGenerator->setPipeColor(well->wellPipeColor()); pipeGeomGenerator->setPipeColor(well->wellPipeColor());
pipeGeomGenerator->setCrossSectionVertexCount(m_rimReservoirView->wellCollection()->pipeCrossSectionVertexCount()); 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); pipeGeomGenerator->setRadius(pipeRadius);
cvf::ref<cvf::DrawableGeo> pipeSurface = pipeGeomGenerator->createPipeSurface(); cvf::ref<cvf::DrawableGeo> pipeSurface = pipeGeomGenerator->createPipeSurface();
@ -250,25 +250,39 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
part->setDrawable(geo1.p()); part->setDrawable(geo1.p());
cvf::Color4f headColor(cvf::Color3::GRAY); 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); if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER)
} {
else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR) headColor = cvf::Color4f(cvf::Color3::GREEN);
{ }
headColor = cvf::Color4f(cvf::Color3::ORANGE); else if (wellResultFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR)
} {
else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR) headColor = cvf::Color4f(cvf::Color3::ORANGE);
{ }
headColor = cvf::Color4f(cvf::Color3::RED); else if (wellResultFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR)
} {
else if (wellResultFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) headColor = cvf::Color4f(cvf::Color3::RED);
{ }
headColor = cvf::Color4f(cvf::Color3::BLUE); 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); caf::SurfaceEffectGenerator surfaceGen(headColor, caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect(); cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
@ -349,6 +363,7 @@ void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
} }
if (wellCollection->showWellHead() && if (wellCollection->showWellHead() &&
m_rimWell->showWellHead() &&
m_wellHeadArrowPart.notNull()) m_wellHeadArrowPart.notNull())
{ {
model->addPart(m_wellHeadArrowPart.p()); model->addPart(m_wellHeadArrowPart.p());

View File

@ -153,7 +153,7 @@ cvf::ref<cvf::Part> RivWellSpheresPartMgr::createPart(std::vector<std::pair<cvf:
cvf::GeometryBuilderTriangles builder; cvf::GeometryBuilderTriangles builder;
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize(); double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
double cellRadius = m_rimReservoirView->wellCollection()->cellCenterSpheresScaleFactor() * characteristicCellSize; double cellRadius = m_rimReservoirView->wellCollection()->spheresScaleFactor() * characteristicCellSize;
cvf::GeometryUtils::createSphere(cellRadius, 15, 15, &builder); cvf::GeometryUtils::createSphere(cellRadius, 15, 15, &builder);
vectorDrawable->setGlyph(builder.trianglesUShort().p(), builder.vertices().p()); 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 // Colours should be synchronized with RivWellPipesPartMgr::updatePipeResultColor
cvf::Color3f cellColor(cvf::Color3f::GRAY); cvf::Color3f cellColor(m_rimWell->wellPipeColor());
if (wellResultPoint.m_isOpen) 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: switch (wellResultFrame.m_productionType)
cellColor = cvf::Color3f::GREEN; {
break; case RigWellResultFrame::PRODUCER:
case RigWellResultFrame::OIL_INJECTOR: cellColor = cvf::Color3f::GREEN;
cellColor = cvf::Color3f::RED; break;
break; case RigWellResultFrame::OIL_INJECTOR:
case RigWellResultFrame::GAS_INJECTOR: cellColor = cvf::Color3f::RED;
cellColor = cvf::Color3f::RED; break;
break; case RigWellResultFrame::GAS_INJECTOR:
case RigWellResultFrame::WATER_INJECTOR: cellColor = cvf::Color3f::RED;
cellColor = cvf::Color3f::BLUE; break;
break; case RigWellResultFrame::WATER_INJECTOR:
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: cellColor = cvf::Color3f::BLUE;
cellColor = cvf::Color3f::GRAY; break;
break; case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
cellColor = cvf::Color3f::GRAY;
break;
}
} }
} }
else
{
cellColor = m_rimWell->wellPipeColor();
}
return cellColor; return cellColor;
} }

View File

@ -43,6 +43,133 @@
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
//==================================================================================================
///
///
//==================================================================================================
class RigAccWellFlowCalculator
{
public:
RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
const std::vector< std::vector <RigWellResultPoint> >& 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<std::pair <size_t, double> >& accumulatedFlowPrConnection(size_t branchIdx)
{
return m_accConnectionFlowPrBranch[branchIdx];
}
private:
const std::vector<std::pair <size_t, double> >& calculateAccumulatedFlowPrConnection(size_t branchIdx, size_t startConnectionNumberFromTop)
{
std::vector<std::pair <size_t, double> >& accConnectionFlow = m_accConnectionFlowPrBranch[branchIdx];
const std::vector<RigWellResultPoint>& branchCells = m_pipeBranchesCellIds[branchIdx];
int clSegIdx = static_cast<int>( branchCells.size()) - 1;
double accFlow = 0.0;
size_t prevGridIdx = -1;
size_t prevGridCellIdx = -1;
std::vector<size_t> 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<int>( 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<size_t> 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 <size_t, double>& 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<size_t> resPointToConnectionIndexFromBottom, size_t clSegIdx)
{
return resPointToConnectionIndexFromBottom.front() - resPointToConnectionIndexFromBottom[clSegIdx];
}
std::vector<size_t> findDownstreamBranchIdxs(const RigWellResultPoint& connectionPoint)
{
std::vector<size_t> 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 <cvf::Vec3d> >& m_pipeBranchesCLCoords;
const std::vector< std::vector <RigWellResultPoint> >& m_pipeBranchesCellIds;
std::vector< std::vector<std::pair <size_t, double> > > m_accConnectionFlowPrBranch;
};
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -144,7 +271,8 @@ void RimWellAllocationPlot::updateFromWell()
pipeBranchesCellIds); pipeBranchesCellIds);
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")"); accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")");
RigAccWellFlowCalculator wfCalculator(pipeBranchesCLCoords, pipeBranchesCellIds);
// Delete existing tracks // Delete existing tracks
{ {
@ -171,6 +299,7 @@ void RimWellAllocationPlot::updateFromWell()
accumulatedWellFlowPlot()->addTrack(plotTrack); accumulatedWellFlowPlot()->addTrack(plotTrack);
#if 0
std::vector<cvf::Vec3d> curveCoords; std::vector<cvf::Vec3d> curveCoords;
std::vector<double> flowRate; std::vector<double> flowRate;
@ -199,9 +328,21 @@ void RimWellAllocationPlot::updateFromWell()
} }
RigSimulationWellCoordsAndMD helper(curveCoords); RigSimulationWellCoordsAndMD helper(curveCoords);
#endif
const std::vector<std::pair <size_t, double> >& flowPrConnection = wfCalculator.accumulatedFlowPrConnection(brIdx);
std::vector<double> connNumbers;
std::vector<double> accFlow;
for (const std::pair<size_t, double> & flowPair: flowPrConnection)
{
connNumbers.push_back(flowPair.first);
accFlow.push_back(flowPair.second);
}
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValues(helper.measuredDepths(), flowRate); curve->setFlowValues(connNumbers, accFlow);
plotTrack->addCurve(curve); plotTrack->addCurve(curve);

View File

@ -433,6 +433,13 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{ {
commandIds << "RicExportFaultsFeature"; commandIds << "RicExportFaultsFeature";
} }
else if (dynamic_cast<RimEclipseWell*>(uiItem))
{
commandIds << "RicEclipseWellShowLabelFeature";
commandIds << "RicEclipseWellShowHeadFeature";
commandIds << "RicEclipseWellShowPipeFeature";
commandIds << "RicEclipseWellShowSpheresFeature";
}
} }

View File

@ -20,6 +20,7 @@
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSingleWellResultsData.h" #include "RigSingleWellResultsData.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
@ -28,7 +29,6 @@
#include "RimSimWellFractureCollection.h" #include "RimSimWellFractureCollection.h"
#include "cvfMath.h" #include "cvfMath.h"
#include "RigSimulationWellCenterLineCalculator.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well"); CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@ -39,16 +39,18 @@ RimEclipseWell::RimEclipseWell()
{ {
CAF_PDM_InitObject("Well", ":/Well.png", "", ""); CAF_PDM_InitObject("Well", ":/Well.png", "", "");
CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", "");
CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", "");
CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", "");
showWell.uiCapability()->setUiHidden(true); 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(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Well Pipe Scale Factor", "", "", "");
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", ""); CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", "");
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(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", ""); CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", "");
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", ""); 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 (!m_reservoirView) return;
if (&showWellLabel == changedField || if (&showWellLabel == changedField ||
&showWellPipes == changedField || &showWellHead == changedField ||
&showWellPipe == changedField ||
&showWellSpheres == changedField || &showWellSpheres == changedField ||
&wellPipeColor == changedField) &wellPipeColor == changedField)
{ {
@ -103,7 +106,7 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS); m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw(); m_reservoirView->scheduleCreateDisplayModelAndRedraw();
} }
else if (&pipeRadiusScaleFactor == changedField) else if (&pipeScaleFactor == changedField)
{ {
if (m_reservoirView) if (m_reservoirView)
{ {
@ -205,15 +208,28 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{ {
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance"); caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance");
pipeGroup->add(&showWellPipes);
pipeGroup->add(&showWellSpheres);
pipeGroup->add(&showWellLabel); pipeGroup->add(&showWellLabel);
pipeGroup->add(&showWellHead);
pipeGroup->add(&showWellPipe);
pipeGroup->add(&showWellSpheres);
pipeGroup->add(&pipeScaleFactor);
pipeGroup->add(&wellPipeColor); pipeGroup->add(&wellPipeColor);
pipeGroup->add(&pipeRadiusScaleFactor);
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter"); caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
filterGroup->add(&showWellCells); filterGroup->add(&showWellCells);
filterGroup->add(&showWellCellFence); 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) bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
{ {
RimEclipseView* m_reservoirView = nullptr; RimEclipseView* reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView); this->firstAncestorOrThisOfType(reservoirView);
if (m_reservoirView == nullptr) return false; if (reservoirView == nullptr) return false;
if (this->wellResults() == nullptr) return false; if (this->wellResults() == nullptr) return false;
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
@ -238,35 +254,29 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
return false; return false;
} }
if (!m_reservoirView->wellCollection()->isActive()) if (!reservoirView->wellCollection()->isActive())
return false; 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; return true;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
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)
{ {
return visibleCellsInstersectsWell(frameIndex); return visibleCellsInstersectsWell(frameIndex);
} }
else
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? {
return true;
return false; }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -294,28 +304,26 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
if (!m_reservoirView->wellCollection()->isActive()) if (!m_reservoirView->wellCollection()->isActive())
return false; return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) if (!this->showWell())
return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF)
return false; return false;
if (this->showWell() == false) if (!m_reservoirView->wellCollection()->showWellSpheres())
return false; return false;
if (this->showWellSpheres() == false) if (!this->showWellSpheres())
return false; return false;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
return true;
if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true; return true;
if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
{ {
return visibleCellsInstersectsWell(frameIndex); return visibleCellsInstersectsWell(frameIndex);
} }
else
{
return true;
}
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?

View File

@ -70,15 +70,18 @@ public:
caf::PdmField<bool> showWell; caf::PdmField<bool> showWell;
caf::PdmField<QString> name; caf::PdmField<QString> name;
caf::PdmField<bool> showWellLabel; caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> showWellHead;
caf::PdmField<bool> showWellPipe;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<double> pipeScaleFactor;
caf::PdmField<cvf::Color3f> wellPipeColor;
caf::PdmField<bool> showWellCells; caf::PdmField<bool> showWellCells;
caf::PdmField<bool> showWellCellFence; caf::PdmField<bool> showWellCellFence;
caf::PdmField<bool> showWellPipes;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<cvf::Color3f> wellPipeColor;
caf::PdmField<double> pipeRadiusScaleFactor;
caf::PdmChildField<RimSimWellFractureCollection*> simwellFractureCollection; caf::PdmChildField<RimSimWellFractureCollection*> simwellFractureCollection;

View File

@ -22,14 +22,20 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RigSingleWellResultsData.h" #include "RigSingleWellResultsData.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RivReservoirViewPartMgr.h" #include "RivReservoirViewPartMgr.h"
#include "cafPdmUiPushButtonEditor.h"
namespace caf namespace caf
{ {
// OBSOLETE enum
template<> template<>
void RimEclipseWellCollection::WellVisibilityEnum::setUp() void RimEclipseWellCollection::WellVisibilityEnum::setUp()
{ {
@ -69,8 +75,8 @@ namespace caf
template<> template<>
void RimEclipseWellCollection::WellHeadPositionEnum::setUp() 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_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "All Active Cells");
addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column"); addItem(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Active Cell Column");
setDefault(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN); setDefault(RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN);
} }
} }
@ -98,34 +104,59 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", ""); CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true); isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", ""); CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", true, "Show Wells Intersecting Visible Cells", "", "", "");
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", ""); // Appearance
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", ""); 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(); cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", ""); 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", "", "", ""); CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true); 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(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", ""); CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", "");
CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence direction", "", "", ""); CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence direction", "", "", "");
CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well cell transparency", "", "", ""); 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(&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(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well Head Position On Top Of", "", "", "");
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_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", "");
wells.uiCapability()->setUiHidden(true); 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; 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() bool RimEclipseWellCollection::hasVisibleWellPipes()
{ {
if (!this->isActive()) return false; 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->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; return true;
} }
@ -206,77 +234,88 @@ bool RimEclipseWellCollection::hasVisibleWellPipes()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{ {
if (&showWellLabel == changedField || &isActive == changedField) if (&isActive == changedField)
{ {
this->updateUiIconFromToggleField(); 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->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->scheduleCreateDisplayModelAndRedraw(); m_reservoirView->scheduleCreateDisplayModelAndRedraw();
} }
} else if (&wellCellTransparencyLevel == changedField)
else if (&wellPipeVisibility == changedField) {
{
if (m_reservoirView)
{
m_reservoirView->scheduleCreateDisplayModelAndRedraw(); m_reservoirView->scheduleCreateDisplayModelAndRedraw();
} }
} else if ( &spheresScaleFactor == changedField
else if ( &pipeCrossSectionVertexCount == changedField || &showWellSpheres == changedField
|| &pipeRadiusScaleFactor == changedField || &showConnectionStatusColors == changedField)
|| &wellHeadScaleFactor == changedField
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField
|| &wellPipeCoordType == changedField)
{
if (m_reservoirView)
{ {
m_reservoirView->schedulePipeGeometryRegen(); m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw(); 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) 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"); caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
filterGroup->add(&wellCellsToRangeFilterMode); filterGroup->add(&wellCellsToRangeFilterMode);
filterGroup->add(&showWellCellFences); filterGroup->add(&showWellCellFences);
filterGroup->add(&wellCellFenceType); 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<caf::PdmUiPushButtonEditorAttribute*>(attribute);
if (editorAttr)
{
editorAttr->m_buttonText = "Apply Individual Well Colors";
}
}
if (&m_applySingleColorToWells == field)
{
caf::PdmUiPushButtonEditorAttribute* editorAttr = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(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<RimEclipseWell>& w1, const caf::PdmPointer<RimEclipseWell>& w2) bool lessEclipseWell(const caf::PdmPointer<RimEclipseWell>& w1, const caf::PdmPointer<RimEclipseWell>& w2)
{ {
if (w1.notNull() && w2.notNull()) if (w1.notNull() && w2.notNull())

View File

@ -29,8 +29,6 @@
// Include to make Pdm work for cvf::Color // Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include <QString>
class RimEclipseView; class RimEclipseView;
class RimEclipseWell; class RimEclipseWell;
@ -88,31 +86,33 @@ public:
typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum; typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum;
caf::PdmField<bool> showWellLabel;
caf::PdmField<cvf::Color3f> wellLabelColor;
caf::PdmField<bool> isActive; caf::PdmField<bool> isActive;
caf::PdmField<bool> showWellsIntersectingVisibleCells;
caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> showWellHead;
caf::PdmField<bool> showWellPipe;
caf::PdmField<bool> showWellSpheres;
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<double> pipeScaleFactor;
caf::PdmField<double> spheresScaleFactor;
caf::PdmField<cvf::Color3f> wellLabelColor;
caf::PdmField<bool> showConnectionStatusColors;
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode; caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
caf::PdmField<bool> showWellCellFences; caf::PdmField<bool> showWellCellFences;
caf::PdmField<WellFenceEnum> wellCellFenceType; caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel; caf::PdmField<double> wellCellTransparencyLevel;
caf::PdmField<WellVisibilityEnum> wellPipeVisibility;
caf::PdmField<double> pipeRadiusScaleFactor;
caf::PdmField<int> pipeCrossSectionVertexCount; caf::PdmField<int> pipeCrossSectionVertexCount;
caf::PdmField<WellPipeCoordEnum> wellPipeCoordType; caf::PdmField<WellPipeCoordEnum> wellPipeCoordType;
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<bool> showWellHead;
caf::PdmField<WellHeadPositionEnum> wellHeadPosition; caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
caf::PdmField<bool> isAutoDetectingBranches; caf::PdmField<bool> isAutoDetectingBranches;
caf::PdmField<WellVisibilityEnum> wellSphereVisibility;
caf::PdmField<double> cellCenterSpheresScaleFactor;
caf::PdmChildArrayField<RimEclipseWell*> wells; caf::PdmChildArrayField<RimEclipseWell*> wells;
@ -125,14 +125,25 @@ public:
void scheduleIsWellPipesVisibleRecalculation(); void scheduleIsWellPipesVisibleRecalculation();
protected: protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual caf::PdmFieldHandle* objectToggleField(); virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void initAfterRead() override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
private: private:
void calculateWellGeometryVisibility(size_t frameIndex); void calculateWellGeometryVisibility(size_t frameIndex);
static cvf::Color3f cycledPaletteColor(size_t colorIndex);
RimEclipseView* m_reservoirView; private:
std::vector< std::vector< cvf::ubyte > > RimEclipseView* m_reservoirView;
m_framesOfResultWellPipeVisibilities; std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities;
// Fields
caf::PdmField<cvf::Color3f> m_wellColorForApply;
caf::PdmField<bool> m_applySingleColorToWells;
caf::PdmField<bool> m_applyIndividualColorsToWells;
// Obsolete fields
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
}; };

View File

@ -42,7 +42,7 @@ struct RigWellResultPoint
m_bottomPosition(cvf::Vec3d::UNDEFINED), m_bottomPosition(cvf::Vec3d::UNDEFINED),
m_flowRate(0.0) m_flowRate(0.0)
{ } { }
bool isPointValid() const bool isPointValid() const
{ {
return m_bottomPosition != cvf::Vec3d::UNDEFINED; return m_bottomPosition != cvf::Vec3d::UNDEFINED;

View File

@ -185,7 +185,6 @@ else()
ecl_well ecl_well
ert_geometry ert_geometry
ert_util ert_util
ert_utilxx
) )
if (MSVC) if (MSVC)

View File

@ -34,7 +34,7 @@ public:
/// For a specific field, return editor specific parameters used to customize the editor behavior. /// 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. /// Return object editor specific parameters used to customize the editor behavior.
void objectEditorAttribute(QString uiConfigName, PdmUiEditorAttribute* attribute); void objectEditorAttribute(QString uiConfigName, PdmUiEditorAttribute* attribute);
@ -53,26 +53,26 @@ public: // Virtual
virtual PdmFieldHandle* objectToggleField() { return NULL; } virtual PdmFieldHandle* objectToggleField() { return NULL; }
/// Method to reimplement to catch when the field has changed due to setUiValue() /// 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 /// Method to re-implement to supply option values for a specific field
virtual QList<PdmOptionItemInfo> virtual QList<PdmOptionItemInfo>
calculateValueOptions(const PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) { return QList<PdmOptionItemInfo>(); } calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { return QList<PdmOptionItemInfo>(); }
protected: protected:
/// Override to customize the order and grouping of the Gui. /// 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 /// 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. /// 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. /// 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 /// 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 /// 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 /// 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 /// This method is intended to be used in macros to make compile time errors
// if user uses them on wrong type of objects // if user uses them on wrong type of objects

View File

@ -93,7 +93,8 @@ void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName)
{ {
m_pushButton->setIcon(attributes.m_buttonIcon); m_pushButton->setIcon(attributes.m_buttonIcon);
} }
else if (!attributes.m_buttonText.isEmpty())
if (!attributes.m_buttonText.isEmpty())
{ {
m_pushButton->setText(attributes.m_buttonText); m_pushButton->setText(attributes.m_buttonText);
} }