mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change 18603 on 2012/09/11 by fredrik@fredrik_MBP-BootCamp
Added glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT); to get proper orientation of textures on point sprites
This commit is contained in:
154
ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp
Normal file
154
ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "RIStdInclude.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimReservoirView.h"
|
||||
#include "RIViewer.h"
|
||||
#include "RimReservoir.h"
|
||||
#include "RigReservoir.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "3dOverlayInfoConfig");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
{
|
||||
CAF_PDM_InitObject("Overlay 3D info", ":/Legend.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showInfoText, "ShowInfoText", true, "Info Text", "", "", "");
|
||||
CAF_PDM_InitField(&showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
|
||||
CAF_PDM_InitField(&showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dOverlayInfoConfig::~Rim3dOverlayInfoConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
this->update3DInfo();
|
||||
m_reservoirView->viewer()->update();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::setPosition(cvf::Vec2ui position)
|
||||
{
|
||||
m_position = position;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
{
|
||||
if (!m_reservoirView && m_reservoirView->viewer()) return;
|
||||
|
||||
m_reservoirView->viewer()->showInfoText(showInfoText());
|
||||
m_reservoirView->viewer()->showHistogram(false);
|
||||
m_reservoirView->viewer()->showAnimationProgress(showAnimProgress());
|
||||
|
||||
if (showInfoText())
|
||||
{
|
||||
QString caseName;
|
||||
QString totCellCount;
|
||||
QString activeCellCount;
|
||||
QString iSize, jSize, kSize;
|
||||
QString propName;
|
||||
QString cellEdgeName;
|
||||
|
||||
if (m_reservoirView->eclipseCase())
|
||||
{
|
||||
caseName = m_reservoirView->eclipseCase()->caseName();
|
||||
totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size());
|
||||
activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->numActiveCells());
|
||||
iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI());
|
||||
jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ());
|
||||
kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK());
|
||||
propName = m_reservoirView->cellResult()->resultVariable();
|
||||
cellEdgeName = m_reservoirView->cellEdgeResult()->resultVariable();
|
||||
}
|
||||
|
||||
QString infoText = QString(
|
||||
"<p><b><center>-- %1 --</center></b><p> "
|
||||
"<b>Cell count:</b> Total: %2 Active: %3 <br>"
|
||||
"<b>Main Grid I,J,K:</b> %4, %5, %6 <br>").arg(caseName, totCellCount, activeCellCount, iSize, jSize, kSize);
|
||||
|
||||
if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult())
|
||||
{
|
||||
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
|
||||
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
|
||||
infoText += QString("<blockquote> Min: %1 P10: %2 P90: %3 Max: %4 </blockquote>").arg(min).arg(p10).arg(p90).arg(max);
|
||||
}
|
||||
|
||||
|
||||
if (m_reservoirView->animationMode() && m_reservoirView->cellEdgeResult()->hasResult())
|
||||
{
|
||||
double min, max;
|
||||
m_reservoirView->cellEdgeResult()->minMaxCellEdgeValues(min, max);
|
||||
infoText += QString("<b>Cell Edge Property:</b> %1 <blockquote>Min: %2 Max: %3 </blockquote>").arg(cellEdgeName).arg(min).arg(max);
|
||||
|
||||
}
|
||||
|
||||
if ( m_reservoirView->cellResult()->hasDynamicResult()
|
||||
|| m_reservoirView->propertyFilterCollection()->hasActiveDynamicFilters()
|
||||
|| m_reservoirView->wellCollection()->hasVisibleWellPipes())
|
||||
{
|
||||
int currentTimeStep = m_reservoirView->currentTimeStep();
|
||||
QDateTime date = m_reservoirView->gridCellResults()->timeStepDate(0, currentTimeStep);
|
||||
infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(date.toString("dd.MMM yyyy"));
|
||||
}
|
||||
|
||||
m_reservoirView->viewer()->setInfoText(infoText);
|
||||
}
|
||||
|
||||
if (showHistogram())
|
||||
{
|
||||
if (m_reservoirView->animationMode() && m_reservoirView->cellResult()->hasResult())
|
||||
{
|
||||
double min, max;
|
||||
double p10, p90;
|
||||
size_t scalarIndex = m_reservoirView->cellResult()->gridScalarIndex();
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
m_reservoirView->gridCellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
|
||||
m_reservoirView->viewer()->showHistogram(true);
|
||||
m_reservoirView->viewer()->setHistogram(min, max, m_reservoirView->gridCellResults()->cellScalarValuesHistogram(scalarIndex));
|
||||
m_reservoirView->viewer()->setHistogramPercentiles(p10, p90);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h
Normal file
55
ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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 "cafPdmPointer.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
class RimReservoirView;
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class Rim3dOverlayInfoConfig: public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
Rim3dOverlayInfoConfig();
|
||||
virtual ~Rim3dOverlayInfoConfig();
|
||||
|
||||
void update3DInfo();
|
||||
|
||||
void setReservoirView(RimReservoirView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
|
||||
|
||||
void setPosition(cvf::Vec2ui position);
|
||||
caf::PdmField<bool> showInfoText;
|
||||
caf::PdmField<bool> showAnimProgress;
|
||||
caf::PdmField<bool> showHistogram;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
cvf::Vec2ui m_position;
|
||||
};
|
||||
@@ -294,3 +294,36 @@ void RimCellEdgeResultSlot::updateIgnoredScalarValue()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeResultSlot::minMaxCellEdgeValues(double& min, double& max)
|
||||
{
|
||||
CVF_ASSERT(min && max);
|
||||
|
||||
double globalMin, globalMax;
|
||||
globalMin = HUGE_VAL;
|
||||
globalMax = -HUGE_VAL;
|
||||
|
||||
size_t resultIndices[6];
|
||||
this->gridScalarIndices(resultIndices);
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
{
|
||||
double cMin, cMax;
|
||||
m_reservoirView->gridCellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
|
||||
|
||||
globalMin = CVF_MIN(globalMin, cMin);
|
||||
globalMax = CVF_MAX(globalMax, cMax);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
min = globalMin;
|
||||
max = globalMax;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
void loadResult();
|
||||
bool hasResult() const;
|
||||
|
||||
void minMaxCellEdgeValues(double& min, double& max);
|
||||
protected:
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "cafCadNavigation.h"
|
||||
#include "cafCeetronNavigation.h"
|
||||
#include "RimReservoir.h"
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
@@ -87,6 +88,10 @@ RimReservoirView::RimReservoirView()
|
||||
CAF_PDM_InitFieldNoDefault(&cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "");
|
||||
cellEdgeResult = new RimCellEdgeResultSlot();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&overlayInfoConfig, "OverlayInfoConfig", "Overlay Info", "", "", "");
|
||||
overlayInfoConfig = new Rim3dOverlayInfoConfig();
|
||||
overlayInfoConfig->setReservoirView(this);
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString(""), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&scaleZ, "GridZScale", 1.0, "Z Scale", "", "Scales the scene in the Z direction", "");
|
||||
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
||||
@@ -144,6 +149,8 @@ RimReservoirView::~RimReservoirView()
|
||||
{
|
||||
delete this->cellResult();
|
||||
delete this->cellEdgeResult();
|
||||
delete this->overlayInfoConfig();
|
||||
|
||||
delete rangeFilterCollection();
|
||||
delete propertyFilterCollection();
|
||||
|
||||
@@ -645,6 +652,7 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
}
|
||||
}
|
||||
|
||||
overlayInfoConfig()->update3DInfo();
|
||||
updateLegends();
|
||||
}
|
||||
|
||||
@@ -691,6 +699,7 @@ void RimReservoirView::loadDataAndUpdate()
|
||||
createDisplayModel();
|
||||
updateDisplayModelVisibility();
|
||||
setDefaultView();
|
||||
overlayInfoConfig()->update3DInfo();
|
||||
|
||||
if (animationMode && m_viewer)
|
||||
{
|
||||
@@ -1018,31 +1027,8 @@ void RimReservoirView::updateLegends()
|
||||
|
||||
if (this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
double localMin, localMax;
|
||||
localMin = HUGE_VAL;
|
||||
localMax = -HUGE_VAL;
|
||||
double globalMin, globalMax;
|
||||
globalMin = HUGE_VAL;
|
||||
globalMax = -HUGE_VAL;
|
||||
|
||||
size_t resultIndices[6];
|
||||
this->cellEdgeResult()->gridScalarIndices(resultIndices);
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
{
|
||||
double min, max;
|
||||
results->minMaxCellScalarValues(resultIndices[idx], min, max);
|
||||
|
||||
globalMin = CVF_MIN(globalMin, min);
|
||||
globalMax = CVF_MAX(globalMax, max);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
||||
this->cellEdgeResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
m_viewer->setColorLegend2(this->cellEdgeResult()->legendConfig->legend());
|
||||
this->cellEdgeResult()->legendConfig->legend()->setTitle(cvfqt::Utils::fromQString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable));
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCellPropertyFilter.h"
|
||||
#include "RimCellPropertyFilterCollection.h"
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
@@ -86,6 +87,7 @@ public:
|
||||
|
||||
caf::PdmField<RimResultSlot*> cellResult;
|
||||
caf::PdmField<RimCellEdgeResultSlot*> cellEdgeResult;
|
||||
caf::PdmField<Rim3dOverlayInfoConfig*> overlayInfoConfig;
|
||||
|
||||
caf::PdmField<double> scaleZ;
|
||||
caf::PdmField<bool> showWindow;
|
||||
|
||||
@@ -44,9 +44,10 @@ RimResultReservoir::RimResultReservoir()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimResultReservoir::openEclipseGridFile()
|
||||
{
|
||||
caf::ProgressInfo progInfo(2, "Reading Eclipse Grid File");
|
||||
caf::ProgressInfo progInfo(20, "Reading Eclipse Grid File");
|
||||
|
||||
progInfo.setProgressDescription("Open Grid File");
|
||||
progInfo.setNextProgressIncrement(19);
|
||||
// Early exit if reservoir data is created
|
||||
if (m_rigReservoir.notNull()) return true;
|
||||
|
||||
@@ -83,7 +84,7 @@ bool RimResultReservoir::openEclipseGridFile()
|
||||
m_rigReservoir = reservoir;
|
||||
}
|
||||
|
||||
progInfo.setProgress(1);
|
||||
progInfo.setProgress(19);
|
||||
|
||||
CVF_ASSERT(m_rigReservoir.notNull());
|
||||
CVF_ASSERT(readerInterface.notNull());
|
||||
|
||||
Reference in New Issue
Block a user