#1222 Interpolate category colors and assign well color based on sorted order

This commit is contained in:
Magne Sjaastad
2017-02-15 13:26:59 +01:00
parent 4fc0839a33
commit 9a7f187765
4 changed files with 59 additions and 20 deletions

View File

@@ -1125,14 +1125,16 @@ void RimEclipseView::syncronizeWellsWithResults()
// Set the new wells into the field.
this->wellCollection()->wells().insert(0, newWells);
// Make sure all the wells have their reservoirView ptr setup correctly
this->wellCollection()->setReservoirView(this);
// Sort wells before assigning colors, as the colors are distributed based on sorting
this->wellCollection()->sortWellsByName();
if (isAnyWellCreated)
{
this->wellCollection()->assignDefaultWellColors();
}
// Make sure all the wells have their reservoirView ptr setup correctly
this->wellCollection()->setReservoirView(this);
this->wellCollection()->sortWellsByName();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -25,7 +25,6 @@
#include "RiaPreferences.h"
#include "RigEclipseCaseData.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
@@ -453,24 +452,16 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
void RimEclipseWellCollection::assignDefaultWellColors()
{
// The wells are sorted, use ordering of single well results data to assign colors
RimEclipseCase* rimEclipseCase = nullptr;
this->firstAncestorOrThisOfType(rimEclipseCase);
if (!rimEclipseCase) return;
if (!rimEclipseCase->reservoirData()) return;
cvf::Collection<RigSingleWellResultsData> wellResults = rimEclipseCase->reservoirData()->wellResults();
const caf::ColorTable& colorTable = RiaColorTables::wellsPaletteColors();
cvf::Color3ubArray catColors = colorTable.color3ubArray();
cvf::Color3ubArray interpolatedCatColors = caf::ColorTable::interpolateColorArray(catColors, wells.size());
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
for (size_t wIdx = 0; wIdx < wells.size(); ++wIdx)
{
RimEclipseWell* well = this->findWell(wellResults[wIdx]->m_wellName);
RimEclipseWell* well = wells[wIdx];
if (well)
{
cvf::Color3f col = colorTable.cycledColor3f(wIdx);
cvf::Color3f col = cvf::Color3f(interpolatedCatColors[wIdx]);
well->wellPipeColor = col;
well->updateConnectedEditors();