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");
|
CAF_PDM_SOURCE_INIT(RimSimWellInViewCollection, "Wells");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -152,13 +163,8 @@ RimSimWellInViewCollection::RimSimWellInViewCollection()
|
|||||||
CAF_PDM_InitField(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Color Pipe Connections", "", "", "");
|
CAF_PDM_InitField(&showConnectionStatusColors, "ShowConnectionStatusColors", true, "Color Pipe Connections", "", "", "");
|
||||||
|
|
||||||
cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW;
|
cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW;
|
||||||
CAF_PDM_InitField(&m_wellColorForApply, "WellColorForApply", defaultApplyColor, "", "", "", "");
|
CAF_PDM_InitField(&m_defaultWellPipeColor, "WellColorForApply", defaultApplyColor, "Uniform Well Color", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellPipeColors, "WellPipeColors", "Individual Pipe Colors", "", "", "");
|
||||||
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(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe Vertex Count", "", "", "");
|
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe Vertex Count", "", "", "");
|
||||||
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
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)
|
||||||
|
{
|
||||||
|
if (m_wellPipeColors == WELLPIPE_COLOR_UNIQUE)
|
||||||
{
|
{
|
||||||
assignDefaultWellColors();
|
assignDefaultWellColors();
|
||||||
|
|
||||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
m_applyIndividualColorsToWells = false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (&m_applySingleColorToWells == changedField)
|
|
||||||
{
|
{
|
||||||
cvf::Color3f col = m_wellColorForApply();
|
cvf::Color3f col = m_defaultWellPipeColor();
|
||||||
|
|
||||||
for (size_t i = 0; i < wells.size(); i++)
|
for (size_t i = 0; i < wells.size(); i++)
|
||||||
{
|
{
|
||||||
wells[i]->wellPipeColor = col;
|
wells[i]->wellPipeColor = col;
|
||||||
wells[i]->updateConnectedEditors();
|
wells[i]->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
|
||||||
|
|
||||||
RimSimWellInViewCollection::updateWellAllocationPlots();
|
RimSimWellInViewCollection::updateWellAllocationPlots();
|
||||||
|
}
|
||||||
m_applySingleColorToWells = false;
|
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (&m_showWellCells == changedField)
|
if (&m_showWellCells == changedField)
|
||||||
@ -471,8 +471,6 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSimWellInViewCollection::assignDefaultWellColors()
|
void RimSimWellInViewCollection::assignDefaultWellColors()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
RimEclipseCase* ownerCase;
|
RimEclipseCase* ownerCase;
|
||||||
firstAncestorOrThisOfTypeAsserted(ownerCase);
|
firstAncestorOrThisOfTypeAsserted(ownerCase);
|
||||||
|
|
||||||
@ -549,9 +547,11 @@ void RimSimWellInViewCollection::defineUiOrdering(QString uiConfigName, caf::Pdm
|
|||||||
colorGroup->setCollapsedByDefault(true);
|
colorGroup->setCollapsedByDefault(true);
|
||||||
colorGroup->add(&showConnectionStatusColors);
|
colorGroup->add(&showConnectionStatusColors);
|
||||||
colorGroup->add(&wellLabelColor);
|
colorGroup->add(&wellLabelColor);
|
||||||
colorGroup->add(&m_applyIndividualColorsToWells);
|
colorGroup->add(&m_wellPipeColors);
|
||||||
colorGroup->add(&m_applySingleColorToWells);
|
if (m_wellPipeColors == WELLPIPE_COLOR_UNIFORM)
|
||||||
colorGroup->add(&m_wellColorForApply);
|
{
|
||||||
|
colorGroup->add(&m_defaultWellPipeColor);
|
||||||
|
}
|
||||||
|
|
||||||
caf::PdmUiGroup* wellPipeGroup = uiOrdering.addNewGroup("Well Pipe Geometry" );
|
caf::PdmUiGroup* wellPipeGroup = uiOrdering.addNewGroup("Well Pipe Geometry" );
|
||||||
wellPipeGroup->add(&wellPipeCoordType);
|
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_CELLCENTER,
|
||||||
WELLPIPE_INTERPOLATED
|
WELLPIPE_INTERPOLATED
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef caf::AppEnum<RimSimWellInViewCollection::WellPipeCoordType> WellPipeCoordEnum;
|
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> isActive;
|
||||||
caf::PdmField<bool> showWellsIntersectingVisibleCells;
|
caf::PdmField<bool> showWellsIntersectingVisibleCells;
|
||||||
@ -135,7 +143,6 @@ protected:
|
|||||||
|
|
||||||
caf::PdmFieldHandle* objectToggleField() override;
|
caf::PdmFieldHandle* objectToggleField() override;
|
||||||
void initAfterRead() override;
|
void initAfterRead() override;
|
||||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void calculateWellGeometryVisibility(size_t frameIndex);
|
void calculateWellGeometryVisibility(size_t frameIndex);
|
||||||
@ -146,9 +153,8 @@ private:
|
|||||||
std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities;
|
std::vector< std::vector< cvf::ubyte > > m_framesOfResultWellPipeVisibilities;
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
caf::PdmField<cvf::Color3f> m_wellColorForApply;
|
caf::PdmField<cvf::Color3f> m_defaultWellPipeColor;
|
||||||
caf::PdmField<bool> m_applySingleColorToWells;
|
caf::PdmField<WellPipeColorsEnum> m_wellPipeColors;
|
||||||
caf::PdmField<bool> m_applyIndividualColorsToWells;
|
|
||||||
|
|
||||||
caf::PdmField<caf::Tristate> m_showWellLabel;
|
caf::PdmField<caf::Tristate> m_showWellLabel;
|
||||||
caf::PdmField<caf::Tristate> m_showWellHead;
|
caf::PdmField<caf::Tristate> m_showWellHead;
|
||||||
|
Loading…
Reference in New Issue
Block a user