#3633 2d Maps: Make contour lines optional

This commit is contained in:
Gaute Lindkvist 2018-11-05 16:19:04 +01:00
parent c8ebb0a4d1
commit a842f3d445
3 changed files with 37 additions and 22 deletions

View File

@ -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());
}
}
}
}

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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;