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/CMakeLists.txt ApplicationCode/ProjectDataModel/CMakeLists_files.cmake ApplicationCode/ProjectDataModel/RimEclipseWell.h ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake
This commit is contained in:
@@ -1591,6 +1591,16 @@ RiuMainPlotWindow* RiaApplication::mainPlotWindow()
|
|||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
|
||||||
|
{
|
||||||
|
if (mainWindowID == 0) return RiuMainWindow::instance();
|
||||||
|
else if (mainWindowID == 1) return m_mainPlotWindow;
|
||||||
|
else return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -1925,6 +1935,7 @@ void RiaApplication::applyPreferences()
|
|||||||
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
|
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||||
|
if (mainPlotWindow()) mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||||
}
|
}
|
||||||
|
|
||||||
caf::FixedAtlasFont::FontSize fontSizeType = caf::FixedAtlasFont::POINT_SIZE_16;
|
caf::FixedAtlasFont::FontSize fontSizeType = caf::FixedAtlasFont::POINT_SIZE_16;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class RimViewWindow;
|
|||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
class RimWellAllocationPlot;
|
class RimWellAllocationPlot;
|
||||||
|
|
||||||
|
class RiuMainWindowBase;
|
||||||
class RiuMainPlotWindow;
|
class RiuMainPlotWindow;
|
||||||
class RiuRecentFileActionProvider;
|
class RiuRecentFileActionProvider;
|
||||||
|
|
||||||
@@ -185,6 +186,7 @@ public:
|
|||||||
|
|
||||||
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
|
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
|
||||||
RiuMainPlotWindow* mainPlotWindow();
|
RiuMainPlotWindow* mainPlotWindow();
|
||||||
|
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||||
|
|
||||||
static RimViewWindow* activeViewWindow();
|
static RimViewWindow* activeViewWindow();
|
||||||
|
|
||||||
|
|||||||
@@ -289,9 +289,7 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
set( LINK_LIBRARIES
|
set( LINK_LIBRARIES
|
||||||
custom-opm-parser
|
${OPM_LIBRARIES}
|
||||||
custom-opm-flowdiagnostics
|
|
||||||
custom-opm-flowdiag-app
|
|
||||||
|
|
||||||
WellPathImportSsihub
|
WellPathImportSsihub
|
||||||
|
|
||||||
@@ -303,15 +301,13 @@ set( LINK_LIBRARIES
|
|||||||
|
|
||||||
${ERT_LIBRARIES}
|
${ERT_LIBRARIES}
|
||||||
|
|
||||||
NRLib
|
${THIRD_PARTY_LIBRARIES}
|
||||||
custom-clipper
|
custom-clipper
|
||||||
|
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
|
|
||||||
${RI_BOOST_LIBRARIES}
|
${RI_BOOST_LIBRARIES}
|
||||||
|
|
||||||
Qwt
|
|
||||||
)
|
)
|
||||||
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
|
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
|||||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||||
if (flowPlotColl)
|
if (flowPlotColl)
|
||||||
{
|
{
|
||||||
flowPlotColl->defaultPlot->setSimulationWell(eclWell);
|
flowPlotColl->defaultPlot->setFromSimulationWell(eclWell);
|
||||||
flowPlotColl->defaultPlot->updateConnectedEditors();
|
flowPlotColl->defaultPlot->updateConnectedEditors();
|
||||||
|
|
||||||
// Make sure the summary plot window is created and visible
|
// Make sure the summary plot window is created and visible
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ void RicShowAllLinkedViewsFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
for (size_t j = 0; j < views.size(); j++)
|
for (size_t j = 0; j < views.size(); j++)
|
||||||
{
|
{
|
||||||
views[j]->showWindow.setValueWithFieldChanged(true);
|
views[j]->forceShowWindowOn();
|
||||||
views[j]->uiCapability()->updateUiIconFromToggleField();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
|
|||||||
CVF_ASSERT(wellLogPlotColl);
|
CVF_ASSERT(wellLogPlotColl);
|
||||||
|
|
||||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||||
|
plot->setAsPlotMdiWindow();
|
||||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||||
|
|
||||||
// Make sure the summary plot window is created and visible
|
// Make sure the summary plot window is created and visible
|
||||||
|
|||||||
@@ -969,6 +969,7 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
|
|||||||
|
|
||||||
resultPoint.m_ertBranchId = ertBranchId;
|
resultPoint.m_ertBranchId = ertBranchId;
|
||||||
resultPoint.m_ertSegmentId = ertSegmentId;
|
resultPoint.m_ertSegmentId = ertSegmentId;
|
||||||
|
resultPoint.m_flowRate = 0.5; // Todo : Get from Ert
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultPoint;
|
return resultPoint;
|
||||||
|
|||||||
@@ -82,40 +82,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
|
|||||||
m_pipeBranchesCLCoords.clear();
|
m_pipeBranchesCLCoords.clear();
|
||||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||||
|
|
||||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(m_rimWell.p(), m_pipeBranchesCLCoords, pipeBranchesCellIds);
|
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||||
|
|
||||||
RimEclipseWellCollection* wellColl = nullptr;
|
|
||||||
m_rimWell->firstAncestorOrThisOfType(wellColl);
|
|
||||||
if (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER)
|
|
||||||
{
|
|
||||||
// Compute coords based on connection centers
|
|
||||||
// Loop over all well cells, and overwrite with cell center instead of interpolated coordinates
|
|
||||||
|
|
||||||
RigMainGrid* mainGrid = m_rimReservoirView->mainGrid();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < pipeBranchesCellIds.size(); i++)
|
|
||||||
{
|
|
||||||
const std::vector<RigWellResultPoint>& resPoints = pipeBranchesCellIds[i];
|
|
||||||
for (size_t j = 0; j < resPoints.size(); j++)
|
|
||||||
{
|
|
||||||
if (resPoints[j].isCell())
|
|
||||||
{
|
|
||||||
size_t gridIndex = resPoints[j].m_gridIndex;
|
|
||||||
size_t gridCellIndex = resPoints[j].m_gridCellIndex;
|
|
||||||
|
|
||||||
if (gridIndex < mainGrid->gridCount())
|
|
||||||
{
|
|
||||||
RigGridBase* rigGrid = mainGrid->gridByIndex(gridIndex);
|
|
||||||
if (gridCellIndex < rigGrid->cellCount())
|
|
||||||
{
|
|
||||||
cvf::Vec3d center = rigGrid->cell(gridCellIndex).center();
|
|
||||||
m_pipeBranchesCLCoords[i][j] = center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
|
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
|
||||||
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;
|
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.h
|
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.h
|
${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimFracture.h
|
${CEE_CURRENT_LIST_DIR}RimFracture.h
|
||||||
@@ -173,6 +174,7 @@ ${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
${CEE_CURRENT_LIST_DIR}RimMultiSnapshotDefinition.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimMdiWindowController.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.cpp
|
${CEE_CURRENT_LIST_DIR}RimEllipseFractureTemplate.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimFractureDefinitionCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimFracture.cpp
|
${CEE_CURRENT_LIST_DIR}RimFracture.cpp
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ set (SOURCE_GROUP_HEADER_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
|
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
|
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
|
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
|
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
|
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimTotalWellAllocationPlot.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimWellFlowRateCurve.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
@@ -47,5 +47,17 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimFlowPlotCollection::~RimFlowPlotCollection()
|
RimFlowPlotCollection::~RimFlowPlotCollection()
|
||||||
{
|
{
|
||||||
|
delete defaultPlot();
|
||||||
|
|
||||||
|
flowPlots.deleteAllChildObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||||
|
{
|
||||||
|
defaultPlot->removeFromMdiAreaAndDeleteViewWidget();
|
||||||
|
|
||||||
flowPlots.deleteAllChildObjects();
|
flowPlots.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ class RimFlowPlotCollection : public caf::PdmObject
|
|||||||
public:
|
public:
|
||||||
RimFlowPlotCollection();
|
RimFlowPlotCollection();
|
||||||
virtual ~RimFlowPlotCollection();
|
virtual ~RimFlowPlotCollection();
|
||||||
|
|
||||||
|
void closeDefaultPlotWindowAndDeletePlots();
|
||||||
|
|
||||||
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot;
|
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot;
|
||||||
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots;
|
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots;
|
||||||
|
|||||||
@@ -0,0 +1,262 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimTotalWellAllocationPlot.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimEclipseWell.h"
|
||||||
|
#include "RimEclipseWellCollection.h"
|
||||||
|
|
||||||
|
#include "RigSingleWellResultsData.h"
|
||||||
|
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
|
||||||
|
#include "RiuMainPlotWindow.h"
|
||||||
|
#include "RiuNightchartsWidget.h"
|
||||||
|
#include "RiuWellAllocationPlot.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimTotalWellAllocationPlot, "TotalWellAllocationPlot");
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Total Well Allocation Plot", ":/newIcon16x16.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Total Well Allocation Plot"), "Name", "", "", "");
|
||||||
|
m_userName.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
||||||
|
{
|
||||||
|
removeMdiWindowFromMdiArea();
|
||||||
|
|
||||||
|
deleteViewWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
||||||
|
{
|
||||||
|
m_simulationWell = simWell;
|
||||||
|
|
||||||
|
updateFromWell();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::deleteViewWidget()
|
||||||
|
{
|
||||||
|
if (m_wellTotalAllocationPlotWidget)
|
||||||
|
{
|
||||||
|
m_wellTotalAllocationPlotWidget->deleteLater();
|
||||||
|
m_wellTotalAllocationPlotWidget= nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* RimTotalWellAllocationPlot::viewWidget()
|
||||||
|
{
|
||||||
|
return m_wellTotalAllocationPlotWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|
||||||
|
if (changedField == &m_userName ||
|
||||||
|
changedField == &m_showPlotTitle)
|
||||||
|
{
|
||||||
|
updateMdiWindowTitle();
|
||||||
|
}
|
||||||
|
else if (changedField == &m_simulationWell)
|
||||||
|
{
|
||||||
|
updateFromWell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QImage RimTotalWellAllocationPlot::snapshotWindowContent()
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::setDescription(const QString& description)
|
||||||
|
{
|
||||||
|
m_userName = description;
|
||||||
|
this->updateMdiWindowTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimTotalWellAllocationPlot::description() const
|
||||||
|
{
|
||||||
|
return m_userName();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
updateMdiWindowVisibility();
|
||||||
|
updateFromWell();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimViewWindow.h"
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
class RiuWellAllocationPlot;
|
||||||
|
class RimEclipseWell;
|
||||||
|
class RimWellLogPlot;
|
||||||
|
class RiuNightchartsWidget;
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
class PdmOptionItemInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimTotalWellAllocationPlot : public RimViewWindow
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimTotalWellAllocationPlot();
|
||||||
|
virtual ~RimTotalWellAllocationPlot();
|
||||||
|
|
||||||
|
void setSimulationWell(RimEclipseWell* simWell);
|
||||||
|
|
||||||
|
void setDescription(const QString& description);
|
||||||
|
QString description() const;
|
||||||
|
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
|
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:
|
||||||
|
// 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;
|
||||||
|
};
|
||||||
@@ -20,14 +20,26 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RigEclipseCaseData.h"
|
||||||
|
#include "RigSimulationWellCenterLineCalculator.h"
|
||||||
|
#include "RigSimulationWellCoordsAndMD.h"
|
||||||
|
#include "RigSingleWellResultsData.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimEclipseWell.h"
|
#include "RimEclipseWell.h"
|
||||||
#include "RimEclipseWellCollection.h"
|
#include "RimEclipseWellCollection.h"
|
||||||
|
#include "RimFlowDiagSolution.h"
|
||||||
|
#include "RimTotalWellAllocationPlot.h"
|
||||||
|
#include "RimWellFlowRateCurve.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
|
||||||
#include "RiuMainPlotWindow.h"
|
#include "RiuMainPlotWindow.h"
|
||||||
#include "RiuWellAllocationPlot.h"
|
#include "RiuWellAllocationPlot.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
|
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
|
||||||
|
|
||||||
|
|
||||||
@@ -37,15 +49,29 @@ CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
|
|||||||
RimWellAllocationPlot::RimWellAllocationPlot()
|
RimWellAllocationPlot::RimWellAllocationPlot()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Well Allocation Plot", ":/newIcon16x16.png", "", "");
|
CAF_PDM_InitObject("Well Allocation Plot", ":/newIcon16x16.png", "", "");
|
||||||
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Flow Diagnostics Plot", "", "", "");
|
|
||||||
m_showWindow.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Flow Diagnostics Plot"), "Name", "", "", "");
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Flow Diagnostics Plot"), "Name", "", "", "");
|
||||||
m_userName.uiCapability()->setUiReadOnly(true);
|
m_userName.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", "");
|
||||||
|
m_case.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "");
|
||||||
|
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true);
|
||||||
|
m_accumulatedWellFlowPlot = new RimWellLogPlot;
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "");
|
||||||
|
m_totalWellAllocationPlot.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
m_totalWellAllocationPlot = new RimTotalWellAllocationPlot;
|
||||||
|
|
||||||
|
this->setAsPlotMdiWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -53,20 +79,29 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellAllocationPlot::~RimWellAllocationPlot()
|
RimWellAllocationPlot::~RimWellAllocationPlot()
|
||||||
{
|
{
|
||||||
if (RiaApplication::instance()->mainPlotWindow())
|
removeMdiWindowFromMdiArea();
|
||||||
{
|
|
||||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_wellAllocationPlot);
|
delete m_accumulatedWellFlowPlot();
|
||||||
}
|
delete m_totalWellAllocationPlot();
|
||||||
|
|
||||||
deletePlotWidget();
|
deleteViewWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
void RimWellAllocationPlot::setFromSimulationWell(RimEclipseWell* simWell)
|
||||||
{
|
{
|
||||||
m_simulationWell = simWell;
|
RimEclipseView* eclView;
|
||||||
|
simWell->firstAncestorOrThisOfType(eclView);
|
||||||
|
RimEclipseResultCase* eclCase;
|
||||||
|
simWell->firstAncestorOrThisOfType(eclCase);
|
||||||
|
|
||||||
|
m_case = eclCase;
|
||||||
|
m_wellName = simWell->wellResults()->m_wellName;
|
||||||
|
m_timeStep = eclView->currentTimeStep();
|
||||||
|
|
||||||
|
m_flowDiagSolution = eclView->cellResult()->flowDiagSolution();
|
||||||
|
|
||||||
updateFromWell();
|
updateFromWell();
|
||||||
}
|
}
|
||||||
@@ -74,12 +109,12 @@ void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::deletePlotWidget()
|
void RimWellAllocationPlot::deleteViewWidget()
|
||||||
{
|
{
|
||||||
if (m_wellAllocationPlot)
|
if (m_wellAllocationPlotWidget)
|
||||||
{
|
{
|
||||||
m_wellAllocationPlot->deleteLater();
|
m_wellAllocationPlotWidget->deleteLater();
|
||||||
m_wellAllocationPlot = nullptr;
|
m_wellAllocationPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,15 +123,93 @@ void RimWellAllocationPlot::deletePlotWidget()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::updateFromWell()
|
void RimWellAllocationPlot::updateFromWell()
|
||||||
{
|
{
|
||||||
QString simName = "None";
|
if (!m_case) return;
|
||||||
|
|
||||||
if (m_simulationWell)
|
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 + ")");
|
||||||
|
|
||||||
|
|
||||||
|
// Delete existing tracks
|
||||||
{
|
{
|
||||||
simName = m_simulationWell->name();
|
std::vector<RimWellLogTrack*> tracks;
|
||||||
|
accumulatedWellFlowPlot()->descendantsIncludingThisOfType(tracks);
|
||||||
|
|
||||||
|
for (RimWellLogTrack* t : tracks)
|
||||||
|
{
|
||||||
|
accumulatedWellFlowPlot()->removeTrack(t);
|
||||||
|
delete t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDescription(simName);
|
CVF_ASSERT(accumulatedWellFlowPlot()->trackCount() == 0);
|
||||||
updateViewerWidget();
|
|
||||||
|
size_t branchCount = pipeBranchesCLCoords.size();
|
||||||
|
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
|
||||||
|
{
|
||||||
|
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
||||||
|
|
||||||
|
// TODO: Description is overwritten by RimWellLogPlot::updateTrackNames()
|
||||||
|
// Add flag to control if this behavior
|
||||||
|
plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1));
|
||||||
|
|
||||||
|
accumulatedWellFlowPlot()->addTrack(plotTrack);
|
||||||
|
|
||||||
|
std::vector<cvf::Vec3d> curveCoords;
|
||||||
|
std::vector<double> flowRate;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<cvf::Vec3d> branchCoords = pipeBranchesCLCoords[brIdx];
|
||||||
|
std::vector<RigWellResultPoint> branchResultPoints = pipeBranchesCellIds[brIdx];
|
||||||
|
|
||||||
|
RigWellResultPoint prevResultPoint;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < branchResultPoints.size(); i++)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RigSimulationWellCoordsAndMD helper(curveCoords);
|
||||||
|
|
||||||
|
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||||
|
curve->setFlowValues(helper.measuredDepths(), flowRate);
|
||||||
|
|
||||||
|
plotTrack->addCurve(curve);
|
||||||
|
|
||||||
|
curve->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
setDescription("Well Allocation (" + m_wellName + ")");
|
||||||
|
accumulatedWellFlowPlot()->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -104,7 +217,7 @@ void RimWellAllocationPlot::updateFromWell()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QWidget* RimWellAllocationPlot::viewWidget()
|
QWidget* RimWellAllocationPlot::viewWidget()
|
||||||
{
|
{
|
||||||
return m_wellAllocationPlot;
|
return m_wellAllocationPlotWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -114,6 +227,22 @@ void RimWellAllocationPlot::zoomAll()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellLogPlot* RimWellAllocationPlot::accumulatedWellFlowPlot()
|
||||||
|
{
|
||||||
|
return m_accumulatedWellFlowPlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
|
||||||
|
{
|
||||||
|
return m_totalWellAllocationPlot();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -121,29 +250,44 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
|||||||
{
|
{
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
if (fieldNeedingOptions == &m_simulationWell)
|
if (fieldNeedingOptions == &m_wellName)
|
||||||
{
|
{
|
||||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
std::set<QString> sortedWellNames;
|
||||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
|
if ( m_case && m_case->reservoirData() )
|
||||||
|
|
||||||
if (eclView && eclView->wellCollection())
|
|
||||||
{
|
{
|
||||||
RimEclipseWellCollection* coll = eclView->wellCollection();
|
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->reservoirData()->wellResults();
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
|
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
|
||||||
|
|
||||||
QIcon simWellIcon(":/Well.png");
|
|
||||||
for (RimEclipseWell* eclWell : eclWells)
|
|
||||||
{
|
{
|
||||||
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
|
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon simWellIcon(":/Well.png");
|
||||||
|
for ( const QString& wname: sortedWellNames )
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon));
|
||||||
|
}
|
||||||
|
|
||||||
if (options.size() == 0)
|
if (options.size() == 0)
|
||||||
{
|
{
|
||||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (fieldNeedingOptions == &m_timeStep)
|
||||||
|
{
|
||||||
|
QStringList timeStepNames;
|
||||||
|
|
||||||
|
if (m_case && m_case->reservoirData())
|
||||||
|
{
|
||||||
|
timeStepNames = m_case->timeStepStrings();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < timeStepNames.size(); i++)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -151,12 +295,18 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::handleViewerDeletion()
|
QString RimWellAllocationPlot::wellName() const
|
||||||
{
|
{
|
||||||
m_showWindow = false;
|
return m_wellName();
|
||||||
|
}
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
//--------------------------------------------------------------------------------------------------
|
||||||
updateConnectedEditors();
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget()
|
||||||
|
{
|
||||||
|
removeMdiWindowFromMdiArea();
|
||||||
|
deleteViewWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -164,34 +314,19 @@ void RimWellAllocationPlot::handleViewerDeletion()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
if (changedField == &m_showWindow)
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
{
|
|
||||||
updateViewerWidget();
|
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
if (changedField == &m_userName ||
|
||||||
}
|
|
||||||
else if (changedField == &m_userName ||
|
|
||||||
changedField == &m_showPlotTitle)
|
changedField == &m_showPlotTitle)
|
||||||
{
|
{
|
||||||
updateViewerWidgetWindowTitle();
|
updateMdiWindowTitle();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_simulationWell)
|
else if (changedField == &m_wellName)
|
||||||
{
|
{
|
||||||
updateFromWell();
|
updateFromWell();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellAllocationPlot::setupBeforeSave()
|
|
||||||
{
|
|
||||||
if (m_wellAllocationPlot && RiaApplication::instance()->mainPlotWindow())
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_wellAllocationPlot));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -210,6 +345,7 @@ QImage RimWellAllocationPlot::snapshotWindowContent()
|
|||||||
void RimWellAllocationPlot::setDescription(const QString& description)
|
void RimWellAllocationPlot::setDescription(const QString& description)
|
||||||
{
|
{
|
||||||
m_userName = description;
|
m_userName = description;
|
||||||
|
this->updateMdiWindowTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -225,59 +361,17 @@ QString RimWellAllocationPlot::description() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::loadDataAndUpdate()
|
void RimWellAllocationPlot::loadDataAndUpdate()
|
||||||
{
|
{
|
||||||
updateViewerWidget();
|
updateMdiWindowVisibility();
|
||||||
|
updateFromWell();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellAllocationPlot::updateViewerWidget()
|
QWidget* RimWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
|
||||||
{
|
{
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
m_wellAllocationPlotWidget = new RiuWellAllocationPlot(this, mainWindowParent);
|
||||||
if (!mainPlotWindow) return;
|
return m_wellAllocationPlotWidget;
|
||||||
|
|
||||||
if (m_showWindow())
|
|
||||||
{
|
|
||||||
if (!m_wellAllocationPlot)
|
|
||||||
{
|
|
||||||
m_wellAllocationPlot = new RiuWellAllocationPlot(this, mainPlotWindow);
|
|
||||||
|
|
||||||
mainPlotWindow->addViewer(m_wellAllocationPlot, this->mdiWindowGeometry());
|
|
||||||
mainPlotWindow->setActiveViewer(m_wellAllocationPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateViewerWidgetWindowTitle();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_wellAllocationPlot)
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_wellAllocationPlot));
|
|
||||||
|
|
||||||
mainPlotWindow->removeViewer(m_wellAllocationPlot);
|
|
||||||
|
|
||||||
deletePlotWidget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellAllocationPlot::updateViewerWidgetWindowTitle()
|
|
||||||
{
|
|
||||||
if (m_wellAllocationPlot)
|
|
||||||
{
|
|
||||||
m_wellAllocationPlot->setWindowTitle(m_userName);
|
|
||||||
|
|
||||||
if (m_showPlotTitle)
|
|
||||||
{
|
|
||||||
m_wellAllocationPlot->setTitle(m_userName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_wellAllocationPlot->setTitle("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,12 @@
|
|||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
class RiuWellAllocationPlot;
|
class RimEclipseResultCase;
|
||||||
class RimEclipseWell;
|
class RimEclipseWell;
|
||||||
|
class RimFlowDiagSolution;
|
||||||
|
class RimTotalWellAllocationPlot;
|
||||||
|
class RimWellLogPlot;
|
||||||
|
class RiuWellAllocationPlot;
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
class PdmOptionItemInfo;
|
class PdmOptionItemInfo;
|
||||||
@@ -47,43 +51,51 @@ public:
|
|||||||
RimWellAllocationPlot();
|
RimWellAllocationPlot();
|
||||||
virtual ~RimWellAllocationPlot();
|
virtual ~RimWellAllocationPlot();
|
||||||
|
|
||||||
void setSimulationWell(RimEclipseWell* simWell);
|
void setFromSimulationWell(RimEclipseWell* simWell);
|
||||||
|
|
||||||
void setDescription(const QString& description);
|
void setDescription(const QString& description);
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
void handleViewerDeletion();
|
|
||||||
|
|
||||||
virtual QWidget* viewWidget() override;
|
virtual QWidget* viewWidget() override;
|
||||||
virtual void zoomAll() override;
|
virtual void zoomAll() override;
|
||||||
|
|
||||||
|
RimWellLogPlot* accumulatedWellFlowPlot();
|
||||||
|
RimTotalWellAllocationPlot* totalWellFlowPlot();
|
||||||
|
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||||
|
|
||||||
|
QString wellName() const;
|
||||||
|
|
||||||
|
void removeFromMdiAreaAndDeleteViewWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
virtual void setupBeforeSave() override;
|
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() override;
|
virtual QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateViewerWidget();
|
|
||||||
void updateViewerWidgetWindowTitle();
|
|
||||||
void deletePlotWidget();
|
|
||||||
void updateFromWell();
|
void updateFromWell();
|
||||||
|
|
||||||
private:
|
// RimViewWindow overrides
|
||||||
caf::PdmField<bool> m_showWindow;
|
|
||||||
|
|
||||||
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||||
|
virtual void deleteViewWidget() override;
|
||||||
|
|
||||||
|
private:
|
||||||
caf::PdmField<bool> m_showPlotTitle;
|
caf::PdmField<bool> m_showPlotTitle;
|
||||||
caf::PdmField<QString> m_userName;
|
caf::PdmField<QString> m_userName;
|
||||||
|
|
||||||
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
|
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||||
|
caf::PdmField<QString> m_wellName;
|
||||||
|
caf::PdmField<int> m_timeStep;
|
||||||
|
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||||
|
|
||||||
QPointer<RiuWellAllocationPlot> m_wellAllocationPlot;
|
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
|
||||||
|
|
||||||
|
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
|
||||||
|
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
|
||||||
};
|
};
|
||||||
|
|||||||
135
ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp
Normal file
135
ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimWellFlowRateCurve.h"
|
||||||
|
|
||||||
|
#include "RimWellAllocationPlot.h"
|
||||||
|
|
||||||
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||||
|
|
||||||
|
#include "qwt_plot.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellFlowRateCurve::RimWellFlowRateCurve()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellFlowRateCurve::~RimWellFlowRateCurve()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimWellFlowRateCurve::wellName() const
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
|
||||||
|
RimWellAllocationPlot* wap = wellAllocationPlot();
|
||||||
|
|
||||||
|
if (wap)
|
||||||
|
{
|
||||||
|
name = wap->wellName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name = "Undefined";
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimWellFlowRateCurve::wellLogChannelName() const
|
||||||
|
{
|
||||||
|
return "Flow Rate";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimWellFlowRateCurve::createCurveAutoName()
|
||||||
|
{
|
||||||
|
return QString("%1 (%2)").arg(wellLogChannelName()).arg(wellName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||||
|
{
|
||||||
|
RimWellLogCurve::updateCurvePresentation();
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
updateZoomInParentPlot();
|
||||||
|
|
||||||
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
|
||||||
|
{
|
||||||
|
RimWellAllocationPlot* wap = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(wap);
|
||||||
|
|
||||||
|
return wap;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellFlowRateCurve::setFlowValues(const std::vector<double>& measuredDepths, const std::vector<double>& flowRates)
|
||||||
|
{
|
||||||
|
m_curveData = new RigWellLogCurveData;
|
||||||
|
m_curveData->setValuesAndMD(flowRates, measuredDepths, RimDefines::UNIT_METER, false);
|
||||||
|
}
|
||||||
|
|
||||||
53
ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h
Normal file
53
ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimWellLogCurve.h"
|
||||||
|
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
class RimWellAllocationPlot;
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimWellFlowRateCurve : public RimWellLogCurve
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimWellFlowRateCurve();
|
||||||
|
virtual ~RimWellFlowRateCurve();
|
||||||
|
|
||||||
|
void setFlowValues(const std::vector<double>& measuredDepths, const std::vector<double>& flowRates);
|
||||||
|
|
||||||
|
virtual QString wellName() const override;
|
||||||
|
virtual QString wellLogChannelName() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QString createCurveAutoName() override;
|
||||||
|
virtual void onLoadDataAndUpdate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
|||||||
if ( !hasFlowDiagFluxes )
|
if ( !hasFlowDiagFluxes )
|
||||||
{
|
{
|
||||||
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
|
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
|
||||||
for ( int i = 0; i < ResCatEnum::size(); ++i )
|
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
|
||||||
{
|
{
|
||||||
RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
|
RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
|
||||||
if ( resType != RimDefines::FLOW_DIAGNOSTICS )
|
if ( resType != RimDefines::FLOW_DIAGNOSTICS )
|
||||||
|
|||||||
@@ -162,26 +162,6 @@ RimEclipseView::~RimEclipseView()
|
|||||||
m_reservoir = NULL;
|
m_reservoir = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimEclipseView::updateViewerWidgetWindowTitle()
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
QString windowTitle;
|
|
||||||
if (m_reservoir.notNull())
|
|
||||||
{
|
|
||||||
windowTitle = QString("%1 - %2").arg(m_reservoir->caseUserDescription()).arg(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
windowTitle = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Clamp the current timestep to actual possibilities
|
/// Clamp the current timestep to actual possibilities
|
||||||
@@ -206,34 +186,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
{
|
{
|
||||||
RimView::fieldChangedByUi(changedField, oldValue, newValue);
|
RimView::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|
||||||
if (changedField == &showWindow)
|
if (changedField == &showInvalidCells)
|
||||||
{
|
|
||||||
if (showWindow)
|
|
||||||
{
|
|
||||||
bool generateDisplayModel = (viewer() == NULL);
|
|
||||||
updateViewerWidget();
|
|
||||||
|
|
||||||
if (generateDisplayModel)
|
|
||||||
{
|
|
||||||
updateDisplayModelForWellResults();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
|
||||||
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
|
||||||
delete m_viewer;
|
|
||||||
m_viewer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->updateUiIconFromToggleField();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (changedField == &showInvalidCells)
|
|
||||||
{
|
{
|
||||||
this->scheduleGeometryRegen(INACTIVE);
|
this->scheduleGeometryRegen(INACTIVE);
|
||||||
this->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
this->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
||||||
@@ -721,7 +674,7 @@ void RimEclipseView::loadDataAndUpdate()
|
|||||||
|
|
||||||
this->faultResultSettings()->customFaultResult()->loadResult();
|
this->faultResultSettings()->customFaultResult()->loadResult();
|
||||||
|
|
||||||
updateViewerWidget();
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
this->m_propertyFilterCollection()->loadAndInitializePropertyFilters();
|
this->m_propertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||||
|
|
||||||
@@ -729,6 +682,8 @@ void RimEclipseView::loadDataAndUpdate()
|
|||||||
this->faultCollection()->syncronizeFaults();
|
this->faultCollection()->syncronizeFaults();
|
||||||
|
|
||||||
m_reservoirGridPartManager->clearGeometryCache();
|
m_reservoirGridPartManager->clearGeometryCache();
|
||||||
|
m_pipesPartManager->clearGeometryCache();
|
||||||
|
m_wellSpheresPartManager->clearGeometryCache();
|
||||||
|
|
||||||
syncronizeWellsWithResults();
|
syncronizeWellsWithResults();
|
||||||
|
|
||||||
@@ -743,6 +698,8 @@ void RimEclipseView::loadDataAndUpdate()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseView::initAfterRead()
|
void RimEclipseView::initAfterRead()
|
||||||
{
|
{
|
||||||
|
RimViewWindow::initAfterRead();
|
||||||
|
|
||||||
this->faultResultSettings()->setReservoirView(this);
|
this->faultResultSettings()->setReservoirView(this);
|
||||||
this->cellResult()->setReservoirView(this);
|
this->cellResult()->setReservoirView(this);
|
||||||
this->cellEdgeResult()->setReservoirView(this);
|
this->cellEdgeResult()->setReservoirView(this);
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ private:
|
|||||||
void updateLegends();
|
void updateLegends();
|
||||||
void updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData);
|
void updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData);
|
||||||
virtual void resetLegendsInViewer();
|
virtual void resetLegendsInViewer();
|
||||||
virtual void updateViewerWidgetWindowTitle();
|
|
||||||
|
|
||||||
std::set<RivCellSetEnum> allVisibleFaultGeometryTypes() const;
|
std::set<RivCellSetEnum> allVisibleFaultGeometryTypes() const;
|
||||||
void updateFaultColors();
|
void updateFaultColors();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "RimSimWellFractureCollection.h"
|
#include "RimSimWellFractureCollection.h"
|
||||||
|
|
||||||
#include "cvfMath.h"
|
#include "cvfMath.h"
|
||||||
|
#include "RigSimulationWellCenterLineCalculator.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
|
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
|
||||||
|
|
||||||
@@ -120,6 +121,25 @@ caf::PdmFieldHandle* RimEclipseWell::objectToggleField()
|
|||||||
return &showWell;
|
return &showWell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseWell::calculateWellPipeStaticCenterLine(std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
|
||||||
|
{
|
||||||
|
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(this, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
||||||
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
|
||||||
|
{
|
||||||
|
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this, timeStepIdx, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -302,6 +322,17 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimEclipseWell::isUsingCellCenterForPipe()
|
||||||
|
{
|
||||||
|
RimEclipseWellCollection* wellColl = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(wellColl);
|
||||||
|
|
||||||
|
return (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -53,14 +53,19 @@ public:
|
|||||||
|
|
||||||
bool isWellPipeVisible(size_t frameIndex);
|
bool isWellPipeVisible(size_t frameIndex);
|
||||||
bool isWellSpheresVisible(size_t frameIndex);
|
bool isWellSpheresVisible(size_t frameIndex);
|
||||||
|
bool isUsingCellCenterForPipe();
|
||||||
|
|
||||||
bool visibleCellsInstersectsWell(size_t frameIndex);
|
bool visibleCellsInstersectsWell(size_t frameIndex);
|
||||||
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
void calculateWellPipeStaticCenterLine( std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
|
||||||
|
|
||||||
|
void calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
||||||
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
|
||||||
|
|
||||||
caf::PdmField<bool> showWell;
|
caf::PdmField<bool> showWell;
|
||||||
|
|
||||||
@@ -78,6 +83,10 @@ public:
|
|||||||
caf::PdmChildField<RimSimWellFractureCollection*> simwellFractureCollection;
|
caf::PdmChildField<RimSimWellFractureCollection*> simwellFractureCollection;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
||||||
size_t m_resultWellIndex;
|
size_t m_resultWellIndex;
|
||||||
|
|||||||
@@ -99,28 +99,6 @@ RimGeoMechView::~RimGeoMechView(void)
|
|||||||
delete m_propertyFilterCollection;
|
delete m_propertyFilterCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechView::updateViewerWidgetWindowTitle()
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
QString windowTitle;
|
|
||||||
if (m_geomechCase.notNull())
|
|
||||||
{
|
|
||||||
windowTitle = QString("%1 - %2").arg(m_geomechCase->caseUserDescription()).arg(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
windowTitle = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -156,7 +134,7 @@ void RimGeoMechView::loadDataAndUpdate()
|
|||||||
progress.incrementProgress();
|
progress.incrementProgress();
|
||||||
progress.setProgressDescription("Create Display model");
|
progress.setProgressDescription("Create Display model");
|
||||||
|
|
||||||
updateViewerWidget();
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||||
|
|
||||||
@@ -498,33 +476,6 @@ cvf::Transform* RimGeoMechView::scaleTransform()
|
|||||||
void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
RimView::fieldChangedByUi(changedField, oldValue, newValue);
|
RimView::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|
||||||
if (changedField == &showWindow)
|
|
||||||
{
|
|
||||||
if (showWindow)
|
|
||||||
{
|
|
||||||
bool generateDisplayModel = (viewer() == NULL);
|
|
||||||
updateViewerWidget();
|
|
||||||
|
|
||||||
if (generateDisplayModel)
|
|
||||||
{
|
|
||||||
scheduleCreateDisplayModelAndRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
|
||||||
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
|
||||||
delete m_viewer;
|
|
||||||
m_viewer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->updateUiIconFromToggleField();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -532,6 +483,7 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGeoMechView::initAfterRead()
|
void RimGeoMechView::initAfterRead()
|
||||||
{
|
{
|
||||||
|
RimViewWindow::initAfterRead();
|
||||||
this->cellResult()->setGeoMechCase(m_geomechCase);
|
this->cellResult()->setGeoMechCase(m_geomechCase);
|
||||||
|
|
||||||
this->updateUiIconFromToggleField();
|
this->updateUiIconFromToggleField();
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ private:
|
|||||||
virtual void updateCurrentTimeStep();
|
virtual void updateCurrentTimeStep();
|
||||||
virtual void updateStaticCellColors();
|
virtual void updateStaticCellColors();
|
||||||
|
|
||||||
virtual void updateViewerWidgetWindowTitle();
|
|
||||||
virtual void resetLegendsInViewer();
|
virtual void resetLegendsInViewer();
|
||||||
|
|
||||||
void updateLegends();
|
void updateLegends();
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ void RimIntersection::updateWellCenterline() const
|
|||||||
{
|
{
|
||||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||||
|
|
||||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(simulationWell(), m_wellBranchCenterlines, pipeBranchesCellIds);
|
simulationWell->calculateWellPipeStaticCenterLine(m_wellBranchCenterlines, pipeBranchesCellIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
|||||||
{
|
{
|
||||||
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||||
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
|
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
|
||||||
m_flowPlotCollection()->flowPlots.deleteAllChildObjects();
|
|
||||||
|
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
173
ApplicationCode/ProjectDataModel/RimMdiWindowController.cpp
Normal file
173
ApplicationCode/ProjectDataModel/RimMdiWindowController.cpp
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RimMdiWindowController.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
#include "RiuMainWindowBase.h"
|
||||||
|
|
||||||
|
CAF_PDM_XML_SOURCE_INIT(RimMdiWindowController, "MdiWindowController");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimMdiWindowController::RimMdiWindowController()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitField(&m_mainWindowID, "MainWindowID", -1, "", "", "", "" );
|
||||||
|
CAF_PDM_InitField(& m_x , "xPos", -1, "", "", "", "" );
|
||||||
|
CAF_PDM_InitField(& m_y , "yPos", -1, "", "", "", "" );
|
||||||
|
CAF_PDM_InitField(& m_width , "Width", -1, "", "", "", "" );
|
||||||
|
CAF_PDM_InitField(& m_height , "Height", -1, "", "", "", "" );
|
||||||
|
CAF_PDM_InitField(& m_isMaximized, "IsMaximized", false, "", "", "", "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimMdiWindowController::~RimMdiWindowController()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMdiWindowController::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||||
|
{
|
||||||
|
m_mainWindowID = windowGeometry.mainWindowID;
|
||||||
|
m_x = windowGeometry.x;
|
||||||
|
m_y = windowGeometry.y;
|
||||||
|
m_width = windowGeometry.width;
|
||||||
|
m_height = windowGeometry.height;
|
||||||
|
m_isMaximized = windowGeometry.isMaximized;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimMdiWindowGeometry RimMdiWindowController::mdiWindowGeometry()
|
||||||
|
{
|
||||||
|
RimMdiWindowGeometry windowGeometry;
|
||||||
|
|
||||||
|
windowGeometry.mainWindowID = m_mainWindowID;
|
||||||
|
windowGeometry.x = m_x ;
|
||||||
|
windowGeometry.y = m_y ;
|
||||||
|
windowGeometry.width = m_width ;
|
||||||
|
windowGeometry.height = m_height ;
|
||||||
|
windowGeometry.isMaximized = m_isMaximized ;
|
||||||
|
|
||||||
|
return windowGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMdiWindowController::handleViewerDeletion()
|
||||||
|
{
|
||||||
|
viewPdmObject()->m_showWindow = false;
|
||||||
|
|
||||||
|
uiCapability()->updateUiIconFromToggleField();
|
||||||
|
updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMdiWindowController::removeWindowFromMDI()
|
||||||
|
{
|
||||||
|
RiuMainWindowBase* mainWin = getMainWindow();
|
||||||
|
if (mainWin && viewWidget()) mainWin->removeViewer(viewWidget());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewWindow* RimMdiWindowController::viewPdmObject()
|
||||||
|
{
|
||||||
|
RimViewWindow * viewWindowObj;
|
||||||
|
this->firstAncestorOrThisOfType(viewWindowObj);
|
||||||
|
return viewWindowObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* RimMdiWindowController::viewWidget()
|
||||||
|
{
|
||||||
|
return viewPdmObject()->viewWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMainWindowBase* RimMdiWindowController::getMainWindow()
|
||||||
|
{
|
||||||
|
return RiaApplication::instance()->mainWindowByID(m_mainWindowID);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMdiWindowController::setupBeforeSave()
|
||||||
|
{
|
||||||
|
if ( viewWidget() && getMainWindow() )
|
||||||
|
{
|
||||||
|
this->setMdiWindowGeometry(getMainWindow()->windowGeometryForViewer(viewWidget()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMdiWindowController::updateViewerWidget()
|
||||||
|
{
|
||||||
|
RiuMainWindowBase* mainWindow = getMainWindow();
|
||||||
|
if ( !mainWindow ) return;
|
||||||
|
|
||||||
|
if ( viewPdmObject()->m_showWindow() )
|
||||||
|
{
|
||||||
|
if ( !viewWidget() )
|
||||||
|
{
|
||||||
|
QWidget * viewWidget = viewPdmObject()->createViewWidget(mainWindow);
|
||||||
|
|
||||||
|
mainWindow->addViewer(viewWidget, this->mdiWindowGeometry());
|
||||||
|
mainWindow->setActiveViewer(viewWidget);
|
||||||
|
|
||||||
|
viewPdmObject()->updateViewWidgetAfterCreation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainWindow->setActiveViewer(viewWidget());
|
||||||
|
}
|
||||||
|
|
||||||
|
viewPdmObject()->updateMdiWindowTitle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( viewWidget() )
|
||||||
|
{
|
||||||
|
this->setMdiWindowGeometry(mainWindow->windowGeometryForViewer(viewWidget()));
|
||||||
|
|
||||||
|
mainWindow->removeViewer(viewWidget());
|
||||||
|
|
||||||
|
viewPdmObject()->deleteViewWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
69
ApplicationCode/ProjectDataModel/RimMdiWindowController.h
Normal file
69
ApplicationCode/ProjectDataModel/RimMdiWindowController.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cafPdmObject.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
|
||||||
|
|
||||||
|
class RimViewWindow;
|
||||||
|
class RiuMainWindowBase;
|
||||||
|
struct RimMdiWindowGeometry;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimMdiWindowController : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimMdiWindowController();
|
||||||
|
virtual ~RimMdiWindowController();
|
||||||
|
|
||||||
|
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||||
|
RimMdiWindowGeometry mdiWindowGeometry();
|
||||||
|
|
||||||
|
void updateViewerWidget();
|
||||||
|
void handleViewerDeletion();
|
||||||
|
void removeWindowFromMDI();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
RimViewWindow* viewPdmObject();
|
||||||
|
QWidget* viewWidget();
|
||||||
|
RiuMainWindowBase* getMainWindow();
|
||||||
|
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual void setupBeforeSave() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
caf::PdmField< int > m_mainWindowID;
|
||||||
|
|
||||||
|
caf::PdmField< int > m_x;
|
||||||
|
caf::PdmField< int > m_y;
|
||||||
|
caf::PdmField< int > m_width;
|
||||||
|
caf::PdmField< int > m_height;
|
||||||
|
caf::PdmField< bool> m_isMaximized;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -73,9 +73,6 @@ RimView::RimView(void)
|
|||||||
|
|
||||||
CAF_PDM_InitField(&name, "UserDescription", QString(""), "Name", "", "", "");
|
CAF_PDM_InitField(&name, "UserDescription", QString(""), "Name", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
|
||||||
showWindow.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "");
|
CAF_PDM_InitField(&cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "");
|
||||||
cameraPosition.uiCapability()->setUiHidden(true);
|
cameraPosition.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
@@ -140,6 +137,8 @@ RimView::RimView(void)
|
|||||||
|
|
||||||
m_wellPathPipeVizModel = new cvf::ModelBasicList;
|
m_wellPathPipeVizModel = new cvf::ModelBasicList;
|
||||||
m_wellPathPipeVizModel->setName("WellPathPipeModel");
|
m_wellPathPipeVizModel->setName("WellPathPipeModel");
|
||||||
|
|
||||||
|
this->setAs3DViewMdiWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -169,12 +168,9 @@ RimView::~RimView(void)
|
|||||||
|
|
||||||
delete this->m_overlayInfoConfig();
|
delete this->m_overlayInfoConfig();
|
||||||
|
|
||||||
if (m_viewer)
|
removeMdiWindowFromMdiArea();
|
||||||
{
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
|
||||||
}
|
|
||||||
|
|
||||||
delete m_viewer;
|
deleteViewWidget();
|
||||||
|
|
||||||
delete m_rangeFilterCollection;
|
delete m_rangeFilterCollection;
|
||||||
delete m_overrideRangeFilterCollection;
|
delete m_overrideRangeFilterCollection;
|
||||||
@@ -193,64 +189,76 @@ RiuViewer* RimView::viewer()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimView::updateViewerWidget()
|
QWidget* RimView::createViewWidget(QWidget* mainWindowParent)
|
||||||
{
|
{
|
||||||
if (showWindow())
|
QGLFormat glFormat;
|
||||||
{
|
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
||||||
bool isViewerCreated = false;
|
|
||||||
if (!m_viewer)
|
|
||||||
{
|
|
||||||
QGLFormat glFormat;
|
|
||||||
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
|
||||||
|
|
||||||
m_viewer = new RiuViewer(glFormat, NULL);
|
m_viewer = new RiuViewer(glFormat, NULL);
|
||||||
m_viewer->setOwnerReservoirView(this);
|
m_viewer->setOwnerReservoirView(this);
|
||||||
|
|
||||||
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), mdiWindowGeometry());
|
return m_viewer->layoutWidget();
|
||||||
m_viewer->setDefaultPerspectiveNearPlaneDistance(10);
|
|
||||||
|
|
||||||
this->resetLegendsInViewer();
|
|
||||||
|
|
||||||
m_viewer->updateNavigationPolicy();
|
|
||||||
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
|
||||||
|
|
||||||
isViewerCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuMainWindow::instance()->setActiveViewer(m_viewer->layoutWidget());
|
|
||||||
|
|
||||||
if(isViewerCreated)
|
|
||||||
{
|
|
||||||
m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
|
||||||
m_viewer->setPointOfInterest(cameraPointOfInterest());
|
|
||||||
m_viewer->enableParallelProjection(!isPerspectiveView());
|
|
||||||
}
|
|
||||||
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
|
||||||
|
|
||||||
this->updateGridBoxData();
|
|
||||||
this->createHighlightAndGridBoxDisplayModel();
|
|
||||||
|
|
||||||
m_viewer->update();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_viewer && m_viewer->layoutWidget())
|
|
||||||
{
|
|
||||||
if (m_viewer->layoutWidget()->parentWidget())
|
|
||||||
{
|
|
||||||
m_viewer->layoutWidget()->parentWidget()->hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_viewer->layoutWidget()->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateViewerWidgetWindowTitle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimView::updateViewWidgetAfterCreation()
|
||||||
|
{
|
||||||
|
m_viewer->setDefaultPerspectiveNearPlaneDistance(10);
|
||||||
|
|
||||||
|
this->resetLegendsInViewer();
|
||||||
|
|
||||||
|
m_viewer->updateNavigationPolicy();
|
||||||
|
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
||||||
|
|
||||||
|
m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
||||||
|
m_viewer->setPointOfInterest(cameraPointOfInterest());
|
||||||
|
m_viewer->enableParallelProjection(!isPerspectiveView());
|
||||||
|
|
||||||
|
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||||
|
|
||||||
|
this->updateGridBoxData();
|
||||||
|
this->createHighlightAndGridBoxDisplayModel();
|
||||||
|
|
||||||
|
m_viewer->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimView::updateMdiWindowTitle()
|
||||||
|
{
|
||||||
|
if (m_viewer)
|
||||||
|
{
|
||||||
|
QString windowTitle;
|
||||||
|
if (ownerCase())
|
||||||
|
{
|
||||||
|
windowTitle = QString("%1 - %2").arg(ownerCase()->caseUserDescription()).arg(name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
windowTitle = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimView::deleteViewWidget()
|
||||||
|
{
|
||||||
|
if (m_viewer)
|
||||||
|
{
|
||||||
|
m_viewer->deleteLater();
|
||||||
|
m_viewer = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -367,8 +375,6 @@ void RimView::setupBeforeSave()
|
|||||||
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
||||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||||
cameraPointOfInterest = m_viewer->pointOfInterest();
|
cameraPointOfInterest = m_viewer->pointOfInterest();
|
||||||
|
|
||||||
setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,6 +520,8 @@ bool RimView::isLightingDisabled() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|
||||||
if (changedField == &meshMode)
|
if (changedField == &meshMode)
|
||||||
{
|
{
|
||||||
createDisplayModel();
|
createDisplayModel();
|
||||||
@@ -586,7 +594,7 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
|||||||
}
|
}
|
||||||
else if (changedField == &name)
|
else if (changedField == &name)
|
||||||
{
|
{
|
||||||
updateViewerWidgetWindowTitle();
|
updateMdiWindowTitle();
|
||||||
|
|
||||||
if (viewController())
|
if (viewController())
|
||||||
{
|
{
|
||||||
@@ -617,9 +625,9 @@ void RimView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
|||||||
}
|
}
|
||||||
else if (changedField == &backgroundColor)
|
else if (changedField == &backgroundColor)
|
||||||
{
|
{
|
||||||
if (viewer() != NULL)
|
if (m_viewer != nullptr)
|
||||||
{
|
{
|
||||||
updateViewerWidget();
|
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (changedField == &maximumFrameRate)
|
else if (changedField == &maximumFrameRate)
|
||||||
@@ -956,6 +964,15 @@ cvf::ref<caf::DisplayCoordTransform> RimView::displayCoordTransform()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QWidget* RimView::viewWidget()
|
QWidget* RimView::viewWidget()
|
||||||
{
|
{
|
||||||
return m_viewer;
|
if ( m_viewer ) return m_viewer->layoutWidget();
|
||||||
|
else return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimView::forceShowWindowOn()
|
||||||
|
{
|
||||||
|
m_showWindow.setValueWithFieldChanged(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ public:
|
|||||||
caf::PdmField<QString> name;
|
caf::PdmField<QString> name;
|
||||||
caf::PdmField<double> scaleZ;
|
caf::PdmField<double> scaleZ;
|
||||||
|
|
||||||
caf::PdmField<bool> showWindow;
|
|
||||||
caf::PdmField<cvf::Mat4d> cameraPosition;
|
caf::PdmField<cvf::Mat4d> cameraPosition;
|
||||||
caf::PdmField<cvf::Vec3d> cameraPointOfInterest;
|
caf::PdmField<cvf::Vec3d> cameraPointOfInterest;
|
||||||
caf::PdmField<bool> isPerspectiveView;
|
caf::PdmField<bool> isPerspectiveView;
|
||||||
@@ -164,12 +163,12 @@ public:
|
|||||||
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform();
|
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform();
|
||||||
|
|
||||||
virtual QWidget* viewWidget() override;
|
virtual QWidget* viewWidget() override;
|
||||||
|
void forceShowWindowOn();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void loadDataAndUpdate() = 0;
|
virtual void loadDataAndUpdate() = 0;
|
||||||
virtual RimCase* ownerCase() = 0;
|
virtual RimCase* ownerCase() = 0;
|
||||||
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField() { return &showWindow; }
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -199,9 +198,6 @@ protected:
|
|||||||
virtual void updateScaleTransform() = 0;
|
virtual void updateScaleTransform() = 0;
|
||||||
virtual cvf::Transform* scaleTransform() = 0;
|
virtual cvf::Transform* scaleTransform() = 0;
|
||||||
|
|
||||||
void updateViewerWidget();
|
|
||||||
virtual void updateViewerWidgetWindowTitle() = 0;
|
|
||||||
|
|
||||||
virtual void resetLegendsInViewer() = 0;
|
virtual void resetLegendsInViewer() = 0;
|
||||||
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0;
|
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility) = 0;
|
||||||
|
|
||||||
@@ -217,8 +213,13 @@ protected:
|
|||||||
|
|
||||||
// Overridden PDM methods:
|
// Overridden PDM methods:
|
||||||
virtual void setupBeforeSave();
|
virtual void setupBeforeSave();
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
||||||
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||||
|
virtual void updateViewWidgetAfterCreation() override;
|
||||||
|
virtual void updateMdiWindowTitle() override;
|
||||||
|
virtual void deleteViewWidget() override;
|
||||||
|
|
||||||
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;
|
cvf::ref<cvf::UByteArray> m_currentReservoirCellVisibility;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RimViewWindow.h"
|
#include "RimViewWindow.h"
|
||||||
|
#include "RimMdiWindowController.h"
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Abstract class
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Abstract class
|
||||||
|
|
||||||
@@ -26,9 +28,17 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Ab
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimViewWindow::RimViewWindow(void)
|
RimViewWindow::RimViewWindow(void)
|
||||||
{
|
{
|
||||||
CAF_PDM_InitFieldNoDefault(&m_windowGeometry, "WindowGeometry", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_windowController, "WindowController", "", "", "", "");
|
||||||
m_windowGeometry.uiCapability()->setUiHidden(true);
|
m_windowController.uiCapability()->setUiHidden(true);
|
||||||
|
m_windowController.uiCapability()->setUiTreeChildrenHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Window", "", "", "");
|
||||||
|
m_showWindow.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
// Obsolete field
|
||||||
|
CAF_PDM_InitFieldNoDefault(&obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "");
|
||||||
|
obsoleteField_windowGeometry.uiCapability()->setUiHidden(true);
|
||||||
|
obsoleteField_windowGeometry.xmlCapability()->setIOWritable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -36,7 +46,48 @@ RimViewWindow::RimViewWindow(void)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimViewWindow::~RimViewWindow(void)
|
RimViewWindow::~RimViewWindow(void)
|
||||||
{
|
{
|
||||||
|
if ( m_windowController() ) delete m_windowController() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::removeMdiWindowFromMdiArea()
|
||||||
|
{
|
||||||
|
if ( m_windowController() ) m_windowController->removeWindowFromMDI();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::handleMdiWindowClosed()
|
||||||
|
{
|
||||||
|
if ( m_windowController() ) m_windowController->handleViewerDeletion();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::updateMdiWindowVisibility()
|
||||||
|
{
|
||||||
|
if (m_windowController())
|
||||||
|
{
|
||||||
|
m_windowController->updateViewerWidget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (viewWidget())
|
||||||
|
{
|
||||||
|
if (m_showWindow)
|
||||||
|
{
|
||||||
|
viewWidget()->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
viewWidget()->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -44,17 +95,10 @@ RimViewWindow::~RimViewWindow(void)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||||
{
|
{
|
||||||
std::vector<int> geom;
|
CVF_ASSERT(m_windowController());
|
||||||
geom.clear();
|
|
||||||
if (windowGeometry.isValid())
|
if (m_windowController()) m_windowController()->setMdiWindowGeometry(windowGeometry);
|
||||||
{
|
|
||||||
geom.push_back(windowGeometry.x);
|
|
||||||
geom.push_back(windowGeometry.y);
|
|
||||||
geom.push_back(windowGeometry.width);
|
|
||||||
geom.push_back(windowGeometry.height);
|
|
||||||
geom.push_back(windowGeometry.isMaximized);
|
|
||||||
}
|
|
||||||
m_windowGeometry.setValue(geom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -62,17 +106,97 @@ void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeome
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry()
|
RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry()
|
||||||
{
|
{
|
||||||
|
CVF_ASSERT(m_windowController());
|
||||||
|
|
||||||
RimMdiWindowGeometry wg;
|
if (m_windowController()) return m_windowController()->mdiWindowGeometry();
|
||||||
if (m_windowGeometry.value().size() == 5)
|
else return RimMdiWindowGeometry();
|
||||||
{
|
|
||||||
wg.x = m_windowGeometry.value()[0];
|
|
||||||
wg.y = m_windowGeometry.value()[1];
|
|
||||||
wg.width = m_windowGeometry.value()[2];
|
|
||||||
wg.height = m_windowGeometry.value()[3];
|
|
||||||
wg.isMaximized = m_windowGeometry.value()[4];
|
|
||||||
}
|
|
||||||
|
|
||||||
return wg;
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimViewWindow::objectToggleField()
|
||||||
|
{
|
||||||
|
return &m_showWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if ( changedField == &m_showWindow )
|
||||||
|
{
|
||||||
|
if (m_showWindow)
|
||||||
|
{
|
||||||
|
loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateMdiWindowVisibility();
|
||||||
|
}
|
||||||
|
uiCapability()->updateUiIconFromToggleField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::updateMdiWindowTitle()
|
||||||
|
{
|
||||||
|
if ( viewWidget() )
|
||||||
|
{
|
||||||
|
caf::PdmUiFieldHandle* uiFieldHandle = this->userDescriptionField()->uiCapability();
|
||||||
|
if ( uiFieldHandle )
|
||||||
|
{
|
||||||
|
QVariant v = uiFieldHandle->uiValue();
|
||||||
|
viewWidget()->setWindowTitle(v.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::setAsMdiWindow(int mainWindowID)
|
||||||
|
{
|
||||||
|
if ( !m_windowController() )
|
||||||
|
{
|
||||||
|
m_windowController = new RimMdiWindowController;
|
||||||
|
RimMdiWindowGeometry mwg;
|
||||||
|
mwg.mainWindowID = mainWindowID;
|
||||||
|
setMdiWindowGeometry(mwg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
#include "RimView.h"
|
||||||
|
|
||||||
|
void RimViewWindow::initAfterRead()
|
||||||
|
{
|
||||||
|
if (obsoleteField_windowGeometry.value().size() == 5)
|
||||||
|
{
|
||||||
|
RimMdiWindowGeometry wg;
|
||||||
|
int mainWindowID = -1;
|
||||||
|
|
||||||
|
if (dynamic_cast<RimView*> (this))
|
||||||
|
mainWindowID = 0;
|
||||||
|
else
|
||||||
|
mainWindowID = 1;
|
||||||
|
|
||||||
|
wg.mainWindowID = mainWindowID;
|
||||||
|
wg.x = obsoleteField_windowGeometry.value()[0];
|
||||||
|
wg.y = obsoleteField_windowGeometry.value()[1];
|
||||||
|
wg.width = obsoleteField_windowGeometry.value()[2];
|
||||||
|
wg.height = obsoleteField_windowGeometry.value()[3];
|
||||||
|
wg.isMaximized = obsoleteField_windowGeometry.value()[4];
|
||||||
|
|
||||||
|
setAsMdiWindow(mainWindowID);
|
||||||
|
setMdiWindowGeometry(wg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,18 @@
|
|||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class RimMdiWindowController;
|
||||||
|
|
||||||
struct RimMdiWindowGeometry
|
struct RimMdiWindowGeometry
|
||||||
{
|
{
|
||||||
RimMdiWindowGeometry() : x(0), y(0), width(-1), height(-1) {}
|
RimMdiWindowGeometry() : mainWindowID(-1), x(0), y(0), width(-1), height(-1) {}
|
||||||
bool isValid() const { return (width >= 0 && height >= 0);}
|
bool isValid() const { return (mainWindowID >= 0 && width >= 0 && height >= 0);}
|
||||||
|
|
||||||
|
int mainWindowID;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
@@ -42,15 +47,49 @@ public:
|
|||||||
RimViewWindow(void);
|
RimViewWindow(void);
|
||||||
virtual ~RimViewWindow(void);
|
virtual ~RimViewWindow(void);
|
||||||
|
|
||||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
void handleMdiWindowClosed();
|
||||||
RimMdiWindowGeometry mdiWindowGeometry();
|
|
||||||
|
void setAs3DViewMdiWindow() { setAsMdiWindow(0); }
|
||||||
|
void setAsPlotMdiWindow() { setAsMdiWindow(1); }
|
||||||
|
|
||||||
|
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||||
|
RimMdiWindowGeometry mdiWindowGeometry();
|
||||||
|
|
||||||
|
virtual QWidget* viewWidget() = 0;
|
||||||
|
|
||||||
|
virtual QImage snapshotWindowContent() = 0;
|
||||||
|
virtual void zoomAll() = 0;
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() = 0;
|
protected:
|
||||||
virtual void zoomAll() = 0;
|
void removeMdiWindowFromMdiArea();
|
||||||
|
void updateMdiWindowVisibility();
|
||||||
|
|
||||||
virtual QWidget* viewWidget() = 0;
|
///////// Interface for the Window controller
|
||||||
|
friend class RimMdiWindowController;
|
||||||
|
|
||||||
private:
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) = 0;
|
||||||
caf::PdmField< std::vector<int> > m_windowGeometry;
|
virtual void updateViewWidgetAfterCreation() {};
|
||||||
|
virtual void updateMdiWindowTitle(); // Has real default implementation
|
||||||
|
virtual void deleteViewWidget() = 0;
|
||||||
|
virtual void loadDataAndUpdate() = 0;
|
||||||
|
//////////
|
||||||
|
|
||||||
|
// Derived classes are not supposed to override this function. The intention is to always use m_showWindow
|
||||||
|
// as the objectToggleField for this class. This way the visibility of a widget being part of a composite widget
|
||||||
|
// can be controlled from the project tree using check box toggles
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField() override final;
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
virtual void initAfterRead() override;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_showWindow;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setAsMdiWindow(int mainWindowID);
|
||||||
|
|
||||||
|
caf::PdmChildField<RimMdiWindowController*> m_windowController;
|
||||||
|
|
||||||
|
|
||||||
|
// Obsoleted field
|
||||||
|
caf::PdmField< std::vector<int> > obsoleteField_windowGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ RimWellLogPlot::RimWellLogPlot()
|
|||||||
|
|
||||||
m_viewer = NULL;
|
m_viewer = NULL;
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show well log plot", "", "", "");
|
|
||||||
m_showWindow.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Well Log Plot"),"Name", "", "", "");
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Well Log Plot"),"Name", "", "", "");
|
||||||
|
|
||||||
caf::AppEnum< RimWellLogPlot::DepthTypeEnum > depthType = MEASURED_DEPTH;
|
caf::AppEnum< RimWellLogPlot::DepthTypeEnum > depthType = MEASURED_DEPTH;
|
||||||
@@ -86,52 +83,11 @@ RimWellLogPlot::RimWellLogPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellLogPlot::~RimWellLogPlot()
|
RimWellLogPlot::~RimWellLogPlot()
|
||||||
{
|
{
|
||||||
if (RiaApplication::instance()->mainPlotWindow())
|
removeMdiWindowFromMdiArea();
|
||||||
{
|
|
||||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
detachAllCurves();
|
|
||||||
m_tracks.deleteAllChildObjects();
|
m_tracks.deleteAllChildObjects();
|
||||||
|
|
||||||
delete m_viewer;
|
deleteViewWidget();
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogPlot::updateViewerWidget()
|
|
||||||
{
|
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
|
||||||
if (!mainPlotWindow) return;
|
|
||||||
|
|
||||||
if (m_showWindow())
|
|
||||||
{
|
|
||||||
if (!m_viewer)
|
|
||||||
{
|
|
||||||
m_viewer = new RiuWellLogPlot(this, mainPlotWindow);
|
|
||||||
|
|
||||||
recreateTrackPlots();
|
|
||||||
|
|
||||||
mainPlotWindow->addViewer(m_viewer, this->mdiWindowGeometry());
|
|
||||||
mainPlotWindow->setActiveViewer(m_viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateViewerWidgetWindowTitle();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_viewer));
|
|
||||||
|
|
||||||
mainPlotWindow->removeViewer(m_viewer);
|
|
||||||
detachAllCurves();
|
|
||||||
|
|
||||||
delete m_viewer;
|
|
||||||
m_viewer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -139,20 +95,9 @@ void RimWellLogPlot::updateViewerWidget()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
if (changedField == &m_showWindow)
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
{
|
|
||||||
if (m_showWindow)
|
|
||||||
{
|
|
||||||
loadDataAndUpdate();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
updateViewerWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth)
|
||||||
}
|
|
||||||
else if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth)
|
|
||||||
{
|
{
|
||||||
applyDepthZoomFromVisibleDepth();
|
applyDepthZoomFromVisibleDepth();
|
||||||
|
|
||||||
@@ -164,7 +109,7 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
}
|
}
|
||||||
else if (changedField == &m_userName)
|
else if (changedField == &m_userName)
|
||||||
{
|
{
|
||||||
updateViewerWidgetWindowTitle();
|
updateMdiWindowTitle();
|
||||||
}
|
}
|
||||||
if (changedField == &m_depthType ||
|
if (changedField == &m_depthType ||
|
||||||
changedField == &m_depthUnit)
|
changedField == &m_depthUnit)
|
||||||
@@ -173,14 +118,6 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
|
|
||||||
{
|
|
||||||
return &m_showWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -240,6 +177,17 @@ void RimWellLogPlot::removeTrack(RimWellLogTrack* track)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogPlot::removeTrackByIndex(size_t index)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(index < m_tracks.size());
|
||||||
|
|
||||||
|
RimWellLogTrack* track = m_tracks[index];
|
||||||
|
this->removeTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -269,6 +217,14 @@ void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::ve
|
|||||||
updateTrackNames();
|
updateTrackNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimWellLogTrack* RimWellLogPlot::trackByIndex(size_t index)
|
||||||
|
{
|
||||||
|
return m_tracks[index];
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -391,21 +347,6 @@ void RimWellLogPlot::depthZoomMinMax(double* minimumDepth, double* maximumDepth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogPlot::setupBeforeSave()
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
if (RiaApplication::instance()->mainPlotWindow())
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_viewer));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -427,7 +368,7 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::loadDataAndUpdate()
|
void RimWellLogPlot::loadDataAndUpdate()
|
||||||
{
|
{
|
||||||
updateViewerWidget();
|
updateMdiWindowVisibility();
|
||||||
updateTracks();
|
updateTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,29 +489,27 @@ QString RimWellLogPlot::description() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::updateViewerWidgetWindowTitle()
|
QWidget* RimWellLogPlot::createViewWidget(QWidget* mainWindowParent)
|
||||||
{
|
{
|
||||||
if (m_viewer)
|
m_viewer = new RiuWellLogPlot(this, mainWindowParent);
|
||||||
{
|
|
||||||
m_viewer->setWindowTitle(m_userName);
|
recreateTrackPlots();
|
||||||
}
|
|
||||||
|
return m_viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::handleViewerDeletion()
|
void RimWellLogPlot::deleteViewWidget()
|
||||||
{
|
{
|
||||||
m_showWindow = false;
|
detachAllCurves();
|
||||||
|
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
{
|
{
|
||||||
detachAllCurves();
|
m_viewer->deleteLater();
|
||||||
m_viewer = NULL;
|
m_viewer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
|
||||||
updateConnectedEditors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
#include "RimDefines.h"
|
#include "RimDefines.h"
|
||||||
|
|
||||||
#include "RimViewWindow.h"
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class RiuWellLogPlot;
|
class RiuWellLogPlot;
|
||||||
class RimWellLogTrack;
|
class RimWellLogTrack;
|
||||||
|
|
||||||
@@ -66,10 +66,14 @@ public:
|
|||||||
void addTrack(RimWellLogTrack* track);
|
void addTrack(RimWellLogTrack* track);
|
||||||
void insertTrack(RimWellLogTrack* track, size_t index);
|
void insertTrack(RimWellLogTrack* track, size_t index);
|
||||||
size_t trackCount() { return m_tracks.size();}
|
size_t trackCount() { return m_tracks.size();}
|
||||||
|
void removeTrackByIndex(size_t index);
|
||||||
|
|
||||||
void removeTrack(RimWellLogTrack* track);
|
void removeTrack(RimWellLogTrack* track);
|
||||||
size_t trackIndex(RimWellLogTrack* track);
|
size_t trackIndex(RimWellLogTrack* track);
|
||||||
void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove);
|
void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove);
|
||||||
|
|
||||||
|
RimWellLogTrack* trackByIndex(size_t index);
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
void updateTracks();
|
void updateTracks();
|
||||||
void updateTrackNames();
|
void updateTrackNames();
|
||||||
@@ -91,25 +95,25 @@ protected:
|
|||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
virtual void setupBeforeSave();
|
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() override;
|
virtual QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateViewerWidget();
|
|
||||||
void updateViewerWidgetWindowTitle();
|
|
||||||
void applyZoomAllDepths();
|
void applyZoomAllDepths();
|
||||||
void applyDepthZoomFromVisibleDepth();
|
void applyDepthZoomFromVisibleDepth();
|
||||||
void recreateTrackPlots();
|
void recreateTrackPlots();
|
||||||
void detachAllCurves();
|
void detachAllCurves();
|
||||||
void handleViewerDeletion();
|
|
||||||
|
public: // Needed by RiuWellAllocation Plot
|
||||||
|
// RimViewWindow overrides
|
||||||
|
|
||||||
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||||
|
virtual void deleteViewWidget() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showWindow;
|
|
||||||
caf::PdmField<QString> m_userName;
|
caf::PdmField<QString> m_userName;
|
||||||
|
|
||||||
caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType;
|
caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType;
|
||||||
|
|||||||
@@ -72,7 +72,11 @@ RimWellLogTrack::~RimWellLogTrack()
|
|||||||
{
|
{
|
||||||
curves.deleteAllChildObjects();
|
curves.deleteAllChildObjects();
|
||||||
|
|
||||||
delete m_wellLogTrackPlotWidget;
|
if (m_wellLogTrackPlotWidget)
|
||||||
|
{
|
||||||
|
m_wellLogTrackPlotWidget->deleteLater();
|
||||||
|
m_wellLogTrackPlotWidget = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
|||||||
RimSummaryPlot::RimSummaryPlot()
|
RimSummaryPlot::RimSummaryPlot()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Summary Plot", ":/SummaryPlot16x16.png", "", "");
|
CAF_PDM_InitObject("Summary Plot", ":/SummaryPlot16x16.png", "", "");
|
||||||
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Summary Plot", "", "", "");
|
|
||||||
m_showWindow.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
||||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||||
@@ -85,6 +83,8 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
|
|
||||||
CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Auto Zoom", "", "", "");
|
CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Auto Zoom", "", "", "");
|
||||||
m_isAutoZoom.uiCapability()->setUiHidden(true);
|
m_isAutoZoom.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
setAsPlotMdiWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -92,29 +92,14 @@ RimSummaryPlot::RimSummaryPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryPlot::~RimSummaryPlot()
|
RimSummaryPlot::~RimSummaryPlot()
|
||||||
{
|
{
|
||||||
if (RiaApplication::instance()->mainPlotWindow())
|
removeMdiWindowFromMdiArea();
|
||||||
{
|
|
||||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_qwtPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
deletePlotWidget();
|
deleteViewWidget();
|
||||||
|
|
||||||
m_curves.deleteAllChildObjects();
|
m_curves.deleteAllChildObjects();
|
||||||
m_curveFilters.deleteAllChildObjects();
|
m_curveFilters.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlot::deletePlotWidget()
|
|
||||||
{
|
|
||||||
if (m_qwtPlot)
|
|
||||||
{
|
|
||||||
m_qwtPlot->deleteLater();
|
|
||||||
m_qwtPlot = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -367,22 +352,6 @@ void RimSummaryPlot::updateTimeAxis()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlot::handleViewerDeletion()
|
|
||||||
{
|
|
||||||
m_showWindow = false;
|
|
||||||
|
|
||||||
if (m_qwtPlot)
|
|
||||||
{
|
|
||||||
detachAllCurves();
|
|
||||||
}
|
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
|
||||||
updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -504,36 +473,15 @@ void RimSummaryPlot::addCurveFilter(RimSummaryCurveFilter* curveFilter)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
if (changedField == &m_showWindow)
|
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
{
|
|
||||||
if (m_showWindow)
|
|
||||||
{
|
|
||||||
loadDataAndUpdate();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
updateViewerWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
uiCapability()->updateUiIconFromToggleField();
|
if (changedField == &m_userName ||
|
||||||
}
|
changedField == &m_showPlotTitle)
|
||||||
else if (changedField == &m_userName ||
|
|
||||||
changedField == &m_showPlotTitle)
|
|
||||||
{
|
{
|
||||||
updateViewerWidgetWindowTitle();
|
updateMdiWindowTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimSummaryPlot::setupBeforeSave()
|
|
||||||
{
|
|
||||||
if (m_qwtPlot && RiaApplication::instance()->mainPlotWindow())
|
|
||||||
{
|
|
||||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_qwtPlot));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -578,7 +526,7 @@ void RimSummaryPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::loadDataAndUpdate()
|
void RimSummaryPlot::loadDataAndUpdate()
|
||||||
{
|
{
|
||||||
updateViewerWidget();
|
updateMdiWindowVisibility();
|
||||||
|
|
||||||
for (RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
for (RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||||
{
|
{
|
||||||
@@ -669,51 +617,44 @@ QString RimSummaryPlot::description() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateViewerWidget()
|
QWidget* RimSummaryPlot::createViewWidget(QWidget* mainWindowParent)
|
||||||
{
|
{
|
||||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
if (!m_qwtPlot)
|
||||||
if (!mainPlotWindow) return;
|
|
||||||
|
|
||||||
if (m_showWindow())
|
|
||||||
{
|
{
|
||||||
if (!m_qwtPlot)
|
m_qwtPlot = new RiuSummaryQwtPlot(this, mainWindowParent);
|
||||||
|
|
||||||
|
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
||||||
{
|
{
|
||||||
m_qwtPlot = new RiuSummaryQwtPlot(this, mainPlotWindow);
|
curveFilter->setParentQwtPlot(m_qwtPlot);
|
||||||
|
|
||||||
for(RimSummaryCurveFilter* curveFilter: m_curveFilters)
|
|
||||||
{
|
|
||||||
curveFilter->setParentQwtPlot(m_qwtPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(RimSummaryCurve* curve : m_curves)
|
|
||||||
{
|
|
||||||
curve->setParentQwtPlot(m_qwtPlot);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainPlotWindow->addViewer(m_qwtPlot, this->mdiWindowGeometry());
|
|
||||||
mainPlotWindow->setActiveViewer(m_qwtPlot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateViewerWidgetWindowTitle();
|
for(RimSummaryCurve* curve : m_curves)
|
||||||
|
{
|
||||||
|
curve->setParentQwtPlot(m_qwtPlot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
return m_qwtPlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::deleteViewWidget()
|
||||||
|
{
|
||||||
|
detachAllCurves();
|
||||||
|
|
||||||
|
if (m_qwtPlot)
|
||||||
{
|
{
|
||||||
if (m_qwtPlot)
|
m_qwtPlot->deleteLater();
|
||||||
{
|
m_qwtPlot = nullptr;
|
||||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_qwtPlot));
|
|
||||||
|
|
||||||
mainPlotWindow->removeViewer(m_qwtPlot);
|
|
||||||
detachAllCurves();
|
|
||||||
|
|
||||||
deletePlotWidget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::updateViewerWidgetWindowTitle()
|
void RimSummaryPlot::updateMdiWindowTitle()
|
||||||
{
|
{
|
||||||
if (m_qwtPlot)
|
if (m_qwtPlot)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
void handleViewerDeletion();
|
void detachAllCurves();
|
||||||
void updateCaseNameHasChanged();
|
void updateCaseNameHasChanged();
|
||||||
|
|
||||||
void updateAxes();
|
void updateAxes();
|
||||||
@@ -88,19 +88,13 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
virtual void setupBeforeSave() override;
|
|
||||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
|
|
||||||
virtual QImage snapshotWindowContent() override;
|
virtual QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateViewerWidget();
|
|
||||||
void updateViewerWidgetWindowTitle();
|
|
||||||
void detachAllCurves();
|
|
||||||
void deletePlotWidget();
|
|
||||||
|
|
||||||
void updateAxis(RimDefines::PlotAxis plotAxis);
|
void updateAxis(RimDefines::PlotAxis plotAxis);
|
||||||
std::vector<RimSummaryCurve*> curvesForAxis(RimDefines::PlotAxis plotAxis) const;
|
std::vector<RimSummaryCurve*> curvesForAxis(RimDefines::PlotAxis plotAxis) const;
|
||||||
@@ -109,10 +103,13 @@ private:
|
|||||||
void updateTimeAxis();
|
void updateTimeAxis();
|
||||||
void setZoomIntervalsInQwtPlot();
|
void setZoomIntervalsInQwtPlot();
|
||||||
|
|
||||||
|
// RimViewWindow overrides
|
||||||
|
|
||||||
|
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||||
|
void updateMdiWindowTitle() override;
|
||||||
|
virtual void deleteViewWidget() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showWindow;
|
|
||||||
|
|
||||||
caf::PdmField<bool> m_showPlotTitle;
|
caf::PdmField<bool> m_showPlotTitle;
|
||||||
caf::PdmField<QString> m_userName;
|
caf::PdmField<QString> m_userName;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
|
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
|
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.h
|
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigSimulationWellCoordsAndMD.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigFracture.h
|
${CEE_CURRENT_LIST_DIR}RigFracture.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigTesselatorTools.h
|
${CEE_CURRENT_LIST_DIR}RigTesselatorTools.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.h
|
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.h
|
||||||
@@ -95,6 +96,7 @@ ${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
|
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp
|
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.cpp
|
${CEE_CURRENT_LIST_DIR}RigLasFileExporter.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigSimulationWellCoordsAndMD.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigFracture.cpp
|
${CEE_CURRENT_LIST_DIR}RigFracture.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigTesselatorTools.cpp
|
${CEE_CURRENT_LIST_DIR}RigTesselatorTools.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.cpp
|
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.cpp
|
||||||
|
|||||||
@@ -262,6 +262,20 @@ void RigEclipseCaseData::setWellResults(const cvf::Collection<RigSingleWellResul
|
|||||||
computeWellCellsPrGrid();
|
computeWellCellsPrGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const RigSingleWellResultsData* RigEclipseCaseData::findWellResult(QString wellName) const
|
||||||
|
{
|
||||||
|
for (size_t wIdx = 0; wIdx < m_wellResults.size(); ++wIdx)
|
||||||
|
{
|
||||||
|
if (m_wellResults[wIdx]->m_wellName == wellName) return m_wellResults[wIdx].p();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -288,14 +302,14 @@ const cvf::UIntArray* RigEclipseCaseData::gridCellToResultWellIndex(size_t gridI
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigCell& RigEclipseCaseData::cellFromWellResultCell(const RigWellResultPoint& wellResultCell)
|
const RigCell& RigEclipseCaseData::cellFromWellResultCell(const RigWellResultPoint& wellResultCell) const
|
||||||
{
|
{
|
||||||
CVF_ASSERT(wellResultCell.isCell());
|
CVF_ASSERT(wellResultCell.isCell());
|
||||||
|
|
||||||
size_t gridIndex = wellResultCell.m_gridIndex;
|
size_t gridIndex = wellResultCell.m_gridIndex;
|
||||||
size_t gridCellIndex = wellResultCell.m_gridCellIndex;
|
size_t gridCellIndex = wellResultCell.m_gridCellIndex;
|
||||||
|
|
||||||
std::vector<RigGridBase*> grids;
|
std::vector<const RigGridBase*> grids;
|
||||||
allGrids(&grids);
|
allGrids(&grids);
|
||||||
|
|
||||||
return grids[gridIndex]->cell(gridCellIndex);
|
return grids[gridIndex]->cell(gridCellIndex);
|
||||||
|
|||||||
@@ -82,11 +82,12 @@ public:
|
|||||||
|
|
||||||
void setWellResults(const cvf::Collection<RigSingleWellResultsData>& data);
|
void setWellResults(const cvf::Collection<RigSingleWellResultsData>& data);
|
||||||
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }
|
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }
|
||||||
|
const RigSingleWellResultsData* findWellResult(QString wellName) const;
|
||||||
|
|
||||||
const cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
|
const cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
|
||||||
const cvf::UIntArray* gridCellToResultWellIndex(size_t gridIndex);
|
const cvf::UIntArray* gridCellToResultWellIndex(size_t gridIndex);
|
||||||
|
|
||||||
RigCell& cellFromWellResultCell(const RigWellResultPoint& wellResultCell);
|
const RigCell& cellFromWellResultCell(const RigWellResultPoint& wellResultCell) const;
|
||||||
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultPoint& sourceWellCellResult, const RigWellResultPoint& otherWellCellResult) const;
|
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultPoint& sourceWellCellResult, const RigWellResultPoint& otherWellCellResult) const;
|
||||||
|
|
||||||
void computeActiveCellBoundingBoxes();
|
void computeActiveCellBoundingBoxes();
|
||||||
|
|||||||
@@ -34,332 +34,361 @@
|
|||||||
/// The returned CellIds is one less than the number of centerline points,
|
/// The returned CellIds is one less than the number of centerline points,
|
||||||
/// and are describing the lines between the points, starting with the first line
|
/// and are describing the lines between the points, starting with the first line
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclipseWell* rimWell,
|
void RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(RimEclipseWell* rimWell,
|
||||||
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
|
||||||
{
|
{
|
||||||
bool isAutoDetectBranches = false;
|
calculateWellPipeDynamicCenterline(rimWell, -1, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||||
RigEclipseCaseData* eclipseCaseData = NULL;
|
}
|
||||||
RigSingleWellResultsData* wellResults = NULL;
|
|
||||||
|
|
||||||
{
|
|
||||||
CVF_ASSERT(rimWell);
|
|
||||||
RimEclipseView* eclipseView;
|
|
||||||
rimWell->firstAncestorOrThisOfType(eclipseView);
|
|
||||||
CVF_ASSERT(eclipseView);
|
|
||||||
|
|
||||||
isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
|
//--------------------------------------------------------------------------------------------------
|
||||||
eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
|
///
|
||||||
wellResults = rimWell->wellResults();
|
//--------------------------------------------------------------------------------------------------
|
||||||
}
|
void RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(RimEclipseWell* rimWell,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(rimWell);
|
||||||
|
|
||||||
// Make sure we have computed the static representation of the well
|
RigSingleWellResultsData* wellResults = rimWell->wellResults();
|
||||||
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
|
|
||||||
{
|
|
||||||
wellResults->computeStaticWellCellPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
const RigWellResultFrame& staticWellFrame = wellResults->m_staticWellCells;
|
RimEclipseView* eclipseView;
|
||||||
if (staticWellFrame.m_wellResultBranches.size() == 0) return;
|
rimWell->firstAncestorOrThisOfType(eclipseView);
|
||||||
|
|
||||||
|
CVF_ASSERT(eclipseView);
|
||||||
|
|
||||||
|
RigEclipseCaseData* eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
|
||||||
|
bool isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
|
||||||
|
|
||||||
|
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
|
||||||
|
|
||||||
|
calculateWellPipeCenterlineFromWellFrame(eclipseCaseData,
|
||||||
|
wellResults,
|
||||||
|
static_cast<int>(timeStepIndex),
|
||||||
|
isAutoDetectBranches,
|
||||||
|
useAllCellCenters,
|
||||||
|
pipeBranchesCLCoords,
|
||||||
|
pipeBranchesCellIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Based on the points and cells, calculate a pipe centerline
|
||||||
|
/// The returned CellIds is one less than the number of centerline points,
|
||||||
|
/// and are describing the lines between the points, starting with the first line
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(const RigEclipseCaseData* eclipseCaseData,
|
||||||
|
const RigSingleWellResultsData* wellResults,
|
||||||
|
int timeStepIndex,
|
||||||
|
bool isAutoDetectBranches,
|
||||||
|
bool useAllCellCenters,
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
|
||||||
|
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds)
|
||||||
|
{
|
||||||
|
if ( !wellResults) return;
|
||||||
|
if ( timeStepIndex >= 0 && !wellResults->hasWellResult(timeStepIndex) ) return;
|
||||||
|
|
||||||
|
const RigWellResultFrame* wellFramePtr = nullptr;
|
||||||
|
|
||||||
|
if (timeStepIndex < 0)
|
||||||
|
{
|
||||||
|
// Make sure we have computed the static representation of the well
|
||||||
|
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
|
||||||
|
{
|
||||||
|
wellResults->computeStaticWellCellPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
wellFramePtr = &wellResults->m_staticWellCells;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wellFramePtr = &(wellResults->wellResultFrame(timeStepIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
const RigWellResultFrame& wellFrame = *wellFramePtr;
|
||||||
|
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
|
||||||
|
|
||||||
// Initialize the return arrays
|
// Initialize the return arrays
|
||||||
pipeBranchesCLCoords.clear();
|
pipeBranchesCLCoords.clear();
|
||||||
pipeBranchesCellIds.clear();
|
pipeBranchesCellIds.clear();
|
||||||
|
|
||||||
|
if ( wellFrame.m_wellResultBranches.size() == 0 ) return;
|
||||||
|
|
||||||
// Well head
|
// Well head
|
||||||
// Match this position with well head position in RivWellHeadPartMgr::buildWellHeadParts()
|
// Match this position with well head position in RivWellHeadPartMgr::buildWellHeadParts()
|
||||||
const RigCell& whCell = eclipseCaseData->cellFromWellResultCell(staticWellFrame.m_wellHead);
|
|
||||||
|
const RigCell& whCell = eclipseCaseData->cellFromWellResultCell(wellFrame.m_wellHead);
|
||||||
cvf::Vec3d whStartPos = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
|
cvf::Vec3d whStartPos = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
|
||||||
const RigWellResultPoint* whResCell = &(staticWellFrame.m_wellHead);
|
const RigWellResultPoint* whResCell = &(wellFrame.m_wellHead);
|
||||||
|
|
||||||
// Loop over all the well branches
|
|
||||||
const std::vector<RigWellResultBranch>& resBranches = staticWellFrame.m_wellResultBranches;
|
const std::vector<RigWellResultBranch>& resBranches = wellFrame.m_wellResultBranches;
|
||||||
bool hasResultCells = false;
|
|
||||||
if (resBranches.size())
|
if ( ! hasAnyResultCells(resBranches) ) return;
|
||||||
|
|
||||||
|
// Add extra coordinate between cell face and cell center
|
||||||
|
// to make sure the well pipe terminated in a segment parallel to z-axis
|
||||||
|
|
||||||
|
cvf::Vec3d whIntermediate = whStartPos;
|
||||||
|
whIntermediate.z() = (whStartPos.z() + whCell.center().z()) / 2.0;
|
||||||
|
|
||||||
|
const RigWellResultPoint* prevWellResPoint = NULL;
|
||||||
|
|
||||||
|
CVF_ASSERT(isMultiSegmentWell || resBranches.size() <= 1);
|
||||||
|
|
||||||
|
// The centerline is calculated by adding a point when the pipe enters a cell,
|
||||||
|
// and one when the line leaves the cell.
|
||||||
|
// For the sake of the loop:
|
||||||
|
// The currentResultPoint (Cell) and the one we index by the loop variable is the one we calculate the entry point to.
|
||||||
|
// The previous cell is the one we leave, and calculate the "out-point" from
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t brIdx = 0; brIdx < resBranches.size(); brIdx++)
|
||||||
{
|
{
|
||||||
for (size_t i = 0 ; i < resBranches.size(); ++i)
|
|
||||||
|
// Skip empty branches. Do not know why they exist, but they make problems.
|
||||||
|
|
||||||
|
const RigWellResultBranch& branch = resBranches[brIdx];
|
||||||
|
if ( !hasAnyValidDataCells(branch) ) continue;
|
||||||
|
|
||||||
|
prevWellResPoint = NULL;
|
||||||
|
|
||||||
|
// Find the start the MSW well-branch centerline. Normal wells are started "once" at wellhead in the code above
|
||||||
|
|
||||||
|
pipeBranchesCLCoords.push_back(std::vector<cvf::Vec3d>());
|
||||||
|
pipeBranchesCellIds.push_back(std::vector <RigWellResultPoint>());
|
||||||
|
|
||||||
|
if (brIdx == 0)
|
||||||
{
|
{
|
||||||
if (resBranches[i].m_branchResultPoints.size() != 0)
|
// The first branch contains segment number 1, and this is the only segment connected to well head
|
||||||
{
|
// See Eclipse documentation for the keyword WELSEGS
|
||||||
hasResultCells = true;
|
prevWellResPoint = whResCell;
|
||||||
break;
|
|
||||||
}
|
pipeBranchesCLCoords.back().push_back(whStartPos);
|
||||||
|
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
||||||
|
|
||||||
|
pipeBranchesCLCoords.back().push_back(whIntermediate);
|
||||||
|
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (hasResultCells)
|
// Loop over all the resultPoints in the branch
|
||||||
{
|
|
||||||
|
|
||||||
// Add extra coordinate between cell face and cell center
|
const std::vector<RigWellResultPoint>& resBranchCells = resBranches[brIdx].m_branchResultPoints;
|
||||||
// to make sure the well pipe terminated in a segment parallel to z-axis
|
|
||||||
cvf::Vec3d whIntermediate = whStartPos;
|
|
||||||
whIntermediate.z() = (whStartPos.z() + whCell.center().z()) / 2.0;
|
|
||||||
|
|
||||||
const RigWellResultPoint* prevWellResPoint = NULL;
|
for (int cIdx = 0; cIdx < static_cast<int>(resBranchCells.size()); cIdx++) // Need int because cIdx can temporarily end on -1
|
||||||
|
|
||||||
CVF_ASSERT(wellResults->isMultiSegmentWell() || resBranches.size() <= 1);
|
|
||||||
|
|
||||||
// The centerline is calculated by adding a point when the pipe enters a cell,
|
|
||||||
// and one when the line leaves the cell.
|
|
||||||
// For the sake of the loop:
|
|
||||||
// The currentResultPoint (Cell) and the one we index by the loop variable is the one we calculate the entry point to.
|
|
||||||
// The previous cell is the one we leave, and calculate the "out-point" from
|
|
||||||
|
|
||||||
|
|
||||||
for (size_t brIdx = 0; brIdx < resBranches.size(); brIdx++)
|
|
||||||
{
|
{
|
||||||
|
std::vector<cvf::Vec3d>& branchCLCoords = pipeBranchesCLCoords.back();
|
||||||
|
std::vector<RigWellResultPoint>& branchCellIds = pipeBranchesCellIds.back();
|
||||||
|
|
||||||
// Skip empty branches. Do not know why they exist, but they make problems.
|
const RigWellResultPoint& currentWellResPoint = resBranchCells[cIdx];
|
||||||
|
|
||||||
bool hasValidData = false;
|
// Ignore invalid cells
|
||||||
for (size_t cIdx = 0; cIdx < resBranches[brIdx].m_branchResultPoints.size(); ++cIdx)
|
|
||||||
|
if (!currentWellResPoint.isValid())
|
||||||
{
|
{
|
||||||
if (resBranches[brIdx].m_branchResultPoints[cIdx].isValid())
|
//CVF_ASSERT(false); // Some segments does not get anything yet.
|
||||||
{
|
continue;
|
||||||
hasValidData = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasValidData) continue;
|
|
||||||
|
|
||||||
|
|
||||||
prevWellResPoint = NULL;
|
|
||||||
|
|
||||||
// Find the start the MSW well-branch centerline. Normal wells are started "once" at wellhead in the code above
|
|
||||||
|
|
||||||
pipeBranchesCLCoords.push_back(std::vector<cvf::Vec3d>());
|
|
||||||
pipeBranchesCellIds.push_back(std::vector <RigWellResultPoint>());
|
|
||||||
|
|
||||||
if (brIdx == 0)
|
|
||||||
{
|
|
||||||
// The first branch contains segment number 1, and this is the only segment connected to well head
|
|
||||||
// See Eclipse documentation for the keyword WELSEGS
|
|
||||||
prevWellResPoint = whResCell;
|
|
||||||
|
|
||||||
pipeBranchesCLCoords.back().push_back(whStartPos);
|
|
||||||
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
|
||||||
|
|
||||||
pipeBranchesCLCoords.back().push_back(whIntermediate);
|
|
||||||
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over all the resultPoints in the branch
|
// Add cl contribution for a geometrical resultPoint by adding exit point from previous cell,
|
||||||
|
// and then the result point position
|
||||||
|
|
||||||
const std::vector<RigWellResultPoint>& resBranchCells = resBranches[brIdx].m_branchResultPoints;
|
if (!currentWellResPoint.isCell())
|
||||||
|
|
||||||
for (int cIdx = 0; cIdx < static_cast<int>(resBranchCells.size()); cIdx++) // Need int because cIdx can temporarily end on -1
|
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3d>& branchCLCoords = pipeBranchesCLCoords.back();
|
// Use the interpolated value of branch head
|
||||||
std::vector<RigWellResultPoint>& branchCellIds = pipeBranchesCellIds.back();
|
CVF_ASSERT(currentWellResPoint.isPointValid());
|
||||||
|
|
||||||
const RigWellResultPoint& currentWellResPoint = resBranchCells[cIdx];
|
cvf::Vec3d currentPoint = currentWellResPoint.m_bottomPosition;
|
||||||
|
|
||||||
// Ignore invalid cells
|
// If we have a real previous cell, we need to go out of it, before adding the current point
|
||||||
|
// That is: add a CL-point describing where it leaves the previous cell.
|
||||||
|
|
||||||
if (!currentWellResPoint.isValid())
|
if (prevWellResPoint && prevWellResPoint->isCell())
|
||||||
{
|
{
|
||||||
//CVF_ASSERT(false); // Some segments does not get anything yet.
|
// Create ray between the previous and this position
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add cl contribution for a geometrical resultPoint by adding exit point from previous cell,
|
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
||||||
// and then the result point position
|
cvf::Vec3d centerPreviousCell = prevCell.center();
|
||||||
|
|
||||||
if (!currentWellResPoint.isCell())
|
cvf::Ray rayToThisCell;
|
||||||
{
|
rayToThisCell.setOrigin(centerPreviousCell);
|
||||||
// Use the interpolated value of branch head
|
rayToThisCell.setDirection((currentPoint - centerPreviousCell).getNormalized());
|
||||||
CVF_ASSERT(currentWellResPoint.isPointValid());
|
|
||||||
|
|
||||||
cvf::Vec3d currentPoint = currentWellResPoint.m_bottomPosition;
|
cvf::Vec3d outOfPrevCell(centerPreviousCell);
|
||||||
|
|
||||||
// If we have a real previous cell, we need to go out of it, before adding the current point
|
int intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
|
||||||
// That is: add a CL-point describing where it leaves the previous cell.
|
//CVF_ASSERT(intersectionOk);
|
||||||
|
//CVF_ASSERT(intersectionOk);
|
||||||
if (prevWellResPoint && prevWellResPoint->isCell())
|
if ((currentPoint - outOfPrevCell).lengthSquared() > 1e-3)
|
||||||
{
|
{
|
||||||
// Create ray between the previous and this position
|
branchCLCoords.push_back(outOfPrevCell);
|
||||||
|
branchCellIds.push_back(RigWellResultPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
branchCLCoords.push_back(currentPoint);
|
||||||
|
branchCellIds.push_back(currentWellResPoint);
|
||||||
|
|
||||||
|
prevWellResPoint = ¤tWellResPoint;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle currentWellResPoint as a real cell result points.
|
||||||
|
//
|
||||||
|
|
||||||
|
const RigCell& cell = eclipseCaseData->cellFromWellResultCell(currentWellResPoint);
|
||||||
|
|
||||||
|
// Check if this and the previous cells has shared faces
|
||||||
|
|
||||||
|
cvf::StructGridInterface::FaceType sharedFace;
|
||||||
|
if (prevWellResPoint && prevWellResPoint->isCell() && eclipseCaseData->findSharedSourceFace(sharedFace, currentWellResPoint, *prevWellResPoint))
|
||||||
|
{
|
||||||
|
// If they share faces, the shared face center is used as point
|
||||||
|
// describing the entry of this cell. (And exit of the previous cell)
|
||||||
|
|
||||||
|
branchCLCoords.push_back(cell.faceCenter(sharedFace));
|
||||||
|
branchCellIds.push_back(currentWellResPoint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This and the previous cell does not share a face.
|
||||||
|
// Then we need to calculate the exit of the previous cell, and the entry point into this cell
|
||||||
|
|
||||||
|
cvf::Vec3d centerPreviousCell(cvf::Vec3d::ZERO);
|
||||||
|
cvf::Vec3d centerThisCell = cell.center();
|
||||||
|
bool distanceToWellHeadIsLonger = true;
|
||||||
|
|
||||||
|
// If we have a previous well result point, use its center as measure point and ray intersection start
|
||||||
|
// when considering things.
|
||||||
|
|
||||||
|
if (prevWellResPoint && prevWellResPoint->isValid())
|
||||||
|
{
|
||||||
|
if (prevWellResPoint->isCell())
|
||||||
|
{
|
||||||
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
||||||
cvf::Vec3d centerPreviousCell = prevCell.center();
|
centerPreviousCell = prevCell.center();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
centerPreviousCell = prevWellResPoint->m_bottomPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
distanceToWellHeadIsLonger = (centerThisCell - centerPreviousCell).lengthSquared() <= (centerThisCell - whStartPos).lengthSquared();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// First make sure this cell is not starting a new "display" branch for none MSW's
|
||||||
|
|
||||||
|
if ( isMultiSegmentWell
|
||||||
|
|| !isAutoDetectBranches
|
||||||
|
|| (prevWellResPoint == whResCell)
|
||||||
|
|| distanceToWellHeadIsLonger)
|
||||||
|
{
|
||||||
|
// Not starting a "display" branch for normal wells
|
||||||
|
// Calculate the exit of the previous cell, and the entry point into this cell
|
||||||
|
|
||||||
|
cvf::Vec3d intoThisCell(centerThisCell); // Use cell center as default for "into" point.
|
||||||
|
|
||||||
|
if (prevWellResPoint && prevWellResPoint->isValid())
|
||||||
|
{
|
||||||
|
// We have a defined previous point
|
||||||
|
// Create ray between the previous and this cell
|
||||||
|
|
||||||
cvf::Ray rayToThisCell;
|
cvf::Ray rayToThisCell;
|
||||||
rayToThisCell.setOrigin(centerPreviousCell);
|
rayToThisCell.setOrigin(centerPreviousCell);
|
||||||
rayToThisCell.setDirection((currentPoint - centerPreviousCell).getNormalized());
|
rayToThisCell.setDirection((centerThisCell - centerPreviousCell).getNormalized());
|
||||||
|
|
||||||
cvf::Vec3d outOfPrevCell(centerPreviousCell);
|
// Intersect with the current cell to find a better entry point than the cell center
|
||||||
|
|
||||||
int intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
|
int intersectionCount = cell.firstIntersectionPoint(rayToThisCell, &intoThisCell);
|
||||||
//CVF_ASSERT(intersectionOk);
|
bool isPreviousResPointInsideCurrentCell = (intersectionCount % 2); // Must intersect uneven times to be inside. (1 % 2 = 1)
|
||||||
//CVF_ASSERT(intersectionOk);
|
|
||||||
if ((currentPoint - outOfPrevCell).lengthSquared() > 1e-3)
|
// If we have a real previous cell, we need to go out of it, before entering this.
|
||||||
|
// That is: add a CL-point describing where it leaves the previous cell.
|
||||||
|
|
||||||
|
if ( prevWellResPoint->isCell())
|
||||||
{
|
{
|
||||||
branchCLCoords.push_back(outOfPrevCell);
|
cvf::Vec3d outOfPrevCell(centerPreviousCell);
|
||||||
branchCellIds.push_back(RigWellResultPoint());
|
|
||||||
|
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
||||||
|
bool intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
|
||||||
|
//CVF_ASSERT(intersectionOk);
|
||||||
|
//CVF_ASSERT(intersectionOk);
|
||||||
|
if ((intoThisCell - outOfPrevCell).lengthSquared() > 1e-3)
|
||||||
|
{
|
||||||
|
branchCLCoords.push_back(outOfPrevCell);
|
||||||
|
branchCellIds.push_back(RigWellResultPoint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isPreviousResPointInsideCurrentCell)
|
||||||
|
{
|
||||||
|
// Since the previous point actually is inside this cell,
|
||||||
|
/// use that as the entry point into this cell
|
||||||
|
intoThisCell = centerPreviousCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
branchCLCoords.push_back(currentPoint);
|
branchCLCoords.push_back(intoThisCell);
|
||||||
branchCellIds.push_back(currentWellResPoint);
|
|
||||||
|
|
||||||
prevWellResPoint = ¤tWellResPoint;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Handle currentWellResPoint as a real cell result points.
|
|
||||||
//
|
|
||||||
|
|
||||||
const RigCell& cell = eclipseCaseData->cellFromWellResultCell(currentWellResPoint);
|
|
||||||
|
|
||||||
// Check if this and the previous cells has shared faces
|
|
||||||
|
|
||||||
cvf::StructGridInterface::FaceType sharedFace;
|
|
||||||
if (prevWellResPoint && prevWellResPoint->isCell() && eclipseCaseData->findSharedSourceFace(sharedFace, currentWellResPoint, *prevWellResPoint))
|
|
||||||
{
|
|
||||||
// If they share faces, the shared face center is used as point
|
|
||||||
// describing the entry of this cell. (And exit of the previous cell)
|
|
||||||
|
|
||||||
branchCLCoords.push_back(cell.faceCenter(sharedFace));
|
|
||||||
branchCellIds.push_back(currentWellResPoint);
|
branchCellIds.push_back(currentWellResPoint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This and the previous cell does not share a face.
|
// Need to start a "display branch" for a Normal Well.
|
||||||
// Then we need to calculate the exit of the previous cell, and the entry point into this cell
|
|
||||||
|
|
||||||
cvf::Vec3d centerPreviousCell(cvf::Vec3d::ZERO);
|
CVF_ASSERT(!isMultiSegmentWell);
|
||||||
cvf::Vec3d centerThisCell = cell.center();
|
|
||||||
bool distanceToWellHeadIsLonger = true;
|
|
||||||
|
|
||||||
// If we have a previous well result point, use its center as measure point and ray intersection start
|
// This cell is further from the previous cell than from the well head,
|
||||||
// when considering things.
|
// thus we interpret it as a new branch.
|
||||||
|
|
||||||
if (prevWellResPoint && prevWellResPoint->isValid())
|
// First finish the current branch in the previous cell
|
||||||
{
|
//branchCLCoords.push_back(branchCLCoords.back() + 1.5*(centerPreviousCell - branchCLCoords.back()) );
|
||||||
if (prevWellResPoint->isCell())
|
finishPipeCenterLine(pipeBranchesCLCoords, centerPreviousCell);
|
||||||
{
|
|
||||||
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
|
||||||
centerPreviousCell = prevCell.center();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
centerPreviousCell = prevWellResPoint->m_bottomPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
distanceToWellHeadIsLonger = (centerThisCell - centerPreviousCell).lengthSquared() <= (centerThisCell - whStartPos).lengthSquared();
|
// Create new display branch
|
||||||
}
|
pipeBranchesCLCoords.push_back(std::vector<cvf::Vec3d>());
|
||||||
|
pipeBranchesCellIds.push_back(std::vector <RigWellResultPoint>());
|
||||||
|
|
||||||
// First make sure this cell is not starting a new "display" branch for none MSW's
|
// Start the new branch by entering the first cell (the wellhead) and intermediate
|
||||||
|
prevWellResPoint = whResCell;
|
||||||
|
pipeBranchesCLCoords.back().push_back(whStartPos);
|
||||||
|
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
||||||
|
|
||||||
if ( wellResults->isMultiSegmentWell()
|
// Include intermediate
|
||||||
|| !isAutoDetectBranches
|
pipeBranchesCLCoords.back().push_back(whIntermediate);
|
||||||
|| (prevWellResPoint == whResCell)
|
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
||||||
|| distanceToWellHeadIsLonger)
|
|
||||||
{
|
|
||||||
// Not starting a "display" branch for normal wells
|
|
||||||
// Calculate the exit of the previous cell, and the entry point into this cell
|
|
||||||
|
|
||||||
cvf::Vec3d intoThisCell(centerThisCell); // Use cell center as default for "into" point.
|
// Well now we need to step one back to take this cell again, but in the new branch.
|
||||||
|
cIdx--;
|
||||||
if (prevWellResPoint && prevWellResPoint->isValid())
|
continue;
|
||||||
{
|
|
||||||
// We have a defined previous point
|
|
||||||
// Create ray between the previous and this cell
|
|
||||||
|
|
||||||
cvf::Ray rayToThisCell;
|
|
||||||
rayToThisCell.setOrigin(centerPreviousCell);
|
|
||||||
rayToThisCell.setDirection((centerThisCell - centerPreviousCell).getNormalized());
|
|
||||||
|
|
||||||
// Intersect with the current cell to find a better entry point than the cell center
|
|
||||||
|
|
||||||
int intersectionCount = cell.firstIntersectionPoint(rayToThisCell, &intoThisCell);
|
|
||||||
bool isPreviousResPointInsideCurrentCell = (intersectionCount % 2); // Must intersect uneven times to be inside. (1 % 2 = 1)
|
|
||||||
|
|
||||||
// If we have a real previous cell, we need to go out of it, before entering this.
|
|
||||||
// That is: add a CL-point describing where it leaves the previous cell.
|
|
||||||
|
|
||||||
if ( prevWellResPoint->isCell())
|
|
||||||
{
|
|
||||||
cvf::Vec3d outOfPrevCell(centerPreviousCell);
|
|
||||||
|
|
||||||
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
|
||||||
bool intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
|
|
||||||
//CVF_ASSERT(intersectionOk);
|
|
||||||
//CVF_ASSERT(intersectionOk);
|
|
||||||
if ((intoThisCell - outOfPrevCell).lengthSquared() > 1e-3)
|
|
||||||
{
|
|
||||||
branchCLCoords.push_back(outOfPrevCell);
|
|
||||||
branchCellIds.push_back(RigWellResultPoint());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isPreviousResPointInsideCurrentCell)
|
|
||||||
{
|
|
||||||
// Since the previous point actually is inside this cell,
|
|
||||||
/// use that as the entry point into this cell
|
|
||||||
intoThisCell = centerPreviousCell;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
branchCLCoords.push_back(intoThisCell);
|
|
||||||
branchCellIds.push_back(currentWellResPoint);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Need to start a "display branch" for a Normal Well.
|
|
||||||
|
|
||||||
CVF_ASSERT(!wellResults->isMultiSegmentWell());
|
|
||||||
|
|
||||||
// This cell is further from the previous cell than from the well head,
|
|
||||||
// thus we interpret it as a new branch.
|
|
||||||
|
|
||||||
// First finish the current branch in the previous cell
|
|
||||||
//branchCLCoords.push_back(branchCLCoords.back() + 1.5*(centerPreviousCell - branchCLCoords.back()) );
|
|
||||||
finishPipeCenterLine(pipeBranchesCLCoords, centerPreviousCell);
|
|
||||||
|
|
||||||
// Create new display branch
|
|
||||||
pipeBranchesCLCoords.push_back(std::vector<cvf::Vec3d>());
|
|
||||||
pipeBranchesCellIds.push_back(std::vector <RigWellResultPoint>());
|
|
||||||
|
|
||||||
// Start the new branch by entering the first cell (the wellhead) and intermediate
|
|
||||||
prevWellResPoint = whResCell;
|
|
||||||
pipeBranchesCLCoords.back().push_back(whStartPos);
|
|
||||||
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
|
||||||
|
|
||||||
// Include intermediate
|
|
||||||
pipeBranchesCLCoords.back().push_back(whIntermediate);
|
|
||||||
pipeBranchesCellIds.back().push_back(*prevWellResPoint);
|
|
||||||
|
|
||||||
// Well now we need to step one back to take this cell again, but in the new branch.
|
|
||||||
cIdx--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
prevWellResPoint = ¤tWellResPoint;
|
prevWellResPoint = ¤tWellResPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For the last cell, add the point 0.5 past the center of that cell
|
|
||||||
// Remember that prevWellResPoint actually is the last one in this branch.
|
|
||||||
|
|
||||||
cvf::Vec3d centerLastCell;
|
// For the last cell, add the point 0.5 past the center of that cell
|
||||||
if (prevWellResPoint && prevWellResPoint->isCell())
|
// Remember that prevWellResPoint actually is the last one in this branch.
|
||||||
{
|
|
||||||
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
if (prevWellResPoint && prevWellResPoint->isCell())
|
||||||
centerLastCell = prevCell.center();
|
{
|
||||||
finishPipeCenterLine(pipeBranchesCLCoords, centerLastCell);
|
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
|
||||||
}
|
cvf::Vec3d centerLastCell = prevCell.center();
|
||||||
else
|
finishPipeCenterLine(pipeBranchesCLCoords, centerLastCell);
|
||||||
{
|
}
|
||||||
// Remove the ID that is superfluous since we will not add an ending point
|
else
|
||||||
pipeBranchesCellIds.back().pop_back();
|
{
|
||||||
}
|
// Remove the ID that is superfluous since we will not add an ending point
|
||||||
|
pipeBranchesCellIds.back().pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useAllCellCenters) addCellCenterPoints(eclipseCaseData, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||||
|
|
||||||
CVF_ASSERT(pipeBranchesCellIds.size() == pipeBranchesCLCoords.size());
|
CVF_ASSERT(pipeBranchesCellIds.size() == pipeBranchesCLCoords.size());
|
||||||
for (size_t i = 0 ; i < pipeBranchesCellIds.size() ; ++i)
|
for (size_t i = 0 ; i < pipeBranchesCellIds.size() ; ++i)
|
||||||
{
|
{
|
||||||
@@ -367,6 +396,81 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigSimulationWellCenterLineCalculator::addCellCenterPoints(const RigEclipseCaseData* eclipseCaseData,
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
|
||||||
|
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds)
|
||||||
|
{
|
||||||
|
for ( size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); brIdx++ )
|
||||||
|
{
|
||||||
|
const std::vector<RigWellResultPoint>& branchResPoints = pipeBranchesCellIds[brIdx];
|
||||||
|
const std::vector<cvf::Vec3d>& branchClPoints = pipeBranchesCLCoords[brIdx];
|
||||||
|
|
||||||
|
std::vector<RigWellResultPoint> branchResPointsWithCellCenters;
|
||||||
|
std::vector<cvf::Vec3d> branchClPointsWithCellCenters;
|
||||||
|
|
||||||
|
for ( size_t cIdx = 0; cIdx < branchResPoints.size(); cIdx++ )
|
||||||
|
{
|
||||||
|
branchResPointsWithCellCenters.push_back(branchResPoints[cIdx]);
|
||||||
|
branchClPointsWithCellCenters.push_back(branchClPoints[cIdx]);
|
||||||
|
|
||||||
|
if ( branchResPoints[cIdx].isCell() )
|
||||||
|
{
|
||||||
|
const RigCell& cell = eclipseCaseData->cellFromWellResultCell(branchResPoints[cIdx]);
|
||||||
|
cvf::Vec3d center = cell.center();
|
||||||
|
branchClPointsWithCellCenters.push_back(center);
|
||||||
|
branchResPointsWithCellCenters.push_back(branchResPoints[cIdx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
branchClPointsWithCellCenters.push_back(branchClPoints[branchResPoints.size()]);
|
||||||
|
|
||||||
|
pipeBranchesCellIds[brIdx] = branchResPointsWithCellCenters;
|
||||||
|
pipeBranchesCLCoords[brIdx] = branchClPointsWithCellCenters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RigSimulationWellCenterLineCalculator::hasAnyResultCells(const std::vector<RigWellResultBranch> &resBranches)
|
||||||
|
{
|
||||||
|
bool hasResultCells = false;
|
||||||
|
if ( resBranches.size() )
|
||||||
|
{
|
||||||
|
for ( size_t i = 0 ; i < resBranches.size(); ++i )
|
||||||
|
{
|
||||||
|
if ( resBranches[i].m_branchResultPoints.size() != 0 )
|
||||||
|
{
|
||||||
|
hasResultCells = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasResultCells;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RigSimulationWellCenterLineCalculator::hasAnyValidDataCells(const RigWellResultBranch& branch)
|
||||||
|
{
|
||||||
|
bool hasValidData = false;
|
||||||
|
for ( size_t cIdx = 0; cIdx < branch.m_branchResultPoints.size(); ++cIdx )
|
||||||
|
{
|
||||||
|
if ( branch.m_branchResultPoints[cIdx].isValid() )
|
||||||
|
{
|
||||||
|
hasValidData = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasValidData;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// All branches are completed using the point 0.5 past the center of
|
/// All branches are completed using the point 0.5 past the center of
|
||||||
/// last cell.
|
/// last cell.
|
||||||
|
|||||||
@@ -23,14 +23,34 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class RimEclipseWell;
|
class RimEclipseWell;
|
||||||
|
class RigEclipseCaseData;
|
||||||
|
|
||||||
class RigSimulationWellCenterLineCalculator
|
class RigSimulationWellCenterLineCalculator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void calculateWellPipeCenterline(RimEclipseWell* m_rimWell,
|
static void calculateWellPipeStaticCenterline(RimEclipseWell* rimWell,
|
||||||
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
|
||||||
|
|
||||||
|
static void calculateWellPipeDynamicCenterline(RimEclipseWell* rimWell,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
||||||
|
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
|
||||||
|
|
||||||
|
|
||||||
|
static void calculateWellPipeCenterlineFromWellFrame(const RigEclipseCaseData* eclipseCaseData,
|
||||||
|
const RigSingleWellResultsData* wellResults,
|
||||||
|
int timeStepIndex,
|
||||||
|
bool isAutoDetectBranches,
|
||||||
|
bool useAllCellCenters,
|
||||||
|
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
|
||||||
|
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static bool hasAnyResultCells(const std::vector<RigWellResultBranch> &resBranches);
|
||||||
|
static bool hasAnyValidDataCells(const RigWellResultBranch& branch);
|
||||||
static void finishPipeCenterLine( std::vector< std::vector<cvf::Vec3d> > &pipeBranchesCLCoords, const cvf::Vec3d& lastCellCenter ) ;
|
static void finishPipeCenterLine( std::vector< std::vector<cvf::Vec3d> > &pipeBranchesCLCoords, const cvf::Vec3d& lastCellCenter ) ;
|
||||||
|
|
||||||
|
static void addCellCenterPoints(const RigEclipseCaseData* eclipseCaseData, std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords, std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RigSimulationWellCoordsAndMD.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigSimulationWellCoordsAndMD::RigSimulationWellCoordsAndMD(const std::vector<cvf::Vec3d>& wellPathPoints)
|
||||||
|
{
|
||||||
|
m_wellPathPoints = wellPathPoints;
|
||||||
|
|
||||||
|
computeMeasuredDepths();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<cvf::Vec3d>& RigSimulationWellCoordsAndMD::wellPathPoints() const
|
||||||
|
{
|
||||||
|
return m_wellPathPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::vector<double>& RigSimulationWellCoordsAndMD::measuredDepths() const
|
||||||
|
{
|
||||||
|
return m_measuredDepths;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::Vec3d RigSimulationWellCoordsAndMD::interpolatedPointAlongWellPath(double measuredDepth) const
|
||||||
|
{
|
||||||
|
cvf::Vec3d wellPathPoint = cvf::Vec3d::ZERO;
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
while (i < m_measuredDepths.size() && m_measuredDepths.at(i) < measuredDepth)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_measuredDepths.size() > i)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
//For measuredDepth same or lower than first point, use this first point
|
||||||
|
wellPathPoint = m_wellPathPoints.at(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Do interpolation
|
||||||
|
double stepsize = (measuredDepth - m_measuredDepths.at(i - 1)) /
|
||||||
|
(m_measuredDepths.at(i) - m_measuredDepths.at(i - 1));
|
||||||
|
wellPathPoint = m_wellPathPoints.at(i - 1) + stepsize * (m_wellPathPoints.at(i) - m_wellPathPoints.at(i - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Use endpoint if measuredDepth same or higher than last point
|
||||||
|
wellPathPoint = m_wellPathPoints.at(i - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return wellPathPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigSimulationWellCoordsAndMD::computeMeasuredDepths()
|
||||||
|
{
|
||||||
|
cvf::Vec3d prev = cvf::Vec3d::UNDEFINED;
|
||||||
|
|
||||||
|
double accumulatedMD = 0;
|
||||||
|
|
||||||
|
for (const auto& point : m_wellPathPoints)
|
||||||
|
{
|
||||||
|
if (!prev.isUndefined())
|
||||||
|
{
|
||||||
|
accumulatedMD += point.pointDistance(prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_measuredDepths.push_back(accumulatedMD);
|
||||||
|
|
||||||
|
prev = point;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "cvfBase.h"
|
||||||
|
#include "cvfVector3.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RigSimulationWellCoordsAndMD
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RigSimulationWellCoordsAndMD(const std::vector<cvf::Vec3d>& wellPathPoints);
|
||||||
|
|
||||||
|
const std::vector<cvf::Vec3d>& wellPathPoints() const;
|
||||||
|
const std::vector<double>& measuredDepths() const;
|
||||||
|
|
||||||
|
cvf::Vec3d interpolatedPointAlongWellPath(double measuredDepth) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void computeMeasuredDepths();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<cvf::Vec3d> m_wellPathPoints;
|
||||||
|
std::vector<double> m_measuredDepths;
|
||||||
|
};
|
||||||
@@ -121,7 +121,7 @@ bool operator== (const RigWellResultPoint& p1, const RigWellResultPoint& p2)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigSingleWellResultsData::computeStaticWellCellPath()
|
void RigSingleWellResultsData::computeStaticWellCellPath() const
|
||||||
{
|
{
|
||||||
if (m_wellCellsTimeSteps.size() == 0) return;
|
if (m_wellCellsTimeSteps.size() == 0) return;
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath()
|
|||||||
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[0].m_wellResultBranches.size(); ++bIdx)
|
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[0].m_wellResultBranches.size(); ++bIdx)
|
||||||
{
|
{
|
||||||
int branchErtId = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_ertBranchId;
|
int branchErtId = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_ertBranchId;
|
||||||
std::vector<RigWellResultPoint>& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchResultPoints;
|
const std::vector<RigWellResultPoint>& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchResultPoints;
|
||||||
|
|
||||||
std::list< RigWellResultPoint >& branch = staticWellBranches[branchErtId];
|
std::list< RigWellResultPoint >& branch = staticWellBranches[branchErtId];
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath()
|
|||||||
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[tIdx].m_wellResultBranches.size(); ++bIdx)
|
for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[tIdx].m_wellResultBranches.size(); ++bIdx)
|
||||||
{
|
{
|
||||||
int branchId = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_ertBranchId;
|
int branchId = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_ertBranchId;
|
||||||
std::vector<RigWellResultPoint>& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchResultPoints;
|
const std::vector<RigWellResultPoint>& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchResultPoints;
|
||||||
|
|
||||||
std::list< RigWellResultPoint >& stBranch = staticWellBranches[branchId];
|
std::list< RigWellResultPoint >& stBranch = staticWellBranches[branchId];
|
||||||
std::list< RigWellResultPoint >::iterator sEndIt;
|
std::list< RigWellResultPoint >::iterator sEndIt;
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ struct RigWellResultPoint
|
|||||||
m_isOpen(false),
|
m_isOpen(false),
|
||||||
m_ertBranchId(-1),
|
m_ertBranchId(-1),
|
||||||
m_ertSegmentId(-1),
|
m_ertSegmentId(-1),
|
||||||
m_bottomPosition(cvf::Vec3d::UNDEFINED)
|
m_bottomPosition(cvf::Vec3d::UNDEFINED),
|
||||||
|
m_flowRate(0.0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool isPointValid() const
|
bool isPointValid() const
|
||||||
@@ -66,6 +67,7 @@ struct RigWellResultPoint
|
|||||||
int m_ertSegmentId;
|
int m_ertSegmentId;
|
||||||
|
|
||||||
cvf::Vec3d m_bottomPosition; //< The estimated bottom position of the well segment, when we have no grid cell connections for the segment.
|
cvf::Vec3d m_bottomPosition; //< The estimated bottom position of the well segment, when we have no grid cell connections for the segment.
|
||||||
|
double m_flowRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -125,7 +127,7 @@ public:
|
|||||||
|
|
||||||
const RigWellResultFrame& wellResultFrame(size_t resultTimeStepIndex) const;
|
const RigWellResultFrame& wellResultFrame(size_t resultTimeStepIndex) const;
|
||||||
|
|
||||||
void computeStaticWellCellPath();
|
void computeStaticWellCellPath() const ;
|
||||||
|
|
||||||
void computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector<QDateTime>& resultTimes);
|
void computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector<QDateTime>& resultTimes);
|
||||||
|
|
||||||
@@ -135,6 +137,6 @@ public:
|
|||||||
|
|
||||||
std::vector<size_t> m_resultTimeStepIndexToWellTimeStepIndex; // Well result timesteps may differ from result timesteps
|
std::vector<size_t> m_resultTimeStepIndexToWellTimeStepIndex; // Well result timesteps may differ from result timesteps
|
||||||
std::vector< RigWellResultFrame > m_wellCellsTimeSteps;
|
std::vector< RigWellResultFrame > m_wellCellsTimeSteps;
|
||||||
RigWellResultFrame m_staticWellCells;
|
mutable RigWellResultFrame m_staticWellCells;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ ${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
|
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
|
||||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
||||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -78,6 +79,7 @@ ${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
|
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
|
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
|
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
@@ -105,6 +107,7 @@ ${CEE_CURRENT_LIST_DIR}RiuSummaryQwtPlot.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h
|
${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h
|
||||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
||||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RiuNightchartsWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND QT_UI_FILES
|
list(APPEND QT_UI_FILES
|
||||||
|
|||||||
@@ -766,6 +766,7 @@ RimMdiWindowGeometry RiuMainPlotWindow::windowGeometryForWidget(QWidget* widget)
|
|||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
|
geo.mainWindowID = 1;
|
||||||
geo.x = widget->pos().x();
|
geo.x = widget->pos().x();
|
||||||
geo.y = widget->pos().y();
|
geo.y = widget->pos().y();
|
||||||
geo.width = widget->size().width();
|
geo.width = widget->size().width();
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ public:
|
|||||||
void initializeGuiNewProjectLoaded();
|
void initializeGuiNewProjectLoaded();
|
||||||
void cleanupGuiBeforeProjectClose();
|
void cleanupGuiBeforeProjectClose();
|
||||||
|
|
||||||
void removeViewer( QWidget* viewer );
|
void removeViewer( QWidget* viewer ) override;
|
||||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry) override;
|
||||||
void setActiveViewer(QWidget* subWindow);
|
void setActiveViewer(QWidget* subWindow) override;
|
||||||
|
|
||||||
caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView;}
|
caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView;}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
void setExpanded(const caf::PdmUiItem* uiItem, bool expanded);
|
||||||
|
|
||||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) override;
|
||||||
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
||||||
|
|
||||||
void tileWindows();
|
void tileWindows();
|
||||||
|
|||||||
@@ -1638,6 +1638,7 @@ RimMdiWindowGeometry RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
|||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
|
geo.mainWindowID = 0;
|
||||||
geo.x = widget->pos().x();
|
geo.x = widget->pos().x();
|
||||||
geo.y = widget->pos().y();
|
geo.y = widget->pos().y();
|
||||||
geo.width = widget->size().width();
|
geo.width = widget->size().width();
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ public:
|
|||||||
void cleanupGuiCaseClose();
|
void cleanupGuiCaseClose();
|
||||||
void cleanupGuiBeforeProjectClose();
|
void cleanupGuiBeforeProjectClose();
|
||||||
|
|
||||||
void removeViewer( QWidget* viewer );
|
void removeViewer( QWidget* viewer ) override;
|
||||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry) override;
|
||||||
void setActiveViewer(QWidget* subWindow);
|
void setActiveViewer(QWidget* subWindow) override;
|
||||||
|
|
||||||
void setResultInfo(const QString& info) const;
|
void setResultInfo(const QString& info) const;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
struct RimMdiWindowGeometry;
|
||||||
|
|
||||||
class RiuMainWindowBase : public QMainWindow
|
class RiuMainWindowBase : public QMainWindow
|
||||||
{
|
{
|
||||||
@@ -29,6 +30,12 @@ public:
|
|||||||
|
|
||||||
virtual QString mainWindowName() = 0;
|
virtual QString mainWindowName() = 0;
|
||||||
|
|
||||||
|
virtual void removeViewer( QWidget* viewer ) = 0;
|
||||||
|
virtual void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry)= 0;
|
||||||
|
virtual void setActiveViewer(QWidget* subWindow) = 0;
|
||||||
|
|
||||||
|
virtual RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer) = 0;
|
||||||
|
|
||||||
void loadWinGeoAndDockToolBarLayout();
|
void loadWinGeoAndDockToolBarLayout();
|
||||||
void saveWinGeoAndDockToolBarLayout();
|
void saveWinGeoAndDockToolBarLayout();
|
||||||
void showWindow();
|
void showWindow();
|
||||||
|
|||||||
79
ApplicationCode/UserInterface/RiuNightchartsWidget.cpp
Normal file
79
ApplicationCode/UserInterface/RiuNightchartsWidget.cpp
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "RiuNightchartsWidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuNightchartsWidget::RiuNightchartsWidget(QWidget* parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuNightchartsWidget::setType(Nightcharts::type t)
|
||||||
|
{
|
||||||
|
m_chart.setType(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuNightchartsWidget::clear()
|
||||||
|
{
|
||||||
|
m_chart = Nightcharts();
|
||||||
|
m_chart.setType(Nightcharts::Pie);
|
||||||
|
m_chart.setLegendType(Nightcharts::Vertical);
|
||||||
|
|
||||||
|
m_marginLeft = 16;
|
||||||
|
m_marginTop = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuNightchartsWidget::paintEvent(QPaintEvent* e)
|
||||||
|
{
|
||||||
|
QWidget::paintEvent(e);
|
||||||
|
|
||||||
|
if(!m_chart.pieceCount()) return ;
|
||||||
|
|
||||||
|
QPainter painter;
|
||||||
|
QFont font;
|
||||||
|
painter.begin(this);
|
||||||
|
int w = (this->width() - m_marginLeft - 150);
|
||||||
|
int h = (this->height() - m_marginTop - 100);
|
||||||
|
int size = (w<h)?w:h;
|
||||||
|
m_chart.setCords(m_marginLeft, m_marginTop,size, size);
|
||||||
|
|
||||||
|
m_chart.draw(&painter);
|
||||||
|
m_chart.drawLegend(&painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuNightchartsWidget::addItem(QString name, QColor color, float value)
|
||||||
|
{
|
||||||
|
m_chart.addPiece(name,color,value);
|
||||||
|
}
|
||||||
48
ApplicationCode/UserInterface/RiuNightchartsWidget.h
Normal file
48
ApplicationCode/UserInterface/RiuNightchartsWidget.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "nightcharts/nightcharts.h"
|
||||||
|
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
|
||||||
|
|
||||||
|
class RiuNightchartsWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit RiuNightchartsWidget(QWidget* parent = 0);
|
||||||
|
|
||||||
|
void addItem(QString name, QColor color, float value);
|
||||||
|
void setType(Nightcharts::type type);
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent* e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Nightcharts m_chart;
|
||||||
|
int m_marginLeft;
|
||||||
|
int m_marginTop;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -151,7 +151,8 @@ RiuSummaryQwtPlot::~RiuSummaryQwtPlot()
|
|||||||
|
|
||||||
if (m_plotDefinition)
|
if (m_plotDefinition)
|
||||||
{
|
{
|
||||||
m_plotDefinition->handleViewerDeletion();
|
m_plotDefinition->detachAllCurves();
|
||||||
|
m_plotDefinition->handleMdiWindowClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_plotMarker->detach();
|
m_plotMarker->detach();
|
||||||
|
|||||||
@@ -182,8 +182,7 @@ RiuViewer::~RiuViewer()
|
|||||||
{
|
{
|
||||||
if (m_rimView)
|
if (m_rimView)
|
||||||
{
|
{
|
||||||
m_rimView->showWindow = false;
|
m_rimView->handleMdiWindowClosed();
|
||||||
m_rimView->uiCapability()->updateUiIconFromToggleField();
|
|
||||||
|
|
||||||
m_rimView->cameraPosition = m_mainCamera->viewMatrix();
|
m_rimView->cameraPosition = m_mainCamera->viewMatrix();
|
||||||
m_rimView->cameraPointOfInterest = pointOfInterest();
|
m_rimView->cameraPointOfInterest = pointOfInterest();
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
|
|
||||||
#include "RiuWellAllocationPlot.h"
|
#include "RiuWellAllocationPlot.h"
|
||||||
|
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
#include "RimWellAllocationPlot.h"
|
#include "RimWellAllocationPlot.h"
|
||||||
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogTrack.h"
|
||||||
|
#include "RimTotalWellAllocationPlot.h"
|
||||||
|
|
||||||
|
#include "QBoxLayout"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -30,10 +33,19 @@
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
||||||
: QwtPlot(parent)
|
: QFrame(parent)
|
||||||
{
|
{
|
||||||
Q_ASSERT(plotDefinition);
|
Q_ASSERT(plotDefinition);
|
||||||
|
this->setLayout(new QHBoxLayout());
|
||||||
|
this->layout()->setMargin(0);
|
||||||
|
|
||||||
m_plotDefinition = plotDefinition;
|
m_plotDefinition = plotDefinition;
|
||||||
|
|
||||||
|
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
|
||||||
|
this->layout()->addWidget(totalFlowAllocationWidget);
|
||||||
|
|
||||||
|
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
|
||||||
|
this->layout()->addWidget(wellFlowWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -43,7 +55,7 @@ RiuWellAllocationPlot::~RiuWellAllocationPlot()
|
|||||||
{
|
{
|
||||||
if (m_plotDefinition)
|
if (m_plotDefinition)
|
||||||
{
|
{
|
||||||
m_plotDefinition->handleViewerDeletion();
|
m_plotDefinition->handleMdiWindowClosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class RimWellAllocationPlot;
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RiuWellAllocationPlot : public QwtPlot
|
class RiuWellAllocationPlot : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ RiuWellLogPlot::~RiuWellLogPlot()
|
|||||||
{
|
{
|
||||||
if (m_plotDefinition)
|
if (m_plotDefinition)
|
||||||
{
|
{
|
||||||
m_plotDefinition->handleViewerDeletion();
|
m_plotDefinition->detachAllCurves();
|
||||||
|
m_plotDefinition->handleMdiWindowClosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QList>
|
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
class RiuWellLogTrack;
|
class RiuWellLogTrack;
|
||||||
|
|
||||||
@@ -72,8 +74,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QHBoxLayout* m_layout;
|
QHBoxLayout* m_layout;
|
||||||
QScrollBar* m_scrollBar;
|
QScrollBar* m_scrollBar;
|
||||||
QList<QwtLegend*> m_legends;
|
QList<QPointer<QwtLegend> > m_legends;
|
||||||
QList<RiuWellLogTrack*> m_trackPlots;
|
QList<QPointer<RiuWellLogTrack> > m_trackPlots;
|
||||||
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
|
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
|
||||||
QTimer* m_scheduleUpdateChildrenLayoutTimer;
|
QTimer* m_scheduleUpdateChildrenLayoutTimer;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -185,13 +185,14 @@ else()
|
|||||||
ecl_well
|
ecl_well
|
||||||
ert_geometry
|
ert_geometry
|
||||||
ert_util
|
ert_util
|
||||||
|
ert_utilxx
|
||||||
)
|
)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set_property(TARGET
|
set_property(TARGET
|
||||||
${ERT_LIBRARIES}
|
${ERT_LIBRARIES}
|
||||||
ecl_lfs
|
ecl_lfs
|
||||||
PROPERTY FOLDER "ERT"
|
PROPERTY FOLDER "Thirdparty/ERT"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -210,12 +211,32 @@ add_subdirectory(ThirdParty/custom-opm-parser/custom-opm-parser-tests)
|
|||||||
add_subdirectory(ThirdParty/custom-opm-flowdiagnostics)
|
add_subdirectory(ThirdParty/custom-opm-flowdiagnostics)
|
||||||
add_subdirectory(ThirdParty/custom-opm-flowdiag-app)
|
add_subdirectory(ThirdParty/custom-opm-flowdiag-app)
|
||||||
|
|
||||||
|
list(APPEND OPM_LIBRARIES
|
||||||
|
custom-opm-parser
|
||||||
|
custom-opm-flowdiagnostics
|
||||||
|
custom-opm-flowdiag-app
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET
|
||||||
|
${OPM_LIBRARIES}
|
||||||
|
PROPERTY FOLDER "Thirdparty/OPM"
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(TARGET
|
||||||
|
opm-parser-tests
|
||||||
|
PROPERTY FOLDER "Thirdparty/OPM"
|
||||||
|
)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# NRLib
|
# NRLib
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
add_subdirectory(ThirdParty/NRLib)
|
add_subdirectory(ThirdParty/NRLib)
|
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_LIBRARIES
|
||||||
|
NRLib
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# clipper
|
# clipper
|
||||||
@@ -248,6 +269,30 @@ find_package( OpenGL )
|
|||||||
|
|
||||||
add_subdirectory(ThirdParty/Qwt/src)
|
add_subdirectory(ThirdParty/Qwt/src)
|
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_LIBRARIES
|
||||||
|
Qwt
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Nightcharts
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
add_subdirectory(ThirdParty/nightcharts)
|
||||||
|
|
||||||
|
list(APPEND THIRD_PARTY_LIBRARIES
|
||||||
|
nightcharts
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Thirdparty libraries are put in ThirdParty solution folder
|
||||||
|
################################################################################
|
||||||
|
set_property(TARGET
|
||||||
|
${THIRD_PARTY_LIBRARIES}
|
||||||
|
PROPERTY FOLDER "Thirdparty"
|
||||||
|
)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Vizualization Framework
|
# Vizualization Framework
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ caf::PdmChildField<DataType*>::PdmChildField(const DataTypePtr& fieldValue)
|
|||||||
template<typename DataType >
|
template<typename DataType >
|
||||||
caf::PdmChildField<DataType*>::~PdmChildField()
|
caf::PdmChildField<DataType*>::~PdmChildField()
|
||||||
{
|
{
|
||||||
assert(m_fieldValue.isNull());
|
bool The_object_owned_by_the_child_field_is_deleted = m_fieldValue.isNull();
|
||||||
|
assert(The_object_owned_by_the_child_field_is_deleted); // Did you forget ?
|
||||||
|
|
||||||
if (!m_fieldValue.isNull()) m_fieldValue.rawPtr()->removeAsParentField(this);
|
if (!m_fieldValue.isNull()) m_fieldValue.rawPtr()->removeAsParentField(this);
|
||||||
m_fieldValue.setRawPtr(NULL);
|
m_fieldValue.setRawPtr(NULL);
|
||||||
|
|||||||
16
ThirdParty/nightcharts/CMakeLists.txt
vendored
Normal file
16
ThirdParty/nightcharts/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
|
||||||
|
project (nightcharts)
|
||||||
|
|
||||||
|
list (APPEND MAIN_SOURCE_FILES
|
||||||
|
nightcharts.h
|
||||||
|
nightcharts.cpp
|
||||||
|
nightchartswidget.h
|
||||||
|
nightchartswidget.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library( ${PROJECT_NAME}
|
||||||
|
STATIC
|
||||||
|
${MAIN_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
41
ThirdParty/nightcharts/README.md
vendored
Normal file
41
ThirdParty/nightcharts/README.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Nightcharts
|
||||||
|
|
||||||
|
This class includes a drawing histogram, pies and pseudo 3D pies.
|
||||||
|
It has very simple API and high level usability.
|
||||||
|
http://qt-apps.org/content/show.php?action=content&content=132560
|
||||||
|
|
||||||
|
Licensed under LGPL 2.1
|
||||||
|
|
||||||
|
Example :
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::paintEvent(QPaintEvent e*)
|
||||||
|
{
|
||||||
|
QWidget::paintEvent(e);
|
||||||
|
QPainter painter;
|
||||||
|
QFont font;
|
||||||
|
painter.begin(this);
|
||||||
|
Nightcharts PieChart;
|
||||||
|
PieChart.setType(Nightcharts::DPie);//{Histogramm,Pie,DPie};
|
||||||
|
PieChart.setLegendType(Nightcharts::Round);//{Round,Vertical}
|
||||||
|
PieChart.setCords(100,100,this->width()/1.5,this->height()/1.5);
|
||||||
|
PieChart.addPiece("Item1",QColor(200,10,50),34);
|
||||||
|
PieChart.addPiece("Item2",Qt::green,27);
|
||||||
|
PieChart.addPiece("Item3",Qt::cyan,14);
|
||||||
|
PieChart.addPiece("Item4",Qt::yellow,7);
|
||||||
|
PieChart.addPiece("Item5",Qt::blue,4);
|
||||||
|
PieChart.draw(&painter);
|
||||||
|
PieChart.drawLegend(&painter);
|
||||||
|
}
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### How to use
|
||||||
|
|
||||||
|
- Check out in any location (or add as a submodule)
|
||||||
|
- Write into Your main .pro file:
|
||||||
|
|
||||||
|
```
|
||||||
|
include("path/to/nightcharts/nightcharts.pri")
|
||||||
|
|
||||||
|
```
|
||||||
469
ThirdParty/nightcharts/nightcharts.cpp
vendored
Normal file
469
ThirdParty/nightcharts/nightcharts.cpp
vendored
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
/*
|
||||||
|
* NightCharts
|
||||||
|
* Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
* Please contact gordos.kund@gmail.com with any questions on this license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include "nightcharts.h"
|
||||||
|
|
||||||
|
Nightcharts::Nightcharts()//QPainter *painter)
|
||||||
|
|
||||||
|
{
|
||||||
|
font.setFamily("verdana");
|
||||||
|
font.setPixelSize(15);
|
||||||
|
//painter = painter;
|
||||||
|
//painter->setFont(font);
|
||||||
|
ctype = Nightcharts::Dpie;
|
||||||
|
cltype = Nightcharts::Vertical;
|
||||||
|
cX = 0;
|
||||||
|
cY = 0;
|
||||||
|
cW = 100;
|
||||||
|
cH = 100;
|
||||||
|
lX = cX+cW+20;
|
||||||
|
lY = cY;
|
||||||
|
shadows = true;
|
||||||
|
}
|
||||||
|
Nightcharts::~Nightcharts()
|
||||||
|
{
|
||||||
|
pieces.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::addPiece(QString name,Qt::GlobalColor color,float Percentage)
|
||||||
|
{
|
||||||
|
this->nPiece++;
|
||||||
|
|
||||||
|
pieceNC piece;
|
||||||
|
piece.addName(name);
|
||||||
|
piece.setColor(color);
|
||||||
|
piece.setPerc(Percentage);
|
||||||
|
pieces.append(piece);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int Nightcharts::addPiece(QString name, QColor color, float Percentage)
|
||||||
|
{
|
||||||
|
this->nPiece++;
|
||||||
|
pieceNC piece;
|
||||||
|
piece.addName(name);
|
||||||
|
piece.setColor(color);
|
||||||
|
piece.setPerc(Percentage);
|
||||||
|
pieces.append(piece);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int Nightcharts::setCords(double x, double y, double w, double h)
|
||||||
|
{
|
||||||
|
this->cX = x;
|
||||||
|
this->cY = y;
|
||||||
|
this->cW = w;
|
||||||
|
this->cH = h;
|
||||||
|
this->lX = cX+cW+20;
|
||||||
|
this->lY = cY;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int Nightcharts::setLegendCords(double x, double y)
|
||||||
|
{
|
||||||
|
this->lX = x;
|
||||||
|
this->lY = y;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::setType(Nightcharts::type t)
|
||||||
|
{
|
||||||
|
this->ctype = t;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::setLegendType(Nightcharts::legend_type t)
|
||||||
|
{
|
||||||
|
this->cltype = t;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int Nightcharts::setFont(QFont f)
|
||||||
|
{
|
||||||
|
this->font = f;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::setShadows(bool ok)
|
||||||
|
{
|
||||||
|
this->shadows = ok;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::draw(QPainter *painter)
|
||||||
|
{
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
if (this->ctype==Nightcharts::Pie)
|
||||||
|
{
|
||||||
|
pW = 0;
|
||||||
|
double pdegree = 0;
|
||||||
|
|
||||||
|
//Options
|
||||||
|
QLinearGradient gradient(cX+0.5*cW,cY,cX+0.5*cW,cY+cH*2.5);
|
||||||
|
gradient.setColorAt(1,Qt::black);
|
||||||
|
|
||||||
|
|
||||||
|
//Draw
|
||||||
|
//pdegree = (360/100)*pieces[i].pPerc;
|
||||||
|
if (shadows)
|
||||||
|
{
|
||||||
|
double sumangle = 0;
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
sumangle += 3.6*pieces[i].pPerc;
|
||||||
|
}
|
||||||
|
painter->setBrush(Qt::darkGray);
|
||||||
|
painter->drawPie(cX,cY+pW+5,cW,cH,palpha*16,sumangle*16);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPen pen;
|
||||||
|
pen.setWidth(2);
|
||||||
|
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
gradient.setColorAt(0,pieces[i].rgbColor);
|
||||||
|
painter->setBrush(gradient);
|
||||||
|
pen.setColor(pieces[i].rgbColor);
|
||||||
|
painter->setPen(pen);
|
||||||
|
pdegree = 3.6*pieces[i].pPerc;
|
||||||
|
painter->drawPie(cX,cY,cW,cH,palpha*16,pdegree*16);
|
||||||
|
palpha += pdegree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this->ctype==Nightcharts::Dpie)
|
||||||
|
{
|
||||||
|
pW = 50;
|
||||||
|
double pdegree = 0;
|
||||||
|
QPointF p;
|
||||||
|
|
||||||
|
QLinearGradient gradient(cX-0.5*cW,cY+cH/2,cX+1.5*cW,cY+cH/2);
|
||||||
|
gradient.setColorAt(0,Qt::black);
|
||||||
|
gradient.setColorAt(1,Qt::white);
|
||||||
|
QLinearGradient gradient_side(cX,cY+cH,cX+cW,cY+cH);
|
||||||
|
gradient_side.setColorAt(0,Qt::black);
|
||||||
|
|
||||||
|
double sumangle = 0;
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
sumangle += 3.6*pieces[i].pPerc;
|
||||||
|
}
|
||||||
|
if (shadows)
|
||||||
|
{
|
||||||
|
painter->setBrush(Qt::darkGray);
|
||||||
|
painter->drawPie(cX,cY+pW+5,cW,cH,palpha*16,sumangle*16);
|
||||||
|
}
|
||||||
|
int q = GetQuater(palpha+sumangle);
|
||||||
|
|
||||||
|
if (q ==2 || q==3)
|
||||||
|
{
|
||||||
|
QPointF p = GetPoint(palpha+sumangle);
|
||||||
|
QPointF points[4] =
|
||||||
|
{
|
||||||
|
QPointF(p.x(),p.y()),
|
||||||
|
QPointF(p.x(),p.y()+pW),
|
||||||
|
QPointF(cX+cW/2,cY+cH/2+pW),
|
||||||
|
QPointF(cX+cW/2,cY+cH/2)
|
||||||
|
};
|
||||||
|
gradient_side.setColorAt(1,pieces[pieces.size()-1].rgbColor);
|
||||||
|
painter->setBrush(gradient_side);
|
||||||
|
painter->drawPolygon(points,4);
|
||||||
|
}
|
||||||
|
p = GetPoint(palpha);
|
||||||
|
q = GetQuater(palpha);
|
||||||
|
if (q ==1 || q==4)
|
||||||
|
{
|
||||||
|
QPointF points[4] =
|
||||||
|
{
|
||||||
|
QPointF(p.x(),p.y()),
|
||||||
|
QPointF(p.x(),p.y()+pW),
|
||||||
|
QPointF(cX+cW/2,cY+cH/2+pW),
|
||||||
|
QPointF(cX+cW/2,cY+cH/2)
|
||||||
|
};
|
||||||
|
gradient_side.setColorAt(1,pieces[0].rgbColor);
|
||||||
|
painter->setBrush(gradient_side);
|
||||||
|
painter->drawPolygon(points,4);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
gradient.setColorAt(0.5,pieces[i].rgbColor);
|
||||||
|
painter->setBrush(gradient);
|
||||||
|
pdegree = 3.6*pieces[i].pPerc;
|
||||||
|
painter->drawPie(cX,cY,cW,cH,palpha*16,pdegree*16);
|
||||||
|
|
||||||
|
double a_ = Angle360(palpha);
|
||||||
|
int q_ = GetQuater(palpha);
|
||||||
|
|
||||||
|
palpha += pdegree;
|
||||||
|
|
||||||
|
double a = Angle360(palpha);
|
||||||
|
int q = GetQuater(palpha);
|
||||||
|
|
||||||
|
QPainterPath path;
|
||||||
|
p = GetPoint(palpha);
|
||||||
|
|
||||||
|
if((q == 3 || q == 4) && (q_ == 3 || q_ == 4))
|
||||||
|
{
|
||||||
|
// 1)
|
||||||
|
if (a>a_)
|
||||||
|
{
|
||||||
|
QPointF p_old = GetPoint(palpha-pdegree);
|
||||||
|
path.moveTo(p_old.x()-1,p_old.y());
|
||||||
|
path.arcTo(cX,cY,cW,cH,palpha-pdegree,pdegree);
|
||||||
|
path.lineTo(p.x(),p.y()+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,palpha,-pdegree);
|
||||||
|
}
|
||||||
|
// 2)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.moveTo(cX,cY+cH/2);
|
||||||
|
path.arcTo(cX,cY,cW,cH,180,Angle360(palpha)-180);
|
||||||
|
path.lineTo(p.x(),p.y()+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,Angle360(palpha),-Angle360(palpha)+180);
|
||||||
|
path.lineTo(cX,cY+cH/2);
|
||||||
|
|
||||||
|
path.moveTo(p.x(),p.y());
|
||||||
|
path.arcTo(cX,cY,cW,cH,palpha-pdegree,360-Angle360(palpha-pdegree));
|
||||||
|
path.lineTo(cX+cW,cY+cH/2+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,0,-360+Angle360(palpha-pdegree));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 3)
|
||||||
|
else if((q == 3 || q == 4) && (q_ == 1 || q_ == 2) && a>a_ )
|
||||||
|
{
|
||||||
|
path.moveTo(cX,cY+cH/2);
|
||||||
|
path.arcTo(cX,cY,cW,cH,180,Angle360(palpha)-180);
|
||||||
|
path.lineTo(p.x(),p.y()+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,Angle360(palpha),-Angle360(palpha)+180);
|
||||||
|
path.lineTo(cX,cY+cH/2);
|
||||||
|
}
|
||||||
|
// 4)
|
||||||
|
else if((q == 1 || q == 2) && (q_ == 3 || q_ == 4) && a<a_)
|
||||||
|
{
|
||||||
|
p = GetPoint(palpha-pdegree);
|
||||||
|
path.moveTo(p.x(),p.y());
|
||||||
|
path.arcTo(cX,cY,cW,cH,palpha-pdegree,360-Angle360(palpha-pdegree));
|
||||||
|
path.lineTo(cX+cW,cY+cH/2+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,0,-360+Angle360(palpha-pdegree));
|
||||||
|
}
|
||||||
|
// 5)
|
||||||
|
else if((q ==1 || q==2) && (q_==1 || q_==2) && a<a_)
|
||||||
|
{
|
||||||
|
path.moveTo(cX,cY+cH/2);
|
||||||
|
path.arcTo(cX,cY,cW,cH,180,180);
|
||||||
|
path.lineTo(cX+cW,cY+cH/2+pW);
|
||||||
|
path.arcTo(cX,cY+pW,cW,cH,0,-180);
|
||||||
|
path.lineTo(cX,cY+cH/2);
|
||||||
|
}
|
||||||
|
if (!path.isEmpty())
|
||||||
|
{
|
||||||
|
gradient_side.setColorAt(1,pieces[i].rgbColor);
|
||||||
|
painter->setBrush(gradient_side);
|
||||||
|
painter->drawPath(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this->ctype==Nightcharts::Histogramm)
|
||||||
|
{
|
||||||
|
double pDist = 15;
|
||||||
|
double pW = (cW-(pieces.size())*pDist)/pieces.size();
|
||||||
|
|
||||||
|
QLinearGradient gradient(cX+cW/2,cY,cX+cW/2,cY+cH);
|
||||||
|
gradient.setColorAt(0,Qt::black);
|
||||||
|
QPen pen;
|
||||||
|
pen.setWidth(3);
|
||||||
|
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
if (shadows)
|
||||||
|
{
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
painter->setBrush(Qt::darkGray);
|
||||||
|
painter->drawRect(cX+pDist+i*(pW + pDist)-pDist/2,cY+cH-1,pW,-cH/100*pieces[i].pPerc+pDist/2-5);
|
||||||
|
}
|
||||||
|
gradient.setColorAt(1,pieces[i].rgbColor);
|
||||||
|
painter->setBrush(gradient);
|
||||||
|
pen.setColor(pieces[i].rgbColor);
|
||||||
|
painter->setPen(pen);
|
||||||
|
painter->drawRect(cX+pDist+i*(pW + pDist),cY+cH,pW,-cH/100*pieces[i].pPerc-5);
|
||||||
|
QString label = QString::number(pieces[i].pPerc)+"%";
|
||||||
|
painter->setPen(Qt::SolidLine);
|
||||||
|
painter->drawText(cX+pDist+i*(pW + pDist)+pW/2-painter->fontMetrics().width(label)/2,cY+cH-cH/100*pieces[i].pPerc-painter->fontMetrics().height()/2,label);
|
||||||
|
}
|
||||||
|
painter->setPen(Qt::SolidLine);
|
||||||
|
for (int i=1;i<10;i++)
|
||||||
|
{
|
||||||
|
painter->drawLine(cX-3,cY+cH/10*i,cX+3,cY+cH/10*i); //äåëåíèÿ ïî îñè Y
|
||||||
|
//painter->drawText(cX-20,cY+cH/10*i,QString::number((10-i)*10)+"%");
|
||||||
|
}
|
||||||
|
painter->drawLine(cX,cY+cH,cX,cY); //îñü Y
|
||||||
|
painter->drawLine(cX,cY,cX+4,cY+10); //ñòðåëêè
|
||||||
|
painter->drawLine(cX,cY,cX-4,cY+10);
|
||||||
|
painter->drawLine(cX,cY+cH,cX+cW,cY+cH); //îñü Õ
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Nightcharts::drawLegend(QPainter *painter)
|
||||||
|
{
|
||||||
|
//double ptext = 25;
|
||||||
|
double angle = palpha;
|
||||||
|
painter->setPen(Qt::SolidLine);
|
||||||
|
|
||||||
|
switch(cltype)
|
||||||
|
{
|
||||||
|
/*case Nightcharts::Horizontal:
|
||||||
|
{
|
||||||
|
int dist = 5;
|
||||||
|
painter->setBrush(Qt::white);
|
||||||
|
float x = cX;
|
||||||
|
float y = cY+cH+20+dist;
|
||||||
|
//painter->drawRoundRect(cX+cW+20,cY,dist*2+200,pieces.size()*(fontmetr.height()+2*dist)+dist,15,15);
|
||||||
|
for (int i=0;i<pieces.size();i++)
|
||||||
|
{
|
||||||
|
painter->setBrush(pieces[i].rgbColor);
|
||||||
|
x += fontmetr.height()+2*dist;
|
||||||
|
if (i%3 == 0)
|
||||||
|
{
|
||||||
|
x = cX;
|
||||||
|
y += dist+fontmetr.height();
|
||||||
|
}
|
||||||
|
painter->drawRect(x,y,fontmetr.height(),fontmetr.height());
|
||||||
|
QString label = pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%";
|
||||||
|
painter->drawText(x+fontmetr.height()+dist,y+fontmetr.height()/2+dist,label);
|
||||||
|
x += fontmetr.width(label);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
case Nightcharts::Vertical:
|
||||||
|
{
|
||||||
|
int dist = 5;
|
||||||
|
painter->setBrush(Qt::white);
|
||||||
|
//painter->drawRoundRect(cX+cW+20,cY,dist*2+200,pieces.size()*(painter->fontMetrics().height()+2*dist)+dist,15,15);
|
||||||
|
for (int i=pieces.size()-1;i>=0;i--)
|
||||||
|
{
|
||||||
|
painter->setBrush(pieces[i].rgbColor);
|
||||||
|
float x = lX+dist;
|
||||||
|
float y = lY+dist+i*(painter->fontMetrics().height()+2*dist);
|
||||||
|
painter->drawRect(x,y,painter->fontMetrics().height(),painter->fontMetrics().height());
|
||||||
|
painter->drawText(x+painter->fontMetrics().height()+dist,y+painter->fontMetrics().height()/2+dist,pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Nightcharts::Round:
|
||||||
|
for (int i=pieces.size()-1;i>=0;i--)
|
||||||
|
{
|
||||||
|
float len = 100;
|
||||||
|
double pdegree = 3.6*pieces[i].pPerc;
|
||||||
|
angle -= pdegree/2;
|
||||||
|
QPointF p = GetPoint(angle);
|
||||||
|
QPointF p_ = GetPoint(angle, cW+len,cH+len);
|
||||||
|
int q = GetQuater(angle);
|
||||||
|
if (q == 3 || q == 4)
|
||||||
|
{
|
||||||
|
p.setY(p.y()+pW/2);
|
||||||
|
p_.setY(p_.y()+pW/2);
|
||||||
|
}
|
||||||
|
painter->drawLine(p.x(),p.y(),p_.x(),p_.y());
|
||||||
|
QString label = pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%";
|
||||||
|
float recW = painter->fontMetrics().width(label)+10;
|
||||||
|
float recH = painter->fontMetrics().height()+10;
|
||||||
|
p_.setX(p_.x()-recW/2 + recW/2*cos(angle*M_PI/180));
|
||||||
|
p_.setY(p_.y()+recH/2 + recH/2*sin(angle*M_PI/180));
|
||||||
|
painter->setBrush(Qt::white);
|
||||||
|
painter->drawRoundRect(p_.x() ,p_.y(), recW, -recH);
|
||||||
|
painter->drawText(p_.x()+5, p_.y()-recH/2+5, label);
|
||||||
|
angle -= pdegree/2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF Nightcharts::GetPoint(double angle, double R1, double R2)
|
||||||
|
{
|
||||||
|
if (R1 == 0 && R2 == 0)
|
||||||
|
{
|
||||||
|
R1 = cW;
|
||||||
|
R2 = cH;
|
||||||
|
}
|
||||||
|
QPointF point;
|
||||||
|
double x = R1/2*cos(angle*M_PI/180);
|
||||||
|
x+=cW/2+cX;
|
||||||
|
double y = -R2/2*sin(angle*M_PI/180);
|
||||||
|
y+=cH/2+cY;
|
||||||
|
point.setX(x);
|
||||||
|
point.setY(y);
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::GetQuater(double angle)
|
||||||
|
{
|
||||||
|
angle = Angle360(angle);
|
||||||
|
|
||||||
|
if(angle>=0 && angle<90)
|
||||||
|
return 1;
|
||||||
|
if(angle>=90 && angle<180)
|
||||||
|
return 2;
|
||||||
|
if(angle>=180 && angle<270)
|
||||||
|
return 3;
|
||||||
|
if(angle>=270 && angle<360)
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Nightcharts::Angle360(double angle)
|
||||||
|
{
|
||||||
|
int i = (int)angle;
|
||||||
|
double delta = angle - i;
|
||||||
|
return (i%360 + delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
pieceNC::pieceNC()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void pieceNC::addName(QString name)
|
||||||
|
{
|
||||||
|
pname = name;
|
||||||
|
}
|
||||||
|
void pieceNC::setColor(Qt::GlobalColor color)
|
||||||
|
{
|
||||||
|
rgbColor = color;
|
||||||
|
}
|
||||||
|
void pieceNC::setColor(QColor color)
|
||||||
|
{
|
||||||
|
rgbColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pieceNC::setPerc(float Percentage)
|
||||||
|
{
|
||||||
|
pPerc = Percentage;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Nightcharts::pieceCount()
|
||||||
|
{
|
||||||
|
return pieces.count();
|
||||||
|
}
|
||||||
88
ThirdParty/nightcharts/nightcharts.h
vendored
Normal file
88
ThirdParty/nightcharts/nightcharts.h
vendored
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* NightCharts
|
||||||
|
* Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
* Please contact gordos.kund@gmail.com with any questions on this license.
|
||||||
|
*/
|
||||||
|
#ifndef NIGHTCHARTS_H
|
||||||
|
#define NIGHTCHARTS_H
|
||||||
|
#define PerConst = 3.6;
|
||||||
|
#include <QObject>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QLinearGradient>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
class pieceNC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit pieceNC();
|
||||||
|
void addName(QString name);
|
||||||
|
void setColor(Qt::GlobalColor);
|
||||||
|
void setColor(QColor color);
|
||||||
|
void setPerc(float Percentage);
|
||||||
|
|
||||||
|
QString pname;
|
||||||
|
QColor rgbColor;
|
||||||
|
float pPerc;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Nightcharts
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit Nightcharts();
|
||||||
|
~Nightcharts();
|
||||||
|
enum type { Histogramm , Pie, Dpie };
|
||||||
|
enum legend_type{ /*Horizontal,*/ Vertical, Round };
|
||||||
|
int addPiece(QString name,Qt::GlobalColor,float Percentage);
|
||||||
|
int addPiece(QString name,QColor, float Percentage);
|
||||||
|
int setCords(double x, double y, double w, double h);
|
||||||
|
int setLegendCords(double x, double y);
|
||||||
|
int setType(Nightcharts::type t);
|
||||||
|
int setLegendType(Nightcharts::legend_type t);
|
||||||
|
int setShadows(bool ok = true);
|
||||||
|
int setFont(QFont f);
|
||||||
|
int draw(QPainter *painter);
|
||||||
|
void drawLegend(QPainter *painter);
|
||||||
|
int pieceCount();
|
||||||
|
double palpha;
|
||||||
|
|
||||||
|
private:
|
||||||
|
double cX,cY,cW,cH,pW,lX,lY;
|
||||||
|
int nPiece;
|
||||||
|
bool shadows;
|
||||||
|
QVector<pieceNC> pieces;
|
||||||
|
int ctype, cltype;
|
||||||
|
QFont font;
|
||||||
|
//QPainter *cpainter;
|
||||||
|
QPointF GetPoint(double angle, double R1 = 0, double R2 = 0);
|
||||||
|
int GetQuater(double angle);
|
||||||
|
double Angle360(double angle);
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // NIGHTCHARTS_H
|
||||||
3
ThirdParty/nightcharts/nightcharts.pri
vendored
Normal file
3
ThirdParty/nightcharts/nightcharts.pri
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
INCLUDEPATH+=$$PWD
|
||||||
|
SOURCES+=$$PWD/nightcharts.cpp
|
||||||
|
HEADERS+=$$PWD/nightcharts.h
|
||||||
44
ThirdParty/nightcharts/nightchartswidget.cpp
vendored
Normal file
44
ThirdParty/nightcharts/nightchartswidget.cpp
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#include "nightchartswidget.h"
|
||||||
|
#include "nightcharts.h"
|
||||||
|
NightchartsWidget::NightchartsWidget(QWidget *parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
void NightchartsWidget::setType(Nightcharts::type t)
|
||||||
|
{
|
||||||
|
_chart.setType(t);
|
||||||
|
}
|
||||||
|
void NightchartsWidget::clear()
|
||||||
|
{
|
||||||
|
_chart = Nightcharts();
|
||||||
|
_chart.setType(Nightcharts::Histogramm);
|
||||||
|
_chart.setLegendType(Nightcharts::Vertical);
|
||||||
|
|
||||||
|
_margin_left = 16;
|
||||||
|
_margin_top = 16;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void NightchartsWidget::paintEvent(QPaintEvent * e)
|
||||||
|
{
|
||||||
|
QWidget::paintEvent(e);
|
||||||
|
if(!_chart.pieceCount()) return ;
|
||||||
|
QPainter painter;
|
||||||
|
QFont font;
|
||||||
|
painter.begin(this);
|
||||||
|
int w = (this->width() - _margin_left - 150);
|
||||||
|
int h = (this->height() - _margin_top - 100);
|
||||||
|
int size = (w<h)?w:h;
|
||||||
|
_chart.setCords(_margin_left, _margin_top,size, size);
|
||||||
|
|
||||||
|
|
||||||
|
_chart.draw(&painter);
|
||||||
|
_chart.drawLegend(&painter);
|
||||||
|
//painter.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NightchartsWidget::addItem(QString name, QColor color, float value)
|
||||||
|
{
|
||||||
|
_chart.addPiece(name,color,value);
|
||||||
|
}
|
||||||
24
ThirdParty/nightcharts/nightchartswidget.h
vendored
Normal file
24
ThirdParty/nightcharts/nightchartswidget.h
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef NIGHTCHARTSWIDGET_H
|
||||||
|
#define NIGHTCHARTSWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include "nightcharts.h"
|
||||||
|
class NightchartsWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit NightchartsWidget(QWidget *parent = 0);
|
||||||
|
void addItem(QString name, QColor color, float value);
|
||||||
|
void setType(Nightcharts::type type);
|
||||||
|
void clear();
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent * e);
|
||||||
|
private:
|
||||||
|
Nightcharts _chart;
|
||||||
|
int _margin_left;
|
||||||
|
int _margin_top;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NIGHTCHARTSWIDGET_H
|
||||||
Reference in New Issue
Block a user