MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / createUMLNode

Function createUMLNode

tools/sql2graph.php:38–83  ·  view source on GitHub ↗
($name, $attributes, $methods)

Source from the content-addressed store, hash-verified

36include("common_functions.php");
37
38function createUMLNode($name, $attributes, $methods) {
39 global $out;
40
41 //make sure arrays and attributes are arrays
42 if(!is_array($attributes))
43 $attributes = array(
44 $attributes,
45 );
46 if(!is_array($methods))
47 $methods = array(
48 $methods,
49 );
50
51 //calculate width and hight
52 $height = 35+14*(count($attributes)+count($methods));
53 $max_att = array_reduce(array_map("strlen", $attributes), "max", 0);
54 $width = 10+max(8*strlen($name), 7*$max_att);
55
56 //begin
57 $out[] = " <node id=\"$name\">\n";
58 $out[] = " <data key=\"d0\" >\n";
59 $out[] = " <y:UMLClassNode >\n";
60 $out[] = " <y:Geometry width=\"$width\" height=\"$height\"/>\n";
61 $out[] = " <y:Fill hasColor=\"false\" />\n";
62 $out[] = " <y:NodeLabel fontStyle=\"bold\">$name</y:NodeLabel>\n";
63 $out[] = " <y:UML use3DEffect=\"false\">\n";
64 //attributes
65 $out[] = " <y:AttributeLabel>";
66 foreach($attributes as $a)
67 {
68 $out[] = "$a\n";
69 }
70 $out[] = " </y:AttributeLabel>\n";
71 //methods
72 $out[] = " <y:MethodLabel>";
73 foreach($methods as $m)
74 {
75 $out[] = "$m\n";
76 }
77 $out[] = " </y:MethodLabel>\n";
78 //end
79 $out[] = " </y:UML>\n";
80 $out[] = " </y:UMLClassNode>\n";
81 $out[] = " </data>\n";
82 $out[] = " </node>\n";
83}
84
85function createUMLEdge($from, $to) {
86 global $out;

Callers 1

sql2graph.phpFile · 0.85

Calls 1

countFunction · 0.85

Tested by

no test coverage detected