mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
Conflicts: ApplicationCode/ProjectDataModel/RimContextCommandBuilder.cpp ApplicationCode/ProjectDataModel/RimEclipseWell.cpp ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp ResInsightVersion.cmake
This commit is contained in:
commit
6dc0a7ff59
@ -868,6 +868,8 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
riv->wellCollection()->assignDefaultWellColors();
|
||||
|
||||
// Add a corresponding summary case if it exists
|
||||
{
|
||||
RimSummaryCaseCollection* sumCaseColl = m_project->activeOilField() ? m_project->activeOilField()->summaryCaseCollection() : NULL;
|
||||
|
@ -56,12 +56,6 @@ void RicEclipseWellShowLabelFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowLabelFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !wellColl->showWellLabel())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
@ -117,12 +111,6 @@ void RicEclipseWellShowHeadFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowHeadFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !wellColl->showWellHead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
@ -179,12 +167,6 @@ void RicEclipseWellShowPipeFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowPipeFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !wellColl->showWellPipe())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
@ -241,12 +223,6 @@ void RicEclipseWellShowSpheresFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowSpheresFeature::isCommandEnabled()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = RicEclipseWellFeatureImpl::wellCollectionFromSelection();
|
||||
if (wellColl && !wellColl->showWellSpheres())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
@ -267,3 +243,110 @@ bool RicEclipseWellShowSpheresFeature::isCommandChecked()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellsFeature, "RicEclipseWellShowWellCellsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellCells.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Cells");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellsFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellsFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellCells();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicEclipseWellShowWellCellFenceFeature, "RicEclipseWellShowWellCellFenceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellFenceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
for (RimEclipseWell* w : selection)
|
||||
{
|
||||
w->showWellCellFence.setValueWithFieldChanged(isChecked);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipseWellShowWellCellFenceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Show Well Cell Fence");
|
||||
actionToSetup->setCheckable(true);
|
||||
actionToSetup->setChecked(isCommandChecked());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellFenceFeature::isCommandEnabled()
|
||||
{
|
||||
return RicEclipseWellFeatureImpl::isAnyWellSelected();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseWellShowWellCellFenceFeature::isCommandChecked()
|
||||
{
|
||||
std::vector<RimEclipseWell*> selection = RicEclipseWellFeatureImpl::selectedWells();
|
||||
if (selection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* well = selection[0];
|
||||
|
||||
return well->showWellCellFence();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -77,3 +77,31 @@ protected:
|
||||
virtual bool isCommandChecked() override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicEclipseWellShowWellCellsFeature : 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 RicEclipseWellShowWellCellFenceFeature : 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;
|
||||
};
|
||||
|
||||
|
@ -6,10 +6,12 @@ endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,88 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicAddStoredWellAllocationPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicAddStoredWellAllocationPlotFeature, "RicAddStoredWellAllocationPlotFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddStoredWellAllocationPlotFeature::isCommandEnabled()
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
if (flowPlotColl->defaultPlot() == wellAllocationPlot)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddStoredWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
RimWellAllocationPlot* sourceObject = dynamic_cast<RimWellAllocationPlot*>(caf::SelectionManager::instance()->selectedItem());
|
||||
|
||||
RimWellAllocationPlot* newObject = dynamic_cast<RimWellAllocationPlot*>(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(newObject);
|
||||
|
||||
flowPlotColl->flowPlots.push_back(newObject);
|
||||
newObject->resolveReferencesRecursively();
|
||||
|
||||
flowPlotColl->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddStoredWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
//actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText("Add Stored Well Allocation Plot");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 RicAddStoredWellAllocationPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -239,6 +239,7 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri
|
||||
{
|
||||
QString fileName = viewCaseResultString + "_" + timeStepString;
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
|
||||
absoluteFileName.replace(" ", "_");
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
|
||||
}
|
||||
@ -275,6 +276,8 @@ void RicExportMultipleSnapshotsFeature::exportViewVariationsToFolder(RimView* ri
|
||||
rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews(rangeFilter);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
|
||||
absoluteFileName.replace(" ", "_");
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
|
||||
}
|
||||
|
||||
|
@ -211,6 +211,7 @@ void RicSnapshotAllPlotsToFileFeature::createSnapshotOfAllPlotsInFolder(QString
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
absoluteFileName.replace(" ", "_");
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, wellLogPlot);
|
||||
}
|
||||
@ -229,6 +230,7 @@ void RicSnapshotAllPlotsToFileFeature::createSnapshotOfAllPlotsInFolder(QString
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
absoluteFileName.replace(" ", "_");
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, summaryPlot);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
|
||||
RigSingleWellResultsData* wRes = m_rimWell->wellResults();
|
||||
if (wRes == NULL) return;
|
||||
|
||||
if (frameIndex < wRes->firstResultTimeStep()) return; // Or reset colors or something
|
||||
if (!wRes->hasWellResult(frameIndex)) return; // Or reset colors or something
|
||||
|
||||
const double closed = -0.1, producing = 1.5, water = 2.5, hcInjection = 3.5; // Closed set to -0.1 instead of 0.5 to workaround bug in the scalar mapper.
|
||||
|
||||
|
@ -197,7 +197,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
}
|
||||
}
|
||||
|
||||
double arrowLength = characteristicCellSize * m_rimReservoirView->wellCollection()->wellHeadScaleFactor();
|
||||
double arrowLength = characteristicCellSize * m_rimReservoirView->wellCollection()->wellHeadScaleFactor() * m_rimWell->wellHeadScaleFactor();
|
||||
cvf::Vec3d textPosition = arrowPosition;
|
||||
textPosition.z() += 1.2 * arrowLength;
|
||||
|
||||
@ -293,7 +293,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
m_wellHeadArrowPart = part;
|
||||
}
|
||||
|
||||
if (m_rimReservoirView->wellCollection()->showWellLabel() && well->showWellLabel() && !well->name().isEmpty())
|
||||
if (well->showWellLabel() && !well->name().isEmpty())
|
||||
{
|
||||
cvf::Font* font = RiaApplication::instance()->customFont();
|
||||
|
||||
@ -355,15 +355,13 @@ void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
|
||||
if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());
|
||||
if (m_wellHeadPipeSurfacePart.notNull()) model->addPart(m_wellHeadPipeSurfacePart.p());
|
||||
|
||||
if (wellCollection->showWellLabel() &&
|
||||
m_rimWell->showWellLabel() &&
|
||||
if (m_rimWell->showWellLabel() &&
|
||||
m_wellHeadLabelPart.notNull())
|
||||
{
|
||||
model->addPart(m_wellHeadLabelPart.p());
|
||||
}
|
||||
|
||||
if (wellCollection->showWellHead() &&
|
||||
m_rimWell->showWellHead() &&
|
||||
if (m_rimWell->showWellHead() &&
|
||||
m_wellHeadArrowPart.notNull())
|
||||
{
|
||||
model->addPart(m_wellHeadArrowPart.p());
|
||||
|
@ -194,7 +194,7 @@ cvf::Color3f RivWellSpheresPartMgr::wellCellColor(const RigWellResultFrame& well
|
||||
m_rimWell->firstAncestorOrThisOfType(wellColl);
|
||||
}
|
||||
|
||||
if (wellColl && wellColl->showConnectionStatusColors())
|
||||
if (wellColl)
|
||||
{
|
||||
if (wellResultPoint.m_isOpen)
|
||||
{
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
|
||||
|
||||
@ -270,6 +271,31 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
|
||||
if ( eclCase )
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
|
||||
{
|
||||
if ( wellResults[wIdx]->m_wellName == tracerName )
|
||||
{
|
||||
|
||||
return RimEclipseWellCollection::cycledPaletteColor(wIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cvf::Color3f::DARK_GRAY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
class RimEclipseWell;
|
||||
class RigFlowDiagResults;
|
||||
@ -57,6 +58,7 @@ public:
|
||||
|
||||
TracerStatusType tracerStatusOverall(QString tracerName);
|
||||
TracerStatusType tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex);
|
||||
cvf::Color3f tracerColor(QString tracerName);
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -38,8 +38,6 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
defaultPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "Stored Plots", "", "", "");
|
||||
flowPlots.push_back(new RimWellAllocationPlot);
|
||||
flowPlots.push_back(new RimWellAllocationPlot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "RiuNightchartsWidget.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
|
||||
|
||||
@ -48,7 +50,6 @@ RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
||||
m_userName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
||||
|
||||
}
|
||||
|
||||
@ -62,15 +63,6 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
||||
{
|
||||
m_simulationWell = simWell;
|
||||
|
||||
updateFromWell();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -84,60 +76,6 @@ void RimTotalWellAllocationPlot::deleteViewWidget()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::updateFromWell()
|
||||
{
|
||||
/*
|
||||
QString simName = "None";
|
||||
int branchCount = 0;
|
||||
|
||||
const RigWellResultFrame* wellResultFrame = nullptr;
|
||||
|
||||
if (m_simulationWell && m_simulationWell->wellResults() )// && Timestep Ok )
|
||||
{
|
||||
simName = m_simulationWell->name();
|
||||
wellResultFrame = &(m_simulationWell->wellResults()->wellResultFrame(1));
|
||||
branchCount = static_cast<int>( wellResultFrame->m_wellResultBranches.size());
|
||||
// // Todo : Use this instead, and use to calculate accumulated flow
|
||||
//
|
||||
// size_t timeStep = 0; // make field
|
||||
// std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
|
||||
// std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||
// m_simulationWell->calculateWellPipeDynamicCenterLine(timeStep, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
// branchCount = static_cast<int>( pipeBranchesCLCoords.size());
|
||||
}
|
||||
|
||||
int existingTrackCount = static_cast<int>(accumulatedWellFlowPlot()->trackCount());
|
||||
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + simName + ")");
|
||||
|
||||
int neededExtraTrackCount = branchCount - existingTrackCount;
|
||||
for (int etc = 0; etc < neededExtraTrackCount; ++etc)
|
||||
{
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
||||
accumulatedWellFlowPlot()->addTrack(plotTrack);
|
||||
}
|
||||
|
||||
for (int etc = branchCount; etc < existingTrackCount; ++etc)
|
||||
{
|
||||
accumulatedWellFlowPlot()->removeTrackByIndex(accumulatedWellFlowPlot()->trackCount()- 1);
|
||||
}
|
||||
|
||||
|
||||
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
|
||||
{
|
||||
RimWellLogTrack* plotTrack = accumulatedWellFlowPlot()->trackByIndex(brIdx);
|
||||
|
||||
plotTrack->setDescription(QString("Branch %1").arg(brIdx+1));
|
||||
|
||||
}
|
||||
|
||||
setDescription("Well Allocation (" + simName + ")");
|
||||
accumulatedWellFlowPlot()->updateConnectedEditors();
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -153,39 +91,6 @@ void RimTotalWellAllocationPlot::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimTotalWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_simulationWell)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
|
||||
if (eclView && eclView->wellCollection())
|
||||
{
|
||||
RimEclipseWellCollection* coll = eclView->wellCollection();
|
||||
|
||||
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
|
||||
|
||||
QIcon simWellIcon(":/Well.png");
|
||||
for (RimEclipseWell* eclWell : eclWells)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
{
|
||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -199,10 +104,7 @@ void RimTotalWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
else if (changedField == &m_simulationWell)
|
||||
{
|
||||
updateFromWell();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -235,13 +137,41 @@ QString RimTotalWellAllocationPlot::description() const
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::addSlice(const QString& name, const cvf::Color3f& color, float value)
|
||||
{
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
|
||||
|
||||
m_wellTotalAllocationPlotWidget->addItem(name, sliceColor, value);
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::clearSlices()
|
||||
{
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget->clear();
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
updateFromWell();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -250,12 +180,6 @@ void RimTotalWellAllocationPlot::loadDataAndUpdate()
|
||||
QWidget* RimTotalWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget(mainWindowParent);
|
||||
m_wellTotalAllocationPlotWidget->addItem("Item1", QColor(200, 10, 50), 34);
|
||||
m_wellTotalAllocationPlotWidget->addItem("Item2", Qt::green, 27);
|
||||
m_wellTotalAllocationPlotWidget->addItem("Item3", Qt::cyan, 14);
|
||||
m_wellTotalAllocationPlotWidget->addItem("Item4", Qt::yellow, 7);
|
||||
m_wellTotalAllocationPlotWidget->addItem("Item5", Qt::blue, 4);
|
||||
|
||||
return m_wellTotalAllocationPlotWidget;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,10 @@ namespace caf {
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
namespace cvf {
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -49,39 +53,31 @@ public:
|
||||
RimTotalWellAllocationPlot();
|
||||
virtual ~RimTotalWellAllocationPlot();
|
||||
|
||||
void setSimulationWell(RimEclipseWell* simWell);
|
||||
|
||||
void setDescription(const QString& description);
|
||||
QString description() const;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void addSlice(const QString& name, const cvf::Color3f& color, float value);
|
||||
void clearSlices();
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual void zoomAll() override;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual void loadDataAndUpdate() override;
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateFromWell();
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
|
||||
|
||||
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
|
||||
};
|
||||
|
@ -39,136 +39,16 @@
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
#include "RigAccWellFlowCalculator.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -250,30 +130,6 @@ void RimWellAllocationPlot::deleteViewWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFromWell()
|
||||
{
|
||||
if (!m_case) return;
|
||||
|
||||
const RigSingleWellResultsData* wellResults = nullptr;
|
||||
wellResults = m_case->reservoirData()->findWellResult(m_wellName);
|
||||
|
||||
if (!wellResults) return;
|
||||
|
||||
|
||||
const RigWellResultFrame* wellResultFrame = nullptr;
|
||||
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
|
||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->reservoirData(),
|
||||
wellResults,
|
||||
m_timeStep,
|
||||
true,
|
||||
true,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds);
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")");
|
||||
|
||||
RigAccWellFlowCalculator wfCalculator(pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
|
||||
// Delete existing tracks
|
||||
{
|
||||
std::vector<RimWellLogTrack*> tracks;
|
||||
@ -288,9 +144,83 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
CVF_ASSERT(accumulatedWellFlowPlot()->trackCount() == 0);
|
||||
|
||||
accumulatedWellFlowPlot()->setDescription("Accumulated Well Flow (" + m_wellName + ")");
|
||||
|
||||
if (!m_case) return;
|
||||
|
||||
const RigSingleWellResultsData* wellResults = nullptr;
|
||||
wellResults = m_case->reservoirData()->findWellResult(m_wellName);
|
||||
|
||||
if (!wellResults) return;
|
||||
|
||||
// Set up the Accumulated Well Flow Calculator
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
|
||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->reservoirData(),
|
||||
wellResults,
|
||||
m_timeStep,
|
||||
true,
|
||||
true,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds);
|
||||
std::unique_ptr< RigAccWellFlowCalculator > wfCalculator;
|
||||
std::map<QString, const std::vector<double>* > tracerCellFractionValues;
|
||||
|
||||
if ( m_flowDiagSolution && wellResults->hasWellResult(m_timeStep))
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
|
||||
|
||||
const RigWellResultFrame& wellResultFrame = wellResults->wellResultFrame(m_timeStep);
|
||||
if (wellResultFrame.m_productionType == RigWellResultFrame::PRODUCER)
|
||||
{
|
||||
requestedTracerType = RimFlowDiagSolution::INJECTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
requestedTracerType = RimFlowDiagSolution::PRODUCER;
|
||||
}
|
||||
|
||||
|
||||
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
|
||||
for ( const QString& tracerName : tracerNames )
|
||||
{
|
||||
if (m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType)
|
||||
{
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
|
||||
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
|
||||
tracerCellFractionValues[tracerName] = tracerCellFractions;
|
||||
}
|
||||
}
|
||||
|
||||
if ( tracerCellFractionValues.size() )
|
||||
{
|
||||
RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
|
||||
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds,
|
||||
tracerCellFractionValues,
|
||||
cellIdxCalc));
|
||||
}
|
||||
}
|
||||
|
||||
if (!wfCalculator)
|
||||
{
|
||||
if (pipeBranchesCLCoords.size() > 0)
|
||||
{
|
||||
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds));
|
||||
}
|
||||
}
|
||||
|
||||
// Create tracks and curves from the calculated data
|
||||
|
||||
size_t branchCount = pipeBranchesCLCoords.size();
|
||||
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
|
||||
{
|
||||
// Skip Tiny dummy branches
|
||||
if (pipeBranchesCellIds[brIdx].size() <= 3) continue;
|
||||
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
||||
|
||||
// TODO: Description is overwritten by RimWellLogPlot::updateTrackNames()
|
||||
@ -299,60 +229,113 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
accumulatedWellFlowPlot()->addTrack(plotTrack);
|
||||
|
||||
#if 0
|
||||
std::vector<cvf::Vec3d> curveCoords;
|
||||
std::vector<double> flowRate;
|
||||
|
||||
std::vector<double> connNumbers;
|
||||
{
|
||||
std::vector<cvf::Vec3d> branchCoords = pipeBranchesCLCoords[brIdx];
|
||||
std::vector<RigWellResultPoint> branchResultPoints = pipeBranchesCellIds[brIdx];
|
||||
const std::vector<size_t>& connNumbersSize_t = wfCalculator->connectionNumbersFromTop(brIdx);
|
||||
for ( size_t conNumb : connNumbersSize_t ) connNumbers.push_back(static_cast<double>(conNumb));
|
||||
}
|
||||
|
||||
RigWellResultPoint prevResultPoint;
|
||||
|
||||
for (size_t i = 0; i < branchResultPoints.size(); i++)
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
std::vector<QString> tracerNames = wfCalculator->tracerNames();
|
||||
for (const QString& tracerName: tracerNames)
|
||||
{
|
||||
const RigWellResultPoint& resultPoint = branchResultPoints[i];
|
||||
|
||||
if (i > 0 && prevResultPoint.m_gridCellIndex != resultPoint.m_gridCellIndex)
|
||||
{
|
||||
// Add an extra curve point when a cell transition is detected
|
||||
curveCoords.push_back(branchCoords[i]);
|
||||
flowRate.push_back(prevResultPoint.m_flowRate);
|
||||
}
|
||||
|
||||
curveCoords.push_back(branchCoords[i]);
|
||||
flowRate.push_back(branchResultPoints[i].m_flowRate);
|
||||
|
||||
prevResultPoint = resultPoint;
|
||||
const std::vector<double>& accFlow = wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx);
|
||||
addStackedCurve(tracerName, connNumbers, accFlow, plotTrack);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
else
|
||||
{
|
||||
connNumbers.push_back(flowPair.first);
|
||||
accFlow.push_back(flowPair.second);
|
||||
const std::vector<double>& accFlow = wfCalculator->accumulatedTotalFlowPrConnection(brIdx);
|
||||
addStackedCurve("Total", connNumbers, accFlow, plotTrack);
|
||||
}
|
||||
|
||||
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||
curve->setFlowValues(connNumbers, accFlow);
|
||||
|
||||
plotTrack->addCurve(curve);
|
||||
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
setDescription("Well Allocation (" + m_wellName + ")");
|
||||
setDescription("Well Allocation: " + m_wellName +", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")");
|
||||
|
||||
/// Pie chart
|
||||
|
||||
m_totalWellAllocationPlot->clearSlices();
|
||||
|
||||
if (wfCalculator)
|
||||
{
|
||||
std::vector<QString> tracerNames = wfCalculator->tracerNames();
|
||||
std::vector<std::pair<QString, double> > tracerWithValues;
|
||||
|
||||
for (const QString& tracerName: tracerNames)
|
||||
{
|
||||
const std::vector<double>& accFlow = wfCalculator->accumulatedTracerFlowPrConnection(tracerName, 0);
|
||||
tracerWithValues.push_back(std::make_pair(tracerName, accFlow.back()));
|
||||
}
|
||||
|
||||
float sumTracerVals = 0.0f;
|
||||
for ( const auto& tracerVal:tracerWithValues)
|
||||
{
|
||||
sumTracerVals += tracerVal.second;
|
||||
}
|
||||
|
||||
if ( sumTracerVals != 0.0f )
|
||||
{
|
||||
for ( const auto& tracerVal : tracerWithValues )
|
||||
{
|
||||
cvf::Color3f color;
|
||||
if ( m_flowDiagSolution )
|
||||
color = m_flowDiagSolution->tracerColor(tracerVal.first);
|
||||
else
|
||||
color = cvf::Color3f::DARK_GRAY;
|
||||
|
||||
m_totalWellAllocationPlot->addSlice(tracerVal.first, color, 100*tracerVal.second/sumTracerVals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_totalWellAllocationPlot->updateConnectedEditors();
|
||||
|
||||
accumulatedWellFlowPlot()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
|
||||
const std::vector<double>& connNumbers,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack)
|
||||
{
|
||||
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||
curve->setFlowValues(tracerName, connNumbers, accFlow);
|
||||
|
||||
if ( m_flowDiagSolution )
|
||||
curve->setColor(m_flowDiagSolution->tracerColor(tracerName));
|
||||
else
|
||||
curve->setColor(cvf::Color3f::DARK_GRAY);
|
||||
|
||||
plotTrack->addCurve(curve);
|
||||
|
||||
curve->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateWidgetTitleWindowTitle()
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
|
||||
if (m_wellAllocationPlotWidget)
|
||||
{
|
||||
if (m_showPlotTitle)
|
||||
{
|
||||
m_wellAllocationPlotWidget->showTitle(m_userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellAllocationPlotWidget->hideTitle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -429,6 +412,33 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_case)
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType(proj);
|
||||
if (proj)
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType(cases);
|
||||
|
||||
for (RimEclipseResultCase* c : cases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_flowDiagSolution)
|
||||
{
|
||||
if (m_case)
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
|
||||
for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -460,9 +470,11 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
if (changedField == &m_userName ||
|
||||
changedField == &m_showPlotTitle)
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
else if (changedField == &m_wellName)
|
||||
else if ( changedField == &m_wellName
|
||||
|| changedField == &m_case
|
||||
|| changedField == &m_timeStep)
|
||||
{
|
||||
updateFromWell();
|
||||
}
|
||||
@ -486,7 +498,8 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
|
||||
void RimWellAllocationPlot::setDescription(const QString& description)
|
||||
{
|
||||
m_userName = description;
|
||||
this->updateMdiWindowTitle();
|
||||
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -33,6 +33,7 @@ class RimFlowDiagSolution;
|
||||
class RimTotalWellAllocationPlot;
|
||||
class RimWellLogPlot;
|
||||
class RiuWellAllocationPlot;
|
||||
class RimWellLogTrack;
|
||||
|
||||
namespace caf {
|
||||
class PdmOptionItemInfo;
|
||||
@ -64,7 +65,6 @@ public:
|
||||
RimWellLogPlot* accumulatedWellFlowPlot();
|
||||
RimTotalWellAllocationPlot* totalWellFlowPlot();
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
QString wellName() const;
|
||||
|
||||
@ -74,12 +74,20 @@ protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateFromWell();
|
||||
|
||||
void addStackedCurve(const QString& tracerName,
|
||||
const std::vector<double>& connNumbers,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack);
|
||||
|
||||
void updateWidgetTitleWindowTitle();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
|
||||
|
||||
@ -40,6 +42,7 @@ CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve");
|
||||
RimWellFlowRateCurve::RimWellFlowRateCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
|
||||
m_curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -76,7 +79,7 @@ QString RimWellFlowRateCurve::wellName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::wellLogChannelName() const
|
||||
{
|
||||
return "Flow Rate";
|
||||
return "AccumulatedFlowRate";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -84,8 +87,7 @@ QString RimWellFlowRateCurve::wellLogChannelName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::createCurveAutoName()
|
||||
{
|
||||
return QString("%1 (%2)").arg(wellLogChannelName()).arg(wellName());
|
||||
|
||||
return m_tracerName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -97,15 +99,9 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType(wellLogPlot);
|
||||
CVF_ASSERT(wellLogPlot);
|
||||
|
||||
m_qwtPlotCurve->setTitle(createCurveAutoName());
|
||||
|
||||
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
|
||||
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
||||
updateStackedPlotData();
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
@ -113,6 +109,64 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
{
|
||||
RimWellLogCurve::updateCurveAppearance();
|
||||
|
||||
m_qwtPlotCurve->setStyle(QwtPlotCurve::Steps);
|
||||
QColor curveQColor = QColor (m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||
m_qwtPlotCurve->setBrush(QBrush( curveQColor));
|
||||
|
||||
QPen curvePen = m_qwtPlotCurve->pen();
|
||||
curvePen.setColor(curveQColor.darker());
|
||||
m_qwtPlotCurve->setPen(curvePen);
|
||||
m_qwtPlotCurve->setOrientation(Qt::Horizontal);
|
||||
m_qwtPlotCurve->setBaseline(0.0);
|
||||
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfType(wellLogTrack);
|
||||
|
||||
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
|
||||
|
||||
std::vector<double> depthValues = m_curveData->measuredDepthPlotValues(displayUnit);
|
||||
if (depthValues.size()) depthValues.insert(depthValues.begin(), depthValues[0]); // Insert the first depth position again, to make room for a real 0 value
|
||||
std::vector<double> stackedValues(depthValues.size(), 0.0);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> stackedCurves = wellLogTrack->visibleStackedCurves();
|
||||
double zPos = -0.1;
|
||||
for ( RimWellFlowRateCurve * stCurve: stackedCurves )
|
||||
{
|
||||
std::vector<double> values = stCurve->curveData()->xPlotValues();
|
||||
for ( size_t i = 0; i < values.size(); ++i )
|
||||
{
|
||||
stackedValues[i+1] += values[i];
|
||||
}
|
||||
|
||||
if ( stCurve == this ) break;
|
||||
zPos -= 1.0;
|
||||
}
|
||||
|
||||
|
||||
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
|
||||
|
||||
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
|
||||
polyLineStartStopIndices.front().second += 1;
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
|
||||
|
||||
m_qwtPlotCurve->setZ(zPos);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -127,9 +181,11 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::setFlowValues(const std::vector<double>& measuredDepths, const std::vector<double>& flowRates)
|
||||
void RimWellFlowRateCurve::setFlowValues(const QString& tracerName, const std::vector<double>& measuredDepths, const std::vector<double>& flowRates)
|
||||
{
|
||||
m_curveData = new RigWellLogCurveData;
|
||||
m_curveData->setValuesAndMD(flowRates, measuredDepths, RimDefines::UNIT_METER, false);
|
||||
|
||||
m_tracerName = tracerName;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
RimWellFlowRateCurve();
|
||||
virtual ~RimWellFlowRateCurve();
|
||||
|
||||
void setFlowValues(const std::vector<double>& measuredDepths, const std::vector<double>& flowRates);
|
||||
void setFlowValues(const QString& tracerName , const std::vector<double>& measuredDepths, const std::vector<double>& flowRates);
|
||||
void updateStackedPlotData();
|
||||
|
||||
virtual QString wellName() const override;
|
||||
virtual QString wellLogChannelName() const override;
|
||||
@ -46,8 +47,11 @@ public:
|
||||
protected:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void updateCurveAppearance() override;
|
||||
|
||||
private:
|
||||
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||
|
||||
QString m_tracerName;
|
||||
};
|
||||
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
@ -363,6 +364,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicExportFaultsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellAllocationPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathFractureCollection*>(uiItem) ||
|
||||
dynamic_cast<RimWellPathFracture*>(uiItem) )
|
||||
{
|
||||
@ -439,6 +444,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicEclipseWellShowHeadFeature";
|
||||
commandIds << "RicEclipseWellShowPipeFeature";
|
||||
commandIds << "RicEclipseWellShowSpheresFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellsFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellFenceFeature";
|
||||
commandIds << "RicExportSelectedSimWellFractureWellCompletionFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
|
@ -134,8 +134,12 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
|
||||
if (reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
|
||||
{
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
|
||||
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
|
||||
|
||||
if (m_flowDiagSolutions.size() == 0)
|
||||
{
|
||||
m_flowDiagSolutions.push_back(new RimFlowDiagSolution());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -654,6 +654,10 @@ void RimEclipseView::updateCurrentTimeStep()
|
||||
}
|
||||
|
||||
m_overlayInfoConfig()->update3DInfo();
|
||||
|
||||
// Invisible Wells are marked as read only when "show wells intersecting visible cells" is enabled
|
||||
// Visibility of wells differ betweeen time steps, so trigger a rebuild of tree state items
|
||||
wellCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -812,6 +816,13 @@ void RimEclipseView::updateDisplayModelVisibility()
|
||||
m_viewer->update();
|
||||
|
||||
faultCollection->updateConnectedEditors();
|
||||
|
||||
// This is required to update the read-only state of simulation wells
|
||||
// when a range filter is manipulated and visible simulation wells might change
|
||||
//
|
||||
// The visibility is controlled by RimEclipseWell::defineUiTreeOrdering
|
||||
// updateConnectedEditors will call recursively on child objects
|
||||
wellCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1151,9 +1162,6 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
|
||||
}
|
||||
visibleCells->setAll(false);
|
||||
|
||||
// If all wells are forced off, return
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimEclipseWellCollection::RANGE_ADD_NONE) return;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
|
||||
|
||||
CVF_ASSERT(activeCellInfo);
|
||||
@ -1162,7 +1170,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimEclipseWell* well = this->wellCollection()->wells()[wIdx];
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimEclipseWellCollection::RANGE_ADD_ALL || (well->showWell() && well->showWellCells()) )
|
||||
if (well->showWell() && well->showWellCells())
|
||||
{
|
||||
RigSingleWellResultsData* wres = well->wellResults();
|
||||
if (!wres) continue;
|
||||
@ -1201,7 +1209,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
|
||||
(*visibleCells)[gridCellIndex] = true;
|
||||
|
||||
// Calculate well fence cells
|
||||
if (well->showWellCellFence() || this->wellCollection()->showWellCellFences())
|
||||
if (well->showWellCellFence())
|
||||
{
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k);
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
|
||||
@ -42,18 +44,18 @@ RimEclipseWell::RimEclipseWell()
|
||||
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(&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(&showWellLabel, "ShowWellLabel", true, "Label", "", "", "");
|
||||
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Well head", "", "", "");
|
||||
CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Pipe", "", "", "");
|
||||
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Spheres", "", "", "");
|
||||
|
||||
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(&wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Scale Factor", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Pipe color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Well Cells", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&simwellFractureCollection, "FractureCollection", "Fractures", "", "", "");
|
||||
|
||||
name.uiCapability()->setUiHidden(true);
|
||||
@ -86,33 +88,44 @@ caf::PdmFieldHandle* RimEclipseWell::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
if (!m_reservoirView) return;
|
||||
|
||||
if (&showWellLabel == changedField ||
|
||||
&showWellHead == changedField ||
|
||||
&showWellPipe == changedField ||
|
||||
&showWellSpheres == changedField ||
|
||||
&wellPipeColor == changedField)
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&showWell == changedField ||
|
||||
&showWellCells == changedField ||
|
||||
&showWellCellFence == changedField)
|
||||
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&pipeScaleFactor == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
if (&showWellLabel == changedField ||
|
||||
&showWellHead == changedField ||
|
||||
&showWellPipe == changedField ||
|
||||
&showWellSpheres == changedField ||
|
||||
&wellPipeColor == changedField)
|
||||
{
|
||||
m_reservoirView->schedulePipeGeometryRegen();
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&showWell == changedField ||
|
||||
&showWellCells == changedField ||
|
||||
&showWellCellFence == changedField)
|
||||
|
||||
{
|
||||
reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( &pipeScaleFactor == changedField
|
||||
|| &wellHeadScaleFactor == changedField)
|
||||
{
|
||||
if (reservoirView)
|
||||
{
|
||||
reservoirView->schedulePipeGeometryRegen();
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl)
|
||||
{
|
||||
wellColl->updateStateForVisibilityCheckboxes();
|
||||
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +159,7 @@ void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
bool RimEclipseWell::intersectsVisibleCells(size_t frameIndex) const
|
||||
{
|
||||
if (this->wellResults() == nullptr) return false;
|
||||
|
||||
@ -158,10 +171,10 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
|
||||
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
|
||||
|
||||
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
|
||||
{
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||
|
||||
for (const RivCellSetEnum& visGridPart : visGridParts)
|
||||
{
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
|
||||
@ -169,8 +182,8 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
|
||||
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
|
||||
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -179,18 +192,18 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
// Then check the rest of the well, with all the branches
|
||||
|
||||
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
|
||||
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
|
||||
for (const RigWellResultBranch& branchSegment : wellResSegments)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
|
||||
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx)
|
||||
const std::vector<RigWellResultPoint>& wsResCells = branchSegment.m_branchResultPoints;
|
||||
for (const RigWellResultPoint& wellResultPoint : wsResCells)
|
||||
{
|
||||
if (wsResCells[cIdx].isCell())
|
||||
if (wellResultPoint.isCell())
|
||||
{
|
||||
gridIndex = wsResCells[cIdx].m_gridIndex;
|
||||
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
||||
gridIndex = wellResultPoint.m_gridIndex;
|
||||
gridCellIndex = wellResultPoint.m_gridCellIndex;
|
||||
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
|
||||
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -207,37 +220,57 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance");
|
||||
pipeGroup->add(&showWellLabel);
|
||||
pipeGroup->add(&showWellHead);
|
||||
pipeGroup->add(&showWellPipe);
|
||||
pipeGroup->add(&showWellSpheres);
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Visibility");
|
||||
appearanceGroup->add(&showWellLabel);
|
||||
appearanceGroup->add(&showWellHead);
|
||||
appearanceGroup->add(&showWellPipe);
|
||||
appearanceGroup->add(&showWellSpheres);
|
||||
|
||||
pipeGroup->add(&pipeScaleFactor);
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
|
||||
sizeScalingGroup->add(&pipeScaleFactor);
|
||||
sizeScalingGroup->add(&wellHeadScaleFactor);
|
||||
|
||||
pipeGroup->add(&wellPipeColor);
|
||||
uiOrdering.add(&wellPipeColor);
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
|
||||
filterGroup->add(&showWellCells);
|
||||
filterGroup->add(&showWellCellFence);
|
||||
uiOrdering.add(&showWellCells);
|
||||
uiOrdering.add(&showWellCellFence);
|
||||
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (!reservoirView) return;
|
||||
|
||||
const RimEclipseWellCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl)
|
||||
if (!wellColl) return;
|
||||
|
||||
if (wellColl->showWellsIntersectingVisibleCells() && !this->intersectsVisibleCells(static_cast<size_t>(reservoirView->currentTimeStep())))
|
||||
{
|
||||
showWellLabel.uiCapability()->setUiReadOnly(!wellColl->showWellLabel());
|
||||
showWellHead.uiCapability()->setUiReadOnly(!wellColl->showWellHead());
|
||||
showWellPipe.uiCapability()->setUiReadOnly(!wellColl->showWellPipe());
|
||||
showWellSpheres.uiCapability()->setUiReadOnly(!wellColl->showWellSpheres());
|
||||
// Mark well as read only if well is not intersecting visible cells
|
||||
|
||||
this->uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
|
||||
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) const
|
||||
{
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
|
||||
if (reservoirView == nullptr) return false;
|
||||
@ -263,15 +296,12 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
|
||||
if (!this->showWellPipe())
|
||||
return false;
|
||||
|
||||
if (!reservoirView->wellCollection()->showWellPipe())
|
||||
return false;
|
||||
|
||||
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
|
||||
return true;
|
||||
|
||||
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
||||
{
|
||||
return visibleCellsInstersectsWell(frameIndex);
|
||||
return intersectsVisibleCells(frameIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -282,9 +312,9 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex) const
|
||||
{
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
const RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
|
||||
if (m_reservoirView == nullptr) return false;
|
||||
@ -307,9 +337,6 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
if (!this->showWell())
|
||||
return false;
|
||||
|
||||
if (!m_reservoirView->wellCollection()->showWellSpheres())
|
||||
return false;
|
||||
|
||||
if (!this->showWellSpheres())
|
||||
return false;
|
||||
|
||||
@ -318,7 +345,7 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
|
||||
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
||||
{
|
||||
return visibleCellsInstersectsWell(frameIndex);
|
||||
return intersectsVisibleCells(frameIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -333,9 +360,9 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isUsingCellCenterForPipe()
|
||||
bool RimEclipseWell::isUsingCellCenterForPipe() const
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
const RimEclipseWellCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
|
||||
return (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER);
|
||||
@ -361,7 +388,15 @@ RigSingleWellResultsData* RimEclipseWell::wellResults()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseWell::resultWellIndex()
|
||||
const RigSingleWellResultsData* RimEclipseWell::wellResults() const
|
||||
{
|
||||
return m_wellResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseWell::resultWellIndex() const
|
||||
{
|
||||
return m_resultWellIndex;
|
||||
}
|
||||
|
@ -49,16 +49,16 @@ public:
|
||||
|
||||
void setWellResults(RigSingleWellResultsData* wellResults, size_t resultWellIndex);
|
||||
RigSingleWellResultsData* wellResults();
|
||||
size_t resultWellIndex();
|
||||
const RigSingleWellResultsData* wellResults() const;
|
||||
size_t resultWellIndex() const;
|
||||
|
||||
bool isWellPipeVisible(size_t frameIndex);
|
||||
bool isWellSpheresVisible(size_t frameIndex);
|
||||
bool isUsingCellCenterForPipe();
|
||||
bool isWellPipeVisible(size_t frameIndex) const;
|
||||
bool isWellSpheresVisible(size_t frameIndex) const;
|
||||
bool isUsingCellCenterForPipe() const;
|
||||
|
||||
bool visibleCellsInstersectsWell(size_t frameIndex);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
virtual caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void calculateWellPipeStaticCenterLine( std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
|
||||
@ -76,6 +76,7 @@ public:
|
||||
caf::PdmField<bool> showWellPipe;
|
||||
caf::PdmField<bool> showWellSpheres;
|
||||
|
||||
caf::PdmField<double> wellHeadScaleFactor;
|
||||
caf::PdmField<double> pipeScaleFactor;
|
||||
|
||||
caf::PdmField<cvf::Color3f> wellPipeColor;
|
||||
@ -87,8 +88,12 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||
|
||||
private:
|
||||
bool intersectsVisibleCells(size_t frameIndex) const;
|
||||
|
||||
private:
|
||||
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
||||
|
@ -23,16 +23,21 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RivReservoirViewPartMgr.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiCheckBoxTristateEditor.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
@ -51,6 +56,7 @@ namespace caf
|
||||
|
||||
namespace caf
|
||||
{
|
||||
// OBSOLETE enum
|
||||
template<>
|
||||
void RimEclipseWellCollection::WellCellsRangeFilterEnum::setUp()
|
||||
{
|
||||
@ -109,10 +115,26 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
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", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellHead, "ShowWellHeadTristate", "Show Well Head", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellLabel, "ShowWellLabelTristate", "Show Well Label", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellPipe, "ShowWellPipe", "Show Well Pipe", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellSpheres, "ShowWellSpheres", "Show Well Spheres", "", "", "");
|
||||
|
||||
m_showWellHead.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellHead.xmlCapability()->setIOReadable(false);
|
||||
m_showWellHead.xmlCapability()->setIOWritable(false);
|
||||
|
||||
m_showWellLabel.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellLabel.xmlCapability()->setIOReadable(false);
|
||||
m_showWellLabel.xmlCapability()->setIOWritable(false);
|
||||
|
||||
m_showWellPipe.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellPipe.xmlCapability()->setIOReadable(false);
|
||||
m_showWellPipe.xmlCapability()->setIOWritable(false);
|
||||
|
||||
m_showWellSpheres.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellSpheres.xmlCapability()->setIOReadable(false);
|
||||
m_showWellSpheres.xmlCapability()->setIOWritable(false);
|
||||
|
||||
// Scaling
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale Factor", "", "", "");
|
||||
@ -121,7 +143,7 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
|
||||
// Color
|
||||
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(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Show Connection Status Colors Along Well", "", "", "");
|
||||
|
||||
@ -142,11 +164,14 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
|
||||
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
|
||||
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Geometry", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Type", "", "", "");
|
||||
|
||||
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_InitFieldNoDefault(&m_showWellCells, "ShowWellCellsTristate", "Show Well Cells", "", "", "");
|
||||
m_showWellCells.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellCells.xmlCapability()->setIOReadable(false);
|
||||
m_showWellCells.xmlCapability()->setIOWritable(false);
|
||||
|
||||
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, "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", "");
|
||||
@ -155,9 +180,30 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
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", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_showWellCellFence, "ShowWellCellFenceTristate", "Show Well Cell Fence", "", "", "");
|
||||
m_showWellCellFence.uiCapability()->setUiEditorTypeName(caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName());
|
||||
m_showWellCellFence.xmlCapability()->setIOReadable(false);
|
||||
m_showWellCellFence.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&obsoleteField_wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_INDIVIDUALLY), "Global well pipe visibility", "", "", "");
|
||||
obsoleteField_wellPipeVisibility.uiCapability()->setUiHidden(true);
|
||||
obsoleteField_wellPipeVisibility.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&obsoleteField_wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_INDIVIDUAL), "Add cells to range filter", "", "", "");
|
||||
obsoleteField_wellCellsToRangeFilterMode.uiCapability()->setUiHidden(true);
|
||||
obsoleteField_wellCellsToRangeFilterMode.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&obsoleteField_showWellHead, "ShowWellHead", true, "Show Well Head", "", "", "");
|
||||
CAF_PDM_InitField(&obsoleteField_showWellLabel, "ShowWellLabel", true, "Show Well Label", "", "", "");
|
||||
CAF_PDM_InitField(&obsoleteField_showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", "");
|
||||
|
||||
obsoleteField_showWellHead.uiCapability()->setUiHidden(true);
|
||||
obsoleteField_showWellLabel.uiCapability()->setUiHidden(true);
|
||||
obsoleteField_showWellCellFence.uiCapability()->setUiHidden(true);
|
||||
|
||||
obsoleteField_showWellHead.xmlCapability()->setIOWritable(false);
|
||||
obsoleteField_showWellLabel.xmlCapability()->setIOWritable(false);
|
||||
obsoleteField_showWellCellFence.xmlCapability()->setIOWritable(false);
|
||||
|
||||
m_reservoirView = NULL;
|
||||
}
|
||||
@ -170,6 +216,40 @@ RimEclipseWellCollection::~RimEclipseWellCollection()
|
||||
wells.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::setShowWellCellsState(bool enable)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = enable;
|
||||
}
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWellCollection::showWellCells()
|
||||
{
|
||||
if (m_showWellCells().isFalse())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -191,14 +271,13 @@ RimEclipseWell* RimEclipseWellCollection::findWell(QString name)
|
||||
bool RimEclipseWellCollection::hasVisibleWellCells()
|
||||
{
|
||||
if (!this->isActive()) return false;
|
||||
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_NONE) return false;
|
||||
if (this->wells().size() == 0 ) return false;
|
||||
|
||||
bool hasCells = false;
|
||||
for (size_t i = 0 ; !hasCells && i < this->wells().size(); ++i)
|
||||
{
|
||||
RimEclipseWell* well = this->wells()[i];
|
||||
if ( well && well->wellResults() && ((well->showWell() && well->showWellCells()) || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) )
|
||||
if ( well && well->wellResults() && ((well->showWell() && well->showWellCells())) )
|
||||
{
|
||||
for (size_t tIdx = 0; !hasCells && tIdx < well->wellResults()->m_wellCellsTimeSteps.size(); ++tIdx )
|
||||
{
|
||||
@ -213,8 +292,6 @@ bool RimEclipseWellCollection::hasVisibleWellCells()
|
||||
|
||||
if (!hasCells) return false;
|
||||
|
||||
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_INDIVIDUAL || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) return true;
|
||||
|
||||
// Todo: Handle range filter intersection
|
||||
|
||||
return true;
|
||||
@ -241,12 +318,66 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
if (&m_showWellLabel == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellLabel = !(m_showWellLabel().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellHead == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellHead = !(m_showWellHead().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellPipe == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellPipe = !(m_showWellPipe().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellSpheres == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellSpheres = !(m_showWellSpheres().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellCells == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = !(m_showWellCells().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_showWellCellFence == changedField)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCellFence = !(m_showWellCellFence().isFalse());
|
||||
w->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
if ( &isActive == changedField
|
||||
|| &showWellLabel == changedField
|
||||
|| &wellCellsToRangeFilterMode == changedField
|
||||
|| &showWellCellFences == changedField
|
||||
|| &m_showWellLabel == changedField
|
||||
|| &m_showWellCells == changedField
|
||||
|| &m_showWellCellFence == changedField
|
||||
|| &wellCellFenceType == changedField)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
@ -257,7 +388,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( &spheresScaleFactor == changedField
|
||||
|| &showWellSpheres == changedField
|
||||
|| &m_showWellSpheres == changedField
|
||||
|| &showConnectionStatusColors == changedField)
|
||||
{
|
||||
m_reservoirView->schedulePipeGeometryRegen();
|
||||
@ -266,40 +397,23 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
else if ( &pipeCrossSectionVertexCount == changedField
|
||||
|| &pipeScaleFactor == changedField
|
||||
|| &wellHeadScaleFactor == changedField
|
||||
|| &showWellHead == changedField
|
||||
|| &m_showWellHead == changedField
|
||||
|| &isAutoDetectingBranches == changedField
|
||||
|| &wellHeadPosition == changedField
|
||||
|| &wellLabelColor == changedField
|
||||
|| &showWellsIntersectingVisibleCells == changedField
|
||||
|| &wellPipeCoordType == changedField
|
||||
|| &showWellPipe == changedField)
|
||||
|| &m_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);
|
||||
assignDefaultWellColors();
|
||||
|
||||
wells[i]->wellPipeColor = col;
|
||||
wells[i]->updateConnectedEditors();
|
||||
}
|
||||
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
m_applyIndividualColorsToWells = false;
|
||||
@ -320,6 +434,12 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
m_applySingleColorToWells = false;
|
||||
}
|
||||
|
||||
if (&m_showWellCells == changedField)
|
||||
{
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
}
|
||||
}
|
||||
|
||||
if (&wellPipeCoordType)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
@ -332,6 +452,34 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::assignDefaultWellColors()
|
||||
{
|
||||
// The wells are sorted, use ordering of single well results data to assign colors
|
||||
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
if (!rimEclipseCase) return;
|
||||
|
||||
if (!rimEclipseCase->reservoirData()) return;
|
||||
|
||||
cvf::Collection<RigSingleWellResultsData> wellResults = rimEclipseCase->reservoirData()->wellResults();
|
||||
|
||||
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
|
||||
{
|
||||
RimEclipseWell* well = this->findWell(wellResults[wIdx]->m_wellName);
|
||||
if (well)
|
||||
{
|
||||
cvf::Color3f col = cycledPaletteColor(wIdx);
|
||||
|
||||
well->wellPipeColor = col;
|
||||
well->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -345,13 +493,15 @@ void RimEclipseWellCollection::setReservoirView(RimEclipseView* ownerReservoirVi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
updateStateForVisibilityCheckboxes();
|
||||
|
||||
uiOrdering.add(&showWellsIntersectingVisibleCells);
|
||||
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||
appearanceGroup->add(&showWellLabel);
|
||||
appearanceGroup->add(&showWellHead);
|
||||
appearanceGroup->add(&showWellPipe);
|
||||
appearanceGroup->add(&showWellSpheres);
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Visibility");
|
||||
appearanceGroup->add(&m_showWellLabel);
|
||||
appearanceGroup->add(&m_showWellHead);
|
||||
appearanceGroup->add(&m_showWellPipe);
|
||||
appearanceGroup->add(&m_showWellSpheres);
|
||||
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
|
||||
sizeScalingGroup->add(&wellHeadScaleFactor);
|
||||
@ -367,18 +517,75 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
|
||||
colorGroup->add(&showConnectionStatusColors);
|
||||
|
||||
uiOrdering.add(&wellPipeCoordType);
|
||||
caf::PdmUiGroup* wellPipeGroup = uiOrdering.addNewGroup("Well Pipe Geometry");
|
||||
wellPipeGroup->add(&wellPipeCoordType);
|
||||
wellPipeGroup->add(&isAutoDetectingBranches);
|
||||
|
||||
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
|
||||
advancedGroup->add(&isAutoDetectingBranches);
|
||||
advancedGroup->add(&wellCellTransparencyLevel);
|
||||
|
||||
uiOrdering.add(&wellHeadPosition);
|
||||
advancedGroup->add(&wellHeadPosition);
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well range filter");
|
||||
filterGroup->add(&wellCellsToRangeFilterMode);
|
||||
filterGroup->add(&showWellCellFences);
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells");
|
||||
filterGroup->add(&obsoleteField_wellCellsToRangeFilterMode);
|
||||
filterGroup->add(&m_showWellCells);
|
||||
filterGroup->add(&m_showWellCellFence);
|
||||
filterGroup->add(&wellCellFenceType);
|
||||
|
||||
m_showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
wellCellFenceType.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::updateStateForVisibilityCheckboxes()
|
||||
{
|
||||
size_t showLabelCount = 0;
|
||||
size_t showWellHeadCount = 0;
|
||||
size_t showPipeCount = 0;
|
||||
size_t showSphereCount = 0;
|
||||
size_t showWellCellsCount = 0;
|
||||
size_t showWellCellFenceCount = 0;
|
||||
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
if (w->showWellLabel()) showLabelCount++;
|
||||
if (w->showWellHead()) showWellHeadCount++;
|
||||
if (w->showWellPipe()) showPipeCount++;
|
||||
if (w->showWellSpheres()) showSphereCount++;
|
||||
if (w->showWellCells()) showWellCellsCount++;
|
||||
if (w->showWellCellFence()) showWellCellFenceCount++;
|
||||
}
|
||||
|
||||
updateStateFromEnabledChildCount(showLabelCount, &m_showWellLabel);
|
||||
updateStateFromEnabledChildCount(showWellHeadCount, &m_showWellHead);
|
||||
updateStateFromEnabledChildCount(showPipeCount, &m_showWellPipe);
|
||||
updateStateFromEnabledChildCount(showSphereCount, &m_showWellSpheres);
|
||||
updateStateFromEnabledChildCount(showWellCellsCount, &m_showWellCells);
|
||||
updateStateFromEnabledChildCount(showWellCellFenceCount, &m_showWellCellFence);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWellCollection::updateStateFromEnabledChildCount(size_t enabledChildCount, caf::PdmField<caf::Tristate>* fieldToUpdate)
|
||||
{
|
||||
caf::Tristate tristate;
|
||||
|
||||
if (enabledChildCount == 0)
|
||||
{
|
||||
tristate = caf::Tristate::State::False;
|
||||
}
|
||||
else if (enabledChildCount == wells.size())
|
||||
{
|
||||
tristate = caf::Tristate::State::True;
|
||||
}
|
||||
else
|
||||
{
|
||||
tristate = caf::Tristate::State::PartiallyTrue;
|
||||
}
|
||||
|
||||
fieldToUpdate->setValue(tristate);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -405,7 +612,7 @@ void RimEclipseWellCollection::initAfterRead()
|
||||
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWell = false;
|
||||
w->showWellPipe = false;
|
||||
}
|
||||
}
|
||||
else if (obsoleteField_wellPipeVisibility() == PIPES_FORCE_ALL_ON)
|
||||
@ -414,12 +621,47 @@ void RimEclipseWellCollection::initAfterRead()
|
||||
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWell = true;
|
||||
w->showWellPipe = true;
|
||||
}
|
||||
}
|
||||
else if (obsoleteField_wellPipeVisibility() == PIPES_INDIVIDUALLY)
|
||||
|
||||
if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_NONE)
|
||||
{
|
||||
showWellsIntersectingVisibleCells = false;
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = false;
|
||||
}
|
||||
}
|
||||
else if (obsoleteField_wellCellsToRangeFilterMode() == RANGE_ADD_ALL)
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCells = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obsoleteField_showWellLabel())
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellLabel = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obsoleteField_showWellHead())
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellHead = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (obsoleteField_showWellCellFence())
|
||||
{
|
||||
for (RimEclipseWell* w : wells)
|
||||
{
|
||||
w->showWellCellFence = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,12 +728,12 @@ void RimEclipseWellCollection::calculateWellGeometryVisibility(size_t frameIndex
|
||||
if (m_framesOfResultWellPipeVisibilities[frameIndex].size() <= wells().size())
|
||||
m_framesOfResultWellPipeVisibilities[frameIndex].resize(wells().size(), false);
|
||||
|
||||
for (size_t i = 0; i < wells().size(); ++i)
|
||||
for (const RimEclipseWell* well : wells())
|
||||
{
|
||||
bool wellPipeVisible = wells[i]->isWellPipeVisible(frameIndex);
|
||||
bool wellSphereVisible = wells[i]->isWellSpheresVisible(frameIndex);
|
||||
bool wellPipeVisible = well->isWellPipeVisible(frameIndex);
|
||||
bool wellSphereVisible = well->isWellSpheresVisible(frameIndex);
|
||||
|
||||
m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wellPipeVisible || wellSphereVisible;
|
||||
m_framesOfResultWellPipeVisibilities[frameIndex][well->resultWellIndex()] = wellPipeVisible || wellSphereVisible;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,10 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h" // Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
// Include to make Pdm work for cvf::Color
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
class RimEclipseView;
|
||||
class RimEclipseWell;
|
||||
@ -89,11 +88,6 @@ public:
|
||||
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;
|
||||
@ -101,9 +95,9 @@ public:
|
||||
caf::PdmField<cvf::Color3f> wellLabelColor;
|
||||
caf::PdmField<bool> showConnectionStatusColors;
|
||||
|
||||
void setShowWellCellsState(bool enable);
|
||||
bool showWellCells();
|
||||
|
||||
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
|
||||
caf::PdmField<bool> showWellCellFences;
|
||||
caf::PdmField<WellFenceEnum> wellCellFenceType;
|
||||
caf::PdmField<double> wellCellTransparencyLevel;
|
||||
|
||||
@ -123,17 +117,26 @@ public:
|
||||
|
||||
const std::vector<cvf::ubyte>& resultWellGeometryVisibilities(size_t frameIndex);
|
||||
void scheduleIsWellPipesVisibleRecalculation();
|
||||
void updateStateForVisibilityCheckboxes();
|
||||
|
||||
|
||||
static cvf::Color3f cycledPaletteColor(size_t colorIndex);
|
||||
void assignDefaultWellColors();
|
||||
|
||||
protected:
|
||||
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);
|
||||
void updateStateFromEnabledChildCount(size_t showLabelCount, caf::PdmField<caf::Tristate>* fieldToUpdate);
|
||||
|
||||
private:
|
||||
RimEclipseView* m_reservoirView;
|
||||
@ -144,6 +147,18 @@ private:
|
||||
caf::PdmField<bool> m_applySingleColorToWells;
|
||||
caf::PdmField<bool> m_applyIndividualColorsToWells;
|
||||
|
||||
caf::PdmField<caf::Tristate> m_showWellLabel;
|
||||
caf::PdmField<caf::Tristate> m_showWellHead;
|
||||
caf::PdmField<caf::Tristate> m_showWellPipe;
|
||||
caf::PdmField<caf::Tristate> m_showWellSpheres;
|
||||
caf::PdmField<caf::Tristate> m_showWellCells;
|
||||
caf::PdmField<caf::Tristate> m_showWellCellFence;
|
||||
|
||||
// Obsolete fields
|
||||
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
|
||||
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
|
||||
caf::PdmField<WellCellsRangeFilterEnum> obsoleteField_wellCellsToRangeFilterMode;
|
||||
|
||||
caf::PdmField<bool> obsoleteField_showWellLabel;
|
||||
caf::PdmField<bool> obsoleteField_showWellHead;
|
||||
caf::PdmField<bool> obsoleteField_showWellCellFence;
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ void RimIntersectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimIntersectionCollection::hasActiveIntersectionForSimulationWell(RimEclipseWell* eclipseWell) const
|
||||
bool RimIntersectionCollection::hasActiveIntersectionForSimulationWell(const RimEclipseWell* eclipseWell) const
|
||||
{
|
||||
if (!isActive) return false;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
void appendIntersection(RimIntersection* intersection);
|
||||
void appendIntersectionBox(RimIntersectionBox* intersectionBox);
|
||||
|
||||
bool hasActiveIntersectionForSimulationWell(RimEclipseWell* eclipseWell) const;
|
||||
bool hasActiveIntersectionForSimulationWell(const RimEclipseWell* eclipseWell) const;
|
||||
|
||||
void updateIntersectionBoxGeometry();
|
||||
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
virtual void onLoadDataAndUpdate() = 0;
|
||||
|
||||
void updateCurvePresentation();
|
||||
void updateCurveAppearance();
|
||||
virtual void updateCurveAppearance();
|
||||
|
||||
void updateOptionSensitivity();
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
RimWellLogTrack* trackByIndex(size_t index);
|
||||
|
||||
void loadDataAndUpdate();
|
||||
virtual void loadDataAndUpdate() override;
|
||||
void updateTracks();
|
||||
void updateTrackNames();
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "qwt_scale_engine.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
|
||||
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
|
||||
#define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0
|
||||
@ -311,6 +312,9 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::updateXZoom()
|
||||
{
|
||||
std::vector<RimWellFlowRateCurve*> stackCurves = visibleStackedCurves();
|
||||
for (RimWellFlowRateCurve* stCurve: stackCurves) stCurve->updateStackedPlotData();
|
||||
|
||||
if (!m_isAutoScaleXEnabled())
|
||||
{
|
||||
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
|
||||
@ -459,3 +463,21 @@ void RimWellLogTrack::setLogarithmicScale(bool enable)
|
||||
updateAxisScaleEngine();
|
||||
computeAndSetXRangeMinForLogarithmicScale();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellFlowRateCurve*> RimWellLogTrack::visibleStackedCurves()
|
||||
{
|
||||
std::vector<RimWellFlowRateCurve*> stackedCurves;
|
||||
for (RimWellLogCurve* curve: curves)
|
||||
{
|
||||
if (curve && curve->isCurveVisible() )
|
||||
{
|
||||
RimWellFlowRateCurve* wfrCurve = dynamic_cast<RimWellFlowRateCurve*>(curve);
|
||||
if (wfrCurve) stackedCurves.push_back(wfrCurve);
|
||||
}
|
||||
}
|
||||
|
||||
return stackedCurves;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
class RimWellLogCurve;
|
||||
class RiuWellLogTrack;
|
||||
class RimWellFlowRateCurve;
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
@ -66,6 +67,7 @@ public:
|
||||
|
||||
void setLogarithmicScale(bool enable);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> visibleStackedCurves();
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
@ -27,6 +27,7 @@ ${CEE_CURRENT_LIST_DIR}RigFlowDiagSolverInterface.h
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagInterfaceTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagStatCalc.h
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagVisibleCellsStatCalc.h
|
||||
${CEE_CURRENT_LIST_DIR}RigAccWellFlowCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
|
||||
@ -76,6 +77,7 @@ ${CEE_CURRENT_LIST_DIR}RigFlowDiagResultFrames.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagSolverInterface.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagStatCalc.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagVisibleCellsStatCalc.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigAccWellFlowCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp
|
||||
|
238
ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp
Normal file
238
ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp
Normal file
@ -0,0 +1,238 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigAccWellFlowCalculator.h"
|
||||
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords, const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds, const std::map<QString, const std::vector<double>* >& tracerCellFractionValues, const RigEclCellIndexCalculator cellIndexCalculator):
|
||||
m_pipeBranchesCLCoords(pipeBranchesCLCoords),
|
||||
m_pipeBranchesCellIds(pipeBranchesCellIds),
|
||||
m_tracerCellFractionValues(&tracerCellFractionValues),
|
||||
m_cellIndexCalculator(cellIndexCalculator)
|
||||
{
|
||||
m_accConnectionFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
for ( const auto& it: (*m_tracerCellFractionValues) ) m_tracerNames.push_back(it.first);
|
||||
calculateAccumulatedFlowPrConnection(0, 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords, const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds):
|
||||
m_pipeBranchesCLCoords(pipeBranchesCLCoords),
|
||||
m_pipeBranchesCellIds(pipeBranchesCellIds),
|
||||
m_tracerCellFractionValues(nullptr),
|
||||
m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr))
|
||||
{
|
||||
m_accConnectionFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
m_tracerNames.push_back("GrandTotalOnly");
|
||||
calculateAccumulatedFlowPrConnection(0, 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::accumulatedTotalFlowPrConnection(size_t branchIdx)
|
||||
{
|
||||
CVF_ASSERT(m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.find("GrandTotalOnly") != m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.end());
|
||||
|
||||
return m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer["GrandTotalOnly"];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx)
|
||||
{
|
||||
CVF_ASSERT(m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.find(tracerName) != m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.end());
|
||||
|
||||
return m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer[tracerName];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RigAccWellFlowCalculator::connectionNumbersFromTop(size_t branchIdx)
|
||||
{
|
||||
return m_accConnectionFlowPrBranch[branchIdx].connectionNumbersFromTop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branchIdx, size_t startConnectionNumberFromTop)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& branchCells = m_pipeBranchesCellIds[branchIdx];
|
||||
|
||||
std::vector<size_t> resPointToConnectionIndexFromBottom = wrpToConnectionIndexFromBottom(branchCells);
|
||||
|
||||
size_t prevConnIndx = -1;
|
||||
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
|
||||
|
||||
std::map<QString, std::vector<double> >& accConnFlowFractionsPrTracer = m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer;
|
||||
std::vector<size_t>& connNumbersFromTop = m_accConnectionFlowPrBranch[branchIdx].connectionNumbersFromTop;
|
||||
|
||||
std::vector<double> accFlow;
|
||||
accFlow.resize(m_tracerNames.size(), 0.0);
|
||||
|
||||
while ( clSegIdx >= 0 )
|
||||
{
|
||||
// Skip point if referring to the same cell as the previous centerline segment did
|
||||
{
|
||||
if ( resPointToConnectionIndexFromBottom[clSegIdx] == prevConnIndx )
|
||||
{
|
||||
--clSegIdx;
|
||||
continue;
|
||||
}
|
||||
|
||||
prevConnIndx = resPointToConnectionIndexFromBottom[clSegIdx];
|
||||
}
|
||||
|
||||
// Accumulate the connection-cell's fraction flows
|
||||
|
||||
if ( m_tracerCellFractionValues )
|
||||
{
|
||||
if ( branchCells[clSegIdx].isCell() && branchCells[clSegIdx].m_isOpen )
|
||||
{
|
||||
size_t resCellIndex = m_cellIndexCalculator.resultCellIndex(branchCells[clSegIdx].m_gridIndex,
|
||||
branchCells[clSegIdx].m_gridCellIndex);
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerFractionIt: (*m_tracerCellFractionValues) )
|
||||
{
|
||||
double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex];
|
||||
if (cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction)
|
||||
{
|
||||
accFlow[tracerIdx] += (*tracerFractionIt.second)[resCellIndex] * branchCells[clSegIdx].flowRate();
|
||||
}
|
||||
tracerIdx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accFlow[0] += branchCells[clSegIdx].flowRate();
|
||||
}
|
||||
|
||||
// Add the total accumulated (fraction) flows from any branches connected to this cell
|
||||
|
||||
size_t connNumFromTop = connectionIndexFromTop(resPointToConnectionIndexFromBottom, clSegIdx) + startConnectionNumberFromTop;
|
||||
|
||||
std::vector<size_t> downstreamBranches = findDownstreamBranchIdxs(branchCells[clSegIdx]);
|
||||
for ( size_t dsBidx : downstreamBranches )
|
||||
{
|
||||
if ( dsBidx != branchIdx && m_accConnectionFlowPrBranch[dsBidx].connectionNumbersFromTop.size() == 0 ) // Not this branch or already calculated
|
||||
{
|
||||
calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop);
|
||||
BranchResult& accConnFlowFractionsDsBranch = m_accConnectionFlowPrBranch[dsBidx];
|
||||
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerName: m_tracerNames )
|
||||
{
|
||||
accFlow[tracerIdx] += accConnFlowFractionsDsBranch.accConnFlowFractionsPrTracer[tracerName].back();
|
||||
tracerIdx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Push back the accumulated result into the storage
|
||||
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerName: m_tracerNames )
|
||||
{
|
||||
accConnFlowFractionsPrTracer[tracerName].push_back(accFlow[tracerIdx]);
|
||||
tracerIdx++;
|
||||
}
|
||||
|
||||
connNumbersFromTop.push_back(connNumFromTop);
|
||||
|
||||
--clSegIdx;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RigAccWellFlowCalculator::wrpToConnectionIndexFromBottom(const std::vector<RigWellResultPoint> &branchCells)
|
||||
{
|
||||
std::vector<size_t> resPointToConnectionIndexFromBottom;
|
||||
resPointToConnectionIndexFromBottom.resize(branchCells.size(), -1);
|
||||
|
||||
size_t connIdxFromBottom = 0;
|
||||
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
|
||||
|
||||
if (clSegIdx < 0) return resPointToConnectionIndexFromBottom;
|
||||
|
||||
size_t prevGridIdx = branchCells[clSegIdx].m_gridIndex;
|
||||
size_t prevGridCellIdx = branchCells[clSegIdx].m_gridCellIndex;
|
||||
int prevErtSegId = branchCells[clSegIdx].m_ertSegmentId;
|
||||
int prevErtBranchId = branchCells[clSegIdx].m_ertBranchId;
|
||||
|
||||
while ( clSegIdx >= 0 )
|
||||
{
|
||||
if ( branchCells[clSegIdx].m_gridIndex != prevGridIdx
|
||||
|| branchCells[clSegIdx].m_gridCellIndex != prevGridCellIdx
|
||||
|| branchCells[clSegIdx].m_ertSegmentId != prevErtSegId
|
||||
|| branchCells[clSegIdx].m_ertBranchId != prevErtBranchId)
|
||||
{
|
||||
++connIdxFromBottom;
|
||||
|
||||
prevGridIdx = branchCells[clSegIdx].m_gridIndex ;
|
||||
prevGridCellIdx = branchCells[clSegIdx].m_gridCellIndex;
|
||||
}
|
||||
|
||||
resPointToConnectionIndexFromBottom[clSegIdx] = connIdxFromBottom;
|
||||
|
||||
--clSegIdx;
|
||||
}
|
||||
|
||||
return resPointToConnectionIndexFromBottom;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigAccWellFlowCalculator::connectionIndexFromTop(const std::vector<size_t>& resPointToConnectionIndexFromBottom, size_t clSegIdx)
|
||||
{
|
||||
return resPointToConnectionIndexFromBottom.front() - resPointToConnectionIndexFromBottom[clSegIdx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RigAccWellFlowCalculator::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
|
||||
&& m_pipeBranchesCellIds[bIdx][0].m_ertBranchId == connectionPoint.m_ertBranchId
|
||||
&& m_pipeBranchesCellIds[bIdx][0].m_ertSegmentId == connectionPoint.m_ertSegmentId)
|
||||
{
|
||||
downStreamBranchIdxs.push_back(bIdx);
|
||||
}
|
||||
}
|
||||
return downStreamBranchIdxs;
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigActiveCellInfo.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
struct RigWellResultPoint;
|
||||
|
||||
class RigEclCellIndexCalculator
|
||||
{
|
||||
public:
|
||||
RigEclCellIndexCalculator(const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo)
|
||||
: m_mainGrid(mainGrid), m_activeCellInfo(activeCellInfo)
|
||||
{}
|
||||
|
||||
size_t resultCellIndex(size_t gridIndex, size_t gridCellIndex) const
|
||||
{
|
||||
const RigGridBase* grid = m_mainGrid->gridByIndex(gridIndex);
|
||||
size_t reservoirCellIndex = grid->reservoirCellIndex(gridCellIndex);
|
||||
|
||||
return m_activeCellInfo->cellResultIndex(reservoirCellIndex);
|
||||
}
|
||||
|
||||
private:
|
||||
const RigMainGrid* m_mainGrid;
|
||||
const RigActiveCellInfo* m_activeCellInfo;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RigAccWellFlowCalculator
|
||||
{
|
||||
|
||||
public:
|
||||
RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds,
|
||||
const std::map<QString, const std::vector<double>* >& tracerCellFractionValues,
|
||||
const RigEclCellIndexCalculator cellIndexCalculator);
|
||||
|
||||
RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
|
||||
|
||||
|
||||
const std::vector<double>& accumulatedTotalFlowPrConnection( size_t branchIdx);
|
||||
const std::vector<double>& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx);
|
||||
const std::vector<size_t>& connectionNumbersFromTop(size_t branchIdx);
|
||||
const std::vector<QString>& tracerNames() { return m_tracerNames;}
|
||||
private:
|
||||
|
||||
void calculateAccumulatedFlowPrConnection( size_t branchIdx, size_t startConnectionNumberFromTop);
|
||||
std::vector<size_t> wrpToConnectionIndexFromBottom( const std::vector<RigWellResultPoint> &branchCells);
|
||||
static size_t connectionIndexFromTop( const std::vector<size_t>& resPointToConnectionIndexFromBottom, size_t clSegIdx);
|
||||
std::vector<size_t> findDownstreamBranchIdxs( const RigWellResultPoint& connectionPoint);
|
||||
|
||||
|
||||
const std::vector< std::vector <cvf::Vec3d> >& m_pipeBranchesCLCoords;
|
||||
const std::vector< std::vector <RigWellResultPoint> >& m_pipeBranchesCellIds;
|
||||
const std::map<QString, const std::vector<double>* >* m_tracerCellFractionValues;
|
||||
RigEclCellIndexCalculator m_cellIndexCalculator;
|
||||
std::vector<QString> m_tracerNames;
|
||||
|
||||
struct BranchResult
|
||||
{
|
||||
std::vector<size_t> connectionNumbersFromTop;
|
||||
std::map<QString, std::vector<double> > accConnFlowFractionsPrTracer;
|
||||
};
|
||||
|
||||
std::vector< BranchResult > m_accConnectionFlowPrBranch;
|
||||
};
|
||||
|
||||
|
@ -95,20 +95,6 @@ bool RigSingleWellResultsData::hasWellResult(size_t resultTimeStepIndex) const
|
||||
return wellTimeStepIndex != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigSingleWellResultsData::firstResultTimeStep() const
|
||||
{
|
||||
size_t i = 0;
|
||||
for(i = 0; i < m_resultTimeStepIndexToWellTimeStepIndex.size(); ++i)
|
||||
{
|
||||
if (m_resultTimeStepIndexToWellTimeStepIndex[i] != cvf::UNDEFINED_SIZE_T) return i;
|
||||
}
|
||||
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
bool operator== (const RigWellResultPoint& p1, const RigWellResultPoint& p2)
|
||||
{
|
||||
return
|
||||
|
@ -58,6 +58,18 @@ struct RigWellResultPoint
|
||||
return isCell() || isPointValid();
|
||||
}
|
||||
|
||||
double flowRate() const
|
||||
{
|
||||
if ( isCell() && m_isOpen)
|
||||
{
|
||||
return m_flowRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t m_gridIndex;
|
||||
size_t m_gridCellIndex; //< Index to cell which is included in the well
|
||||
|
||||
@ -123,7 +135,6 @@ public:
|
||||
bool isMultiSegmentWell() const;
|
||||
|
||||
bool hasWellResult(size_t resultTimeStepIndex) const;
|
||||
size_t firstResultTimeStep() const;
|
||||
|
||||
const RigWellResultFrame& wellResultFrame(size_t resultTimeStepIndex) const;
|
||||
|
||||
|
@ -289,11 +289,10 @@ void RiuMainWindow::createActions()
|
||||
m_toggleFaultsLabelAction->setCheckable(true);
|
||||
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
|
||||
|
||||
m_addWellCellsToRangeFilterAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Add Well Cells To Range Filter", this);
|
||||
m_addWellCellsToRangeFilterAction->setCheckable(true);
|
||||
m_addWellCellsToRangeFilterAction->setToolTip("Add Well Cells To Range Filter based on the individual settings");
|
||||
connect(m_addWellCellsToRangeFilterAction, SIGNAL(toggled(bool)), SLOT(slotAddWellCellsToRangeFilterAction(bool)));
|
||||
|
||||
m_showWellCellsAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Show Well Cells", this);
|
||||
m_showWellCellsAction->setCheckable(true);
|
||||
m_showWellCellsAction->setToolTip("Show Well Cells");
|
||||
connect(m_showWellCellsAction, SIGNAL(toggled(bool)), SLOT(slotShowWellCellsAction(bool)));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -474,7 +473,7 @@ void RiuMainWindow::createToolBars()
|
||||
dsToolBar->addAction(m_disableLightingAction);
|
||||
dsToolBar->addAction(m_drawStyleHideGridCellsAction);
|
||||
dsToolBar->addAction(m_toggleFaultsLabelAction);
|
||||
dsToolBar->addAction(m_addWellCellsToRangeFilterAction);
|
||||
dsToolBar->addAction(m_showWellCellsAction);
|
||||
}
|
||||
|
||||
// Create animation toolbar
|
||||
@ -1376,7 +1375,7 @@ void RiuMainWindow::refreshDrawStyleActions()
|
||||
enable = enable && eclView;
|
||||
|
||||
m_toggleFaultsLabelAction->setEnabled(enable);
|
||||
m_addWellCellsToRangeFilterAction->setEnabled(enable);
|
||||
m_showWellCellsAction->setEnabled(enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
@ -1384,9 +1383,10 @@ void RiuMainWindow::refreshDrawStyleActions()
|
||||
m_toggleFaultsLabelAction->setChecked(eclView->faultCollection()->showFaultLabel());
|
||||
m_toggleFaultsLabelAction->blockSignals(false);
|
||||
|
||||
m_addWellCellsToRangeFilterAction->blockSignals(true);
|
||||
m_addWellCellsToRangeFilterAction->setChecked(eclView->wellCollection()->wellCellsToRangeFilterMode() != RimEclipseWellCollection::RANGE_ADD_NONE);
|
||||
m_addWellCellsToRangeFilterAction->blockSignals(false);
|
||||
m_showWellCellsAction->blockSignals(true);
|
||||
eclView->wellCollection()->updateStateForVisibilityCheckboxes();
|
||||
m_showWellCellsAction->setChecked(eclView->wellCollection()->showWellCells());
|
||||
m_showWellCellsAction->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1573,15 +1573,12 @@ void RiuMainWindow::setDefaultWindowSize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotAddWellCellsToRangeFilterAction(bool doAdd)
|
||||
void RiuMainWindow::slotShowWellCellsAction(bool doAdd)
|
||||
{
|
||||
RimEclipseView* riv = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
||||
if (riv)
|
||||
{
|
||||
caf::AppEnum<RimEclipseWellCollection::WellCellsRangeFilterType> rangeAddType;
|
||||
rangeAddType = doAdd ? RimEclipseWellCollection::RANGE_ADD_INDIVIDUAL : RimEclipseWellCollection::RANGE_ADD_NONE;
|
||||
|
||||
riv->wellCollection()->wellCellsToRangeFilterMode.setValueWithFieldChanged(rangeAddType);
|
||||
riv->wellCollection()->setShowWellCellsState(doAdd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ private slots:
|
||||
void slotToggleFaultLabelsAction(bool);
|
||||
void slotDisableLightingAction(bool);
|
||||
|
||||
void slotAddWellCellsToRangeFilterAction(bool doAdd);
|
||||
void slotShowWellCellsAction(bool doAdd);
|
||||
|
||||
// Debug slots
|
||||
void slotUseShaders(bool enable);
|
||||
@ -246,7 +246,7 @@ private:
|
||||
QAction* m_drawStyleLinesSolidAction;
|
||||
QAction* m_drawStyleFaultLinesSolidAction;
|
||||
QAction* m_drawStyleSurfOnlyAction;
|
||||
QAction* m_addWellCellsToRangeFilterAction;
|
||||
QAction* m_showWellCellsAction;
|
||||
|
||||
std::vector<QPointer<QDockWidget> > additionalProjectViews;
|
||||
|
||||
|
@ -729,7 +729,7 @@ QString RiuResultTextBuilder::wellResultText()
|
||||
{
|
||||
RigSingleWellResultsData* singleWellResultData = wellResults.at(i);
|
||||
|
||||
if (m_timeStepIndex < singleWellResultData->firstResultTimeStep())
|
||||
if (!singleWellResultData->hasWellResult(m_timeStepIndex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -25,27 +25,42 @@
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimTotalWellAllocationPlot.h"
|
||||
|
||||
#include "QBoxLayout"
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
||||
: QFrame(parent)
|
||||
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
||||
: m_plotDefinition(plotDefinition),
|
||||
QFrame(parent)
|
||||
{
|
||||
Q_ASSERT(plotDefinition);
|
||||
this->setLayout(new QHBoxLayout());
|
||||
Q_ASSERT(m_plotDefinition);
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
this->setLayout(mainLayout);
|
||||
this->layout()->setMargin(0);
|
||||
this->layout()->setSpacing(2);
|
||||
|
||||
m_plotDefinition = plotDefinition;
|
||||
m_titleLabel = new QLabel(this);
|
||||
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPointSize(14);
|
||||
font.setBold(true);
|
||||
m_titleLabel->setFont(font);
|
||||
|
||||
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
|
||||
|
||||
QHBoxLayout* plotWidgetsLayout = new QHBoxLayout();
|
||||
mainLayout->addLayout(plotWidgetsLayout, 10);
|
||||
|
||||
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
|
||||
this->layout()->addWidget(totalFlowAllocationWidget);
|
||||
plotWidgetsLayout->addWidget(totalFlowAllocationWidget);
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
|
||||
this->layout()->addWidget(wellFlowWidget);
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,6 +82,24 @@ RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::showTitle(const QString& title)
|
||||
{
|
||||
m_titleLabel->show();
|
||||
|
||||
m_titleLabel->setText(title);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::hideTitle()
|
||||
{
|
||||
m_titleLabel->hide();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -23,10 +23,12 @@
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
class QLabel;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@ -41,6 +43,9 @@ public:
|
||||
|
||||
RimWellAllocationPlot* ownerPlotDefinition();
|
||||
|
||||
void showTitle(const QString& title);
|
||||
void hideTitle();
|
||||
|
||||
protected:
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
@ -50,5 +55,6 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
|
||||
QPointer<QLabel> m_titleLabel;
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,9 @@ set( PROJECT_FILES
|
||||
|
||||
cafNotificationCenter.cpp
|
||||
cafNotificationCenter.h
|
||||
|
||||
cafTristate.cpp
|
||||
cafTristate.h
|
||||
)
|
||||
|
||||
|
||||
|
158
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafTristate.cpp
Normal file
158
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafTristate.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
#include "cafTristate.h"
|
||||
|
||||
#include <QTextStream>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::Tristate::Tristate()
|
||||
: m_state(State::False)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Tristate::operator=(const Tristate& other)
|
||||
{
|
||||
m_state = other.m_state;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Tristate::operator=(const State& state)
|
||||
{
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::operator==(const Tristate& other) const
|
||||
{
|
||||
return m_state == other.m_state;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::operator==(State state) const
|
||||
{
|
||||
return m_state == state;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::operator!=(const Tristate& other) const
|
||||
{
|
||||
return !(m_state == other.m_state);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::Tristate::State caf::Tristate::state() const
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::isTrue() const
|
||||
{
|
||||
return m_state == State::True;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::isPartiallyTrue() const
|
||||
{
|
||||
return m_state == State::PartiallyTrue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool caf::Tristate::isFalse() const
|
||||
{
|
||||
return m_state == State::False;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString caf::Tristate::text() const
|
||||
{
|
||||
QString txt;
|
||||
|
||||
switch (m_state)
|
||||
{
|
||||
case Tristate::State::False:
|
||||
txt = "False";
|
||||
break;
|
||||
case Tristate::State::PartiallyTrue:
|
||||
txt = "PartiallyTrue";
|
||||
break;
|
||||
case Tristate::State::True:
|
||||
txt = "True";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::Tristate::setFromText(const QString& valueText)
|
||||
{
|
||||
QString lowerCase = valueText.toLower();
|
||||
|
||||
if (lowerCase == "false")
|
||||
{
|
||||
m_state = State::False;
|
||||
}
|
||||
else if (lowerCase == "partiallytrue")
|
||||
{
|
||||
m_state = State::PartiallyTrue;
|
||||
}
|
||||
else if (lowerCase == "true")
|
||||
{
|
||||
m_state = State::True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void operator >> (QTextStream& str, caf::Tristate& triplet)
|
||||
{
|
||||
QString text;
|
||||
str >> text;
|
||||
triplet.setFromText(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void operator << (QTextStream& str, const caf::Tristate& triplet)
|
||||
{
|
||||
str << triplet.text();
|
||||
}
|
53
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafTristate.h
Normal file
53
Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafTristate.h
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
class QTextStream;
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
//==================================================================================================
|
||||
class Tristate
|
||||
{
|
||||
public:
|
||||
enum class State {False, PartiallyTrue, True};
|
||||
|
||||
public:
|
||||
Tristate();
|
||||
|
||||
void operator=(const Tristate& other);
|
||||
void operator=(const State& state);
|
||||
|
||||
bool operator==(const Tristate& other) const;
|
||||
bool operator==(State state) const;
|
||||
bool operator!=(const Tristate& other) const;
|
||||
|
||||
State state() const;
|
||||
|
||||
bool isTrue() const;
|
||||
bool isPartiallyTrue() const;
|
||||
bool isFalse() const;
|
||||
|
||||
QString text() const;
|
||||
void setFromText(const QString& valueText);
|
||||
|
||||
protected:
|
||||
State m_state;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace caf
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// Overload of QTextStream for caf::Triplet
|
||||
//==================================================================================================
|
||||
void operator >> (QTextStream& str, caf::Tristate& triplet);
|
||||
void operator << (QTextStream& str, const caf::Tristate& triplet);
|
||||
|
||||
Q_DECLARE_METATYPE(caf::Tristate);
|
@ -20,6 +20,7 @@ include_directories (
|
||||
set( QOBJECT_HEADERS
|
||||
cafPdmUiCheckBoxDelegate.h
|
||||
cafPdmUiCheckBoxEditor.h
|
||||
cafPdmUiCheckBoxTristateEditor.h
|
||||
cafPdmUiColorEditor.h
|
||||
cafPdmUiComboBoxEditor.h
|
||||
cafPdmUiDoubleSliderEditor.h
|
||||
@ -55,6 +56,8 @@ set( PROJECT_FILES
|
||||
cafPdmUiCheckBoxDelegate.h
|
||||
cafPdmUiCheckBoxEditor.cpp
|
||||
cafPdmUiCheckBoxEditor.h
|
||||
cafPdmUiCheckBoxTristateEditor.cpp
|
||||
cafPdmUiCheckBoxTristateEditor.h
|
||||
cafPdmUiColorEditor.cpp
|
||||
cafPdmUiColorEditor.h
|
||||
cafPdmUiComboBoxEditor.cpp
|
||||
|
113
Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp
Normal file
113
Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
|
||||
#include "cafPdmUiCheckBoxTristateEditor.h"
|
||||
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cafFactory.h"
|
||||
#include "cafTristate.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiCheckBoxTristateEditor);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiCheckBoxTristateEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
assert(!m_checkBox.isNull());
|
||||
assert(!m_label.isNull());
|
||||
|
||||
{
|
||||
QIcon ic = field()->uiIcon(uiConfigName);
|
||||
if (!ic.isNull())
|
||||
{
|
||||
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_label->setText(field()->uiName(uiConfigName));
|
||||
}
|
||||
}
|
||||
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_checkBox->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
Tristate state = field()->uiValue().value<Tristate>();
|
||||
|
||||
if (state == Tristate::State::True)
|
||||
{
|
||||
m_checkBox->setCheckState(Qt::Checked);
|
||||
}
|
||||
else if (state == Tristate::State::PartiallyTrue)
|
||||
{
|
||||
m_checkBox->setCheckState(Qt::PartiallyChecked);
|
||||
}
|
||||
else if (state == Tristate::State::False)
|
||||
{
|
||||
m_checkBox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiCheckBoxTristateEditor::createEditorWidget(QWidget * parent)
|
||||
{
|
||||
m_checkBox = new QCheckBox(parent);
|
||||
m_checkBox->setTristate(true);
|
||||
|
||||
connect(m_checkBox, SIGNAL(clicked(bool)), this, SLOT(slotClicked(bool)));
|
||||
return m_checkBox;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiCheckBoxTristateEditor::createLabelWidget(QWidget * parent)
|
||||
{
|
||||
m_label = new QLabel(parent);
|
||||
return m_label;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiCheckBoxTristateEditor::slotClicked(bool)
|
||||
{
|
||||
Tristate state;
|
||||
|
||||
if (m_checkBox->checkState() == Qt::Checked)
|
||||
{
|
||||
state = Tristate::State::True;
|
||||
}
|
||||
else if (m_checkBox->checkState() == Qt::PartiallyChecked)
|
||||
{
|
||||
state = Tristate::State::PartiallyTrue;
|
||||
}
|
||||
else if (m_checkBox->checkState() == Qt::Unchecked)
|
||||
{
|
||||
state = Tristate::State::False;
|
||||
}
|
||||
|
||||
QVariant v = QVariant::fromValue(state);
|
||||
|
||||
this->setValueToField(v);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace caf
|
38
Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h
Normal file
38
Fwk/AppFwk/cafUserInterface/cafPdmUiCheckBoxTristateEditor.h
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
class PdmUiCheckBoxTristateEditor : public PdmUiFieldEditorHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
|
||||
|
||||
public:
|
||||
PdmUiCheckBoxTristateEditor() {}
|
||||
virtual ~PdmUiCheckBoxTristateEditor() {}
|
||||
|
||||
protected:
|
||||
virtual QWidget* createEditorWidget(QWidget* parent);
|
||||
virtual QWidget* createLabelWidget(QWidget* parent);
|
||||
virtual void configureAndUpdateUi(const QString& uiConfigName);
|
||||
|
||||
protected slots:
|
||||
void slotClicked(bool);
|
||||
|
||||
private:
|
||||
QPointer<QCheckBox> m_checkBox;
|
||||
QPointer<QLabel> m_label;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace caf
|
Loading…
Reference in New Issue
Block a user