mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2618 Tensor Vectors: Add arrow length scaling range option for result
This commit is contained in:
parent
0583c7a815
commit
af4b35b990
@ -108,12 +108,18 @@ void RivTensorResultPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLi
|
|||||||
|
|
||||||
RigFemPartNodes nodes = part->nodes();
|
RigFemPartNodes nodes = part->nodes();
|
||||||
|
|
||||||
double min, max;
|
|
||||||
resultCollection->minMaxScalarValuesOverAllTensorComponents(address, (int)frameIndex, &min, &max);
|
|
||||||
|
|
||||||
if (max == 0) max = 1;
|
|
||||||
float arrowConstantScaling = 0.5 * m_rimReservoirView->tensorResults()->sizeScale() * part->characteristicElementSize();
|
float arrowConstantScaling = 0.5 * m_rimReservoirView->tensorResults()->sizeScale() * part->characteristicElementSize();
|
||||||
float arrowResultScaling = arrowConstantScaling / cvf::Math::abs(max);
|
|
||||||
|
double min, max;
|
||||||
|
m_rimReservoirView->tensorResults()->mappingRange(&min, &max);
|
||||||
|
|
||||||
|
double maxAbsResult = 1.0;
|
||||||
|
if (min != cvf::UNDEFINED_DOUBLE && max != cvf::UNDEFINED_DOUBLE)
|
||||||
|
{
|
||||||
|
maxAbsResult = std::max(cvf::Math::abs(max), cvf::Math::abs(min));
|
||||||
|
}
|
||||||
|
|
||||||
|
float arrowResultScaling = arrowConstantScaling / maxAbsResult;
|
||||||
|
|
||||||
cvf::ref<RivGeoMechPartMgrCache> partMgrCache = m_rimReservoirView->vizLogic()->partMgrCache();
|
cvf::ref<RivGeoMechPartMgrCache> partMgrCache = m_rimReservoirView->vizLogic()->partMgrCache();
|
||||||
|
|
||||||
@ -337,7 +343,7 @@ cvf::ref<cvf::Part> RivTensorResultPartMgr::createPart(const std::vector<TensorV
|
|||||||
auto vectorColors = m_rimReservoirView->tensorResults()->vectorColors();
|
auto vectorColors = m_rimReservoirView->tensorResults()->vectorColors();
|
||||||
if (vectorColors == RimTensorResults::RESULT_COLORS)
|
if (vectorColors == RimTensorResults::RESULT_COLORS)
|
||||||
{
|
{
|
||||||
activeScalerMapper = m_rimReservoirView->tensorResults()->legendConfig()->scalarMapper();
|
activeScalerMapper = m_rimReservoirView->tensorResults()->arrowColorLegendConfig()->scalarMapper();
|
||||||
|
|
||||||
createResultColorTextureCoords(lineTexCoords.p(), tensorVisualizations, activeScalerMapper);
|
createResultColorTextureCoords(lineTexCoords.p(), tensorVisualizations, activeScalerMapper);
|
||||||
}
|
}
|
||||||
|
@ -383,11 +383,11 @@ void RimGeoMechView::updateLegends()
|
|||||||
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTensorLegendTextAndRanges(m_tensorResults->legendConfig(), m_currentTimeStep());
|
updateTensorLegendTextAndRanges(m_tensorResults->arrowColorLegendConfig(), m_currentTimeStep());
|
||||||
|
|
||||||
if (tensorResults()->vectorColors() == RimTensorResults::RESULT_COLORS && tensorResults()->showTensors())
|
if (tensorResults()->vectorColors() == RimTensorResults::RESULT_COLORS && tensorResults()->showTensors())
|
||||||
{
|
{
|
||||||
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->legendConfig->legend());
|
m_viewer->addColorLegendToBottomLeftCorner(m_tensorResults->arrowColorLegendConfig->legend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,13 @@
|
|||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaColorTables.h"
|
#include "RiaColorTables.h"
|
||||||
|
#include "RiaPreferences.h"
|
||||||
|
|
||||||
#include "RimCellEdgeColors.h"
|
#include "RimCellEdgeColors.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
|
#include "RimIntersectionCollection.h"
|
||||||
#include "RimStimPlanColors.h"
|
#include "RimStimPlanColors.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
|
|
||||||
@ -47,8 +49,6 @@
|
|||||||
#include "cvfqtUtils.h"
|
#include "cvfqtUtils.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "RimIntersectionCollection.h"
|
|
||||||
#include "RiaPreferences.h"
|
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
||||||
@ -57,8 +57,8 @@ namespace caf {
|
|||||||
template<>
|
template<>
|
||||||
void AppEnum<RimLegendConfig::RangeModeType>::setUp()
|
void AppEnum<RimLegendConfig::RangeModeType>::setUp()
|
||||||
{
|
{
|
||||||
addItem(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS, "AUTOMATIC_ALLTIMESTEPS", "All Timesteps");
|
addItem(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS, "AUTOMATIC_ALLTIMESTEPS", "Min and Max for All Timesteps");
|
||||||
addItem(RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP,"AUTOMATIC_CURRENT_TIMESTEP", "Current Timestep");
|
addItem(RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP,"AUTOMATIC_CURRENT_TIMESTEP", "Min and Max for Current Timestep");
|
||||||
addItem(RimLegendConfig::USER_DEFINED, "USER_DEFINED_MAX_MIN", "User Defined Range");
|
addItem(RimLegendConfig::USER_DEFINED, "USER_DEFINED_MAX_MIN", "User Defined Range");
|
||||||
setDefault(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS);
|
setDefault(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2018 Statoil ASA
|
// Copyright (C) 2018 Statoil ASA
|
||||||
//
|
//
|
||||||
// ResInsight is free software: you can redistribute it and/or modify
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
//
|
//
|
||||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
// for more details.
|
// for more details.
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -19,51 +19,52 @@
|
|||||||
#include "RimTensorResults.h"
|
#include "RimTensorResults.h"
|
||||||
|
|
||||||
#include "RigFemResultAddress.h"
|
#include "RigFemResultAddress.h"
|
||||||
|
#include "RimGeoMechCase.h"
|
||||||
#include "RimGeoMechResultDefinition.h"
|
#include "RimGeoMechResultDefinition.h"
|
||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimLegendConfig.h"
|
|
||||||
|
#include "RigFemPartResultsCollection.h"
|
||||||
|
#include "RigGeoMechCaseData.h"
|
||||||
|
|
||||||
#include "cafAppEnum.h"
|
#include "cafAppEnum.h"
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimTensorResults, "RimTensorResults");
|
CAF_PDM_SOURCE_INIT(RimTensorResults, "RimTensorResults");
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
void AppEnum< RimTensorResults::TensorColors >::setUp()
|
void AppEnum<RimTensorResults::TensorColors>::setUp()
|
||||||
{
|
{
|
||||||
addItem(RimTensorResults::WHITE_GRAY_BLACK , "WHITE_GRAY_BLACK", "White, Gray, Black");
|
addItem(RimTensorResults::WHITE_GRAY_BLACK, "WHITE_GRAY_BLACK", "White, Gray, Black");
|
||||||
addItem(RimTensorResults::ORANGE_BLUE_WHITE, "ORANGE_BLUE_WHITE", "Orange, Blue, White");
|
addItem(RimTensorResults::ORANGE_BLUE_WHITE, "ORANGE_BLUE_WHITE", "Orange, Blue, White");
|
||||||
addItem(RimTensorResults::MAGENTA_BROWN_GRAY, "MAGENTA_BROWN_GRAY", "Magenta, Brown, Gray");
|
addItem(RimTensorResults::MAGENTA_BROWN_GRAY, "MAGENTA_BROWN_GRAY", "Magenta, Brown, Gray");
|
||||||
addItem(RimTensorResults::RESULT_COLORS, "RESULT_COLORS", "Result Colors");
|
addItem(RimTensorResults::RESULT_COLORS, "RESULT_COLORS", "Result Colors");
|
||||||
|
|
||||||
setDefault(RimTensorResults::WHITE_GRAY_BLACK);
|
setDefault(RimTensorResults::WHITE_GRAY_BLACK);
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void AppEnum< RimTensorResults::ScaleMethod >::setUp()
|
|
||||||
{
|
|
||||||
addItem(RimTensorResults::RESULT, "RESULT", "Result");
|
|
||||||
addItem(RimTensorResults::CONSTANT, "CONSTANT", "Constant");
|
|
||||||
|
|
||||||
setDefault(RimTensorResults::RESULT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void AppEnum<RimTensorResults::ScaleMethod>::setUp()
|
||||||
|
{
|
||||||
|
addItem(RimTensorResults::RESULT, "RESULT", "Result");
|
||||||
|
addItem(RimTensorResults::CONSTANT, "CONSTANT", "Constant");
|
||||||
|
|
||||||
|
setDefault(RimTensorResults::RESULT);
|
||||||
|
}
|
||||||
|
} // namespace caf
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimTensorResults::RimTensorResults()
|
RimTensorResults::RimTensorResults()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Element Tensor Results", ":/CellResult.png", "", "");
|
CAF_PDM_InitObject("Element Tensor Results", ":/CellResult.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&arrowColorLegendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
||||||
this->legendConfig = new RimLegendConfig();
|
this->arrowColorLegendConfig = new RimLegendConfig();
|
||||||
legendConfig.uiCapability()->setUiHidden(true);
|
arrowColorLegendConfig.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_resultFieldName, "ResultVariable", QString("ST"), "Value", "", "", "");
|
CAF_PDM_InitField(&m_resultFieldName, "ResultVariable", QString("ST"), "Value", "", "", "");
|
||||||
m_resultFieldName.uiCapability()->setUiHidden(true);
|
m_resultFieldName.uiCapability()->setUiHidden(true);
|
||||||
@ -83,20 +84,25 @@ RimTensorResults::RimTensorResults()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_vectorColor, "VectorColor", "Color", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_vectorColor, "VectorColor", "Color", "", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "");
|
||||||
CAF_PDM_InitField(&m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "");
|
CAF_PDM_InitField(&m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "");
|
||||||
|
CAF_PDM_InitField(&m_rangeMode,
|
||||||
|
"RangeType",
|
||||||
|
RimLegendConfig::RangeModeEnum(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS),
|
||||||
|
"Range Type",
|
||||||
|
"",
|
||||||
|
"Switches between automatic and user defined range",
|
||||||
|
"");
|
||||||
|
|
||||||
m_resultFieldNameUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
m_resultFieldNameUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
m_resultFieldNameUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
m_resultFieldNameUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimTensorResults::~RimTensorResults()
|
RimTensorResults::~RimTensorResults() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFemResultAddress RimTensorResults::selectedTensorResult() const
|
RigFemResultAddress RimTensorResults::selectedTensorResult() const
|
||||||
{
|
{
|
||||||
@ -104,7 +110,7 @@ RigFemResultAddress RimTensorResults::selectedTensorResult() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimTensorResults::setShowTensors(bool enableTensors)
|
void RimTensorResults::setShowTensors(bool enableTensors)
|
||||||
{
|
{
|
||||||
@ -115,7 +121,7 @@ void RimTensorResults::setShowTensors(bool enableTensors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimTensorResults::showTensors() const
|
bool RimTensorResults::showTensors() const
|
||||||
{
|
{
|
||||||
@ -123,7 +129,7 @@ bool RimTensorResults::showTensors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimTensorResults::showPrincipal1() const
|
bool RimTensorResults::showPrincipal1() const
|
||||||
{
|
{
|
||||||
@ -131,7 +137,7 @@ bool RimTensorResults::showPrincipal1() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimTensorResults::showPrincipal2() const
|
bool RimTensorResults::showPrincipal2() const
|
||||||
{
|
{
|
||||||
@ -139,7 +145,7 @@ bool RimTensorResults::showPrincipal2() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimTensorResults::showPrincipal3() const
|
bool RimTensorResults::showPrincipal3() const
|
||||||
{
|
{
|
||||||
@ -147,7 +153,7 @@ bool RimTensorResults::showPrincipal3() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
float RimTensorResults::threshold() const
|
float RimTensorResults::threshold() const
|
||||||
{
|
{
|
||||||
@ -155,7 +161,7 @@ float RimTensorResults::threshold() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
float RimTensorResults::sizeScale() const
|
float RimTensorResults::sizeScale() const
|
||||||
{
|
{
|
||||||
@ -163,7 +169,7 @@ float RimTensorResults::sizeScale() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimTensorResults::TensorColors RimTensorResults::vectorColors() const
|
RimTensorResults::TensorColors RimTensorResults::vectorColors() const
|
||||||
{
|
{
|
||||||
@ -171,7 +177,7 @@ RimTensorResults::TensorColors RimTensorResults::vectorColors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimTensorResults::ScaleMethod RimTensorResults::scaleMethod() const
|
RimTensorResults::ScaleMethod RimTensorResults::scaleMethod() const
|
||||||
{
|
{
|
||||||
@ -179,7 +185,37 @@ RimTensorResults::ScaleMethod RimTensorResults::scaleMethod() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTensorResults::mappingRange(double* min, double* max) const
|
||||||
|
{
|
||||||
|
*min = cvf::UNDEFINED_DOUBLE;
|
||||||
|
*max = cvf::UNDEFINED_DOUBLE;
|
||||||
|
|
||||||
|
if (scaleMethod() == RESULT)
|
||||||
|
{
|
||||||
|
Rim3dView* view = nullptr;
|
||||||
|
firstAncestorOrThisOfType(view);
|
||||||
|
|
||||||
|
int currentTimeStep = view->currentTimeStep();
|
||||||
|
|
||||||
|
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
|
||||||
|
RigFemPartResultsCollection* resultCollection = geoMechView->geoMechCase()->geoMechData()->femPartResults();
|
||||||
|
if (!resultCollection) return;
|
||||||
|
|
||||||
|
if (m_rangeMode == RimLegendConfig::AUTOMATIC_ALLTIMESTEPS)
|
||||||
|
{
|
||||||
|
resultCollection->minMaxScalarValuesOverAllTensorComponents(selectedTensorResult(), min, max);
|
||||||
|
}
|
||||||
|
else if (m_rangeMode == RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP)
|
||||||
|
{
|
||||||
|
resultCollection->minMaxScalarValuesOverAllTensorComponents(selectedTensorResult(), currentTimeStep, min, max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFemResultPosEnum RimTensorResults::resultPositionType()
|
RigFemResultPosEnum RimTensorResults::resultPositionType()
|
||||||
{
|
{
|
||||||
@ -187,7 +223,7 @@ RigFemResultPosEnum RimTensorResults::resultPositionType()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimTensorResults::resultFieldName() const
|
QString RimTensorResults::resultFieldName() const
|
||||||
{
|
{
|
||||||
@ -195,7 +231,7 @@ QString RimTensorResults::resultFieldName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<std::string> RimTensorResults::getResultMetaDataForUIFieldSetting()
|
std::vector<std::string> RimTensorResults::getResultMetaDataForUIFieldSetting()
|
||||||
{
|
{
|
||||||
@ -208,15 +244,17 @@ std::vector<std::string> RimTensorResults::getResultMetaDataForUIFieldSetting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimTensorResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimTensorResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue)
|
||||||
{
|
{
|
||||||
if (changedField == &m_resultFieldNameUiField)
|
if (changedField == &m_resultFieldNameUiField)
|
||||||
{
|
{
|
||||||
m_resultFieldName = fieldNameFromUi(m_resultFieldNameUiField);
|
m_resultFieldName = fieldNameFromUi(m_resultFieldNameUiField);
|
||||||
}
|
}
|
||||||
if (changedField == &m_showTensors)
|
else if (changedField == &m_showTensors)
|
||||||
{
|
{
|
||||||
setShowTensors(m_showTensors);
|
setShowTensors(m_showTensors);
|
||||||
}
|
}
|
||||||
@ -227,7 +265,7 @@ void RimTensorResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
caf::PdmFieldHandle* RimTensorResults::objectToggleField()
|
caf::PdmFieldHandle* RimTensorResults::objectToggleField()
|
||||||
{
|
{
|
||||||
@ -235,9 +273,10 @@ caf::PdmFieldHandle* RimTensorResults::objectToggleField()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
|
bool* useOptionsOnly)
|
||||||
{
|
{
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
*useOptionsOnly = true;
|
*useOptionsOnly = true;
|
||||||
@ -248,15 +287,24 @@ QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf:
|
|||||||
|
|
||||||
for (size_t oIdx = 0; oIdx < fieldCompNames.size(); ++oIdx)
|
for (size_t oIdx = 0; oIdx < fieldCompNames.size(); ++oIdx)
|
||||||
{
|
{
|
||||||
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldCompNames[oIdx]), QString::fromStdString(fieldCompNames[oIdx])));
|
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldCompNames[oIdx]),
|
||||||
|
QString::fromStdString(fieldCompNames[oIdx])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (fieldNeedingOptions == &m_rangeMode)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(RimLegendConfig::RangeModeEnum::uiText(RimLegendConfig::AUTOMATIC_ALLTIMESTEPS),
|
||||||
|
RimLegendConfig::AUTOMATIC_ALLTIMESTEPS));
|
||||||
|
options.push_back(
|
||||||
|
caf::PdmOptionItemInfo(RimLegendConfig::RangeModeEnum::uiText(RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP),
|
||||||
|
RimLegendConfig::AUTOMATIC_CURRENT_TIMESTEP));
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimTensorResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimTensorResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
@ -272,14 +320,19 @@ void RimTensorResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering
|
|||||||
vectorColorsGroup->add(&m_vectorColor);
|
vectorColorsGroup->add(&m_vectorColor);
|
||||||
|
|
||||||
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup("Vector Size");
|
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup("Vector Size");
|
||||||
vectorSizeGroup->add(&m_scaleMethod);
|
|
||||||
vectorSizeGroup->add(&m_sizeScale);
|
vectorSizeGroup->add(&m_sizeScale);
|
||||||
|
vectorSizeGroup->add(&m_scaleMethod);
|
||||||
|
|
||||||
|
if (m_scaleMethod == RESULT)
|
||||||
|
{
|
||||||
|
vectorSizeGroup->add(&m_rangeMode);
|
||||||
|
}
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimTensorResults::initAfterRead()
|
void RimTensorResults::initAfterRead()
|
||||||
{
|
{
|
||||||
@ -287,9 +340,11 @@ void RimTensorResults::initAfterRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimTensorResults::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
void RimTensorResults::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||||
|
QString uiConfigName,
|
||||||
|
caf::PdmUiEditorAttribute* attribute)
|
||||||
{
|
{
|
||||||
if (field == &m_resultFieldNameUiField)
|
if (field == &m_resultFieldNameUiField)
|
||||||
{
|
{
|
||||||
@ -302,7 +357,7 @@ void RimTensorResults::defineEditorAttribute(const caf::PdmFieldHandle* field, Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimTensorResults::uiFieldName(const QString& fieldName)
|
QString RimTensorResults::uiFieldName(const QString& fieldName)
|
||||||
{
|
{
|
||||||
@ -315,7 +370,7 @@ QString RimTensorResults::uiFieldName(const QString& fieldName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimTensorResults::fieldNameFromUi(const QString& uiFieldName)
|
QString RimTensorResults::fieldNameFromUi(const QString& uiFieldName)
|
||||||
{
|
{
|
||||||
@ -326,3 +381,14 @@ QString RimTensorResults::fieldNameFromUi(const QString& uiFieldName)
|
|||||||
|
|
||||||
return uiFieldName;
|
return uiFieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTensorResults::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||||
|
{
|
||||||
|
if (m_vectorColor() != RESULT_COLORS)
|
||||||
|
{
|
||||||
|
uiTreeOrdering.skipRemainingChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
#include "RigFemResultPosEnum.h"
|
#include "RigFemResultPosEnum.h"
|
||||||
|
#include "RimLegendConfig.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
@ -69,11 +70,13 @@ public:
|
|||||||
TensorColors vectorColors() const;
|
TensorColors vectorColors() const;
|
||||||
ScaleMethod scaleMethod() const;
|
ScaleMethod scaleMethod() const;
|
||||||
|
|
||||||
|
void mappingRange(double *min, double* max) const;
|
||||||
|
|
||||||
static RigFemResultPosEnum resultPositionType();
|
static RigFemResultPosEnum resultPositionType();
|
||||||
QString resultFieldName() const;
|
QString resultFieldName() const;
|
||||||
static QString uiFieldName(const QString& fieldName);
|
static QString uiFieldName(const QString& fieldName);
|
||||||
|
|
||||||
caf::PdmChildField<RimLegendConfig*> legendConfig;
|
caf::PdmChildField<RimLegendConfig*> arrowColorLegendConfig;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> getResultMetaDataForUIFieldSetting();
|
std::vector<std::string> getResultMetaDataForUIFieldSetting();
|
||||||
@ -83,6 +86,7 @@ private:
|
|||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
virtual void initAfterRead() override;
|
virtual void initAfterRead() override;
|
||||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||||
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
|
|
||||||
static QString fieldNameFromUi(const QString& uiFieldName);
|
static QString fieldNameFromUi(const QString& uiFieldName);
|
||||||
|
|
||||||
@ -103,4 +107,5 @@ private:
|
|||||||
|
|
||||||
caf::PdmField<caf::AppEnum<ScaleMethod>> m_scaleMethod;
|
caf::PdmField<caf::AppEnum<ScaleMethod>> m_scaleMethod;
|
||||||
caf::PdmField<float> m_sizeScale;
|
caf::PdmField<float> m_sizeScale;
|
||||||
|
caf::PdmField<RimLegendConfig::RangeModeEnum> m_rangeMode;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user