mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Version 0.8.6
This commit is contained in:
@@ -331,6 +331,8 @@ bool RIApplication::closeProject(bool askToSaveIfDirty)
|
|||||||
{
|
{
|
||||||
RIMainWindow* mainWnd = RIMainWindow::instance();
|
RIMainWindow* mainWnd = RIMainWindow::instance();
|
||||||
|
|
||||||
|
terminateProcess();
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox(mainWnd);
|
QMessageBox msgBox(mainWnd);
|
||||||
@@ -353,7 +355,7 @@ bool RIApplication::closeProject(bool askToSaveIfDirty)
|
|||||||
|
|
||||||
mainWnd->cleanupGuiBeforeProjectClose();
|
mainWnd->cleanupGuiBeforeProjectClose();
|
||||||
|
|
||||||
caf::EffectCache::instance()->clear();
|
caf::EffectGenerator::clearEffectCache();
|
||||||
m_project->close();
|
m_project->close();
|
||||||
|
|
||||||
onProjectOpenedOrClosed();
|
onProjectOpenedOrClosed();
|
||||||
@@ -417,16 +419,19 @@ bool RIApplication::openEclipseCase(const QString& caseName, const QString& case
|
|||||||
|
|
||||||
RimReservoirView* riv = rimResultReservoir->createAndAddReservoirView();
|
RimReservoirView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||||
|
|
||||||
// Select SOIL as default result variable
|
if (m_preferences->autocomputeSOIL)
|
||||||
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
|
{
|
||||||
riv->cellResult()->resultVariable = "SOIL";
|
// Select SOIL as default result variable
|
||||||
riv->animationMode = true;
|
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
|
||||||
|
riv->cellResult()->resultVariable = "SOIL";
|
||||||
|
riv->animationMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
riv->loadDataAndUpdate();
|
riv->loadDataAndUpdate();
|
||||||
|
|
||||||
if (!riv->cellResult()->hasResult())
|
if (!riv->cellResult()->hasResult())
|
||||||
{
|
{
|
||||||
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
|
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||||
}
|
}
|
||||||
|
|
||||||
onProjectOpenedOrClosed();
|
onProjectOpenedOrClosed();
|
||||||
@@ -455,7 +460,7 @@ bool RIApplication::openInputEclipseCase(const QString& caseName, const QStringL
|
|||||||
|
|
||||||
if (!riv->cellResult()->hasResult())
|
if (!riv->cellResult()->hasResult())
|
||||||
{
|
{
|
||||||
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
|
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||||
}
|
}
|
||||||
|
|
||||||
onProjectOpenedOrClosed();
|
onProjectOpenedOrClosed();
|
||||||
@@ -536,10 +541,12 @@ void RIApplication::setUseShaders(bool enable)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RIApplication::useShaders() const
|
bool RIApplication::useShaders() const
|
||||||
{
|
{
|
||||||
|
if (!m_preferences->useShaders) return false;
|
||||||
|
|
||||||
bool isShadersSupported = caf::Viewer::isShadersSupported();
|
bool isShadersSupported = caf::Viewer::isShadersSupported();
|
||||||
if (!isShadersSupported) return false;
|
if (!isShadersSupported) return false;
|
||||||
|
|
||||||
return m_preferences->useShaders;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -721,7 +728,7 @@ void RIApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus
|
|||||||
// get a chance to run before we delete the object
|
// get a chance to run before we delete the object
|
||||||
if (m_workerProcess)
|
if (m_workerProcess)
|
||||||
{
|
{
|
||||||
m_workerProcess->deleteLater();
|
m_workerProcess->close();
|
||||||
}
|
}
|
||||||
m_workerProcess = NULL;
|
m_workerProcess = NULL;
|
||||||
|
|
||||||
@@ -749,23 +756,33 @@ void RIApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RIApplication::launchProcess(const QString& program, const QStringList& arguments)
|
bool RIApplication::launchProcess(const QString& program, const QStringList& arguments)
|
||||||
{
|
{
|
||||||
m_workerProcess = new caf::UiProcess(this);
|
if (m_workerProcess == NULL)
|
||||||
connect(m_workerProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
|
||||||
|
|
||||||
RIMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
|
|
||||||
|
|
||||||
m_workerProcess->start(program, arguments);
|
|
||||||
if (!m_workerProcess->waitForStarted(1000))
|
|
||||||
{
|
{
|
||||||
m_workerProcess->deleteLater();
|
m_workerProcess = new caf::UiProcess(this);
|
||||||
m_workerProcess = NULL;
|
connect(m_workerProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
||||||
|
|
||||||
RIMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
RIMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
|
||||||
|
|
||||||
|
m_workerProcess->start(program, arguments);
|
||||||
|
if (!m_workerProcess->waitForStarted(1000))
|
||||||
|
{
|
||||||
|
m_workerProcess->close();
|
||||||
|
m_workerProcess = NULL;
|
||||||
|
|
||||||
|
RIMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
||||||
|
|
||||||
|
QMessageBox::warning(RIMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + program);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(NULL, "Script execution", "An Octave process is still running. Please stop this process before executing a new script.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -853,3 +870,16 @@ void RIApplication::applyPreferences()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RIApplication::terminateProcess()
|
||||||
|
{
|
||||||
|
if (m_workerProcess)
|
||||||
|
{
|
||||||
|
m_workerProcess->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_workerProcess = NULL;
|
||||||
|
}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ public:
|
|||||||
QString octavePath() const;
|
QString octavePath() const;
|
||||||
|
|
||||||
bool launchProcess(const QString& program, const QStringList& arguments);
|
bool launchProcess(const QString& program, const QStringList& arguments);
|
||||||
|
void terminateProcess();
|
||||||
|
|
||||||
RIPreferences* preferences();
|
RIPreferences* preferences();
|
||||||
void readPreferences();
|
void readPreferences();
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ RIPreferences::RIPreferences(void)
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
||||||
lastUsedProjectFileName.setUiHidden(true);
|
lastUsedProjectFileName.setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&autocomputeSOIL, "autocomputeSOIL", true, "Compute SOIL if not on disk", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ public: // Pdm Fields
|
|||||||
|
|
||||||
caf::PdmField<QString> lastUsedProjectFileName;
|
caf::PdmField<QString> lastUsedProjectFileName;
|
||||||
|
|
||||||
|
caf::PdmField<bool> autocomputeSOIL;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigReservoi
|
|||||||
FILE* gridFilePointer = util_fopen(fileName.toLatin1().data(), "r");
|
FILE* gridFilePointer = util_fopen(fileName.toLatin1().data(), "r");
|
||||||
if (!gridFilePointer) return false;
|
if (!gridFilePointer) return false;
|
||||||
|
|
||||||
// Main grid Dimentions
|
// Main grid dimensions
|
||||||
// SPECGRID - This is whats normally available, but not really the input to Eclipse.
|
// SPECGRID - This is whats normally available, but not really the input to Eclipse.
|
||||||
// DIMENS - Is what Eclipse expects and uses, but is not defined in the GRID section and is not (?) available normally
|
// DIMENS - Is what Eclipse expects and uses, but is not defined in the GRID section and is not (?) available normally
|
||||||
// ZCORN, COORD, ACTNUM, MAPAXES
|
// ZCORN, COORD, ACTNUM, MAPAXES
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#endif //USE_ECL_LIB
|
#endif //USE_ECL_LIB
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include "cafProgressInfo.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@@ -105,7 +106,11 @@ bool RifEclipseOutputFileTools::keywordsOnFile(QStringList* keywords, size_t num
|
|||||||
CVF_ASSERT(keywords);
|
CVF_ASSERT(keywords);
|
||||||
keywords->clear();
|
keywords->clear();
|
||||||
|
|
||||||
|
|
||||||
size_t numKeywords = ecl_file_get_num_distinct_kw(m_file);
|
size_t numKeywords = ecl_file_get_num_distinct_kw(m_file);
|
||||||
|
|
||||||
|
caf::ProgressInfo info(numKeywords, "Reading Keywords on file");
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < numKeywords; i++)
|
for (i = 0; i < numKeywords; i++)
|
||||||
{
|
{
|
||||||
@@ -148,6 +153,8 @@ bool RifEclipseOutputFileTools::keywordsOnFile(QStringList* keywords, size_t num
|
|||||||
{
|
{
|
||||||
keywords->append(QString(kw));
|
keywords->append(QString(kw));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info.setProgress(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -142,7 +142,15 @@ QStringList RifEclipseRestartFilesetAccess::resultNames()
|
|||||||
bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t timeStep, std::vector<double>* values)
|
bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t timeStep, std::vector<double>* values)
|
||||||
{
|
{
|
||||||
size_t numOccurrences = m_files[timeStep]->numOccurrences(resultName);
|
size_t numOccurrences = m_files[timeStep]->numOccurrences(resultName);
|
||||||
CVF_ASSERT(m_numGrids == numOccurrences);
|
|
||||||
|
// No results for this result variable for current time step found
|
||||||
|
if (numOccurrences == 0) return true;
|
||||||
|
|
||||||
|
// Result handling depends on presens of result values for all grids
|
||||||
|
if (m_numGrids != numOccurrences)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < numOccurrences; i++)
|
for (i = 0; i < numOccurrences; i++)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ bool RifReaderEclipseInput::open(const QString& fileName, RigReservoir* reservoi
|
|||||||
close();
|
close();
|
||||||
|
|
||||||
// Should we handle gridless properties ?
|
// Should we handle gridless properties ?
|
||||||
// If so, they must match dimentions, and a grid afterwards must match dimension
|
// If so, they must match dimensions, and a grid afterwards must match dimension
|
||||||
|
|
||||||
// Add file:
|
// Add file:
|
||||||
// Open file
|
// Open file
|
||||||
|
|||||||
@@ -381,7 +381,11 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
|||||||
QStringList staticResultNames = staticResults;
|
QStringList staticResultNames = staticResults;
|
||||||
|
|
||||||
QList<QDateTime> staticDate;
|
QList<QDateTime> staticDate;
|
||||||
staticDate.push_back(m_timeSteps.front());
|
if (m_timeSteps.size() > 0)
|
||||||
|
{
|
||||||
|
staticDate.push_back(m_timeSteps.front());
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < static_cast<size_t>(staticResultNames.size()); ++i)
|
for (size_t i = 0; i < static_cast<size_t>(staticResultNames.size()); ++i)
|
||||||
{
|
{
|
||||||
size_t resIndex = resCellResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, staticResultNames[i]);
|
size_t resIndex = resCellResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, staticResultNames[i]);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "cvfTexture.h"
|
#include "cvfTexture.h"
|
||||||
#include "cvfSampler.h"
|
#include "cvfSampler.h"
|
||||||
#include "cvfScalarMapper.h"
|
#include "cvfScalarMapper.h"
|
||||||
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -87,22 +88,16 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
|||||||
const RigGridBase* grid = dynamic_cast<const RigGridBase*>(generator->activeGrid());
|
const RigGridBase* grid = dynamic_cast<const RigGridBase*>(generator->activeGrid());
|
||||||
|
|
||||||
CVF_ASSERT(grid != NULL);
|
CVF_ASSERT(grid != NULL);
|
||||||
const std::vector< double >* cellScalarResults = NULL;
|
|
||||||
bool cellScalarResultUseGlobalActiveIndex = true;
|
|
||||||
|
|
||||||
const std::vector< double >* edgeScalarResults[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
bool cellScalarResultUseGlobalActiveIndex = true;
|
||||||
bool edgeScalarResultUseGlobalActiveIndex[6];
|
bool edgeScalarResultUseGlobalActiveIndex[6];
|
||||||
|
|
||||||
if (cellResultSlot->hasResult())
|
if (cellResultSlot->hasResult())
|
||||||
{
|
{
|
||||||
const std::vector< std::vector<double> >& scalarResultTimeSteps = grid->mainGrid()->results()->cellScalarResults(cellResultSlot->gridScalarIndex());
|
if (!cellResultSlot->hasDynamicResult())
|
||||||
if (cellResultSlot->hasDynamicResult())
|
|
||||||
{
|
{
|
||||||
cellScalarResults = &scalarResultTimeSteps[timeStepIndex];
|
// Static result values are located at time step 0
|
||||||
}
|
timeStepIndex = 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
cellScalarResults = &scalarResultTimeSteps[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cellScalarResultUseGlobalActiveIndex = grid->mainGrid()->results()->isUsingGlobalActiveIndex(cellResultSlot->gridScalarIndex());
|
cellScalarResultUseGlobalActiveIndex = grid->mainGrid()->results()->isUsingGlobalActiveIndex(cellResultSlot->gridScalarIndex());
|
||||||
@@ -118,8 +113,6 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
|||||||
{
|
{
|
||||||
if (resultIndices[cubeFaceIdx] != cvf::UNDEFINED_SIZE_T)
|
if (resultIndices[cubeFaceIdx] != cvf::UNDEFINED_SIZE_T)
|
||||||
{
|
{
|
||||||
const std::vector< std::vector<double> >& scalarResultTimeSteps = grid->mainGrid()->results()->cellScalarResults(resultIndices[cubeFaceIdx]);
|
|
||||||
edgeScalarResults[cubeFaceIdx] = &scalarResultTimeSteps[0]; // Assuming only static edge results
|
|
||||||
edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx] = grid->mainGrid()->results()->isUsingGlobalActiveIndex(resultIndices[cubeFaceIdx]);
|
edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx] = grid->mainGrid()->results()->isUsingGlobalActiveIndex(resultIndices[cubeFaceIdx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,18 +136,16 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
|||||||
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
|
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
|
||||||
size_t cellIndex = quadToCell[quadIdx];
|
size_t cellIndex = quadToCell[quadIdx];
|
||||||
|
|
||||||
size_t resultIndex = cellIndex;
|
size_t resultValueIndex = cellIndex;
|
||||||
if (cellScalarResultUseGlobalActiveIndex)
|
if (cellScalarResultUseGlobalActiveIndex)
|
||||||
{
|
{
|
||||||
resultIndex = grid->cell(cellIndex).globalActiveIndex();
|
resultValueIndex = grid->cell(cellIndex).globalActiveIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cellScalarResults )
|
|
||||||
{
|
{
|
||||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
double scalarValue = grid->mainGrid()->results()->cellScalarResult(timeStepIndex, cellResultSlot->gridScalarIndex(), resultValueIndex);
|
||||||
|
if (scalarValue != HUGE_VAL)
|
||||||
{
|
{
|
||||||
double scalarValue = (*cellScalarResults)[resultIndex];
|
|
||||||
|
|
||||||
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -174,19 +165,17 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
|||||||
{
|
{
|
||||||
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
edgeColor = -1.0f; // Undefined texture coord. Shader handles this.
|
||||||
|
|
||||||
resultIndex = cellIndex;
|
resultValueIndex = cellIndex;
|
||||||
if (edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx])
|
if (edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx])
|
||||||
{
|
{
|
||||||
resultIndex = grid->cell(cellIndex).globalActiveIndex();
|
resultValueIndex = grid->cell(cellIndex).globalActiveIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultIndices[cubeFaceIdx] != cvf::UNDEFINED_SIZE_T && resultIndex != cvf::UNDEFINED_SIZE_T)
|
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||||
|
double scalarValue = grid->mainGrid()->results()->cellScalarResult(0, resultIndices[cubeFaceIdx], resultValueIndex);
|
||||||
|
if (scalarValue != HUGE_VAL && scalarValue != ignoredScalarValue)
|
||||||
{
|
{
|
||||||
double scalarValue = (*(edgeScalarResults[cubeFaceIdx]))[resultIndex];
|
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||||
if(scalarValue != ignoredScalarValue)
|
|
||||||
{
|
|
||||||
edgeColor = edgeResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
cvf::FloatArray* colArr = cellEdgeColorTextureCoordsArrays.at(cubeFaceIdx);
|
||||||
@@ -250,6 +239,20 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
|
|||||||
&& m_defaultCellColor == otherCellFaceEffectGenerator->m_defaultCellColor
|
&& m_defaultCellColor == otherCellFaceEffectGenerator->m_defaultCellColor
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||||
|
|
||||||
|
if (otherCellFaceEffectGenerator->m_edgeScalarMapper.notNull())
|
||||||
|
{
|
||||||
|
otherCellFaceEffectGenerator->m_edgeScalarMapper->updateTexture(texImg2.p());
|
||||||
|
if (!caf::ScalarMapperEffectGenerator::isImagesEqual(m_edgeTextureImage.p(), texImg2.p())) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (otherCellFaceEffectGenerator->m_cellScalarMapper.notNull())
|
||||||
|
{
|
||||||
|
otherCellFaceEffectGenerator->m_cellScalarMapper->updateTexture(texImg2.p());
|
||||||
|
if (!caf::ScalarMapperEffectGenerator::isImagesEqual(m_cellTextureImage.p(), texImg2.p())) return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -264,6 +267,9 @@ bool CellEdgeEffectGenerator::isEqual(const EffectGenerator* other) const
|
|||||||
caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
|
caf::EffectGenerator* CellEdgeEffectGenerator::copy() const
|
||||||
{
|
{
|
||||||
CellEdgeEffectGenerator * newEffect = new CellEdgeEffectGenerator(m_edgeScalarMapper.p(), m_cellScalarMapper.p());
|
CellEdgeEffectGenerator * newEffect = new CellEdgeEffectGenerator(m_edgeScalarMapper.p(), m_cellScalarMapper.p());
|
||||||
|
newEffect->m_edgeTextureImage = m_edgeTextureImage;
|
||||||
|
newEffect->m_cellTextureImage = m_cellTextureImage;
|
||||||
|
|
||||||
newEffect->setOpacityLevel(m_opacityLevel);
|
newEffect->setOpacityLevel(m_opacityLevel);
|
||||||
newEffect->setCullBackfaces(m_cullBackfaces);
|
newEffect->setCullBackfaces(m_cullBackfaces);
|
||||||
newEffect->setUndefinedColor(m_undefinedColor);
|
newEffect->setUndefinedColor(m_undefinedColor);
|
||||||
@@ -316,23 +322,25 @@ void CellEdgeEffectGenerator::updateForShaderBasedRendering(cvf::Effect* effect)
|
|||||||
|
|
||||||
// Set up textures
|
// Set up textures
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> edgeTexImg = new cvf::TextureImage;
|
m_edgeTextureImage = new cvf::TextureImage;
|
||||||
cvf::ref<cvf::TextureImage> cellTexImg = new cvf::TextureImage;
|
m_cellTextureImage = new cvf::TextureImage;
|
||||||
|
|
||||||
m_edgeScalarMapper->updateTexture(edgeTexImg.p());
|
cvf::ref<cvf::TextureImage> modifiedCellTextImage;
|
||||||
|
m_edgeScalarMapper->updateTexture(m_edgeTextureImage.p());
|
||||||
if (m_cellScalarMapper.notNull())
|
if (m_cellScalarMapper.notNull())
|
||||||
{
|
{
|
||||||
m_cellScalarMapper->updateTexture(cellTexImg.p());
|
m_cellScalarMapper->updateTexture(m_cellTextureImage.p());
|
||||||
cellTexImg = caf::ScalarMapperEffectGenerator::addAlphaAndUndefStripes(cellTexImg.p(), m_undefinedColor, m_opacityLevel);
|
modifiedCellTextImage = caf::ScalarMapperEffectGenerator::addAlphaAndUndefStripes(m_cellTextureImage.p(), m_undefinedColor, m_opacityLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cellTexImg->allocate(2,1);
|
modifiedCellTextImage = new cvf::TextureImage;
|
||||||
cellTexImg->fill(cvf::Color4ub(cvf::Color4f(m_defaultCellColor, m_opacityLevel)));
|
modifiedCellTextImage->allocate(2,1);
|
||||||
|
modifiedCellTextImage->fill(cvf::Color4ub(cvf::Color4f(m_defaultCellColor, m_opacityLevel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
cvf::ref<cvf::Texture> edgeTexture = new cvf::Texture(edgeTexImg.p());
|
cvf::ref<cvf::Texture> edgeTexture = new cvf::Texture(m_edgeTextureImage.p());
|
||||||
cvf::ref<cvf::Texture> cellTexture = new cvf::Texture(cellTexImg.p());
|
cvf::ref<cvf::Texture> cellTexture = new cvf::Texture(modifiedCellTextImage.p());
|
||||||
|
|
||||||
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
||||||
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
|
sampler->setWrapMode(cvf::Sampler::CLAMP_TO_EDGE);
|
||||||
|
|||||||
@@ -58,17 +58,18 @@ public:
|
|||||||
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
||||||
void setDefaultCellColor(cvf::Color3f color) { m_defaultCellColor = color; }
|
void setDefaultCellColor(cvf::Color3f color) { m_defaultCellColor = color; }
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool isEqual( const EffectGenerator* other ) const;
|
virtual bool isEqual( const EffectGenerator* other ) const;
|
||||||
virtual EffectGenerator* copy() const;
|
virtual EffectGenerator* copy() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::cref<cvf::ScalarMapper> m_edgeScalarMapper;
|
cvf::cref<cvf::ScalarMapper> m_edgeScalarMapper;
|
||||||
cvf::cref<cvf::ScalarMapper> m_cellScalarMapper;
|
mutable cvf::ref<cvf::TextureImage> m_edgeTextureImage;
|
||||||
|
cvf::cref<cvf::ScalarMapper> m_cellScalarMapper;
|
||||||
|
mutable cvf::ref<cvf::TextureImage> m_cellTextureImage;
|
||||||
|
|
||||||
float m_opacityLevel;
|
float m_opacityLevel;
|
||||||
bool m_cullBackfaces;
|
bool m_cullBackfaces;
|
||||||
|
|||||||
@@ -588,16 +588,12 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
|||||||
const double lowerBound = (*pfIt)->lowerBound();
|
const double lowerBound = (*pfIt)->lowerBound();
|
||||||
const double upperBound = (*pfIt)->upperBound();
|
const double upperBound = (*pfIt)->upperBound();
|
||||||
|
|
||||||
const std::vector< std::vector<double> >& scalarResultTimeSteps = grid->mainGrid()->results()->cellScalarResults((*pfIt)->resultDefinition->gridScalarIndex());
|
size_t scalarResultIndex = (*pfIt)->resultDefinition->gridScalarIndex();
|
||||||
const std::vector< double >* scalarResult = NULL;
|
|
||||||
|
|
||||||
if ((*pfIt)->resultDefinition()->hasDynamicResult())
|
// Set time step to zero for static results
|
||||||
|
if ((*pfIt)->resultDefinition()->hasStaticResult())
|
||||||
{
|
{
|
||||||
scalarResult = &(scalarResultTimeSteps[timeStepIndex]);
|
timeStepIndex = 0;
|
||||||
}
|
|
||||||
else if ((*pfIt)->resultDefinition()->hasStaticResult())
|
|
||||||
{
|
|
||||||
scalarResult = &(scalarResultTimeSteps[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const RimCellFilter::FilterModeType filterType = (*pfIt)->filterMode();
|
const RimCellFilter::FilterModeType filterType = (*pfIt)->filterMode();
|
||||||
@@ -608,15 +604,13 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
|||||||
{
|
{
|
||||||
if ( (*cellVisibility)[cellIndex] )
|
if ( (*cellVisibility)[cellIndex] )
|
||||||
{
|
{
|
||||||
size_t resultIndex = cellIndex;
|
size_t resultValueIndex = cellIndex;
|
||||||
if (useGlobalActiveIndex)
|
if (useGlobalActiveIndex)
|
||||||
{
|
{
|
||||||
resultIndex = grid->cell(cellIndex).globalActiveIndex();
|
resultValueIndex = grid->cell(cellIndex).globalActiveIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
double scalarValue = HUGE_VAL;
|
double scalarValue = grid->mainGrid()->results()->cellScalarResult(timeStepIndex, scalarResultIndex, resultValueIndex);
|
||||||
if (resultIndex != cvf::UNDEFINED_SIZE_T) scalarValue = (*scalarResult)[resultIndex];
|
|
||||||
|
|
||||||
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
if (lowerBound <= scalarValue && scalarValue <= upperBound)
|
||||||
{
|
{
|
||||||
if (filterType == RimCellFilter::EXCLUDE)
|
if (filterType == RimCellFilter::EXCLUDE)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeResultSlot::calculateValueOptions(const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
optionList.push_front(caf::PdmOptionItemInfo( "None", "" ));
|
optionList.push_front(caf::PdmOptionItemInfo( RimDefines::undefinedResultName(), "" ));
|
||||||
|
|
||||||
if (useOptionsOnly) *useOptionsOnly = true;
|
if (useOptionsOnly) *useOptionsOnly = true;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ public:
|
|||||||
REMOVED
|
REMOVED
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString nonSelectedResultName() { return "None"; }
|
static QString undefinedResultName() { return "None"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,20 @@
|
|||||||
#include "RIStdInclude.h"
|
#include "RIStdInclude.h"
|
||||||
|
|
||||||
#include "RifReaderEclipseOutput.h"
|
#include "RifReaderEclipseOutput.h"
|
||||||
|
#include "RifReaderMockModel.h"
|
||||||
|
|
||||||
#include "RimReservoir.h"
|
#include "RimReservoir.h"
|
||||||
|
#include "RimReservoirView.h"
|
||||||
|
|
||||||
#include "RigReservoir.h"
|
#include "RigReservoir.h"
|
||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
#include "RigReservoirCellResults.h"
|
#include "RigReservoirCellResults.h"
|
||||||
|
|
||||||
#include "RimReservoirView.h"
|
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "RifReaderMockModel.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -39,6 +42,10 @@ RimReservoir::RimReservoir()
|
|||||||
m_rigReservoir = NULL;
|
m_rigReservoir = NULL;
|
||||||
|
|
||||||
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Case name", "", "" ,"");
|
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Case name", "", "" ,"");
|
||||||
|
// CAF_PDM_InitField(&releaseResultMemory, "ReleaseResultMemory", true, "Release result memory", "", "" ,"");
|
||||||
|
// releaseResultMemory.setIOReadable(false);
|
||||||
|
// releaseResultMemory.setIOWritable(false);
|
||||||
|
// releaseResultMemory.setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&reservoirViews, "ReservoirViews", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&reservoirViews, "ReservoirViews", "", "", "", "");
|
||||||
}
|
}
|
||||||
@@ -141,7 +148,7 @@ void RimReservoir::removeResult(const QString& resultName)
|
|||||||
// Set cell result variable to none if displaying
|
// Set cell result variable to none if displaying
|
||||||
if (result->resultVariable() == resultName)
|
if (result->resultVariable() == resultName)
|
||||||
{
|
{
|
||||||
result->resultVariable.v() = QString("None");
|
result->resultVariable.v() = RimDefines::undefinedResultName();
|
||||||
result->loadResult();
|
result->loadResult();
|
||||||
|
|
||||||
rebuildDisplayModel = true;
|
rebuildDisplayModel = true;
|
||||||
@@ -154,7 +161,7 @@ void RimReservoir::removeResult(const QString& resultName)
|
|||||||
RimCellPropertyFilter* propertyFilter = *it;
|
RimCellPropertyFilter* propertyFilter = *it;
|
||||||
if (propertyFilter->resultDefinition->resultVariable.v() == resultName)
|
if (propertyFilter->resultDefinition->resultVariable.v() == resultName)
|
||||||
{
|
{
|
||||||
propertyFilter->resultDefinition->resultVariable.v() = QString("None");
|
propertyFilter->resultDefinition->resultVariable.v() = RimDefines::undefinedResultName();
|
||||||
propertyFilter->resultDefinition->loadResult();
|
propertyFilter->resultDefinition->loadResult();
|
||||||
propertyFilter->setDefaultValues();
|
propertyFilter->setDefaultValues();
|
||||||
|
|
||||||
@@ -173,3 +180,43 @@ void RimReservoir::removeResult(const QString& resultName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimReservoir::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &releaseResultMemory)
|
||||||
|
{
|
||||||
|
if (m_rigReservoir.notNull())
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < reservoirViews().size(); i++)
|
||||||
|
{
|
||||||
|
RimReservoirView* reservoirView = reservoirViews()[i];
|
||||||
|
CVF_ASSERT(reservoirView);
|
||||||
|
|
||||||
|
RimResultSlot* result = reservoirView->cellResult;
|
||||||
|
CVF_ASSERT(result);
|
||||||
|
|
||||||
|
result->resultVariable.v() = RimDefines::undefinedResultName();
|
||||||
|
result->loadResult();
|
||||||
|
|
||||||
|
RimCellEdgeResultSlot* cellEdgeResult = reservoirView->cellEdgeResult;
|
||||||
|
CVF_ASSERT(cellEdgeResult);
|
||||||
|
|
||||||
|
cellEdgeResult->resultVariable.v() = RimDefines::undefinedResultName();
|
||||||
|
cellEdgeResult->loadResult();
|
||||||
|
|
||||||
|
reservoirView->createDisplayModelAndRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
RigReservoirCellResults* results = m_rigReservoir->mainGrid()->results();
|
||||||
|
if (results)
|
||||||
|
{
|
||||||
|
results->clearAllResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
releaseResultMemory = oldValue.toBool();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
class RigReservoir;
|
class RigReservoir;
|
||||||
class RigGridBase;
|
class RigGridBase;
|
||||||
class RimReservoirView;
|
class RimReservoirView;
|
||||||
@@ -55,6 +56,7 @@ public:
|
|||||||
|
|
||||||
// Fields:
|
// Fields:
|
||||||
caf::PdmField<QString> caseName;
|
caf::PdmField<QString> caseName;
|
||||||
|
caf::PdmField<bool> releaseResultMemory;
|
||||||
|
|
||||||
caf::PdmPointersField<RimReservoirView*> reservoirViews;
|
caf::PdmPointersField<RimReservoirView*> reservoirViews;
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ protected:
|
|||||||
// Overridden methods
|
// Overridden methods
|
||||||
virtual void initAfterRead();
|
virtual void initAfterRead();
|
||||||
|
|
||||||
|
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cvf::ref<RigReservoir> m_rigReservoir;
|
cvf::ref<RigReservoir> m_rigReservoir;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "RigGridBase.h"
|
#include "RigGridBase.h"
|
||||||
#include "RigReservoir.h"
|
#include "RigReservoir.h"
|
||||||
#include "RIApplication.h"
|
#include "RIApplication.h"
|
||||||
|
#include "RIPreferences.h"
|
||||||
|
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
#include "cafFrameAnimationControl.h"
|
#include "cafFrameAnimationControl.h"
|
||||||
@@ -665,7 +666,11 @@ void RimReservoirView::loadDataAndUpdate()
|
|||||||
RigReservoirCellResults* results = gridCellResults();
|
RigReservoirCellResults* results = gridCellResults();
|
||||||
CVF_ASSERT(results);
|
CVF_ASSERT(results);
|
||||||
|
|
||||||
results->loadOrComputeSOIL();
|
RIApplication* app = RIApplication::instance();
|
||||||
|
if (app->preferences()->autocomputeSOIL)
|
||||||
|
{
|
||||||
|
results->loadOrComputeSOIL();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ RimResultDefinition::RimResultDefinition()
|
|||||||
CAF_PDM_InitObject("Result Definition", "", "", "");
|
CAF_PDM_InitObject("Result Definition", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&resultType, "ResultType", "Type", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&resultType, "ResultType", "Type", "", "", "");
|
||||||
CAF_PDM_InitField(&resultVariable, "ResultVariable", RimDefines::nonSelectedResultName(), "Variable", "", "", "" );
|
CAF_PDM_InitField(&resultVariable, "ResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "" );
|
||||||
|
|
||||||
resultVariable.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
resultVariable.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ void RimResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
{
|
{
|
||||||
if (changedField == &resultType)
|
if (changedField == &resultType)
|
||||||
{
|
{
|
||||||
resultVariable = RimDefines::nonSelectedResultName();
|
resultVariable = RimDefines::undefinedResultName();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadResult();
|
loadResult();
|
||||||
@@ -118,7 +118,7 @@ QList<caf::PdmOptionItemInfo> RimResultDefinition::calculateValueOptions(const c
|
|||||||
{
|
{
|
||||||
optionList.push_back(caf::PdmOptionItemInfo( varList[i], varList[i]));
|
optionList.push_back(caf::PdmOptionItemInfo( varList[i], varList[i]));
|
||||||
}
|
}
|
||||||
optionList.push_front(caf::PdmOptionItemInfo( RimDefines::nonSelectedResultName(), RimDefines::nonSelectedResultName() ));
|
optionList.push_front(caf::PdmOptionItemInfo( RimDefines::undefinedResultName(), RimDefines::undefinedResultName() ));
|
||||||
|
|
||||||
if (useOptionsOnly) *useOptionsOnly = true;
|
if (useOptionsOnly) *useOptionsOnly = true;
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,10 @@ void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co
|
|||||||
changeLegendConfig(this->resultVariable());
|
changeLegendConfig(this->resultVariable());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newValue != "None") if (m_reservoirView) m_reservoirView->animationMode = true;
|
if (newValue != RimDefines::undefinedResultName())
|
||||||
|
{
|
||||||
|
if (m_reservoirView) m_reservoirView->animationMode = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue);
|
RimResultDefinition::fieldChangedByUi(changedField, oldValue, newValue);
|
||||||
|
|||||||
@@ -456,10 +456,7 @@ void RimUiTreeView::slotExecuteScript()
|
|||||||
arguments.append("-q");
|
arguments.append("-q");
|
||||||
arguments << calcScript->absolutePath();
|
arguments << calcScript->absolutePath();
|
||||||
|
|
||||||
if (!RIApplication::instance()->launchProcess(octavePath, arguments))
|
RIApplication::instance()->launchProcess(octavePath, arguments);
|
||||||
{
|
|
||||||
QMessageBox::warning(RIMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + octavePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,20 +250,16 @@ double RigGridBase::cellScalar(size_t timeStepIndex, size_t scalarSetIndex, size
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
double RigGridBase::cellScalar(size_t timeStepIndex, size_t scalarSetIndex, size_t cellIndex) const
|
double RigGridBase::cellScalar(size_t timeStepIndex, size_t scalarSetIndex, size_t cellIndex) const
|
||||||
{
|
{
|
||||||
size_t resultIndex = cellIndex;
|
size_t resultValueIndex = cellIndex;
|
||||||
|
|
||||||
bool useGlobalActiveIndex = m_mainGrid->results()->isUsingGlobalActiveIndex(scalarSetIndex);
|
bool useGlobalActiveIndex = m_mainGrid->results()->isUsingGlobalActiveIndex(scalarSetIndex);
|
||||||
if (useGlobalActiveIndex)
|
if (useGlobalActiveIndex)
|
||||||
{
|
{
|
||||||
resultIndex = cell(cellIndex).globalActiveIndex();
|
resultValueIndex = cell(cellIndex).globalActiveIndex();
|
||||||
if (resultIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL;
|
if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector< std::vector<double> >& scalarResult = m_mainGrid->results()->cellScalarResults(scalarSetIndex);
|
return m_mainGrid->results()->cellScalarResult(timeStepIndex, scalarSetIndex, resultValueIndex);
|
||||||
|
|
||||||
if (!(timeStepIndex < scalarResult.size() && resultIndex < scalarResult[timeStepIndex].size())) return HUGE_VAL;
|
|
||||||
|
|
||||||
return scalarResult[timeStepIndex][resultIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -347,6 +347,12 @@ bool RigReservoirBuilderMock::dynamicResult(RigReservoir* reservoir, const QStri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set result size to zero for some timesteps
|
||||||
|
if ((stepIndex + 1) % 3 == 0)
|
||||||
|
{
|
||||||
|
values->clear();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,11 +152,19 @@ std::vector< std::vector<double> > & RigReservoirCellResults::cellScalarResults(
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const std::vector< std::vector<double> >& RigReservoirCellResults::cellScalarResults( size_t scalarResultIndex ) const
|
double RigReservoirCellResults::cellScalarResult(size_t timeStepIndex, size_t scalarResultIndex, size_t resultValueIndex)
|
||||||
{
|
{
|
||||||
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
|
if (scalarResultIndex < resultCount() &&
|
||||||
|
timeStepIndex < m_cellScalarResults[scalarResultIndex].size() &&
|
||||||
return m_cellScalarResults[scalarResultIndex];
|
resultValueIndex != cvf::UNDEFINED_SIZE_T &&
|
||||||
|
resultValueIndex < m_cellScalarResults[scalarResultIndex][timeStepIndex].size())
|
||||||
|
{
|
||||||
|
return m_cellScalarResults[scalarResultIndex][timeStepIndex][resultValueIndex];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return HUGE_VAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -172,8 +180,10 @@ size_t RigReservoirCellResults::findOrLoadScalarResult(RimDefines::ResultCatType
|
|||||||
|
|
||||||
if (cellScalarResults(resultGridIndex).size()) return resultGridIndex;
|
if (cellScalarResults(resultGridIndex).size()) return resultGridIndex;
|
||||||
|
|
||||||
// Generated and Input properties should always be loaded up front.
|
if (type == RimDefines::GENERATED)
|
||||||
CVF_ASSERT(type == RimDefines::STATIC_NATIVE || type == RimDefines::DYNAMIC_NATIVE);
|
{
|
||||||
|
return cvf::UNDEFINED_SIZE_T;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_readerInterface.notNull())
|
if (m_readerInterface.notNull())
|
||||||
{
|
{
|
||||||
@@ -475,3 +485,15 @@ void RigReservoirCellResults::removeResult(const QString& resultName)
|
|||||||
|
|
||||||
m_resultInfos[resultIdx].m_resultType = RimDefines::REMOVED;
|
m_resultInfos[resultIdx].m_resultType = RimDefines::REMOVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigReservoirCellResults::clearAllResults()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_cellScalarResults.size(); i++)
|
||||||
|
{
|
||||||
|
m_cellScalarResults[i].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,12 +58,13 @@ public:
|
|||||||
QString makeResultNameUnique(const QString& resultNameProposal) const;
|
QString makeResultNameUnique(const QString& resultNameProposal) const;
|
||||||
|
|
||||||
void removeResult(const QString& resultName);
|
void removeResult(const QString& resultName);
|
||||||
|
void clearAllResults();
|
||||||
|
|
||||||
void loadOrComputeSOIL();
|
void loadOrComputeSOIL();
|
||||||
|
|
||||||
// Access the results data
|
// Access the results data
|
||||||
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex);
|
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex);
|
||||||
const std::vector< std::vector<double> >& cellScalarResults(size_t scalarResultIndex) const;
|
double cellScalarResult(size_t timeStepIndex, size_t scalarResultIndex, size_t resultValueIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results for each timestep for each Result index (ResultVariable)
|
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results for each timestep for each Result index (ResultVariable)
|
||||||
|
|||||||
@@ -243,14 +243,6 @@ void RIMainWindow::createActions()
|
|||||||
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
||||||
|
|
||||||
// Debug actions
|
// Debug actions
|
||||||
m_debugUseShaders = new QAction("Use shaders", this);
|
|
||||||
m_debugUseShaders->setCheckable(true);
|
|
||||||
connect(m_debugUseShaders, SIGNAL(triggered(bool)), SLOT(slotUseShaders(bool)));
|
|
||||||
|
|
||||||
m_performanceHud = new QAction("Show Performance Info", this);
|
|
||||||
m_performanceHud->setCheckable(true);
|
|
||||||
connect(m_performanceHud, SIGNAL(triggered(bool)), SLOT(slotShowPerformanceInfo(bool)));
|
|
||||||
|
|
||||||
m_newPropertyView = new QAction("New Property View", this);
|
m_newPropertyView = new QAction("New Property View", this);
|
||||||
connect(m_newPropertyView, SIGNAL(triggered()), SLOT(slotNewObjectPropertyView()));
|
connect(m_newPropertyView, SIGNAL(triggered()), SLOT(slotNewObjectPropertyView()));
|
||||||
|
|
||||||
@@ -309,8 +301,6 @@ void RIMainWindow::createMenus()
|
|||||||
debugMenu->addAction(m_mockLargeResultsModelAction);
|
debugMenu->addAction(m_mockLargeResultsModelAction);
|
||||||
debugMenu->addAction(m_mockInputModelAction);
|
debugMenu->addAction(m_mockInputModelAction);
|
||||||
debugMenu->addSeparator();
|
debugMenu->addSeparator();
|
||||||
debugMenu->addAction(m_debugUseShaders);
|
|
||||||
debugMenu->addAction(m_performanceHud);
|
|
||||||
debugMenu->addAction(m_newPropertyView);
|
debugMenu->addAction(m_newPropertyView);
|
||||||
|
|
||||||
connect(debugMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshDebugActions()));
|
connect(debugMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshDebugActions()));
|
||||||
@@ -1036,8 +1026,6 @@ void RIMainWindow::slotShowPerformanceInfo(bool enable)
|
|||||||
void RIMainWindow::slotRefreshDebugActions()
|
void RIMainWindow::slotRefreshDebugActions()
|
||||||
{
|
{
|
||||||
RIApplication* app = RIApplication::instance();
|
RIApplication* app = RIApplication::instance();
|
||||||
m_debugUseShaders->setChecked(app->useShaders());
|
|
||||||
m_performanceHud->setChecked(app->showPerformanceInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ private:
|
|||||||
QAction* m_zoomAll;
|
QAction* m_zoomAll;
|
||||||
|
|
||||||
// Debug actions
|
// Debug actions
|
||||||
QAction* m_debugUseShaders;
|
|
||||||
QAction* m_performanceHud;
|
|
||||||
QAction* m_newPropertyView;
|
QAction* m_newPropertyView;
|
||||||
|
|
||||||
// Help actions
|
// Help actions
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "RIProcessMonitor.h"
|
#include "RIProcessMonitor.h"
|
||||||
#include "cafUiProcess.h"
|
#include "cafUiProcess.h"
|
||||||
|
#include "RIApplication.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -38,6 +39,15 @@ RIProcessMonitor::RIProcessMonitor(QDockWidget* pParent)
|
|||||||
pTopLayout->addWidget(pLabel);
|
pTopLayout->addWidget(pLabel);
|
||||||
pTopLayout->addWidget(m_labelStatus);
|
pTopLayout->addWidget(m_labelStatus);
|
||||||
|
|
||||||
|
pTopLayout->addStretch();
|
||||||
|
QPushButton* clearPushButton = new QPushButton("Clear", this);
|
||||||
|
pTopLayout->addWidget(clearPushButton);
|
||||||
|
connect(clearPushButton, SIGNAL(clicked()), this, SLOT(slotClearTextEdit()) );
|
||||||
|
|
||||||
|
m_terminatePushButton = new QPushButton("Stop", this);
|
||||||
|
pTopLayout->addWidget(m_terminatePushButton);
|
||||||
|
connect(m_terminatePushButton, SIGNAL(clicked()), this, SLOT(slotTerminateProcess()) );
|
||||||
|
m_terminatePushButton->setEnabled(false);
|
||||||
|
|
||||||
m_textEdit = new QPlainTextEdit(this);
|
m_textEdit = new QPlainTextEdit(this);
|
||||||
m_textEdit->setReadOnly(true);
|
m_textEdit->setReadOnly(true);
|
||||||
@@ -72,7 +82,6 @@ RIProcessMonitor::~RIProcessMonitor()
|
|||||||
void RIProcessMonitor::startMonitorWorkProcess(caf::UiProcess* pProcess)
|
void RIProcessMonitor::startMonitorWorkProcess(caf::UiProcess* pProcess)
|
||||||
{
|
{
|
||||||
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
||||||
m_textEdit->clear();
|
|
||||||
|
|
||||||
if (m_monitoredProcess == pProcess) return;
|
if (m_monitoredProcess == pProcess) return;
|
||||||
|
|
||||||
@@ -82,6 +91,11 @@ void RIProcessMonitor::startMonitorWorkProcess(caf::UiProcess* pProcess)
|
|||||||
connect(m_monitoredProcess, SIGNAL(signalStatusMsg(const QString&, int)), SLOT(slotShowProcStatusMsg(const QString&, int)));
|
connect(m_monitoredProcess, SIGNAL(signalStatusMsg(const QString&, int)), SLOT(slotShowProcStatusMsg(const QString&, int)));
|
||||||
connect(m_monitoredProcess, SIGNAL(readyReadStandardError()), SLOT(slotProcReadyReadStdErr()));
|
connect(m_monitoredProcess, SIGNAL(readyReadStandardError()), SLOT(slotProcReadyReadStdErr()));
|
||||||
connect(m_monitoredProcess, SIGNAL(readyReadStandardOutput()), SLOT(slotProcReadyReadStdOut()));
|
connect(m_monitoredProcess, SIGNAL(readyReadStandardOutput()), SLOT(slotProcReadyReadStdOut()));
|
||||||
|
|
||||||
|
m_terminatePushButton->setEnabled(true);
|
||||||
|
|
||||||
|
QString timeStamp = QTime::currentTime().toString("hh:mm:ss");
|
||||||
|
addStringToLog(timeStamp + " Process starting\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +106,12 @@ void RIProcessMonitor::stopMonitorWorkProcess()
|
|||||||
{
|
{
|
||||||
m_monitoredProcess = NULL;
|
m_monitoredProcess = NULL;
|
||||||
|
|
||||||
|
m_terminatePushButton->setEnabled(false);
|
||||||
|
|
||||||
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
||||||
|
|
||||||
|
QString timeStamp = QTime::currentTime().toString("hh:mm:ss");
|
||||||
|
addStringToLog(timeStamp + " Process finished\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -166,3 +185,22 @@ void RIProcessMonitor::slotProcReadyReadStdErr()
|
|||||||
addStringToLog(dataArray.data());
|
addStringToLog(dataArray.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RIProcessMonitor::slotTerminateProcess()
|
||||||
|
{
|
||||||
|
addStringToLog("Process terminated by user\n");
|
||||||
|
|
||||||
|
RIApplication* app = RIApplication::instance();
|
||||||
|
app->terminateProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RIProcessMonitor::slotClearTextEdit()
|
||||||
|
{
|
||||||
|
m_textEdit->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@@ -40,6 +41,7 @@ class RIProcessMonitor : public QWidget
|
|||||||
private:
|
private:
|
||||||
QLabel* m_labelStatus; // Shows current status string
|
QLabel* m_labelStatus; // Shows current status string
|
||||||
QPlainTextEdit* m_textEdit; // Showing the textual output from the process
|
QPlainTextEdit* m_textEdit; // Showing the textual output from the process
|
||||||
|
QPushButton* m_terminatePushButton;
|
||||||
|
|
||||||
caf::UiProcess* m_monitoredProcess; // Pointer to the process we're monitoring. Needed to fetch text
|
caf::UiProcess* m_monitoredProcess; // Pointer to the process we're monitoring. Needed to fetch text
|
||||||
|
|
||||||
@@ -58,5 +60,7 @@ private slots:
|
|||||||
void slotShowProcStatusMsg(const QString& message, int messageType);
|
void slotShowProcStatusMsg(const QString& message, int messageType);
|
||||||
void slotProcReadyReadStdOut();
|
void slotProcReadyReadStdOut();
|
||||||
void slotProcReadyReadStdErr();
|
void slotProcReadyReadStdErr();
|
||||||
|
void slotTerminateProcess();
|
||||||
|
void slotClearTextEdit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "cafUtils.h"
|
#include "cafUtils.h"
|
||||||
#include "cafFrameAnimationControl.h"
|
#include "cafFrameAnimationControl.h"
|
||||||
#include "cafNavigationPolicy.h"
|
#include "cafNavigationPolicy.h"
|
||||||
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
using cvf::ManipulatorTrackball;
|
using cvf::ManipulatorTrackball;
|
||||||
|
|
||||||
@@ -255,6 +256,8 @@ void RIViewer::slotEndAnimation()
|
|||||||
if (m_reservoirView) m_reservoirView->endAnimation();
|
if (m_reservoirView) m_reservoirView->endAnimation();
|
||||||
|
|
||||||
caf::Viewer::slotEndAnimation();
|
caf::Viewer::slotEndAnimation();
|
||||||
|
|
||||||
|
caf::EffectGenerator::releaseUnreferencedEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ENDIF()
|
|||||||
|
|
||||||
set(CMAKE_MAJOR_VERSION 0)
|
set(CMAKE_MAJOR_VERSION 0)
|
||||||
set(CMAKE_MINOR_VERSION 8)
|
set(CMAKE_MINOR_VERSION 8)
|
||||||
set(CMAKE_PATCH_VERSION 0)
|
set(CMAKE_PATCH_VERSION 6)
|
||||||
|
|
||||||
set(PRODUCTVER ${CMAKE_MAJOR_VERSION},${CMAKE_MINOR_VERSION},0,${CMAKE_PATCH_VERSION})
|
set(PRODUCTVER ${CMAKE_MAJOR_VERSION},${CMAKE_MINOR_VERSION},0,${CMAKE_PATCH_VERSION})
|
||||||
set(STRPRODUCTVER ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
|
set(STRPRODUCTVER ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ EffectCache* EffectCache::instance()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::Effect> EffectCache::getOrCreateEffect(const EffectGenerator* generator)
|
cvf::Effect* EffectCache::findEffect(const EffectGenerator* generator)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(generator);
|
CVF_ASSERT(generator);
|
||||||
|
|
||||||
@@ -69,18 +69,11 @@ cvf::ref<cvf::Effect> EffectCache::getOrCreateEffect(const EffectGenerator* gene
|
|||||||
{
|
{
|
||||||
cvf::ref<cvf::Effect> effect = m_effectCache[i].second;
|
cvf::ref<cvf::Effect> effect = m_effectCache[i].second;
|
||||||
EffectGenerator* effGen = m_effectCache[i].first;
|
EffectGenerator* effGen = m_effectCache[i].first;
|
||||||
effGen->updateEffect(effect.p());
|
return effect.p();
|
||||||
|
|
||||||
return effect;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectGenerator* myCopy = generator->copy();
|
return NULL;
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> eff = generator->generateEffect();
|
|
||||||
m_effectCache.push_back(std::make_pair(myCopy, eff));
|
|
||||||
|
|
||||||
return eff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -98,5 +91,38 @@ void EffectCache::clear()
|
|||||||
m_effectCache.clear();
|
m_effectCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EffectCache::addEffect(const EffectGenerator* generator, cvf::Effect* effect)
|
||||||
|
{
|
||||||
|
EffectGenerator* myCopy = generator->copy();
|
||||||
|
m_effectCache.push_back(std::make_pair(myCopy, effect));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EffectCache::releaseUnreferencedEffects()
|
||||||
|
{
|
||||||
|
std::vector<std::pair<EffectGenerator*, cvf::ref<cvf::Effect> > > newCache;
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < m_effectCache.size(); i++)
|
||||||
|
{
|
||||||
|
if (m_effectCache[i].second.p()->refCount() <= 1 )
|
||||||
|
{
|
||||||
|
m_effectCache[i].second = NULL;
|
||||||
|
delete m_effectCache[i].first;
|
||||||
|
m_effectCache[i].first = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newCache.push_back(m_effectCache[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_effectCache.swap(newCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,26 +25,30 @@
|
|||||||
|
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
//
|
// Private class. Used only by caf::EffectGenerator to cache effects (with GPU resources)
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class EffectCache
|
class EffectCache
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
|
friend class EffectGenerator;
|
||||||
EffectCache();
|
EffectCache();
|
||||||
|
|
||||||
static EffectCache* instance();
|
static EffectCache* instance();
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> getOrCreateEffect(const EffectGenerator* generator);
|
cvf::Effect* findEffect(const EffectGenerator* generator);
|
||||||
void clear();
|
void addEffect(const EffectGenerator* generator, cvf::Effect* effect);
|
||||||
|
|
||||||
|
void releaseUnreferencedEffects();
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EffectGenerator::RenderingModeType m_effectType;
|
EffectGenerator::RenderingModeType m_effectType;
|
||||||
|
|
||||||
std::vector<std::pair<EffectGenerator*, cvf::ref<cvf::Effect> > > m_effectCache;
|
std::vector<std::pair<EffectGenerator*, cvf::ref<cvf::Effect> > > m_effectCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "cvfSampler.h"
|
#include "cvfSampler.h"
|
||||||
|
|
||||||
#include <QtOpenGL/QGLFormat>
|
#include <QtOpenGL/QGLFormat>
|
||||||
|
#include "cafEffectCache.h"
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
|
|
||||||
@@ -66,7 +67,13 @@ EffectGenerator::RenderingModeType EffectGenerator::renderingMode()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::Effect> EffectGenerator::generateEffect() const
|
cvf::ref<cvf::Effect> EffectGenerator::generateEffect() const
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::Effect> eff = new cvf::Effect;
|
|
||||||
|
cvf::ref<cvf::Effect> eff = caf::EffectCache::instance()->findEffect(this);
|
||||||
|
|
||||||
|
if (eff.notNull()) return eff.p();
|
||||||
|
|
||||||
|
eff = new cvf::Effect;
|
||||||
|
|
||||||
if (sm_renderingMode == SHADER_BASED)
|
if (sm_renderingMode == SHADER_BASED)
|
||||||
{
|
{
|
||||||
updateForShaderBasedRendering(eff.p());
|
updateForShaderBasedRendering(eff.p());
|
||||||
@@ -76,6 +83,8 @@ cvf::ref<cvf::Effect> EffectGenerator::generateEffect() const
|
|||||||
updateForFixedFunctionRendering(eff.p());
|
updateForFixedFunctionRendering(eff.p());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caf::EffectCache::instance()->addEffect(this, eff.p());
|
||||||
|
|
||||||
return eff;
|
return eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +113,22 @@ void EffectGenerator::updateEffect(cvf::Effect* effect) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EffectGenerator::clearEffectCache()
|
||||||
|
{
|
||||||
|
EffectCache::instance()->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void EffectGenerator::releaseUnreferencedEffects()
|
||||||
|
{
|
||||||
|
EffectCache::instance()->releaseUnreferencedEffects();
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
// SurfaceEffectGenerator
|
// SurfaceEffectGenerator
|
||||||
@@ -272,10 +297,10 @@ void ScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::Effect* eff
|
|||||||
|
|
||||||
// Result mapping texture
|
// Result mapping texture
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> texImg = new cvf::TextureImage;
|
m_textureImage = new cvf::TextureImage();
|
||||||
m_scalarMapper->updateTexture(texImg.p());
|
m_scalarMapper->updateTexture(m_textureImage.p());
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(texImg.p(), m_undefinedColor, m_opacityLevel);
|
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(m_textureImage.p(), m_undefinedColor, m_opacityLevel);
|
||||||
|
|
||||||
cvf::ref<cvf::Texture> texture = new cvf::Texture(modTexImg.p());
|
cvf::ref<cvf::Texture> texture = new cvf::Texture(modTexImg.p());
|
||||||
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
||||||
@@ -308,10 +333,10 @@ void ScalarMapperEffectGenerator::updateForFixedFunctionRendering(cvf::Effect* e
|
|||||||
|
|
||||||
// Result mapping texture
|
// Result mapping texture
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> texImg = new cvf::TextureImage;
|
m_textureImage = new cvf::TextureImage;
|
||||||
m_scalarMapper->updateTexture(texImg.p());
|
m_scalarMapper->updateTexture(m_textureImage.p());
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(texImg.p(), m_undefinedColor, m_opacityLevel);
|
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(m_textureImage.p(), m_undefinedColor, m_opacityLevel);
|
||||||
|
|
||||||
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(modTexImg.p());
|
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(modTexImg.p());
|
||||||
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
||||||
@@ -374,7 +399,10 @@ bool ScalarMapperEffectGenerator::isEqual(const EffectGenerator* other) const
|
|||||||
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
|
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor
|
||||||
&& m_cullBackfaces == otherTextureResultEffect->m_cullBackfaces)
|
&& m_cullBackfaces == otherTextureResultEffect->m_cullBackfaces)
|
||||||
{
|
{
|
||||||
return true;
|
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||||
|
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p());
|
||||||
|
|
||||||
|
return ScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,6 +415,7 @@ bool ScalarMapperEffectGenerator::isEqual(const EffectGenerator* other) const
|
|||||||
EffectGenerator* ScalarMapperEffectGenerator::copy() const
|
EffectGenerator* ScalarMapperEffectGenerator::copy() const
|
||||||
{
|
{
|
||||||
ScalarMapperEffectGenerator* scEffGen = new ScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
|
ScalarMapperEffectGenerator* scEffGen = new ScalarMapperEffectGenerator(m_scalarMapper.p(), m_polygonOffset);
|
||||||
|
scEffGen->m_textureImage = m_textureImage;
|
||||||
scEffGen->m_opacityLevel = m_opacityLevel;
|
scEffGen->m_opacityLevel = m_opacityLevel;
|
||||||
scEffGen->m_undefinedColor = m_undefinedColor;
|
scEffGen->m_undefinedColor = m_undefinedColor;
|
||||||
scEffGen->m_cullBackfaces = m_cullBackfaces;
|
scEffGen->m_cullBackfaces = m_cullBackfaces;
|
||||||
@@ -419,6 +448,32 @@ ScalarMapperEffectGenerator::addAlphaAndUndefStripes(const cvf::TextureImage* te
|
|||||||
return modTexImg;
|
return modTexImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Tests whether two texture images are equal. It might in some rare cases not detect the difference
|
||||||
|
/// but to make the comparison fast only some sampling points are used. If both pointers are NULL,
|
||||||
|
/// they are considered equal.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool ScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2)
|
||||||
|
{
|
||||||
|
if (texImg1 == NULL && texImg2 == NULL ) return true;
|
||||||
|
|
||||||
|
if ( texImg1 != NULL && texImg2 != NULL
|
||||||
|
&& texImg1->height() == texImg2->height()
|
||||||
|
&& texImg1->width() == texImg2->width()
|
||||||
|
&& texImg1->width() > 0 && texImg1->height() > 0
|
||||||
|
&& texImg1->pixel(0,0) == texImg2->pixel(0,0)
|
||||||
|
&& texImg1->pixel( texImg1->width()-1, texImg1->height()-1) == texImg2->pixel(texImg1->width()-1, texImg1->height()-1)
|
||||||
|
&& texImg1->pixel( texImg1->width()/2, texImg1->height()/2) == texImg2->pixel(texImg1->width()/2, texImg1->height()/2)
|
||||||
|
&& texImg1->pixel( texImg1->width()/4, texImg1->height()/4) == texImg2->pixel(texImg1->width()/4, texImg1->height()/4)
|
||||||
|
&& texImg1->pixel( texImg1->width()/2 + texImg1->width()/4, texImg1->height()/2 + texImg1->height()/4) == texImg2->pixel(texImg1->width()/2 + texImg1->width()/4, texImg1->height()/2 + texImg1->height()/4 )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -456,10 +511,10 @@ void ScalarMapperMeshEffectGenerator::updateForShaderBasedRendering(cvf::Effect*
|
|||||||
|
|
||||||
// Result mapping texture
|
// Result mapping texture
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> texImg = new cvf::TextureImage;
|
m_textureImage = new cvf::TextureImage;
|
||||||
m_scalarMapper->updateTexture(texImg.p());
|
m_scalarMapper->updateTexture(m_textureImage.p());
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(texImg.p(), m_undefinedColor, m_opacityLevel);
|
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(m_textureImage.p(), m_undefinedColor, m_opacityLevel);
|
||||||
|
|
||||||
cvf::ref<cvf::Texture> texture = new cvf::Texture(modTexImg.p());
|
cvf::ref<cvf::Texture> texture = new cvf::Texture(modTexImg.p());
|
||||||
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
cvf::ref<cvf::Sampler> sampler = new cvf::Sampler;
|
||||||
@@ -490,10 +545,10 @@ void ScalarMapperMeshEffectGenerator::updateForFixedFunctionRendering(cvf::Effec
|
|||||||
|
|
||||||
// Result mapping texture
|
// Result mapping texture
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> texImg = new cvf::TextureImage;
|
m_textureImage = new cvf::TextureImage;
|
||||||
m_scalarMapper->updateTexture(texImg.p());
|
m_scalarMapper->updateTexture(m_textureImage.p());
|
||||||
|
|
||||||
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(texImg.p(), m_undefinedColor, m_opacityLevel);
|
cvf::ref<cvf::TextureImage> modTexImg = ScalarMapperEffectGenerator::addAlphaAndUndefStripes(m_textureImage.p(), m_undefinedColor, m_opacityLevel);
|
||||||
|
|
||||||
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(modTexImg.p());
|
cvf::ref<cvf::Texture2D_FF> texture = new cvf::Texture2D_FF(modTexImg.p());
|
||||||
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
texture->setWrapMode(cvf::Texture2D_FF::CLAMP);
|
||||||
@@ -541,7 +596,10 @@ bool ScalarMapperMeshEffectGenerator::isEqual(const EffectGenerator* other) cons
|
|||||||
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
|
&& m_opacityLevel == otherTextureResultEffect->m_opacityLevel
|
||||||
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor)
|
&& m_undefinedColor == otherTextureResultEffect->m_undefinedColor)
|
||||||
{
|
{
|
||||||
return true;
|
cvf::ref<cvf::TextureImage> texImg2 = new cvf::TextureImage;
|
||||||
|
otherTextureResultEffect->m_scalarMapper->updateTexture(texImg2.p());
|
||||||
|
|
||||||
|
return ScalarMapperEffectGenerator::isImagesEqual(m_textureImage.p(), texImg2.p());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,6 +612,7 @@ bool ScalarMapperMeshEffectGenerator::isEqual(const EffectGenerator* other) cons
|
|||||||
EffectGenerator* ScalarMapperMeshEffectGenerator::copy() const
|
EffectGenerator* ScalarMapperMeshEffectGenerator::copy() const
|
||||||
{
|
{
|
||||||
ScalarMapperMeshEffectGenerator* scEffGen = new ScalarMapperMeshEffectGenerator(m_scalarMapper.p());
|
ScalarMapperMeshEffectGenerator* scEffGen = new ScalarMapperMeshEffectGenerator(m_scalarMapper.p());
|
||||||
|
scEffGen->m_textureImage = m_textureImage;
|
||||||
scEffGen->m_opacityLevel = m_opacityLevel;
|
scEffGen->m_opacityLevel = m_opacityLevel;
|
||||||
scEffGen->m_undefinedColor = m_undefinedColor;
|
scEffGen->m_undefinedColor = m_undefinedColor;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
#include "cvfEffect.h"
|
#include "cvfEffect.h"
|
||||||
#include "cvfScalarMapper.h"
|
#include "cvfScalarMapper.h"
|
||||||
|
#include "cvfTextureImage.h"
|
||||||
#include "cvfCollection.h"
|
#include "cvfCollection.h"
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
@@ -41,16 +42,22 @@ public:
|
|||||||
EffectGenerator() {}
|
EffectGenerator() {}
|
||||||
virtual ~EffectGenerator() {}
|
virtual ~EffectGenerator() {}
|
||||||
|
|
||||||
|
cvf::ref<cvf::Effect> generateEffect() const;
|
||||||
|
void updateEffect(cvf::Effect* effect) const;
|
||||||
|
|
||||||
static void setRenderingMode(RenderingModeType effectType);
|
static void setRenderingMode(RenderingModeType effectType);
|
||||||
static RenderingModeType renderingMode();
|
static RenderingModeType renderingMode();
|
||||||
|
|
||||||
cvf::ref<cvf::Effect> generateEffect() const;
|
static void clearEffectCache();
|
||||||
void updateEffect(cvf::Effect* effect) const;
|
static void releaseUnreferencedEffects();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// Interface that must be implemented in base classes
|
// Interface that must be implemented in base classes
|
||||||
virtual bool isEqual(const EffectGenerator* other) const = 0;
|
virtual bool isEqual(const EffectGenerator* other) const = 0;
|
||||||
virtual EffectGenerator* copy() const = 0;
|
virtual EffectGenerator* copy() const = 0;
|
||||||
protected:
|
friend class EffectCache;
|
||||||
|
|
||||||
// When these are called, the effect is already cleared by updateEffect()
|
// When these are called, the effect is already cleared by updateEffect()
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const = 0;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const = 0;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const = 0;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const = 0;
|
||||||
@@ -73,10 +80,10 @@ public:
|
|||||||
|
|
||||||
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool isEqual(const EffectGenerator* other) const;
|
virtual bool isEqual(const EffectGenerator* other) const;
|
||||||
virtual EffectGenerator* copy() const;
|
virtual EffectGenerator* copy() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||||
|
|
||||||
@@ -104,15 +111,14 @@ public:
|
|||||||
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
|
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
|
||||||
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
||||||
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
void setCullBackfaces(bool cullBackFaces) { m_cullBackfaces = cullBackFaces; }
|
||||||
|
public:
|
||||||
|
static cvf::ref<cvf::TextureImage> addAlphaAndUndefStripes(const cvf::TextureImage* texImg, const cvf::Color3f& undefScalarColor, float opacityLevel);
|
||||||
|
static bool isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2);
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool isEqual(const EffectGenerator* other) const;
|
virtual bool isEqual(const EffectGenerator* other) const;
|
||||||
virtual EffectGenerator* copy() const;
|
virtual EffectGenerator* copy() const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
static cvf::ref<cvf::TextureImage> addAlphaAndUndefStripes(const cvf::TextureImage* texImg, const cvf::Color3f& undefScalarColor, float opacityLevel);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||||
|
|
||||||
@@ -121,6 +127,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::cref<cvf::ScalarMapper> m_scalarMapper;
|
cvf::cref<cvf::ScalarMapper> m_scalarMapper;
|
||||||
|
mutable cvf::ref<cvf::TextureImage> m_textureImage;
|
||||||
bool m_polygonOffset;
|
bool m_polygonOffset;
|
||||||
float m_opacityLevel;
|
float m_opacityLevel;
|
||||||
cvf::Color3f m_undefinedColor;
|
cvf::Color3f m_undefinedColor;
|
||||||
@@ -141,10 +148,10 @@ public:
|
|||||||
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
|
void setOpacityLevel(float opacity) { m_opacityLevel = cvf::Math::clamp(opacity, 0.0f , 1.0f ); }
|
||||||
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
void setUndefinedColor(cvf::Color3f color) { m_undefinedColor = color; }
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool isEqual(const EffectGenerator* other) const;
|
virtual bool isEqual(const EffectGenerator* other) const;
|
||||||
virtual EffectGenerator* copy() const;
|
virtual EffectGenerator* copy() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||||
|
|
||||||
@@ -153,6 +160,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::cref<cvf::ScalarMapper> m_scalarMapper;
|
cvf::cref<cvf::ScalarMapper> m_scalarMapper;
|
||||||
|
mutable cvf::ref<cvf::TextureImage> m_textureImage;
|
||||||
float m_opacityLevel;
|
float m_opacityLevel;
|
||||||
cvf::Color3f m_undefinedColor;
|
cvf::Color3f m_undefinedColor;
|
||||||
};
|
};
|
||||||
@@ -167,10 +175,11 @@ class MeshEffectGenerator : public EffectGenerator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MeshEffectGenerator(const cvf::Color3f& color);
|
MeshEffectGenerator(const cvf::Color3f& color);
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual bool isEqual(const EffectGenerator* other) const;
|
virtual bool isEqual(const EffectGenerator* other) const;
|
||||||
virtual EffectGenerator* copy() const;
|
virtual EffectGenerator* copy() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
virtual void updateForShaderBasedRendering(cvf::Effect* effect) const;
|
||||||
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
virtual void updateForFixedFunctionRendering(cvf::Effect* effect) const;
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ DEFUN_DLD (riGetMainGridDimensions, args, nargout,
|
|||||||
" riGetMainGridDimensions( [CaseName/CaseIndex])\n"
|
" riGetMainGridDimensions( [CaseName/CaseIndex])\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Returns a vector of size 3: [ICount, JCount, KCount] \n"
|
"Returns a vector of size 3: [ICount, JCount, KCount] \n"
|
||||||
"Containing the dimentions of the main grid in the requested case.\n"
|
"Containing the dimensions of the main grid in the requested case.\n"
|
||||||
"If the Eclipse Case is not defined, the active View in ResInsight is used."
|
"If the Eclipse Case is not defined, the active View in ResInsight is used."
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -347,13 +347,10 @@ QString BasicAboutDialog::openGLVersionString() const
|
|||||||
|
|
||||||
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
|
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
|
||||||
|
|
||||||
if (false) ;
|
if (flags & QGLFormat::OpenGL_Version_4_0 ) versionString += "4.0";
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
|
|
||||||
else if (flags & QGLFormat::OpenGL_Version_4_0 ) versionString += "4.0";
|
|
||||||
else if (flags & QGLFormat::OpenGL_Version_3_3 ) versionString += "3.3";
|
else if (flags & QGLFormat::OpenGL_Version_3_3 ) versionString += "3.3";
|
||||||
else if (flags & QGLFormat::OpenGL_Version_3_2 ) versionString += "3.2";
|
else if (flags & QGLFormat::OpenGL_Version_3_2 ) versionString += "3.2";
|
||||||
else if (flags & QGLFormat::OpenGL_Version_3_1 ) versionString += "3.1";
|
else if (flags & QGLFormat::OpenGL_Version_3_1 ) versionString += "3.1";
|
||||||
#endif /* QT_VERSION > 4.7 */
|
|
||||||
else if (flags & QGLFormat::OpenGL_Version_3_0 ) versionString += "3.0";
|
else if (flags & QGLFormat::OpenGL_Version_3_0 ) versionString += "3.0";
|
||||||
else if (flags & QGLFormat::OpenGL_ES_Version_2_0 ) versionString += "ES_Version 2.0";
|
else if (flags & QGLFormat::OpenGL_ES_Version_2_0 ) versionString += "ES_Version 2.0";
|
||||||
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1) versionString += "ES_CommonLite_Version 1.1";
|
else if (flags & QGLFormat::OpenGL_ES_CommonLite_Version_1_1) versionString += "ES_CommonLite_Version 1.1";
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void FrameAnimationControl::slotTimerTriggered()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stop();
|
m_timer->stop();
|
||||||
m_currentFrame = m_numFrames - 1;
|
m_currentFrame = m_numFrames - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,7 @@ void FrameAnimationControl::slotTimerTriggered()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stop();
|
m_timer->stop();
|
||||||
m_currentFrame = 0;
|
m_currentFrame = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ set( QOBJECT_HEADERS
|
|||||||
cafPdmUiLineEditor.h
|
cafPdmUiLineEditor.h
|
||||||
cafPdmUiCheckBoxEditor.h
|
cafPdmUiCheckBoxEditor.h
|
||||||
cafPdmUiComboBoxEditor.h
|
cafPdmUiComboBoxEditor.h
|
||||||
|
cafPdmUiPushButtonEditor.h
|
||||||
cafPdmUiFilePathEditor.h
|
cafPdmUiFilePathEditor.h
|
||||||
cafPdmUiListEditor.h
|
cafPdmUiListEditor.h
|
||||||
cafPdmUiSliderEditor.h
|
cafPdmUiSliderEditor.h
|
||||||
@@ -36,6 +37,7 @@ add_library( ${PROJECT_NAME}
|
|||||||
cafPdmUiLineEditor.cpp
|
cafPdmUiLineEditor.cpp
|
||||||
cafPdmUiCheckBoxEditor.cpp
|
cafPdmUiCheckBoxEditor.cpp
|
||||||
cafPdmUiComboBoxEditor.cpp
|
cafPdmUiComboBoxEditor.cpp
|
||||||
|
cafPdmUiPushButtonEditor.cpp
|
||||||
cafPdmUiFilePathEditor.cpp
|
cafPdmUiFilePathEditor.cpp
|
||||||
cafPdmUiListEditor.cpp
|
cafPdmUiListEditor.cpp
|
||||||
cafPdmUiSliderEditor.cpp
|
cafPdmUiSliderEditor.cpp
|
||||||
|
|||||||
100
cafUserInterface/cafPdmUiPushButtonEditor.cpp
Normal file
100
cafUserInterface/cafPdmUiPushButtonEditor.cpp
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Custom Visualization Core library
|
||||||
|
// Copyright (C) 2011-2012 Ceetron AS
|
||||||
|
//
|
||||||
|
// This library 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.
|
||||||
|
//
|
||||||
|
// 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 General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
#include "cafPdmUiPushButtonEditor.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiDefaultObjectEditor.h"
|
||||||
|
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
#include "cafPdmUiOrdering.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
|
||||||
|
#include "cafFactory.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiPushButtonEditor);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||||
|
{
|
||||||
|
assert(!m_pushButton.isNull());
|
||||||
|
assert(!m_label.isNull());
|
||||||
|
|
||||||
|
QIcon ic = field()->uiIcon(uiConfigName);
|
||||||
|
if (!ic.isNull())
|
||||||
|
{
|
||||||
|
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_label->setText(field()->uiName(uiConfigName));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_label->setVisible(!field()->isUiHidden(uiConfigName));
|
||||||
|
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||||
|
|
||||||
|
//m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||||
|
|
||||||
|
PdmUiPushButtonEditorAttribute attributes;
|
||||||
|
field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
||||||
|
|
||||||
|
//m_checkBox->setChecked(field()->uiValue().toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* PdmUiPushButtonEditor::createEditorWidget(QWidget * parent)
|
||||||
|
{
|
||||||
|
m_pushButton = new QPushButton("Ok", parent);
|
||||||
|
connect(m_pushButton, SIGNAL(clicked(bool)), this, SLOT(slotClicked(bool)));
|
||||||
|
return m_pushButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* PdmUiPushButtonEditor::createLabelWidget(QWidget * parent)
|
||||||
|
{
|
||||||
|
m_label = new QLabel(parent);
|
||||||
|
return m_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmUiPushButtonEditor::slotClicked(bool checked)
|
||||||
|
{
|
||||||
|
QVariant v;
|
||||||
|
v = checked;
|
||||||
|
this->setValueToField(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // end namespace caf
|
||||||
64
cafUserInterface/cafPdmUiPushButtonEditor.h
Normal file
64
cafUserInterface/cafPdmUiPushButtonEditor.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Custom Visualization Core library
|
||||||
|
// Copyright (C) 2011-2012 Ceetron AS
|
||||||
|
//
|
||||||
|
// This library 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.
|
||||||
|
//
|
||||||
|
// 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 General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
/// The default editor for several PdmFields.
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
class PdmUiPushButtonEditorAttribute : public PdmUiEditorAttribute
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class PdmUiPushButtonEditor : public PdmUiFieldEditorHandle
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PdmUiPushButtonEditor() {}
|
||||||
|
virtual ~PdmUiPushButtonEditor() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual QWidget* createEditorWidget(QWidget * parent);
|
||||||
|
virtual QWidget* createLabelWidget(QWidget * parent);
|
||||||
|
virtual void configureAndUpdateUi(const QString& uiConfigName);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void slotClicked(bool checked);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<QPushButton> m_pushButton;
|
||||||
|
QPointer<QLabel> m_label;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // end namespace caf
|
||||||
@@ -116,7 +116,8 @@ void caf::Viewer::setupMainRendering()
|
|||||||
m_mainRendering->setCamera(m_mainCamera.p());
|
m_mainRendering->setCamera(m_mainCamera.p());
|
||||||
m_mainRendering->setRenderQueueSorter(new cvf::RenderQueueSorterBasic(cvf::RenderQueueSorterBasic::EFFECT_ONLY));
|
m_mainRendering->setRenderQueueSorter(new cvf::RenderQueueSorterBasic(cvf::RenderQueueSorterBasic::EFFECT_ONLY));
|
||||||
|
|
||||||
if (!Viewer::isShadersSupported())
|
// Set fixed function rendering if QGLFormat does not support directRendering
|
||||||
|
if (!this->format().directRendering())
|
||||||
{
|
{
|
||||||
m_mainRendering->renderEngine()->enableForcedImmediateMode(true);
|
m_mainRendering->renderEngine()->enableForcedImmediateMode(true);
|
||||||
}
|
}
|
||||||
@@ -530,6 +531,7 @@ void caf::Viewer::slotSetCurrentFrame(int frameIndex)
|
|||||||
|
|
||||||
m_renderingSequence->firstRendering()->setScene(m_frameScenes.at(frameIndex));
|
m_renderingSequence->firstRendering()->setScene(m_frameScenes.at(frameIndex));
|
||||||
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,7 +545,15 @@ void caf::Viewer::releaseOGlResourcesForCurrentFrame()
|
|||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < modelCount; ++i)
|
for (i = 0; i < modelCount; ++i)
|
||||||
{
|
{
|
||||||
currentScene->model(i)->deleteOrReleaseOpenGLResources(cvfOpenGLContext());
|
cvf::Collection<cvf::Part> partCollection;
|
||||||
|
currentScene->model(i)->allParts(&partCollection);
|
||||||
|
for (size_t pIdx = 0; pIdx < partCollection.size(); ++pIdx)
|
||||||
|
{
|
||||||
|
if (partCollection[pIdx].notNull() && partCollection[pIdx]->drawable())
|
||||||
|
{
|
||||||
|
partCollection[pIdx]->drawable()->releaseBufferObjectsGPU();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,3 +659,8 @@ void caf::Viewer::debugShowRenderingSequencePartNames()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void caf::Viewer::enableForcedImmediateMode(bool enable)
|
||||||
|
{
|
||||||
|
m_mainRendering->renderEngine()->enableForcedImmediateMode(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ public:
|
|||||||
void enablePerfInfoHud(bool enable);
|
void enablePerfInfoHud(bool enable);
|
||||||
bool isPerfInfoHudEnabled();
|
bool isPerfInfoHudEnabled();
|
||||||
|
|
||||||
|
void enableForcedImmediateMode(bool enable);
|
||||||
|
|
||||||
// Find out whether the system supports shaders
|
// Find out whether the system supports shaders
|
||||||
static bool isShadersSupported();
|
static bool isShadersSupported();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user