return edge_arrowhead_bbox;
}
+SVG::SVGRect GraphvizEdge::arrowtail_outline_bbox(
+ std::string_view dir, std::string_view primitive_arrow_shape) const {
+ assert((dir == "back" || dir == "both") &&
+ "no arrowhead for this edge direction");
+ if (!supported_primitive_arrow_shapes.contains(primitive_arrow_shape)) {
+ throw std::runtime_error{
+ fmt::format("primitive arrow shape {} is not yet supported",
+ primitive_arrow_shape)};
+ }
+ auto edge_arrowtail = arrow(0);
+ const auto edge_arrowtail_bbox = edge_arrowtail.outline_bbox();
+
+ return edge_arrowtail_bbox;
+}
+
std::string_view GraphvizEdge::edgeop() const { return m_edgeop; }
std::string GraphvizEdge::fillcolor() const {
SVG::SVGRect
arrowhead_outline_bbox(std::string_view dir,
std::string_view primitive_arrow_shape) const;
+ /// Return the outline bounding box of the edge arrowtail. The outline
+ /// bounding box is the bounding box with penwidth taken into account.
+ SVG::SVGRect
+ arrowtail_outline_bbox(std::string_view dir,
+ std::string_view primitive_arrow_shape) const;
/// Return the bounding box of the edge
SVG::SVGRect bbox() const;
/// Return the center of the edge's bounding box
const auto dir = graph_options.dir;
const auto primitive_arrowhead_shape =
graph_options.primitive_arrowhead_shape;
+ const auto primitive_arrowtail_shape =
+ graph_options.primitive_arrowtail_shape;
REQUIRE(svg_analyzer.graphs().size() == 1);
auto &recreated_graph = svg_analyzer.graphs().back();
// check overlap of edge stem and arrowtail
if (dir == "back" || dir == "both") {
- auto edge_arrowtail = edge.arrow(0);
- const auto edge_arrowtail_bbox = edge_arrowtail.outline_bbox();
+ const auto edge_arrowtail_bbox =
+ edge.arrowtail_outline_bbox(dir, primitive_arrowtail_shape);
const auto overlap_bbox = edge_stem_bbox.intersection(edge_arrowtail_bbox);
INFO("Edge stem and arrowtail overlap:");
INFO(fmt::format(" width: {:.3f}", overlap_bbox.width));