From f8bbaace121ac849f00130d31a68ac1ddf531001 Mon Sep 17 00:00:00 2001 From: gapry Date: Fri, 29 Nov 2024 22:29:17 +0800 Subject: [PATCH] change option type from bool to vector --- application/F3DOptionsTools.cxx | 2 +- library/options.json | 4 ++-- vtkext/private/module/vtkF3DRenderer.cxx | 6 +++++- vtkext/private/module/vtkF3DRenderer.h | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/application/F3DOptionsTools.cxx b/application/F3DOptionsTools.cxx index a9ae036029..c14c5a2965 100644 --- a/application/F3DOptionsTools.cxx +++ b/application/F3DOptionsTools.cxx @@ -135,7 +135,7 @@ static inline const std::array CLIOptions = {{ {"bar", "b", "Show scalar bar", "", "1" }, {"colormap-file", "", "Specify a colormap image", "", ""}, {"colormap", "", "Specify a custom colormap (ignored if \"colormap-file\" is specified)", "", ""}, - {"colormap-discretization", "", "test", "", "1"}, + {"colormap-discretization", "", "test colormap discretization", "", ""}, {"volume", "v", "Show volume if the file is compatible", "", "1"}, {"inverse", "i", "Inverse opacity function for volume rendering", "", "1"} } }, {"Camera", diff --git a/library/options.json b/library/options.json index 0ad042e75c..2ef270b0f6 100644 --- a/library/options.json +++ b/library/options.json @@ -247,8 +247,8 @@ "default_value": "0.0, 0.0, 0.0, 0.0, 0.4, 0.9, 0.0, 0.0, 0.8, 0.9, 0.9, 0.0, 1.0, 1.0, 1.0, 1.0" }, "discretization" : { - "type": "bool", - "default_value": "false" + "type": "double_vector", + "default_value": "1.0, 1.0, 1.0, 1.0" }, "range": { "type": "double_vector" diff --git a/vtkext/private/module/vtkF3DRenderer.cxx b/vtkext/private/module/vtkF3DRenderer.cxx index f5ba4f252c..89199400c3 100644 --- a/vtkext/private/module/vtkF3DRenderer.cxx +++ b/vtkext/private/module/vtkF3DRenderer.cxx @@ -2230,9 +2230,13 @@ void vtkF3DRenderer::SetColormap(const std::vector& colormap) } } -void vtkF3DRenderer::SetColorDiscretization(const bool discretization) { +void vtkF3DRenderer::SetColorDiscretization(const std::vector& discretization) { auto logMsg = std::string("[Gapry PoC][Add CLI Options] " + std::string(__PRETTY_FUNCTION__)); F3DLog::Print(F3DLog::Severity::Warning, logMsg); + for(auto& e : discretization) { + F3DLog::Print(F3DLog::Severity::Warning, std::to_string(e) + std::string(" ")); + } + F3DLog::Print(F3DLog::Severity::Warning, std::string("\n")); } //---------------------------------------------------------------------------- diff --git a/vtkext/private/module/vtkF3DRenderer.h b/vtkext/private/module/vtkF3DRenderer.h index df23463123..a8d95876ec 100644 --- a/vtkext/private/module/vtkF3DRenderer.h +++ b/vtkext/private/module/vtkF3DRenderer.h @@ -282,7 +282,7 @@ class vtkF3DRenderer : public vtkOpenGLRenderer */ void SetColormap(const std::vector& colormap); - void SetColorDiscretization(const bool discretization); + void SetColorDiscretization(const std::vector& discretization); enum class CycleType {