Skip to content

Commit

Permalink
wire through grid style
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger committed Oct 3, 2024
1 parent e7dceab commit 0e23adc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Examples/Python/src/Svg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,21 @@ void addSvg(Context& ctx) {
});
}

{
auto gco = py::class_<Svg::GridConverter::Options>(svg, "GridOptions")
.def(py::init<>());
ACTS_PYTHON_STRUCT_BEGIN(gco, Svg::GridConverter::Options);
ACTS_PYTHON_MEMBER(style);
ACTS_PYTHON_STRUCT_END();

auto isco = py::class_<Svg::IndexedSurfacesConverter::Options>(
svg, "IndexedSurfacesOptions")
.def(py::init<>());
ACTS_PYTHON_STRUCT_BEGIN(isco, Svg::IndexedSurfacesConverter::Options);
ACTS_PYTHON_MEMBER(gridOptions);
ACTS_PYTHON_STRUCT_END();
}

// How detector volumes are drawn: Svg DetectorVolume options & drawning
{
auto c = py::class_<Svg::DetectorVolumeConverter::Options>(
Expand All @@ -338,12 +353,16 @@ void addSvg(Context& ctx) {
ACTS_PYTHON_MEMBER(portalIndices);
ACTS_PYTHON_MEMBER(portalOptions);
ACTS_PYTHON_MEMBER(surfaceOptions);
ACTS_PYTHON_MEMBER(indexedSurfacesOptions);
ACTS_PYTHON_STRUCT_END();

// Define the proto volume & indexed surface grid
py::class_<Svg::ProtoVolume>(svg, "ProtoVolume");
py::class_<Svg::ProtoIndexedSurfaceGrid>(svg, "ProtoIndexedSurfaceGrid");

// Define the proto grid
py::class_<Svg::ProtoGrid>(svg, "ProtoGrid");

// Convert an Acts::Experimental::DetectorVolume object into an
// acts::svg::proto::volume
svg.def("convertDetectorVolume", &Svg::DetectorVolumeConverter::convert);
Expand All @@ -352,6 +371,15 @@ void addSvg(Context& ctx) {
svg.def("drawDetectorVolume", &drawDetectorVolume);
}

// Draw the ProtoIndexedSurfaceGrid
{
svg.def("drawIndexedSurfaces",
[](const Svg::ProtoIndexedSurfaceGrid& pIndexedSurfaceGrid,
const std::string& identification) {
return Svg::View::xy(pIndexedSurfaceGrid, identification);
});
}

// How a detector is drawn: Svg Detector options & drawning
{ svg.def("drawDetector", &drawDetector); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ struct Options {
PortalConverter::Options portalOptions;
/// The Surface converter options
SurfaceConverter::Options surfaceOptions;
/// The Grid converter options
IndexedSurfacesConverter::Options indexedSurfacesOptions;
};

/// Write/create the detector volume
Expand Down
3 changes: 2 additions & 1 deletion Plugins/ActSVG/src/DetectorVolumeSvgConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ Acts::Svg::DetectorVolumeConverter::convert(
// Make dedicated surface grid sheets
const auto& internalNavigationDelegate = dVolume.internalNavigation();

IndexedSurfacesConverter::Options isOptions;
IndexedSurfacesConverter::Options isOptions =
volumeOptions.indexedSurfacesOptions;
// Use or transfer the surface style
if (isOptions.surfaceStyles.empty()) {
std::pair<Acts::GeometryIdentifier, Acts::Svg::Style> style{
Expand Down

0 comments on commit 0e23adc

Please sign in to comment.