Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make ViewConfig usable with designated initializers #3613

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Core/include/Acts/Visualization/EventDataView3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
namespace Acts {
class IVisualization3D;

static ViewConfig s_viewParameter = ViewConfig({0, 0, 255});
static ViewConfig s_viewMeasurement = ViewConfig({255, 102, 0});
static ViewConfig s_viewPredicted = ViewConfig({51, 204, 51});
static ViewConfig s_viewFiltered = ViewConfig({255, 255, 0});
static ViewConfig s_viewSmoothed = ViewConfig({0, 102, 255});
static ViewConfig s_viewParameter = {.color = {0, 0, 255}};
static ViewConfig s_viewMeasurement = {.color = {255, 102, 0}};
static ViewConfig s_viewPredicted = {.color = {51, 204, 51}};
static ViewConfig s_viewFiltered = {.color = {255, 255, 0}};
static ViewConfig s_viewSmoothed = {.color = {0, 102, 25}};

struct EventDataView3D {
/// Helper to find the eigen values and corr angle
Expand Down Expand Up @@ -277,7 +277,7 @@ struct EventDataView3D {
state.predicted(), state.predictedCovariance(),
particleHypothesis),
gctx, momentumScale, locErrorScale, angularErrorScale,
predictedConfig, predictedConfig, ViewConfig(false));
predictedConfig, predictedConfig, {.visible = false});
}
// (b) filtered track parameters
if (filteredConfig.visible && state.hasFiltered()) {
Expand All @@ -287,7 +287,7 @@ struct EventDataView3D {
state.filtered(), state.filteredCovariance(),
particleHypothesis),
gctx, momentumScale, locErrorScale, angularErrorScale,
filteredConfig, filteredConfig, ViewConfig(false));
filteredConfig, filteredConfig, {.visible = false});
}
// (c) smoothed track parameters
if (smoothedConfig.visible && state.hasSmoothed()) {
Expand All @@ -297,7 +297,7 @@ struct EventDataView3D {
state.smoothed(), state.smoothedCovariance(),
particleHypothesis),
gctx, momentumScale, locErrorScale, angularErrorScale,
smoothedConfig, smoothedConfig, ViewConfig(false));
smoothedConfig, smoothedConfig, {.visible = false});
}
return true;
});
Expand Down
17 changes: 8 additions & 9 deletions Core/include/Acts/Visualization/GeometryView3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ struct GeometryView3D {
/// @param transform An option additional transform
/// @param connected The config for connected portals
/// @param disconnected The config for disconnected portals
static void drawPortal(IVisualization3D& helper,
const Experimental::Portal& portal,
const GeometryContext& gctx,
const Transform3& transform = Transform3::Identity(),
const ViewConfig& connected = ViewConfig({0, 255, 0}),
const ViewConfig& disconnected = ViewConfig({255, 0,
0}));
static void drawPortal(
IVisualization3D& helper, const Experimental::Portal& portal,
const GeometryContext& gctx,
const Transform3& transform = Transform3::Identity(),
const ViewConfig& connected = ViewConfig{.color = {0, 255, 0}},
const ViewConfig& disconnected = ViewConfig{.color = {255, 0, 0}});
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved

/// Helper method to draw DetectorVolume objects
///
Expand All @@ -120,8 +119,8 @@ struct GeometryView3D {
const Acts::Experimental::DetectorVolume& volume,
const GeometryContext& gctx,
const Transform3& transform = Transform3::Identity(),
const ViewConfig& connected = ViewConfig({0, 255, 0}),
const ViewConfig& unconnected = ViewConfig({255, 0, 0}),
const ViewConfig& connected = ViewConfig{.color = {0, 255, 0}},
const ViewConfig& unconnected = ViewConfig{.color = {255, 0, 0}},
paulgessinger marked this conversation as resolved.
Show resolved Hide resolved
const ViewConfig& viewConfig = s_viewSensitive);

/// Helper method to draw Layer objects
Expand Down
6 changes: 0 additions & 6 deletions Core/include/Acts/Visualization/ViewConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ using ColorRGB = std::array<int, 3>;
/// @brief Struct to concentrate all visualization configurations
/// in order to harmonize visualization interfaces
struct ViewConfig {
/// Constructor to switch visibility off
ViewConfig(bool vis = true) : visible(vis) {}

/// Constructor for color settings only
ViewConfig(const ColorRGB& rgb) : color(rgb) {}

/// Visible flag
bool visible = true;
/// The RGB color for this object
Expand Down
10 changes: 5 additions & 5 deletions Core/src/Visualization/GeometryView3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
#include <vector>

namespace Acts::Experimental {
ViewConfig s_viewSensitive = ViewConfig({0, 180, 240});
ViewConfig s_viewPassive = ViewConfig({240, 280, 0});
ViewConfig s_viewVolume = ViewConfig({220, 220, 0});
ViewConfig s_viewGrid = ViewConfig({220, 0, 0});
ViewConfig s_viewLine = ViewConfig({0, 0, 220});
ViewConfig s_viewSensitive = {.color = {0, 180, 240}};
ViewConfig s_viewPassive = {.color = {240, 280, 0}};
ViewConfig s_viewVolume = {.color = {220, 220, 0}};
ViewConfig s_viewGrid = {.color = {220, 0, 0}};
ViewConfig s_viewLine = {.color = {0, 0, 220}};
} // namespace Acts::Experimental

void Acts::GeometryView3D::drawPolyhedron(IVisualization3D& helper,
Expand Down
Loading