File indexing completed on 2025-11-01 07:55:23
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 "ActsPlugins/ActSVG/LayerSvgConverter.hpp"
0015 #include "ActsPlugins/ActSVG/SvgUtils.hpp"
0016 #include "ActsPlugins/ActSVG/TrackingGeometrySvgConverter.hpp"
0017 #include "ActsTests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0018 #include "ActsTests/CommonHelpers/TemporaryDirectory.hpp"
0019
0020 #include <format>
0021 #include <fstream>
0022 #include <memory>
0023 #include <vector>
0024
0025 using namespace Acts;
0026 using namespace ActsPlugins;
0027
0028 namespace ActsTests {
0029
0030 GeometryContext tgContext;
0031
0032 BOOST_AUTO_TEST_SUITE(ActSvgSuite)
0033
0034 BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometrySvg) {
0035 Svg::Style cylinderLayerStyle;
0036 cylinderLayerStyle.fillColor = {51, 153, 255};
0037 cylinderLayerStyle.fillOpacity = 0.75;
0038 cylinderLayerStyle.highlightColor = {255, 153, 51};
0039 cylinderLayerStyle.highlights = {"mouseover", "mouseout"};
0040 cylinderLayerStyle.strokeColor = {25, 25, 25};
0041 cylinderLayerStyle.strokeWidth = 0.5;
0042 cylinderLayerStyle.quarterSegments = 72u;
0043
0044 GeometryIdentifier geoID{0};
0045
0046 CylindricalTrackingGeometry cGeometry(tgContext);
0047 auto tGeometry = cGeometry();
0048
0049 Svg::LayerConverter::Options lOptions;
0050 lOptions.name = "cylinder_layer_";
0051 lOptions.surfaceStyles =
0052 GeometryHierarchyMap<Svg::Style>({{geoID, cylinderLayerStyle}});
0053
0054 Svg::TrackingGeometryConverter::Options tgOptions;
0055 tgOptions.prefix = "utest_geometry_";
0056 tgOptions.layerOptions =
0057 GeometryHierarchyMap<Svg::LayerConverter::Options>({{geoID, lOptions}});
0058
0059 auto geometrySheets =
0060 Svg::TrackingGeometryConverter::convert(tgContext, *tGeometry, tgOptions);
0061
0062 for (const auto& s : geometrySheets) {
0063 Svg::toFile({s}, s._id + ".svg");
0064 }
0065 }
0066
0067 BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometrySvgGen3) {
0068 CylindricalTrackingGeometry cGeometry(tgContext, true);
0069 TemporaryDirectory tmp{};
0070
0071 auto tGeometry = cGeometry();
0072
0073 auto objects =
0074 Svg::drawTrackingGeometry(tgContext, *tGeometry, actsvg::views::x_y{});
0075
0076 Svg::toFile(objects, tmp.path() / "utest_geometry_gen3_xy.svg");
0077
0078 objects = Svg::drawTrackingGeometry(tgContext, *tGeometry,
0079 actsvg::views::z_r{}, true, true);
0080 Svg::toFile(objects, tmp.path() / "utest_geometry_gen3_zr.svg");
0081
0082 objects = Svg::drawSurfaceArrays(tgContext, *tGeometry);
0083
0084 for (const auto& obj : objects) {
0085 Svg::toFile(
0086 {obj},
0087 tmp.path() /
0088 std::format("utest_geometry_gen3_surface_arrays_{}.svg", obj._id));
0089 }
0090 }
0091
0092 BOOST_AUTO_TEST_SUITE_END()
0093
0094 }