diff --git a/vtkm/cont/ColorTable.h b/vtkm/cont/ColorTable.h index 45d7b91d6..9b02d0661 100644 --- a/vtkm/cont/ColorTable.h +++ b/vtkm/cont/ColorTable.h @@ -166,7 +166,7 @@ public: /// /// Note: The color table will have 0 entries /// Note: The alpha table will have 0 entries - ColorTable(ColorSpace space = ColorSpace::LAB); + explicit ColorTable(ColorSpace space); /// Construct a color table with a 2 positions /// diff --git a/vtkm/cont/testing/TestingColorTable.h b/vtkm/cont/testing/TestingColorTable.h index fd504a739..600b15faa 100644 --- a/vtkm/cont/testing/TestingColorTable.h +++ b/vtkm/cont/testing/TestingColorTable.h @@ -109,7 +109,7 @@ public: //verify that we can get the presets std::set names = table.GetPresets(); - VTKM_TEST_ASSERT(names.size() == 14, "incorrect number of names in preset set"); + VTKM_TEST_ASSERT(names.size() == 15, "incorrect number of names in preset set"); VTKM_TEST_ASSERT(names.count("inferno") == 1, "names should contain inferno"); VTKM_TEST_ASSERT(names.count("black-body radiation") == 1, @@ -288,8 +288,7 @@ public: vtkm::Range range{ 0.0, 50.0 }; auto diverging = vtkm::cont::ColorSpace::DIVERGING; - vtkm::cont::ColorTable table; - table.LoadPreset("Cool to Warm"); + vtkm::cont::ColorTable table(vtkm::cont::ColorTable::Preset::COOL_TO_WARM); VTKM_TEST_ASSERT(table.GetColorSpace() == diverging, "color space not switched when loading preset"); @@ -426,8 +425,7 @@ public: static void TestSampling() { - vtkm::cont::ColorTable table; - table.LoadPreset("Linear green"); + vtkm::cont::ColorTable table(vtkm::cont::ColorTable::Preset::LINEAR_GREEN); VTKM_TEST_ASSERT((table.GetRange() == vtkm::Range{ 0.0, 1.0 }), "loading linear green table failed with wrong range"); VTKM_TEST_ASSERT((table.GetNumberOfPoints() == 21), @@ -453,8 +451,7 @@ public: { //build a color table with clamping off and verify that sampling works vtkm::Range range{ 0.0, 50.0 }; - vtkm::cont::ColorTable table; - table.LoadPreset("Cool to Warm"); + vtkm::cont::ColorTable table(vtkm::cont::ColorTable::Preset::COOL_TO_WARM); table.RescaleToRange(range); table.SetClampingOff(); table.SetAboveRangeColor(vtkm::Vec{ 1.0f, 0.0f, 0.0f }); //red diff --git a/vtkm/filter/testing/UnitTestFieldToColors.cxx b/vtkm/filter/testing/UnitTestFieldToColors.cxx index c62ac5a1c..bd8032019 100644 --- a/vtkm/filter/testing/UnitTestFieldToColors.cxx +++ b/vtkm/filter/testing/UnitTestFieldToColors.cxx @@ -32,8 +32,7 @@ void TestFieldToColors() //build a color table with clamping off and verify that sampling works vtkm::Range range{ 0.0, 50.0 }; - vtkm::cont::ColorTable table; - table.LoadPreset(vtkm::cont::ColorTable::Preset::COOL_TO_WARM); + vtkm::cont::ColorTable table(vtkm::cont::ColorTable::Preset::COOL_TO_WARM); table.RescaleToRange(range); table.SetClampingOff(); table.SetAboveRangeColor(vtkm::Vec{ 1.0f, 0.0f, 0.0f }); //red diff --git a/vtkm/rendering/Actor.cxx b/vtkm/rendering/Actor.cxx index 67e9c793b..624ff26eb 100644 --- a/vtkm/rendering/Actor.cxx +++ b/vtkm/rendering/Actor.cxx @@ -38,17 +38,6 @@ struct Actor::InternalsType vtkm::Range ScalarRange; vtkm::Bounds SpatialBounds; - VTKM_CONT - InternalsType(const vtkm::cont::DynamicCellSet& cells, - const vtkm::cont::CoordinateSystem& coordinates, - const vtkm::cont::Field& scalarField) - : Cells(cells) - , Coordinates(coordinates) - , ScalarField(scalarField) - { - this->ColorTable.LoadPreset("Cool to Warm"); - } - VTKM_CONT InternalsType(const vtkm::cont::DynamicCellSet& cells, const vtkm::cont::CoordinateSystem& coordinates, @@ -65,7 +54,7 @@ struct Actor::InternalsType InternalsType(const vtkm::cont::DynamicCellSet& cells, const vtkm::cont::CoordinateSystem& coordinates, const vtkm::cont::Field& scalarField, - const vtkm::cont::ColorTable& colorTable) + const vtkm::cont::ColorTable& colorTable = vtkm::cont::ColorTable::Preset::DEFAULT) : Cells(cells) , Coordinates(coordinates) , ScalarField(scalarField) diff --git a/vtkm/rendering/ColorBarAnnotation.cxx b/vtkm/rendering/ColorBarAnnotation.cxx index 4b02eaee0..c92f7b76b 100644 --- a/vtkm/rendering/ColorBarAnnotation.cxx +++ b/vtkm/rendering/ColorBarAnnotation.cxx @@ -27,11 +27,11 @@ namespace rendering { ColorBarAnnotation::ColorBarAnnotation() + : ColorTable(vtkm::cont::ColorSpace::LAB) + , Position(vtkm::Range(-0.88, +0.88), vtkm::Range(+0.87, +0.92), vtkm::Range(0, 0)) + , Horizontal(true) + , FieldName("") { - vtkm::Bounds bounds(vtkm::Range(-0.88, +0.88), vtkm::Range(+0.87, +0.92), vtkm::Range(0, 0)); - Position = bounds; - Horizontal = true; - FieldName = ""; } ColorBarAnnotation::~ColorBarAnnotation()