File: graphviz_edge.h

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (73 lines) | stat: -rw-r--r-- 3,134 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once

#include <string>
#include <string_view>

#include "graphviz_node.h"
#include "svg_element.h"

/**
 * @brief The GraphvizEdge class represents a Graphviz edge according to the DOT
 * language
 */

class GraphvizEdge {
public:
  GraphvizEdge() = delete;
  explicit GraphvizEdge(SVG::SVGElement &svg_g_element);

  /// Add an SVG `rect` element to the edge's corresponding `g` element. The
  /// `rect` is represes the bounding box of the edge.
  void add_bbox();
  /// Add an SVG `rect` element to the edge's corresponding `g` element. The
  /// `rect` represents the outline bounding box of the edge. The outline
  /// bounding box is the bounding box with penwidth taken into account.
  void add_outline_bbox();
  /// Add an SVG `rect` element representing the overlap between the outline
  /// bounding box of the edge and the specified node, to the corresponding `g`
  /// 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::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
  SVG::SVGPoint center() const;
  /// Return the edge's `color` attribute in RGB hex format if the opacity is
  /// 100 % or in RGBA hex format otherwise.
  std::string color() const;
  /// Return the 'edgeop' according to the DOT language specification. Note that
  /// this is not the same as the 'id' attribute of an edge.
  std::string_view edgeop() const;
  /// Return the edge's `fillcolor` attribute in RGB hex format if the opacity
  /// is 100 % or in RGBA hex format otherwise.
  std::string fillcolor() const;
  /// Return the outline bounding box of the edge. The outline bounding box is
  /// the bounding box with penwidth taken into account.
  SVG::SVGRect outline_bbox() const;
  /// Return the edge stem, i.e., the part of the edge that does not include any
  /// arrowhead or arrowtail
  SVG::SVGElement &stem() const;
  /// Return the edge's `penwidth` attribute
  double penwidth() const;
  /// Return a non-mutable reference to the SVG `g` element corresponding to the
  /// edge
  const SVG::SVGElement &svg_g_element() const;

private:
  /// The 'edgeop' according to the DOT language specification
  std::string m_edgeop;
  /// The SVG `g` element corresponding to the edge
  SVG::SVGElement &m_svg_g_element;
};