]> granicus.if.org Git - graphviz/commitdiff
tests: SVGAnalyzer: add retrieval of edge arrow to GraphvizEdge
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 24 Aug 2022 09:54:30 +0000 (11:54 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 20 Sep 2022 15:53:06 +0000 (17:53 +0200)
tests/graphviz_edge.cpp
tests/graphviz_edge.h

index 26e3b4f82fe4d74b95c92752de4ff4208edcf582..866e70ed58cd6200d8fd419d235e35d2d01d6ca5 100644 (file)
@@ -16,6 +16,10 @@ void GraphvizEdge::add_outline_overlap_bbox(const GraphvizNode &node,
   m_svg_g_element.add_outline_overlap_bbox(node.svg_g_element(), tolerance);
 }
 
+SVG::SVGElement &GraphvizEdge::arrow(const std::size_t index) const {
+  return m_svg_g_element.find_child(SVG::SVGElementType::Polygon, index);
+}
+
 std::string_view GraphvizEdge::edgeop() const { return m_edgeop; }
 
 std::string GraphvizEdge::fillcolor() const {
index bd6f8423f42b61550a89a9d8e9372d18248cc1a9..e2fcde1d8a5f9e7a3b6a684e1ebdde92df6d2824 100644 (file)
@@ -28,6 +28,11 @@ public:
   /// element. The outline bounding box is the bounding box with penwidth taken
   /// into account.
   void add_outline_overlap_bbox(const GraphvizNode &node, double tolerance = 0);
+  /// Return the edge arrowhead/arrowtail with the specified index. If there's
+  /// both an arrowhead and an arrowtail, the arrowtail is at index 0 and the
+  /// arrowhead is at index 1. If there's only one, it's at index 0. Throws an
+  /// exception if there's no arrow at the specified index.
+  SVG::SVGElement &arrow(std::size_t index = 0) const;
   /// Return the bounding box of the edge
   SVG::SVGRect bbox() const;
   /// Return the center of the edge's bounding box