diff --git a/ApplicationCode/Application/Tools/RiaColorTables.cpp b/ApplicationCode/Application/Tools/RiaColorTables.cpp index e28ab49cb8..007d6b959b 100644 --- a/ApplicationCode/Application/Tools/RiaColorTables.cpp +++ b/ApplicationCode/Application/Tools/RiaColorTables.cpp @@ -158,34 +158,7 @@ const caf::ColorTable& RiaColorTables::redWhiteBluePaletteColors() //-------------------------------------------------------------------------------------------------- const caf::ColorTable& RiaColorTables::categoryPaletteColors() { - // Based on http://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors - // and Kelly Colors and sorted by hue - // See also http://www.w3schools.com/colors/ for palettes etc. - - static std::vector colors{ - cvf::Color3ub(128, 62, 117), // hwb(310, 24%, 50%) strong_purple - cvf::Color3ub(212, 28, 132), // hwb(326, 11%, 17%) strong_purplish_red - cvf::Color3ub(246, 118, 142), // hwb(349, 46%, 4%) strong_purplish_pink - cvf::Color3ub(193, 0, 32), // hwb(350, 0%, 24%) vivid_red - cvf::Color3ub(127, 24, 13), // hwb( 6, 5%, 50%) strong_reddish_brown - cvf::Color3ub(241, 58, 19), // hwb( 11, 7%, 5%) vivid_reddish_orange - cvf::Color3ub(255, 122, 92), // hwb( 11, 36%, 0%) strong_yellowish_pink - cvf::Color3ub(129, 112, 102), // hwb( 22, 40%, 49%) medium_gray - cvf::Color3ub(255, 104, 0), // hwb( 24, 0%, 0%) vivid_orange - cvf::Color3ub( 89, 51, 21), // hwb( 26, 8%, 65%) deep_yellowish_brown - cvf::Color3ub(255, 142, 0), // hwb( 33, 0%, 0%) vivid_orange_yellow - cvf::Color3ub(206, 162, 98), // hwb( 36, 38%, 19%) grayish_yellow - cvf::Color3ub(244, 200, 0), // hwb( 49, 0%, 4%) vivid_greenish_yellow - cvf::Color3ub(147, 170, 0), // hwb( 68, 0%, 33%) vivid_yellowish_green - cvf::Color3ub( 59, 84, 23), // hwb( 85, 9%, 67%) dark_olive_green - cvf::Color3ub( 0, 125, 52), // hwb(145, 0%, 51%) vivid_green - cvf::Color3ub( 54, 125, 123), // hwb(178, 21%, 51%) vivid_blueish_green - cvf::Color3ub( 0, 83, 138), // hwb(204, 0%, 46%) strong_blue - cvf::Color3ub(166, 189, 215), // hwb(212, 65%, 16%) very_light_blue - cvf::Color3ub( 46, 76, 224) // hwb(230, 18%, 12%) medium_blue - }; - - static caf::ColorTable colorTable = caf::ColorTable(colors); + static caf::ColorTable colorTable = caf::ColorTable(categoryColors()); return colorTable; } @@ -517,6 +490,18 @@ const caf::ColorTable& RiaColorTables::editableWellPathsPaletteColors() return colorTable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const caf::ColorTable& RiaColorTables::wellPathsPaletteColors() +{ + // Use inverted category colors to avoid identical colors if we have few sim wells and few well paths + + static caf::ColorTable colorTable = caf::ColorTable(invertedCategoryColors()); + + return colorTable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -536,3 +521,69 @@ cvf::Color3f RiaColorTables::perforationLengthColor() return cvf::Color3f(color); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaColorTables::categoryColors() +{ + // Based on http://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors + // and Kelly Colors and sorted by hue + // See also http://www.w3schools.com/colors/ for palettes etc. + + static std::vector colors{ + cvf::Color3ub(128, 62, 117), // hwb(310, 24%, 50%) strong_purple + cvf::Color3ub(212, 28, 132), // hwb(326, 11%, 17%) strong_purplish_red + cvf::Color3ub(246, 118, 142), // hwb(349, 46%, 4%) strong_purplish_pink + cvf::Color3ub(193, 0, 32), // hwb(350, 0%, 24%) vivid_red + cvf::Color3ub(127, 24, 13), // hwb( 6, 5%, 50%) strong_reddish_brown + cvf::Color3ub(241, 58, 19), // hwb( 11, 7%, 5%) vivid_reddish_orange + cvf::Color3ub(255, 122, 92), // hwb( 11, 36%, 0%) strong_yellowish_pink + cvf::Color3ub(129, 112, 102), // hwb( 22, 40%, 49%) medium_gray + cvf::Color3ub(255, 104, 0), // hwb( 24, 0%, 0%) vivid_orange + cvf::Color3ub( 89, 51, 21), // hwb( 26, 8%, 65%) deep_yellowish_brown + cvf::Color3ub(255, 142, 0), // hwb( 33, 0%, 0%) vivid_orange_yellow + cvf::Color3ub(206, 162, 98), // hwb( 36, 38%, 19%) grayish_yellow + cvf::Color3ub(244, 200, 0), // hwb( 49, 0%, 4%) vivid_greenish_yellow + cvf::Color3ub(147, 170, 0), // hwb( 68, 0%, 33%) vivid_yellowish_green + cvf::Color3ub( 59, 84, 23), // hwb( 85, 9%, 67%) dark_olive_green + cvf::Color3ub( 0, 125, 52), // hwb(145, 0%, 51%) vivid_green + cvf::Color3ub( 54, 125, 123), // hwb(178, 21%, 51%) vivid_blueish_green + cvf::Color3ub( 0, 83, 138), // hwb(204, 0%, 46%) strong_blue + cvf::Color3ub(166, 189, 215), // hwb(212, 65%, 16%) very_light_blue + cvf::Color3ub( 46, 76, 224) // hwb(230, 18%, 12%) medium_blue + }; + + return colors; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaColorTables::invertedCategoryColors() +{ + static std::vector colors{ + cvf::Color3ub( 46, 76, 224), // hwb(230, 18%, 12%) medium_blue + cvf::Color3ub(166, 189, 215), // hwb(212, 65%, 16%) very_light_blue + cvf::Color3ub( 0, 83, 138), // hwb(204, 0%, 46%) strong_blue + cvf::Color3ub( 54, 125, 123), // hwb(178, 21%, 51%) vivid_blueish_green + cvf::Color3ub( 0, 125, 52), // hwb(145, 0%, 51%) vivid_green + cvf::Color3ub( 59, 84, 23), // hwb( 85, 9%, 67%) dark_olive_green + cvf::Color3ub(147, 170, 0), // hwb( 68, 0%, 33%) vivid_yellowish_green + cvf::Color3ub(244, 200, 0), // hwb( 49, 0%, 4%) vivid_greenish_yellow + cvf::Color3ub(206, 162, 98), // hwb( 36, 38%, 19%) grayish_yellow + cvf::Color3ub(255, 142, 0), // hwb( 33, 0%, 0%) vivid_orange_yellow + cvf::Color3ub( 89, 51, 21), // hwb( 26, 8%, 65%) deep_yellowish_brown + cvf::Color3ub(255, 104, 0), // hwb( 24, 0%, 0%) vivid_orange + cvf::Color3ub(129, 112, 102), // hwb( 22, 40%, 49%) medium_gray + cvf::Color3ub(255, 122, 92), // hwb( 11, 36%, 0%) strong_yellowish_pink + cvf::Color3ub(241, 58, 19), // hwb( 11, 7%, 5%) vivid_reddish_orange + cvf::Color3ub(127, 24, 13), // hwb( 6, 5%, 50%) strong_reddish_brown + cvf::Color3ub(193, 0, 32), // hwb(350, 0%, 24%) vivid_red + cvf::Color3ub(246, 118, 142), // hwb(349, 46%, 4%) strong_purplish_pink + cvf::Color3ub(212, 28, 132), // hwb(326, 11%, 17%) strong_purplish_red + cvf::Color3ub(128, 62, 117) // hwb(310, 24%, 50%) strong_purple + }; + + return colors; +} diff --git a/ApplicationCode/Application/Tools/RiaColorTables.h b/ApplicationCode/Application/Tools/RiaColorTables.h index d143514bc4..b14944d30d 100644 --- a/ApplicationCode/Application/Tools/RiaColorTables.h +++ b/ApplicationCode/Application/Tools/RiaColorTables.h @@ -54,7 +54,12 @@ public: static const caf::ColorTable& selectionPaletteColors(); static const caf::ColorTable& timestepsPaletteColors(); static const caf::ColorTable& editableWellPathsPaletteColors(); + static const caf::ColorTable& wellPathsPaletteColors(); static cvf::Color3f undefinedCellColor(); static cvf::Color3f perforationLengthColor(); + +private: + static std::vector categoryColors(); + static std::vector invertedCategoryColors(); }; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp index 2b8c1b33b2..25ccc99937 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathCollection.cpp @@ -255,15 +255,6 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector& w { caf::ProgressInfo progress(wellPathArray.size(), "Reading well paths from file"); - const caf::ColorTable& colorTable = RiaColorTables::wellLogPlotPaletteColors(); - cvf::Color3ubArray wellColors = colorTable.color3ubArray(); - cvf::Color3ubArray interpolatedWellColors = wellColors; - - if (wellPathArray.size() > 1) - { - interpolatedWellColors = caf::ColorTable::interpolateColorArray(wellColors, wellPathArray.size()); - } - for (size_t wpIdx = 0; wpIdx < wellPathArray.size(); wpIdx++) { RimFileWellPath* wellPath = wellPathArray[wpIdx]; @@ -287,7 +278,7 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector& w } else { - wellPath->setWellPathColor(cvf::Color3f(interpolatedWellColors[wpIdx])); + wellPath->setWellPathColor(RiaColorTables::wellPathsPaletteColors().cycledColor3f(wellPaths.size())); wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath)); m_mostRecentlyUpdatedWellPath = wellPath; wellPaths.push_back(wellPath);