mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve Simulation Well Color UI
This commit is contained in:
parent
2e13e53b3c
commit
195fc85a5a
@ -106,6 +106,17 @@ namespace caf
|
||||
}
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimSimWellInViewCollection::WellPipeColorsEnum::setUp()
|
||||
{
|
||||
addItem(RimSimWellInViewCollection::WELLPIPE_COLOR_UNIQUE, "WELLPIPE_COLOR_INDIDUALLY", "Unique Colors");
|
||||
addItem(RimSimWellInViewCollection::WELLPIPE_COLOR_UNIFORM, "WELLPIPE_COLOR_UNIFORM", "Uniform Default Color");
|
||||
setDefault(RimSimWellInViewCollection::WELLPIPE_COLOR_UNIQUE);
|
||||
}
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSimWellInViewCollection, "Wells");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -152,13 +163,8 @@ RimSimWellInViewCollection::RimSimWellInViewCollection()
|
||||
CAF_PDM_InitField(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Color Pipe Connections", "", "", "");
|
||||
|
||||
cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW;
|
||||
CAF_PDM_InitField(&m_wellColorForApply, "WellColorForApply", defaultApplyColor, "", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_applySingleColorToWells, "ApplySingleColorToWells", false, "Uniform Pipe Colors", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&m_applySingleColorToWells);
|
||||
|
||||
CAF_PDM_InitField(&m_applyIndividualColorsToWells, "ApplyIndividualColorsToWells", false, "Unique Pipe Colors", "", "", "");
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField(&m_applyIndividualColorsToWells);
|
||||
CAF_PDM_InitField(&m_defaultWellPipeColor, "WellColorForApply", defaultApplyColor, "Uniform Well Color", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPipeColors, "WellPipeColors", "Individual Pipe Colors", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe Vertex Count", "", "", "");
|
||||
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
||||
@ -415,30 +421,24 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_applyIndividualColorsToWells == changedField)
|
||||
if (&m_wellPipeColors == changedField || &m_defaultWellPipeColor == changedField)
|
||||
{
|
||||
assignDefaultWellColors();
|
||||
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
m_applyIndividualColorsToWells = false;
|
||||
}
|
||||
|
||||
if (&m_applySingleColorToWells == changedField)
|
||||
{
|
||||
cvf::Color3f col = m_wellColorForApply();
|
||||
|
||||
for (size_t i = 0; i < wells.size(); i++)
|
||||
if (m_wellPipeColors == WELLPIPE_COLOR_UNIQUE)
|
||||
{
|
||||
wells[i]->wellPipeColor = col;
|
||||
wells[i]->updateConnectedEditors();
|
||||
assignDefaultWellColors();
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Color3f col = m_defaultWellPipeColor();
|
||||
|
||||
for (size_t i = 0; i < wells.size(); i++)
|
||||
{
|
||||
wells[i]->wellPipeColor = col;
|
||||
wells[i]->updateConnectedEditors();
|
||||
}
|
||||
RimSimWellInViewCollection::updateWellAllocationPlots();
|
||||
}
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
RimSimWellInViewCollection::updateWellAllocationPlots();
|
||||
|
||||
m_applySingleColorToWells = false;
|
||||
}
|
||||
|
||||
if (&m_showWellCells == changedField)
|
||||
@ -471,8 +471,6 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInViewCollection::assignDefaultWellColors()
|
||||
{
|
||||
|
||||
|
||||
RimEclipseCase* ownerCase;
|
||||
firstAncestorOrThisOfTypeAsserted(ownerCase);
|
||||
|
||||
@ -549,9 +547,11 @@ void RimSimWellInViewCollection::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
colorGroup->setCollapsedByDefault(true);
|
||||
colorGroup->add(&showConnectionStatusColors);
|
||||
colorGroup->add(&wellLabelColor);
|
||||
colorGroup->add(&m_applyIndividualColorsToWells);
|
||||
colorGroup->add(&m_applySingleColorToWells);
|
||||
colorGroup->add(&m_wellColorForApply);
|
||||
colorGroup->add(&m_wellPipeColors);
|
||||
if (m_wellPipeColors == WELLPIPE_COLOR_UNIFORM)
|
||||
{
|
||||
colorGroup->add(&m_defaultWellPipeColor);
|
||||
}
|
||||
|
||||
caf::PdmUiGroup* wellPipeGroup = uiOrdering.addNewGroup("Well Pipe Geometry" );
|
||||
wellPipeGroup->add(&wellPipeCoordType);
|
||||
@ -708,39 +708,6 @@ void RimSimWellInViewCollection::initAfterRead()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInViewCollection::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (&m_applyIndividualColorsToWells == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* editorAttr = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
|
||||
if (editorAttr)
|
||||
{
|
||||
editorAttr->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_applySingleColorToWells == field)
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* editorAttr = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>(attribute);
|
||||
if (editorAttr)
|
||||
{
|
||||
QColor col;
|
||||
col.setRgbF(m_wellColorForApply().r(), m_wellColorForApply().g(), m_wellColorForApply().b());
|
||||
|
||||
QPixmap pixmap(20, 20);
|
||||
pixmap.fill(col);
|
||||
|
||||
QIcon colorIcon(pixmap);
|
||||
|
||||
editorAttr->m_buttonIcon = colorIcon;
|
||||
editorAttr->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -82,8 +82,16 @@ public:
|
||||
WELLPIPE_CELLCENTER,
|
||||
WELLPIPE_INTERPOLATED
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<RimSimWellInViewCollection::WellPipeCoordType> WellPipeCoordEnum;
|
||||
|
||||
enum WellPipeColors
|
||||
{
|
||||
WELLPIPE_COLOR_UNIQUE,
|
||||
WELLPIPE_COLOR_UNIFORM
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<RimSimWellInViewCollection::WellPipeColors> WellPipeColorsEnum;
|
||||
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField<bool> showWellsIntersectingVisibleCells;
|
||||
@ -135,7 +143,6 @@ protected:
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void initAfterRead() override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
private:
|
||||
void calculateWellGeometryVisibility(size_t frameIndex);
|
||||
@ -146,9 +153,8 @@ private:
|
||||
std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities;
|
||||
|
||||
// Fields
|
||||
caf::PdmField<cvf::Color3f> m_wellColorForApply;
|
||||
caf::PdmField<bool> m_applySingleColorToWells;
|
||||
caf::PdmField<bool> m_applyIndividualColorsToWells;
|
||||
caf::PdmField<cvf::Color3f> m_defaultWellPipeColor;
|
||||
caf::PdmField<WellPipeColorsEnum> m_wellPipeColors;
|
||||
|
||||
caf::PdmField<caf::Tristate> m_showWellLabel;
|
||||
caf::PdmField<caf::Tristate> m_showWellHead;
|
||||
|
Loading…
Reference in New Issue
Block a user