mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add legend levels field to Contor Map projection and make sliders delay update until release
This commit is contained in:
@@ -84,7 +84,7 @@ RimContourMapProjection::RimContourMapProjection()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("RimContourMapProjection", ":/2DMapProjection16x16.png", "", "");
|
CAF_PDM_InitObject("RimContourMapProjection", ":/2DMapProjection16x16.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_relativeSampleSpacing, "SampleSpacing", 0.75, "Sample Spacing Factor", "", "", "");
|
CAF_PDM_InitField(&m_relativeSampleSpacing, "SampleSpacing", 0.8, "Sample Spacing Factor", "", "", "");
|
||||||
m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "");
|
||||||
@@ -1691,6 +1691,8 @@ void RimContourMapProjection::defineEditorAttribute(const caf::PdmFieldHandle* f
|
|||||||
{
|
{
|
||||||
myAttr->m_minimum = 0.2;
|
myAttr->m_minimum = 0.2;
|
||||||
myAttr->m_maximum = 2.0;
|
myAttr->m_maximum = 2.0;
|
||||||
|
myAttr->m_sliderTickCount = 9;
|
||||||
|
myAttr->m_delaySliderUpdateUntilRelease = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1701,14 +1703,14 @@ void RimContourMapProjection::defineEditorAttribute(const caf::PdmFieldHandle* f
|
|||||||
void RimContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings");
|
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings");
|
||||||
|
mainGroup->add(&m_resultAggregation);
|
||||||
|
legendConfig()->uiOrdering("NumLevelsOnly", *mainGroup);
|
||||||
mainGroup->add(&m_relativeSampleSpacing);
|
mainGroup->add(&m_relativeSampleSpacing);
|
||||||
mainGroup->add(&m_showContourLines);
|
mainGroup->add(&m_showContourLines);
|
||||||
mainGroup->add(&m_showContourLabels);
|
mainGroup->add(&m_showContourLabels);
|
||||||
m_showContourLabels.uiCapability()->setUiReadOnly(!m_showContourLines());
|
m_showContourLabels.uiCapability()->setUiReadOnly(!m_showContourLines());
|
||||||
mainGroup->add(&m_smoothContourLines);
|
mainGroup->add(&m_smoothContourLines);
|
||||||
m_smoothContourLines.uiCapability()->setUiReadOnly(!m_showContourLines());
|
m_smoothContourLines.uiCapability()->setUiReadOnly(!m_showContourLines());
|
||||||
mainGroup->add(&m_resultAggregation);
|
|
||||||
|
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -564,6 +564,7 @@ void RimGeoMechContourMapProjection::defineEditorAttribute(const caf::PdmFieldHa
|
|||||||
myAttr->m_minimum = 0.0;
|
myAttr->m_minimum = 0.0;
|
||||||
myAttr->m_maximum = 1.0;
|
myAttr->m_maximum = 1.0;
|
||||||
myAttr->m_sliderTickCount = 4;
|
myAttr->m_sliderTickCount = 4;
|
||||||
|
myAttr->m_delaySliderUpdateUntilRelease = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -823,6 +823,12 @@ cvf::Color3ubArray RimRegularLegendConfig::colorArrayFromColorType(ColorRangesTy
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimRegularLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
void RimRegularLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
{
|
{
|
||||||
|
if (uiConfigName == "NumLevelsOnly")
|
||||||
|
{
|
||||||
|
uiOrdering.add(&m_numLevels);
|
||||||
|
uiOrdering.skipRemainingFields(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
caf::PdmUiOrdering * formatGr = uiOrdering.addNewGroup("Format");
|
caf::PdmUiOrdering * formatGr = uiOrdering.addNewGroup("Format");
|
||||||
formatGr->add(&m_numLevels);
|
formatGr->add(&m_numLevels);
|
||||||
@@ -836,7 +842,6 @@ void RimRegularLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
|
|||||||
mappingGr->add(&m_userDefinedMaxValue);
|
mappingGr->add(&m_userDefinedMaxValue);
|
||||||
mappingGr->add(&m_userDefinedMinValue);
|
mappingGr->add(&m_userDefinedMinValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFieldVisibility();
|
updateFieldVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ void PdmUiDoubleSliderEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
m_lineEdit->setValidator(pdmValidator);
|
m_lineEdit->setValidator(pdmValidator);
|
||||||
m_lineEdit->setText(textValue);
|
m_lineEdit->setText(textValue);
|
||||||
|
|
||||||
|
m_sliderValue = doubleValue;
|
||||||
updateSliderPosition(doubleValue);
|
updateSliderPosition(doubleValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ QWidget* PdmUiDoubleSliderEditor::createEditorWidget(QWidget * parent)
|
|||||||
layout->addWidget(m_slider);
|
layout->addWidget(m_slider);
|
||||||
|
|
||||||
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderValueChanged(int)));
|
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderValueChanged(int)));
|
||||||
|
connect(m_slider, SIGNAL(sliderReleased()), this, SLOT(slotSliderReleased()));
|
||||||
return containerWidget;
|
return containerWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ void PdmUiDoubleSliderEditor::slotEditingFinished()
|
|||||||
|
|
||||||
double doubleVal = textValue.toDouble();
|
double doubleVal = textValue.toDouble();
|
||||||
doubleVal = qBound(m_attributes.m_minimum, doubleVal, m_attributes.m_maximum);
|
doubleVal = qBound(m_attributes.m_minimum, doubleVal, m_attributes.m_maximum);
|
||||||
|
m_sliderValue = doubleVal;
|
||||||
|
|
||||||
writeValueToField(doubleVal);
|
writeValueToField(doubleVal);
|
||||||
}
|
}
|
||||||
@@ -169,8 +171,24 @@ void PdmUiDoubleSliderEditor::slotEditingFinished()
|
|||||||
void PdmUiDoubleSliderEditor::slotSliderValueChanged(int value)
|
void PdmUiDoubleSliderEditor::slotSliderValueChanged(int value)
|
||||||
{
|
{
|
||||||
double newDoubleValue = convertFromSliderValue(value);
|
double newDoubleValue = convertFromSliderValue(value);
|
||||||
|
m_sliderValue = newDoubleValue;
|
||||||
|
|
||||||
writeValueToField(newDoubleValue);
|
if (m_attributes.m_delaySliderUpdateUntilRelease)
|
||||||
|
{
|
||||||
|
m_lineEdit->setText(QString("%1").arg(m_sliderValue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writeValueToField(m_sliderValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void PdmUiDoubleSliderEditor::slotSliderReleased()
|
||||||
|
{
|
||||||
|
writeValueToField(m_sliderValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
m_maximum = 10;
|
m_maximum = 10;
|
||||||
m_decimals = 6;
|
m_decimals = 6;
|
||||||
m_sliderTickCount = 2000;
|
m_sliderTickCount = 2000;
|
||||||
|
m_delaySliderUpdateUntilRelease = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -68,6 +69,7 @@ public:
|
|||||||
double m_maximum;
|
double m_maximum;
|
||||||
int m_decimals;
|
int m_decimals;
|
||||||
int m_sliderTickCount;
|
int m_sliderTickCount;
|
||||||
|
bool m_delaySliderUpdateUntilRelease;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -91,6 +93,7 @@ protected:
|
|||||||
protected slots:
|
protected slots:
|
||||||
void slotEditingFinished();
|
void slotEditingFinished();
|
||||||
void slotSliderValueChanged(int value);
|
void slotSliderValueChanged(int value);
|
||||||
|
void slotSliderReleased();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSliderPosition(double value);
|
void updateSliderPosition(double value);
|
||||||
@@ -103,6 +106,7 @@ private:
|
|||||||
QPointer<QLineEdit> m_lineEdit;
|
QPointer<QLineEdit> m_lineEdit;
|
||||||
QPointer<QSlider> m_slider;
|
QPointer<QSlider> m_slider;
|
||||||
QPointer<QLabel> m_label;
|
QPointer<QLabel> m_label;
|
||||||
|
double m_sliderValue;
|
||||||
|
|
||||||
PdmUiDoubleSliderEditorAttribute m_attributes;
|
PdmUiDoubleSliderEditorAttribute m_attributes;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user