mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
commit
8973fb397a
@ -123,7 +123,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
//cvf::Trace::enable(false);
|
||||
|
||||
m_preferences = new RiaPreferences;
|
||||
readPreferences();
|
||||
readFieldsFromApplicationStore(m_preferences);
|
||||
applyPreferences();
|
||||
|
||||
if (useShaders())
|
||||
@ -143,12 +143,12 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
m_socketServer = new RiaSocketServer( this);
|
||||
m_workerProcess = NULL;
|
||||
|
||||
|
||||
m_startupDefaultDirectory = QDir::homePath();
|
||||
|
||||
#ifdef WIN32
|
||||
//m_startupDefaultDirectory += "/My Documents/";
|
||||
m_startupDefaultDirectory = QDir::homePath();
|
||||
#else
|
||||
m_startupDefaultDirectory = QDir::currentPath();
|
||||
#endif
|
||||
|
||||
setDefaultFileDialogDirectory("MULTICASEIMPORT", "/");
|
||||
|
||||
// The creation of a font is time consuming, so make sure you really need your own font
|
||||
@ -287,7 +287,7 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
// VL check regarding specific order mentioned in comment above...
|
||||
|
||||
m_preferences->lastUsedProjectFileName = projectFileName;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
@ -472,7 +472,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
m_project->writeFile();
|
||||
|
||||
m_preferences->lastUsedProjectFileName = fileName;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -695,7 +695,7 @@ void RiaApplication::setActiveReservoirView(RimReservoirView* rv)
|
||||
void RiaApplication::setUseShaders(bool enable)
|
||||
{
|
||||
m_preferences->useShaders = enable;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -727,7 +727,7 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
|
||||
void RiaApplication::setShowPerformanceInfo(bool enable)
|
||||
{
|
||||
m_preferences->showHud = enable;
|
||||
writePreferences();
|
||||
writeFieldsToApplicationStore(m_preferences);
|
||||
}
|
||||
|
||||
|
||||
@ -870,15 +870,7 @@ bool RiaApplication::parseArguments()
|
||||
|
||||
if (isRunRegressionTest)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (mainWnd)
|
||||
{
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
runRegressionTest(regressionTestPath);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
executeRegressionTests(regressionTestPath);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1080,12 +1072,12 @@ bool RiaApplication::launchProcessForMultipleCases(const QString& program, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::readPreferences()
|
||||
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
|
||||
{
|
||||
QSettings settings;
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
|
||||
m_preferences->fields(fields);
|
||||
object->fields(fields);
|
||||
size_t i;
|
||||
for (i = 0; i < fields.size(); i++)
|
||||
{
|
||||
@ -1102,12 +1094,14 @@ void RiaApplication::readPreferences()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Write fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::writePreferences()
|
||||
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
|
||||
{
|
||||
CVF_ASSERT(object);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
m_preferences->fields(fields);
|
||||
object->fields(fields);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < fields.size(); i++)
|
||||
@ -1769,3 +1763,20 @@ void RiaApplication::executeCommandObjects()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (mainWnd)
|
||||
{
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
runRegressionTest(regressionTestPath);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
|
||||
bool parseArguments();
|
||||
|
||||
void executeRegressionTests(const QString& regressionTestPath);
|
||||
|
||||
void setActiveReservoirView(RimReservoirView*);
|
||||
RimReservoirView* activeReservoirView();
|
||||
const RimReservoirView* activeReservoirView() const;
|
||||
@ -124,8 +126,8 @@ public:
|
||||
void terminateProcess();
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void readPreferences();
|
||||
void writePreferences();
|
||||
void readFieldsFromApplicationStore(caf::PdmObject* object);
|
||||
void writeFieldsToApplicationStore(const caf::PdmObject* object);
|
||||
void applyPreferences();
|
||||
|
||||
cvf::Font* standardFont();
|
||||
|
@ -44,6 +44,7 @@ RiaPreferences::RiaPreferences(void)
|
||||
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", "");
|
||||
CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh color", "", "", "");
|
||||
CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh color along faults", "", "", "");
|
||||
CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", cvf::Color3f(0.92f, 0.92f, 0.92f), "Well label color", "", "The default well label color in new views", "");
|
||||
|
||||
CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", cvf::Color3f(0.69f, 0.77f, 0.87f), "Viewer background", "", "The viewer background color for new views", "");
|
||||
|
||||
@ -102,7 +103,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
defaultSettingsGroup->add(&defaultGridLines);
|
||||
defaultSettingsGroup->add(&defaultGridLineColors);
|
||||
defaultSettingsGroup->add(&defaultFaultGridLineColors);
|
||||
|
||||
defaultSettingsGroup->add(&defaultWellLabelColor);
|
||||
|
||||
caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Compute when loading new case");
|
||||
autoComputeGroup->add(&autocomputeSOIL);
|
||||
|
@ -48,6 +48,7 @@ public: // Pdm Fields
|
||||
caf::PdmField<cvf::Color3f> defaultGridLineColors;
|
||||
caf::PdmField<cvf::Color3f> defaultFaultGridLineColors;
|
||||
caf::PdmField<cvf::Color3f> defaultViewerBackgroundColor;
|
||||
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
|
||||
|
||||
caf::PdmField<bool> useShaders;
|
||||
caf::PdmField<bool> showHud;
|
||||
|
60
ApplicationCode/Application/RiaRegressionTest.cpp
Normal file
60
ApplicationCode/Application/RiaRegressionTest.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaRegressionTest.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::RiaRegressionTest(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Application Working Folder", "", "", "");
|
||||
applicationWorkingFolder.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||
regressionTestFolder.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::~RiaRegressionTest(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &applicationWorkingFolder || field == ®ressionTestFolder)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
43
ApplicationCode/Application/RiaRegressionTest.h
Normal file
43
ApplicationCode/Application/RiaRegressionTest.h
Normal file
@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
class RiaRegressionTest : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RiaRegressionTest(void);
|
||||
virtual ~RiaRegressionTest(void);
|
||||
|
||||
public:
|
||||
caf::PdmField<QString> applicationWorkingFolder;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
|
||||
};
|
@ -36,6 +36,7 @@ set( APPLICATION_FILES
|
||||
Application/RiaPreferences.cpp
|
||||
Application/RiaImageFileCompare.cpp
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
Application/RiaRegressionTest.cpp
|
||||
)
|
||||
|
||||
set( USER_INTERFACE_FILES
|
||||
@ -151,6 +152,7 @@ list( REMOVE_ITEM RAW_SOURCES
|
||||
|
||||
Application/RiaImageFileCompare.cpp
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
Application/RiaRegressionTest.cpp
|
||||
|
||||
FileInterface/RifEclipseInputFileTools.cpp
|
||||
FileInterface/RifEclipseOutputFileTools.cpp
|
||||
|
@ -290,7 +290,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
drawableText->setDrawBorder(false);
|
||||
drawableText->setDrawBackground(false);
|
||||
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
|
||||
drawableText->setTextColor(cvf::Color3f(0.92f, 0.92f, 0.92f));
|
||||
drawableText->setTextColor(m_rimReservoirView->wellCollection()->wellLabelColor());
|
||||
|
||||
cvf::String cvfString = cvfqt::Utils::fromQString(well->name());
|
||||
|
||||
|
@ -197,8 +197,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl
|
||||
drawableText->setDrawBorder(false);
|
||||
drawableText->setDrawBackground(false);
|
||||
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
|
||||
//drawableText->setTextColor(cvf::Color3f(0.08f, 0.08f, 0.08f));
|
||||
drawableText->setTextColor(cvf::Color3f(0.92f, 0.92f, 0.92f));
|
||||
drawableText->setTextColor(m_wellPathCollection->wellPathLabelColor());
|
||||
|
||||
cvf::String cvfString = cvfqt::Utils::fromQString(m_rimWellPath->name());
|
||||
|
||||
|
@ -367,13 +367,13 @@ void RimLegendConfig::updateLegend()
|
||||
if (m_mappingMode == LOG10_CONTINUOUS || m_mappingMode == LOG10_DISCRETE)
|
||||
{
|
||||
// For log mapping, use the min value as reference for num valid digits
|
||||
decadesInRange = abs(adjustedMin) < abs(adjustedMax) ? abs(adjustedMin) : abs(adjustedMax);
|
||||
decadesInRange = cvf::Math::abs(adjustedMin) < cvf::Math::abs(adjustedMax) ? cvf::Math::abs(adjustedMin) : cvf::Math::abs(adjustedMax);
|
||||
decadesInRange = log10(decadesInRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For linear mapping, use the max value as reference for num valid digits
|
||||
double absRange = CVF_MAX(abs(adjustedMax), abs(adjustedMin));
|
||||
double absRange = CVF_MAX(cvf::Math::abs(adjustedMax), cvf::Math::abs(adjustedMin));
|
||||
decadesInRange = log10(absRange);
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ void RimLegendConfig::updateLegend()
|
||||
int numDecimalDigits = m_precision();
|
||||
if (nft != SCIENTIFIC)
|
||||
{
|
||||
numDecimalDigits -= decadesInRange;
|
||||
numDecimalDigits -= static_cast<int>(decadesInRange);
|
||||
}
|
||||
m_legend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
|
||||
|
||||
@ -416,13 +416,45 @@ void RimLegendConfig::updateLegend()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimLegendConfig::setAutomaticRanges(double globalMin, double globalMax, double localMin, double localMax)
|
||||
{
|
||||
m_globalAutoMin = roundToNumSignificantDigits(globalMin, m_precision);
|
||||
m_globalAutoMax = roundToNumSignificantDigits(globalMax, m_precision);
|
||||
double candidateGlobalAutoMin = roundToNumSignificantDigits(globalMin, m_precision);
|
||||
double candidateGlobalAutoMax = roundToNumSignificantDigits(globalMax, m_precision);
|
||||
|
||||
m_localAutoMin = roundToNumSignificantDigits(localMin, m_precision);
|
||||
m_localAutoMax = roundToNumSignificantDigits(localMax, m_precision);
|
||||
double candidateLocalAutoMin = roundToNumSignificantDigits(localMin, m_precision);
|
||||
double candidateLocalAutoMax = roundToNumSignificantDigits(localMax, m_precision);
|
||||
|
||||
updateLegend();
|
||||
bool needsUpdate = false;
|
||||
const double epsilon = std::numeric_limits<double>::epsilon();
|
||||
|
||||
if (cvf::Math::abs(candidateGlobalAutoMax - m_globalAutoMax) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if (cvf::Math::abs(candidateGlobalAutoMin - m_globalAutoMin) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if (cvf::Math::abs(candidateLocalAutoMax - m_localAutoMax) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if (cvf::Math::abs(candidateLocalAutoMin - m_localAutoMin) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if (needsUpdate)
|
||||
{
|
||||
m_globalAutoMin = candidateGlobalAutoMin;
|
||||
m_globalAutoMax = candidateGlobalAutoMax;
|
||||
|
||||
m_localAutoMin = candidateLocalAutoMin;
|
||||
m_localAutoMax = candidateLocalAutoMax;
|
||||
|
||||
updateLegend();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -550,7 +582,7 @@ double RimLegendConfig::roundToNumSignificantDigits(double domainValue, double n
|
||||
double integerPart;
|
||||
double fraction = modf(tmp, &integerPart);
|
||||
|
||||
if (abs(fraction)>= 0.5) (integerPart >= 0) ? integerPart++: integerPart-- ;
|
||||
if (cvf::Math::abs(fraction)>= 0.5) (integerPart >= 0) ? integerPart++: integerPart-- ;
|
||||
|
||||
double newDomainValue = integerPart / factor;
|
||||
|
||||
@ -562,17 +594,40 @@ double RimLegendConfig::roundToNumSignificantDigits(double domainValue, double n
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimLegendConfig::setClosestToZeroValues(double globalPosClosestToZero, double globalNegClosestToZero, double localPosClosestToZero, double localNegClosestToZero)
|
||||
{
|
||||
m_globalAutoPosClosestToZero = globalPosClosestToZero;
|
||||
m_globalAutoNegClosestToZero = globalNegClosestToZero;
|
||||
m_localAutoPosClosestToZero = localPosClosestToZero;
|
||||
m_localAutoNegClosestToZero = localNegClosestToZero;
|
||||
bool needsUpdate = false;
|
||||
const double epsilon = std::numeric_limits<double>::epsilon();
|
||||
|
||||
if (m_globalAutoPosClosestToZero == HUGE_VAL) m_globalAutoPosClosestToZero = 0;
|
||||
if (m_globalAutoNegClosestToZero == -HUGE_VAL) m_globalAutoNegClosestToZero = 0;
|
||||
if (m_localAutoPosClosestToZero == HUGE_VAL) m_localAutoPosClosestToZero = 0;
|
||||
if (m_localAutoNegClosestToZero == -HUGE_VAL) m_localAutoNegClosestToZero = 0;
|
||||
if (cvf::Math::abs(globalPosClosestToZero - m_globalAutoPosClosestToZero) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
if (cvf::Math::abs(globalNegClosestToZero - m_globalAutoNegClosestToZero) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
if (cvf::Math::abs(localPosClosestToZero - m_localAutoPosClosestToZero) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
if (cvf::Math::abs(localNegClosestToZero - m_localAutoNegClosestToZero) > epsilon)
|
||||
{
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
updateLegend();
|
||||
if (needsUpdate)
|
||||
{
|
||||
m_globalAutoPosClosestToZero = globalPosClosestToZero;
|
||||
m_globalAutoNegClosestToZero = globalNegClosestToZero;
|
||||
m_localAutoPosClosestToZero = localPosClosestToZero;
|
||||
m_localAutoNegClosestToZero = localNegClosestToZero;
|
||||
|
||||
if (m_globalAutoPosClosestToZero == HUGE_VAL) m_globalAutoPosClosestToZero = 0;
|
||||
if (m_globalAutoNegClosestToZero == -HUGE_VAL) m_globalAutoNegClosestToZero = 0;
|
||||
if (m_localAutoPosClosestToZero == HUGE_VAL) m_localAutoPosClosestToZero = 0;
|
||||
if (m_localAutoNegClosestToZero == -HUGE_VAL) m_localAutoNegClosestToZero = 0;
|
||||
|
||||
updateLegend();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -92,14 +92,14 @@ public:
|
||||
void setPosition(cvf::Vec2ui position);
|
||||
|
||||
cvf::ScalarMapper* scalarMapper() { return m_currentScalarMapper.p(); }
|
||||
cvf::OverlayScalarMapperLegend* legend() { return m_legend.p(); }
|
||||
void updateLegend();
|
||||
cvf::OverlayScalarMapperLegend* legend() { return m_legend.p(); }
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
private:
|
||||
void updateLegend();
|
||||
void updateFieldVisibility();
|
||||
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
|
||||
double roundToNumSignificantDigits(double value, double precision);
|
||||
@ -115,7 +115,7 @@ private:
|
||||
cvf::ref<cvf::ScalarMapperContinuousLinear> m_linSmoothScalarMapper;
|
||||
cvf::ref<cvf::ScalarMapper> m_currentScalarMapper;
|
||||
|
||||
cvf::ref<cvf::OverlayScalarMapperLegend> m_legend;
|
||||
cvf::ref<cvf::OverlayScalarMapperLegend> m_legend;
|
||||
|
||||
double m_globalAutoMax;
|
||||
double m_globalAutoMin;
|
||||
|
@ -74,6 +74,7 @@ RimProject::RimProject(void)
|
||||
CAF_PDM_InitFieldNoDefault(&wellPathImport, "WellPathImport", "WellPathImport", "", "", "");
|
||||
wellPathImport = new RimWellPathImport();
|
||||
wellPathImport.setUiHidden(true);
|
||||
wellPathImport.setUiChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&commandObjects, "CommandObjects", "CommandObjects", "", "", "");
|
||||
//wellPathImport.setUiHidden(true);
|
||||
|
@ -1431,12 +1431,16 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
const std::vector< RigWellResultFrame >& wellResFrames = wres->m_wellCellsTimeSteps;
|
||||
for (size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx)
|
||||
{
|
||||
// Add the wellhead cell
|
||||
|
||||
// Add the wellhead cell if it is active
|
||||
if (wellResFrames[wfIdx].m_wellHead.m_gridIndex == grid->gridIndex())
|
||||
{
|
||||
size_t gridCellIndex = wellResFrames[wfIdx].m_wellHead.m_gridCellIndex;
|
||||
(*visibleCells)[gridCellIndex] = true;
|
||||
size_t globalGridCellIndex = grid->globalGridCellIndex(gridCellIndex);
|
||||
|
||||
if (activeCellInfo->isActive(globalGridCellIndex))
|
||||
{
|
||||
(*visibleCells)[gridCellIndex] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Add all the cells from the branches
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeResultSlot.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -93,6 +95,8 @@ RimWellCollection::RimWellCollection()
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
|
||||
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
|
||||
CAF_PDM_InitField(&wellLabelColor, "WellLabelColor", defWellLabelColor, "Well label color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", "");
|
||||
|
||||
@ -243,7 +247,8 @@ void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
|| &wellHeadScaleFactor == changedField
|
||||
|| &showWellHead == changedField
|
||||
|| &isAutoDetectingBranches == changedField
|
||||
|| &wellHeadPosition == changedField)
|
||||
|| &wellHeadPosition == changedField
|
||||
|| &wellLabelColor == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
@ -276,6 +281,7 @@ void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
wellHeadGroup->add(&wellHeadScaleFactor);
|
||||
wellHeadGroup->add(&showWellLabel);
|
||||
wellHeadGroup->add(&wellHeadPosition);
|
||||
wellHeadGroup->add(&wellLabelColor);
|
||||
|
||||
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
|
||||
wellPipe->add(&wellPipeVisibility);
|
||||
|
@ -76,6 +76,8 @@ public:
|
||||
|
||||
|
||||
caf::PdmField<bool> showWellLabel;
|
||||
caf::PdmField<cvf::Color3f> wellLabelColor;
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
|
||||
@ -91,6 +93,7 @@ public:
|
||||
caf::PdmField<bool> showWellHead;
|
||||
caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
|
||||
|
||||
|
||||
caf::PdmField<bool> isAutoDetectingBranches;
|
||||
|
||||
caf::PdmPointersField<RimWell*> wells;
|
||||
|
@ -42,6 +42,9 @@
|
||||
#include "RimAnalysisModels.h"
|
||||
#include <fstream>
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
@ -65,6 +68,9 @@ RimWellPathCollection::RimWellPathCollection()
|
||||
|
||||
CAF_PDM_InitField(&showWellPathLabel, "ShowWellPathLabel", true, "Show well path labels", "", "", "");
|
||||
|
||||
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
|
||||
CAF_PDM_InitField(&wellPathLabelColor, "WellPathLabelColor", defWellLabelColor, "Well label color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellPathVisibility, "GlobalWellPathVisibility", WellVisibilityEnum(ALL_ON), "Global well path visibility", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.1, "Well Path radius scale", "", "", "");
|
||||
@ -123,7 +129,7 @@ void RimWellPathCollection::setProject( RimProject* project )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::readWellPathFiles()
|
||||
{
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
|
||||
caf::ProgressInfo progress(wellPaths.size(), "Reading well paths from file");
|
||||
|
||||
for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
typedef caf::AppEnum<RimWellPathCollection::WellVisibilityType> WellVisibilityEnum;
|
||||
|
||||
caf::PdmField<bool> showWellPathLabel;
|
||||
caf::PdmField<cvf::Color3f> wellPathLabelColor;
|
||||
|
||||
caf::PdmField<WellVisibilityEnum> wellPathVisibility;
|
||||
caf::PdmField<double> wellPathRadiusScaleFactor;
|
||||
|
@ -164,10 +164,15 @@ void RigCaseData::computeWellCellsPrGrid()
|
||||
size_t gridIndex = wellCells.m_wellHead.m_gridIndex;
|
||||
size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex;
|
||||
|
||||
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
if (gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size())
|
||||
{
|
||||
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
|
||||
m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast<cvf::uint>(wIdx));
|
||||
size_t globalGridCellIndex = grids[gridIndex]->globalGridCellIndex(gridCellIndex);
|
||||
if (m_activeCellInfo->isActive(globalGridCellIndex)
|
||||
|| m_fractureActiveCellInfo->isActive(globalGridCellIndex))
|
||||
{
|
||||
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
|
||||
m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast<cvf::uint>(wIdx));
|
||||
}
|
||||
}
|
||||
|
||||
size_t sIdx;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "cvfBase.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// A function to do basic statistical calculations
|
||||
@ -103,7 +105,7 @@ std::vector<double> RigStatisticsMath::calculateNearestRankPercentiles(const std
|
||||
{
|
||||
double pVal = HUGE_VAL;
|
||||
|
||||
size_t pValIndex = static_cast<size_t>(sortedValues.size() * fabs(pValPositions[i]) / 100);
|
||||
size_t pValIndex = static_cast<size_t>(sortedValues.size() * cvf::Math::abs(pValPositions[i]) / 100);
|
||||
|
||||
if (pValIndex >= sortedValues.size() ) pValIndex = sortedValues.size() - 1;
|
||||
|
||||
@ -142,7 +144,7 @@ std::vector<double> RigStatisticsMath::calculateInterpolatedPercentiles(const st
|
||||
{
|
||||
double pVal = HUGE_VAL;
|
||||
|
||||
double doubleIndex = (sortedValues.size() - 1) * fabs(pValPositions[i]) / 100.0;
|
||||
double doubleIndex = (sortedValues.size() - 1) * cvf::Math::abs(pValPositions[i]) / 100.0;
|
||||
|
||||
size_t lowerValueIndex = static_cast<size_t>(floor(doubleIndex));
|
||||
size_t upperValueIndex = lowerValueIndex + 1;
|
||||
|
@ -161,7 +161,13 @@ void RiaSocketServer::handleClientConnection(QTcpSocket* clientToHandle)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RiaSocketServer::findReservoir(int caseId)
|
||||
{
|
||||
int currCaseId = caseId;
|
||||
if (caseId < 0)
|
||||
{
|
||||
currCaseId = this->currentCaseId();
|
||||
}
|
||||
|
||||
if (currCaseId < 0)
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView())
|
||||
{
|
||||
@ -178,7 +184,7 @@ RimCase* RiaSocketServer::findReservoir(int caseId)
|
||||
|
||||
for (size_t i = 0; i < cases.size(); i++)
|
||||
{
|
||||
if (cases[i]->caseId == caseId)
|
||||
if (cases[i]->caseId == currCaseId)
|
||||
{
|
||||
return cases[i];
|
||||
}
|
||||
@ -223,8 +229,6 @@ void RiaSocketServer::readCommandFromOctave()
|
||||
|
||||
CVF_ASSERT(args.size() > 0);
|
||||
|
||||
std::cout << args[0].data() << std::endl;
|
||||
|
||||
m_currentCommand = RiaSocketCommandFactory::instance()->create(args[0]);
|
||||
|
||||
if (m_currentCommand)
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "cafAnimationToolBar.h"
|
||||
#include "cafPdmUiPropertyView.h"
|
||||
#include "cvfqtBasicAboutDialog.h"
|
||||
#include "cvfTimer.h"
|
||||
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
|
||||
@ -60,6 +61,7 @@
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RiuWellImportWizard.h"
|
||||
#include "RimCalcScript.h"
|
||||
#include "RiaRegressionTest.h"
|
||||
|
||||
|
||||
|
||||
@ -202,6 +204,8 @@ void RiuMainWindow::createActions()
|
||||
m_snapshotAllViewsToFile = new QAction(QIcon(":/SnapShotSaveViews.png"), "Snapshot All Views To File", this);
|
||||
|
||||
m_createCommandObject = new QAction("Create Command Object", this);
|
||||
m_showRegressionTestDialog = new QAction("Regression Test Dialog", this);
|
||||
m_executePaintEventPerformanceTest = new QAction("&Paint Event Performance Test", this);
|
||||
|
||||
m_saveProjectAction = new QAction(QIcon(":/Save.png"), "&Save Project", this);
|
||||
m_saveProjectAsAction = new QAction(QIcon(":/Save.png"), "Save Project &As", this);
|
||||
@ -227,6 +231,8 @@ void RiuMainWindow::createActions()
|
||||
connect(m_snapshotAllViewsToFile, SIGNAL(triggered()), SLOT(slotSnapshotAllViewsToFile()));
|
||||
|
||||
connect(m_createCommandObject, SIGNAL(triggered()), SLOT(slotCreateCommandObject()));
|
||||
connect(m_showRegressionTestDialog, SIGNAL(triggered()), SLOT(slotShowRegressionTestDialog()));
|
||||
connect(m_executePaintEventPerformanceTest, SIGNAL(triggered()), SLOT(slotExecutePaintEventPerformanceTest()));
|
||||
|
||||
connect(m_saveProjectAction, SIGNAL(triggered()), SLOT(slotSaveProject()));
|
||||
connect(m_saveProjectAsAction, SIGNAL(triggered()), SLOT(slotSaveProjectAs()));
|
||||
@ -364,7 +370,9 @@ void RiuMainWindow::createMenus()
|
||||
debugMenu->addAction(m_mockInputModelAction);
|
||||
debugMenu->addSeparator();
|
||||
debugMenu->addAction(m_createCommandObject);
|
||||
|
||||
debugMenu->addSeparator();
|
||||
debugMenu->addAction(m_showRegressionTestDialog);
|
||||
debugMenu->addAction(m_executePaintEventPerformanceTest);
|
||||
|
||||
connect(debugMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshDebugActions()));
|
||||
|
||||
@ -1197,13 +1205,13 @@ void RiuMainWindow::slotEditPreferences()
|
||||
if (preferencesDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
// Write preferences using QSettings and apply them to the application
|
||||
app->writePreferences();
|
||||
app->writeFieldsToApplicationStore(app->preferences());
|
||||
app->applyPreferences();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read back currently stored values using QSettings
|
||||
app->readPreferences();
|
||||
app->readFieldsFromApplicationStore(app->preferences());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1700,3 +1708,55 @@ void RiuMainWindow::slotCreateCommandObject()
|
||||
app->project()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotShowRegressionTestDialog()
|
||||
{
|
||||
RiaRegressionTest regTestConfig;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
app->readFieldsFromApplicationStore(®TestConfig);
|
||||
|
||||
RiuPreferencesDialog regressionTestDialog(this, ®TestConfig, "Regression Test");
|
||||
if (regressionTestDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
// Write preferences using QSettings and apply them to the application
|
||||
app->writeFieldsToApplicationStore(®TestConfig);
|
||||
|
||||
QString currentApplicationPath = QDir::currentPath();
|
||||
|
||||
QDir::setCurrent(regTestConfig.applicationWorkingFolder);
|
||||
app->executeRegressionTests(regTestConfig.regressionTestFolder);
|
||||
|
||||
QDir::setCurrent(currentApplicationPath);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotExecutePaintEventPerformanceTest()
|
||||
{
|
||||
|
||||
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
|
||||
{
|
||||
size_t redrawCount = 50;
|
||||
|
||||
caf::Viewer* viewer = RiaApplication::instance()->activeReservoirView()->viewer();
|
||||
|
||||
cvf::Timer timer;
|
||||
for (size_t i = 0; i < redrawCount; i++)
|
||||
{
|
||||
viewer->repaint();
|
||||
}
|
||||
|
||||
double totalTimeMS = timer.time() * 1000.0;
|
||||
|
||||
double msPerFrame = totalTimeMS / redrawCount;
|
||||
|
||||
QString resultInfo = QString("Total time '%1 ms' for %2 number of redraws, frame time '%3 ms'").arg(totalTimeMS).arg(redrawCount).arg(msPerFrame);
|
||||
setResultInfo(resultInfo);
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +155,8 @@ private:
|
||||
QAction* m_snapshotAllViewsToFile;
|
||||
|
||||
QAction* m_createCommandObject;
|
||||
QAction* m_showRegressionTestDialog;
|
||||
QAction* m_executePaintEventPerformanceTest;
|
||||
|
||||
// Help actions
|
||||
QAction* m_aboutAction;
|
||||
@ -225,6 +227,9 @@ private slots:
|
||||
|
||||
void slotCreateCommandObject();
|
||||
|
||||
void slotShowRegressionTestDialog();
|
||||
void slotExecutePaintEventPerformanceTest();
|
||||
|
||||
// Mock models
|
||||
void slotMockModel();
|
||||
void slotMockResultsModel();
|
||||
|
@ -454,28 +454,13 @@ void caf::Viewer::paintEvent(QPaintEvent* event)
|
||||
// Convert the QImage into the cvf::TextureImage,
|
||||
// handling vertical mirroring and (possible) byteswapping
|
||||
|
||||
if (((int)m_overlayTextureImage->height()) != this->height() || ((int)m_overlayTextureImage->width() != this->width()))
|
||||
if (((int)m_overlayTextureImage->height()) != this->height() || ((int)m_overlayTextureImage->width() != this->width()))
|
||||
{
|
||||
m_overlayTextureImage->allocate(this->width(), this->height());
|
||||
}
|
||||
|
||||
int height = m_overlayTextureImage->height();
|
||||
int width = m_overlayTextureImage->width();
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int y = 0 ; y < height; ++y)
|
||||
{
|
||||
int negy = height - 1 - y;
|
||||
for (int x = 0 ; x < width; ++x)
|
||||
{
|
||||
// Should probably do direct conversion on byte level. Would be faster
|
||||
// QImage.bits() and cvf::TextureImage.ptr() (casting away const)
|
||||
QRgb qtRgbaVal = m_overlayPaintingQImage.pixel(x, negy);
|
||||
cvf::Color4ub cvfRgbVal(qRed(qtRgbaVal), qGreen(qtRgbaVal), qBlue(qtRgbaVal), qAlpha(qtRgbaVal));
|
||||
m_overlayTextureImage->setPixel(x, y, cvfRgbVal);
|
||||
}
|
||||
}
|
||||
|
||||
cvfqt::Utils::copyFromQImage(m_overlayTextureImage.p(), m_overlayPaintingQImage);
|
||||
|
||||
m_overlayImage->setImage(m_overlayTextureImage.p());
|
||||
m_overlayImage->setPixelSize(cvf::Vec2ui(this->width(), this->height()));
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfTextureImage.h"
|
||||
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
@ -89,14 +90,14 @@ cvf::String Utils::fromQString(const QString& qtString)
|
||||
{
|
||||
if (qtString.length() == 0)
|
||||
{
|
||||
return cvf::String();
|
||||
return cvf::String();
|
||||
}
|
||||
|
||||
if (sizeof(wchar_t) == 2)
|
||||
{
|
||||
const wchar_t* strPtr = reinterpret_cast<const wchar_t*>(qtString.utf16());
|
||||
|
||||
return cvf::String(strPtr);
|
||||
return cvf::String(strPtr);
|
||||
}
|
||||
else if (sizeof(wchar_t) == 4)
|
||||
{
|
||||
@ -104,11 +105,78 @@ cvf::String Utils::fromQString(const QString& qtString)
|
||||
ucs4Str.push_back(0);
|
||||
const wchar_t* strPtr = reinterpret_cast<const wchar_t*>(ucs4Str.data());
|
||||
|
||||
return cvf::String(strPtr);
|
||||
return cvf::String(strPtr);
|
||||
}
|
||||
|
||||
CVF_FAIL_MSG("Unexpected sizeof wchar_t");
|
||||
return cvf::String();
|
||||
return cvf::String();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Utils::copyFromQImage(cvf::TextureImage* textureImage, const QImage& qtImage)
|
||||
{
|
||||
CVF_ASSERT(textureImage);
|
||||
|
||||
if (qtImage.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (((int)textureImage->height()) != qtImage.height() || ((int)textureImage->width() != qtImage.width()))
|
||||
{
|
||||
textureImage->allocate(qtImage.width(), qtImage.height());
|
||||
}
|
||||
|
||||
int height = textureImage->height();
|
||||
int width = textureImage->width();
|
||||
|
||||
// Check if QImage has format QImage::Format_ARGB32, and perform a direct memory copy of image data
|
||||
if (qtImage.format() == QImage::Format_ARGB32)
|
||||
{
|
||||
cvf::ubyte* dataPtr = const_cast<cvf::ubyte*>(textureImage->ptr());
|
||||
|
||||
int negy = 0;
|
||||
uint idx = 0;
|
||||
QRgb qtRgbaVal = 0;
|
||||
|
||||
// This loop is a candidate for multi-threading. Testing with OpenMP has so far indicated
|
||||
// quite large variance in performance (Windows Intel i7 with 8 cores).
|
||||
// When this function is called from the paint event,
|
||||
// the user experience is considered better when the paint time is consistent.
|
||||
for (int y = 0 ; y < height; ++y)
|
||||
{
|
||||
negy = height - 1 - y;
|
||||
const uchar* s = qtImage.scanLine(negy);
|
||||
|
||||
for (int x = 0 ; x < width; ++x)
|
||||
{
|
||||
qtRgbaVal = ((QRgb*)s)[x]; // Taken from QImage::pixel(int x, int y)
|
||||
|
||||
idx = 4*(y*width + x);
|
||||
dataPtr[idx] = qRed(qtRgbaVal);
|
||||
dataPtr[idx + 1] = qGreen(qtRgbaVal);
|
||||
dataPtr[idx + 2] = qBlue(qtRgbaVal);
|
||||
dataPtr[idx + 3] = qAlpha(qtRgbaVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0 ; y < height; ++y)
|
||||
{
|
||||
int negy = height - 1 - y;
|
||||
QRgb qtRgbaVal;
|
||||
cvf::Color4ub cvfRgbVal;
|
||||
for (int x = 0 ; x < width; ++x)
|
||||
{
|
||||
qtRgbaVal = qtImage.pixel(x, negy);
|
||||
cvfRgbVal.set(qRed(qtRgbaVal), qGreen(qtRgbaVal), qBlue(qtRgbaVal), qAlpha(qtRgbaVal));
|
||||
textureImage->setPixel(x, y, cvfRgbVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,11 @@
|
||||
#include "cvfString.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QImage>
|
||||
|
||||
namespace cvf {
|
||||
class TextureImage;
|
||||
}
|
||||
|
||||
namespace cvfqt {
|
||||
|
||||
@ -54,6 +59,8 @@ class Utils
|
||||
public:
|
||||
static QString toQString(const cvf::String& ceeString);
|
||||
static cvf::String fromQString(const QString& qtString);
|
||||
|
||||
static void copyFromQImage(cvf::TextureImage* textureImage, const QImage& qtImage);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -217,10 +217,12 @@ void TextureImage::setPixel(uint x, uint y, const Color4ub& clr)
|
||||
CVF_TIGHT_ASSERT(y < m_height);
|
||||
|
||||
const uint idx = 4*(y*m_width + x);
|
||||
m_dataRgba[idx] = clr.r();
|
||||
m_dataRgba[idx + 1] = clr.g();
|
||||
m_dataRgba[idx + 2] = clr.b();
|
||||
m_dataRgba[idx + 3] = clr.a();
|
||||
const ubyte* data = clr.ptr();
|
||||
|
||||
m_dataRgba[idx] = data[0];
|
||||
m_dataRgba[idx + 1] = data[1];
|
||||
m_dataRgba[idx + 2] = data[2];
|
||||
m_dataRgba[idx + 3] = data[3];
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ void getActiveCellCenters(NDArray& cellCenterValues, const QString &hostName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(2 * sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getActiveCellCorners(NDArray& cellCornerValues, const QString &hostName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(2 * sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -177,10 +177,7 @@ DEFUN_DLD (riGetActiveCellInfo, args, nargout,
|
||||
{
|
||||
porosityModel = args(1).char_matrix_value().row_as_string(0).c_str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
octave_stdout << "Porosity: " << porosityModel.toStdString() << " CaseId : " << caseId << std::endl;
|
||||
}
|
||||
|
||||
getActiveCellInfo(propertyFrames, "127.0.0.1", 40001, caseId, porosityModel);
|
||||
|
||||
|
@ -38,7 +38,7 @@ void getActiveCellProperty(Matrix& propertyFrames, const QString &serverName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -31,7 +31,7 @@ void getCaseGroups(std::vector<QString>& groupNames, std::vector<int>& groupIds,
|
||||
// Get response. First wait for the header
|
||||
while (socket.bytesAvailable() < (int)(2*sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -49,7 +49,7 @@ void getCaseGroups(std::vector<QString>& groupNames, std::vector<int>& groupIds,
|
||||
// Get response. Read all data for command
|
||||
while (socket.bytesAvailable() < (int)byteCount)
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNames, std
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -45,7 +45,7 @@ void getCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNames, std
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getCellCenters(NDArray& cellCenterValues, const QString &hostName, quint16
|
||||
|
||||
while (socket.bytesAvailable() < (int)(5 * sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getCellCorners(NDArray& cellCornerValues, const QString &hostName, quint16
|
||||
|
||||
while (socket.bytesAvailable() < (int)(5 * sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getCoarseningInfo(int32NDArray& coarseningInfo, const QString &hostName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -45,7 +45,7 @@ void getCurrentCase(qint64& caseId, QString& caseName, QString& caseType, qint64
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getGridDimensions(int32NDArray& gridDimensions, const QString &hostName, qu
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -46,8 +46,8 @@ void getGridDimensions(int32NDArray& gridDimensions, const QString &hostName, qu
|
||||
quint64 gridCount = byteCount / (3 * sizeof(quint64));
|
||||
|
||||
dim_vector dv (1, 1);
|
||||
dv(0) = 3;
|
||||
dv(1) = gridCount;
|
||||
dv(0) = gridCount;
|
||||
dv(1) = 3;
|
||||
|
||||
gridDimensions.resize(dv);
|
||||
|
||||
@ -61,9 +61,9 @@ void getGridDimensions(int32NDArray& gridDimensions, const QString &hostName, qu
|
||||
socketStream >> jCount;
|
||||
socketStream >> kCount;
|
||||
|
||||
gridDimensions(0, i) = iCount;
|
||||
gridDimensions(1, i) = jCount;
|
||||
gridDimensions(2, i) = kCount;
|
||||
gridDimensions(i, 0) = iCount;
|
||||
gridDimensions(i, 1) = jCount;
|
||||
gridDimensions(i, 2) = kCount;
|
||||
}
|
||||
|
||||
QString tmp = QString("riGetGridDimensions : Read grid dimensions");
|
||||
|
@ -5,8 +5,6 @@
|
||||
void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16 serverPort,
|
||||
const int& caseId, int gridIdx, QString propertyName, const int32NDArray& requestedTimeSteps, QString porosityModel)
|
||||
{
|
||||
const int Timeout = riOctavePlugin::shortTimeOutMilliSecs;
|
||||
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost(serverName, serverPort);
|
||||
|
||||
@ -40,7 +38,7 @@ void getGridProperty(NDArray& propertyFrames, const QString &serverName, quint16
|
||||
|
||||
while (socket.bytesAvailable() < (int)(4*sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getMainGridDimensions(int32NDArray& gridDimensions, const QString &hostName
|
||||
|
||||
while (socket.bytesAvailable() < (int)(3*sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ void getPropertyNames(std::vector<QString>& propNames, std::vector<QString>& pro
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -50,7 +50,7 @@ void getPropertyNames(std::vector<QString>& propNames, std::vector<QString>& pro
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@ void getSelectedCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNa
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -45,7 +45,7 @@ void getSelectedCases(std::vector<qint64>& caseIds, std::vector<QString>& caseNa
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -41,7 +41,7 @@ void getTimeStepDates( std::vector<qint32>& yearValues,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -53,7 +53,7 @@ void getTimeStepDates( std::vector<qint32>& yearValues,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -14,7 +14,7 @@ void getTimeStepDates( std::vector<double>& decimalDays,
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost(serverName, serverPort);
|
||||
|
||||
if (!socket.waitForConnected(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
|
||||
{
|
||||
error((("Connection: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -35,7 +35,7 @@ void getTimeStepDates( std::vector<double>& decimalDays,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -47,7 +47,7 @@ void getTimeStepDates( std::vector<double>& decimalDays,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ void getWellCells( std::vector<int>& cellIs,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -60,7 +60,7 @@ void getWellCells( std::vector<int>& cellIs,
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -35,7 +35,7 @@ void getWellNames(std::vector<QString>& wellNames, const QString &hostName, quin
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -50,7 +50,7 @@ void getWellNames(std::vector<QString>& wellNames, const QString &hostName, quin
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ void getWellStatus(std::vector<QString>& wellTypes, std::vector<int>& wellStatus
|
||||
|
||||
while (socket.bytesAvailable() < (int)(sizeof(quint64)))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for header: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
@ -55,7 +55,7 @@ void getWellStatus(std::vector<QString>& wellTypes, std::vector<int>& wellStatus
|
||||
|
||||
while (socket.bytesAvailable() < (int)(byteCount))
|
||||
{
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForReadyRead(riOctavePlugin::longTimeOutMilliSecs))
|
||||
{
|
||||
error((("Waiting for data: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -9,7 +9,7 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost(hostName, port);
|
||||
|
||||
if (!socket.waitForConnected(riOctavePlugin::shortTimeOutMilliSecs))
|
||||
if (!socket.waitForConnected(riOctavePlugin::connectTimeOutMilliSecs))
|
||||
{
|
||||
error((("Connection: ") + socket.errorString()).toLatin1().data());
|
||||
return;
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
namespace riOctavePlugin
|
||||
{
|
||||
const int connectTimeOutMilliSecs = 5000;
|
||||
const int shortTimeOutMilliSecs = 5000;
|
||||
const int longTimeOutMilliSecs = 60000;
|
||||
const int connectTimeOutMilliSecs = 5000;
|
||||
const int shortTimeOutMilliSecs = 5000;
|
||||
const int longTimeOutMilliSecs = 6000000;
|
||||
|
||||
// Octave data structure : CaseInfo
|
||||
char caseInfo_CaseId[] = "CaseId";
|
||||
|
Loading…
Reference in New Issue
Block a user