mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3633 2d Maps: Make contour lines optional
This commit is contained in:
parent
c8ebb0a4d1
commit
a842f3d445
@ -46,22 +46,25 @@ void Riv2dGridProjectionPartMgr::appendProjectionToModel(cvf::ModelBasicList* mo
|
||||
model->addPart(part.p());
|
||||
}
|
||||
|
||||
std::vector<cvf::ref<cvf::DrawableGeo>> contourDrawables = createContourPolygons(displayCoordTransform);
|
||||
for (cvf::ref<cvf::DrawableGeo> contourDrawable : contourDrawables)
|
||||
if (m_2dGridProjection->showContourLines())
|
||||
{
|
||||
if (contourDrawable.notNull() && contourDrawable->boundingBox().isValid())
|
||||
std::vector<cvf::ref<cvf::DrawableGeo>> contourDrawables = createContourPolygons(displayCoordTransform);
|
||||
for (cvf::ref<cvf::DrawableGeo> contourDrawable : contourDrawables)
|
||||
{
|
||||
caf::MeshEffectGenerator meshEffectGen(cvf::Color3::BLACK);
|
||||
meshEffectGen.setLineWidth(1.0f);
|
||||
meshEffectGen.createAndConfigurePolygonOffsetRenderState(caf::PO_2);
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
if (contourDrawable.notNull() && contourDrawable->boundingBox().isValid())
|
||||
{
|
||||
caf::MeshEffectGenerator meshEffectGen(cvf::Color3::BLACK);
|
||||
meshEffectGen.setLineWidth(1.0f);
|
||||
meshEffectGen.createAndConfigurePolygonOffsetRenderState(caf::PO_2);
|
||||
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(contourDrawable.p());
|
||||
part->setEffect(effect.p());
|
||||
part->setSourceInfo(new RivMeshLinesSourceInfo(m_2dGridProjection.p()));
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setDrawable(contourDrawable.p());
|
||||
part->setEffect(effect.p());
|
||||
part->setSourceInfo(new RivMeshLinesSourceInfo(m_2dGridProjection.p()));
|
||||
|
||||
model->addPart(part.p());
|
||||
model->addPart(part.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ Rim2dGridProjection::Rim2dGridProjection()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_showContourLines, "ContourLines", true, "Show Contour Lines", "", "", "");
|
||||
|
||||
setName("2d Grid Projection");
|
||||
nameField()->uiCapability()->setUiReadOnly(true);
|
||||
|
||||
@ -297,6 +299,14 @@ double Rim2dGridProjection::sampleSpacing() const
|
||||
return m_sampleSpacing;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Rim2dGridProjection::showContourLines() const
|
||||
{
|
||||
return m_showContourLines();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -882,20 +892,18 @@ RigMainGrid* Rim2dGridProjection::mainGrid() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dGridProjection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isChecked || changedField == &m_sampleSpacing || changedField == &m_resultAggregation)
|
||||
{
|
||||
RimEclipseView* view = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(view);
|
||||
view->updateConnectedEditors();
|
||||
|
||||
RimProject* proj;
|
||||
view->firstAncestorOrThisOfTypeAsserted(proj);
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
if (changedField == &m_resultAggregation)
|
||||
{
|
||||
legendConfig()->disableAllTimeStepsRange(isSummationResult());
|
||||
}
|
||||
|
||||
RimEclipseView* view = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(view);
|
||||
view->updateConnectedEditors();
|
||||
|
||||
RimProject* proj;
|
||||
view->firstAncestorOrThisOfTypeAsserted(proj);
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
double maxValue() const;
|
||||
double minValue() const;
|
||||
double sampleSpacing() const;
|
||||
bool showContourLines() const;
|
||||
|
||||
void updateDefaultSampleSpacingFromGrid();
|
||||
const std::vector<double>& aggregatedResults() const;
|
||||
bool isSummationResult() const;
|
||||
@ -111,6 +113,8 @@ protected:
|
||||
protected:
|
||||
caf::PdmField<double> m_sampleSpacing;
|
||||
caf::PdmField<ResultAggregation> m_resultAggregation;
|
||||
caf::PdmField<bool> m_showContourLines;
|
||||
|
||||
std::map<size_t, cvf::ref<cvf::UByteArray>> m_cellGridIdxVisibilityMap;
|
||||
|
||||
std::vector<double> m_aggregatedResults;
|
||||
|
Loading…
Reference in New Issue
Block a user