File indexing completed on 2025-09-18 08:14:38
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Geometry/GeometryHierarchyMap.hpp"
0013 #include "Acts/Geometry/TrackingGeometry.hpp"
0014 #include "Acts/Plugins/ActSVG/LayerSvgConverter.hpp"
0015 #include "Acts/Plugins/ActSVG/SvgUtils.hpp"
0016 #include "Acts/Plugins/ActSVG/TrackingGeometrySvgConverter.hpp"
0017 #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0018 #include "Acts/Tests/CommonHelpers/TemporaryDirectory.hpp"
0019
0020 #include <format>
0021 #include <fstream>
0022 #include <memory>
0023 #include <vector>
0024
0025 Acts::GeometryContext tgContext;
0026
0027 BOOST_AUTO_TEST_SUITE(ActSvg)
0028
0029 BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometrySvg) {
0030 Acts::Svg::Style cylinderLayerStyle;
0031 cylinderLayerStyle.fillColor = {51, 153, 255};
0032 cylinderLayerStyle.fillOpacity = 0.75;
0033 cylinderLayerStyle.highlightColor = {255, 153, 51};
0034 cylinderLayerStyle.highlights = {"mouseover", "mouseout"};
0035 cylinderLayerStyle.strokeColor = {25, 25, 25};
0036 cylinderLayerStyle.strokeWidth = 0.5;
0037 cylinderLayerStyle.quarterSegments = 72u;
0038
0039 Acts::GeometryIdentifier geoID{0};
0040
0041 Acts::Test::CylindricalTrackingGeometry cGeometry(tgContext);
0042 auto tGeometry = cGeometry();
0043
0044 Acts::Svg::LayerConverter::Options lOptions;
0045 lOptions.name = "cylinder_layer_";
0046 lOptions.surfaceStyles = Acts::GeometryHierarchyMap<Acts::Svg::Style>(
0047 {{geoID, cylinderLayerStyle}});
0048
0049 Acts::Svg::TrackingGeometryConverter::Options tgOptions;
0050 tgOptions.prefix = "utest_geometry_";
0051 tgOptions.layerOptions =
0052 Acts::GeometryHierarchyMap<Acts::Svg::LayerConverter::Options>(
0053 {{geoID, lOptions}});
0054
0055 auto geometrySheets = Acts::Svg::TrackingGeometryConverter::convert(
0056 tgContext, *tGeometry, tgOptions);
0057
0058 for (const auto& s : geometrySheets) {
0059 Acts::Svg::toFile({s}, s._id + ".svg");
0060 }
0061 }
0062
0063 BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometrySvgGen3) {
0064 Acts::Test::CylindricalTrackingGeometry cGeometry(tgContext, true);
0065 Acts::Test::TemporaryDirectory tmp{};
0066
0067 auto tGeometry = cGeometry();
0068
0069 auto objects = Acts::Svg::drawTrackingGeometry(tgContext, *tGeometry,
0070 actsvg::views::x_y{});
0071
0072 Acts::Svg::toFile(objects, tmp.path() / "utest_geometry_gen3_xy.svg");
0073
0074 objects = Acts::Svg::drawTrackingGeometry(tgContext, *tGeometry,
0075 actsvg::views::z_r{}, true, true);
0076 Acts::Svg::toFile(objects, tmp.path() / "utest_geometry_gen3_zr.svg");
0077
0078 objects = Acts::Svg::drawSurfaceArrays(tgContext, *tGeometry);
0079
0080 for (const auto& obj : objects) {
0081 Acts::Svg::toFile(
0082 {obj},
0083 tmp.path() /
0084 std::format("utest_geometry_gen3_surface_arrays_{}.svg", obj._id));
0085 }
0086 }
0087
0088 BOOST_AUTO_TEST_SUITE_END()