mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'origin/internal' into internal
This commit is contained in:
@@ -106,13 +106,13 @@ RimLegendConfig::RimLegendConfig()
|
||||
m_localAutoNegClosestToZero(0)
|
||||
{
|
||||
CAF_PDM_InitObject("Legend Definition", ":/Legend.png", "", "");
|
||||
CAF_PDM_InitField(&m_numLevels, "NumberOfLevels", 8, "Number of levels", "", "","");
|
||||
CAF_PDM_InitField(&m_precision, "Precision", 2, "Precision", "", "","");
|
||||
CAF_PDM_InitField(&m_tickNumberFormat, "TickNumberFormat", caf::AppEnum<RimLegendConfig::NumberFormatType>(FIXED), "Precision", "", "","");
|
||||
CAF_PDM_InitField(&m_numLevels, "NumberOfLevels", 8, "Number of levels", "", "A hint on how many tick marks you whish.","");
|
||||
CAF_PDM_InitField(&m_precision, "Precision", 2, "Significant digits", "", "The number of significant digits displayed in the legend numbers","");
|
||||
CAF_PDM_InitField(&m_tickNumberFormat, "TickNumberFormat", caf::AppEnum<RimLegendConfig::NumberFormatType>(FIXED), "Number format", "", "","");
|
||||
|
||||
CAF_PDM_InitField(&m_colorRangeMode, "ColorRangeMode", ColorRangeEnum(NORMAL) , "Color range", "", "", "");
|
||||
CAF_PDM_InitField(&m_colorRangeMode, "ColorRangeMode", ColorRangeEnum(NORMAL) , "Colors", "", "", "");
|
||||
CAF_PDM_InitField(&m_mappingMode, "MappingMode", MappingEnum(LINEAR_CONTINUOUS) , "Mapping", "", "", "");
|
||||
CAF_PDM_InitField(&m_rangeMode, "RangeType", caf::AppEnum<RimLegendConfig::RangeModeType>(AUTOMATIC_ALLTIMESTEPS), "Legend range type", "", "Switches between automatic and user defined range on the legend", "");
|
||||
CAF_PDM_InitField(&m_rangeMode, "RangeType", caf::AppEnum<RimLegendConfig::RangeModeType>(AUTOMATIC_ALLTIMESTEPS), "Range type", "", "Switches between automatic and user defined range on the legend", "");
|
||||
CAF_PDM_InitField(&m_userDefinedMaxValue, "UserDefinedMax", 1.0, "Max", "", "Min value of the legend", "");
|
||||
CAF_PDM_InitField(&m_userDefinedMinValue, "UserDefinedMin", 0.0, "Min", "", "Max value of the legend", "");
|
||||
CAF_PDM_InitField(&resultVariableName, "ResultVariableUsage", QString(""), "", "", "", "");
|
||||
@@ -366,12 +366,14 @@ void RimLegendConfig::updateLegend()
|
||||
|
||||
if (m_mappingMode == LOG10_CONTINUOUS || m_mappingMode == LOG10_DISCRETE)
|
||||
{
|
||||
decadesInRange = abs(adjustedMin - adjustedMax) ? abs(adjustedMin) : abs(adjustedMax);
|
||||
// For log mapping, use the min value as reference for num valid digits
|
||||
decadesInRange = abs(adjustedMin) < abs(adjustedMax) ? abs(adjustedMin) : abs(adjustedMax);
|
||||
decadesInRange = log10(decadesInRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
double absRange = abs(adjustedMax - adjustedMin);
|
||||
// For linear mapping, use the max value as reference for num valid digits
|
||||
double absRange = CVF_MAX(abs(adjustedMax), abs(adjustedMin));
|
||||
decadesInRange = log10(absRange);
|
||||
}
|
||||
|
||||
@@ -382,7 +384,11 @@ void RimLegendConfig::updateLegend()
|
||||
m_legend->setTickFormat((cvf::OverlayScalarMapperLegend::NumberFormat)nft);
|
||||
|
||||
// Set the fixed number of digits after the decimal point to the number needed to show all the significant digits.
|
||||
int numDecimalDigits = m_precision() - decadesInRange;
|
||||
int numDecimalDigits = m_precision();
|
||||
if (nft != SCIENTIFIC)
|
||||
{
|
||||
numDecimalDigits -= decadesInRange;
|
||||
}
|
||||
m_legend->setTickPrecision(cvf::Math::clamp(numDecimalDigits, 0, 20));
|
||||
|
||||
|
||||
@@ -569,3 +575,21 @@ void RimLegendConfig::setClosestToZeroValues(double globalPosClosestToZero, doub
|
||||
updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiOrdering * formatGr = uiOrdering.addNewGroup("Format");
|
||||
formatGr->add(&m_numLevels);
|
||||
formatGr->add(&m_precision);
|
||||
formatGr->add(&m_tickNumberFormat);
|
||||
formatGr->add(&m_colorRangeMode);
|
||||
|
||||
caf::PdmUiOrdering * mappingGr = uiOrdering.addNewGroup("Mapping");
|
||||
mappingGr->add(&m_mappingMode);
|
||||
mappingGr->add(&m_rangeMode);
|
||||
mappingGr->add(&m_userDefinedMaxValue);
|
||||
mappingGr->add(&m_userDefinedMinValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,11 +98,14 @@ public:
|
||||
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 updateFieldVisibility();
|
||||
cvf::ref<cvf::Color3ubArray> interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount);
|
||||
double roundToNumSignificantDigits(double value, double precision);
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ void PdmUiCheckBoxEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_checkBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_checkBox->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
PdmUiCheckBoxEditorAttribute attributes;
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
||||
|
||||
@@ -81,8 +81,10 @@ void PdmUiFilePathEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
}
|
||||
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_lineEdit->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &m_attributes);
|
||||
|
||||
|
||||
@@ -79,7 +79,10 @@ void PdmUiLineEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
}
|
||||
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_lineEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_lineEdit->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
PdmUiLineEditorAttribute leab;
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &leab);
|
||||
|
||||
@@ -130,7 +130,10 @@ void PdmUiListEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
}
|
||||
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_listView->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_listView->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
/// Demo code Not used yet
|
||||
// PdmUiListEditorAttribute attributes;
|
||||
|
||||
@@ -77,6 +77,8 @@ void PdmUiPushButtonEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
|
||||
//m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_pushButton->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_pushButton->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
PdmUiPushButtonEditorAttribute attributes;
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &attributes);
|
||||
|
||||
@@ -75,8 +75,13 @@ void PdmUiSliderEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
}
|
||||
|
||||
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_spinBox->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_spinBox->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_slider->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_slider->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &m_attributes);
|
||||
|
||||
|
||||
@@ -80,9 +80,11 @@ void PdmUiTextEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
}
|
||||
|
||||
//m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
|
||||
m_label->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
m_textEdit->setReadOnly(field()->isUiReadOnly(uiConfigName));
|
||||
//m_textEdit->setEnabled(!field()->isUiReadOnly(uiConfigName)); // Neccesary ?
|
||||
m_textEdit->setToolTip(field()->uiToolTip(uiConfigName));
|
||||
|
||||
PdmUiTextEditorAttribute leab;
|
||||
field()->ownerObject()->editorAttribute(field(), uiConfigName, &leab);
|
||||
|
||||
@@ -54,19 +54,19 @@
|
||||
class MySortFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
MySortFilterProxyModel(QObject *parent = 0)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void notifyModelChanged()
|
||||
{
|
||||
MySortFilterProxyModel(QObject *parent = 0)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void notifyModelChanged()
|
||||
{
|
||||
QModelIndex startModelIdx = index(0,0);
|
||||
QModelIndex endModelIdx = index(rowCount(startModelIdx), 0);
|
||||
|
||||
emit dataChanged(startModelIdx, endModelIdx);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ QWidget* PdmUiTreeViewEditor::createWidget(QWidget* parent)
|
||||
m_proxyTreeModelPdm->setSourceModel(m_treeModelPdm);
|
||||
m_treeView->setModel(m_proxyTreeModelPdm);
|
||||
|
||||
m_treeView->setSortingEnabled(true);
|
||||
m_treeView->setSortingEnabled(true);
|
||||
m_treeView->sortByColumn(1, Qt::AscendingOrder);
|
||||
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ void UiTreeModelPdm::notifyModelChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant UiTreeModelPdm::headerData(int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole */) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
if (section < m_columnHeaders.size())
|
||||
|
||||
Reference in New Issue
Block a user