Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php |
— | — | @@ -14,6 +14,40 @@ |
15 | 15 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
16 | 16 | */ |
17 | 17 | class SRFGraph extends SMWResultPrinter { |
| 18 | + public static $NODE_SHAPES = array( |
| 19 | + 'box', 'rect', 'rectangle', |
| 20 | + 'none', 'plaintext', |
| 21 | + 'polygon', |
| 22 | + 'ellipse', |
| 23 | + 'circle', |
| 24 | + 'point', |
| 25 | + 'egg', |
| 26 | + 'triangle', |
| 27 | + 'diamond', |
| 28 | + 'trapezium', |
| 29 | + 'parallelogram', |
| 30 | + 'house', |
| 31 | + 'pentagon ', |
| 32 | + 'hexagon', |
| 33 | + 'septagon', |
| 34 | + 'octagon', |
| 35 | + 'doublecircle', |
| 36 | + 'doubleoctagon', |
| 37 | + 'tripleoctagon', |
| 38 | + 'invtriangle', |
| 39 | + 'invtrapezium', |
| 40 | + 'invhouse', |
| 41 | + 'Mdiamond', |
| 42 | + 'Msquare', |
| 43 | + 'Mcircle', |
| 44 | + 'square', |
| 45 | + 'note', |
| 46 | + 'tab', |
| 47 | + 'folder', |
| 48 | + 'box3d', |
| 49 | + 'component', |
| 50 | + ); |
| 51 | + |
18 | 52 | protected $m_graphName = 'QueryResult'; |
19 | 53 | protected $m_graphLabel; |
20 | 54 | protected $m_graphColor; |
— | — | @@ -24,6 +58,7 @@ |
25 | 59 | protected $m_labelArray = array(); |
26 | 60 | protected $m_graphColors = array( 'black', 'red', 'green', 'blue', 'darkviolet', 'gold', 'deeppink', 'brown', 'bisque', 'darkgreen', 'yellow', 'darkblue', 'magenta', 'steelblue2' ); |
27 | 61 | protected $m_nameProperty = false; |
| 62 | + protected $m_nodeShape = false; |
28 | 63 | protected $m_parentRelation; |
29 | 64 | |
30 | 65 | protected function readParameters( $params, $outputmode ) { |
— | — | @@ -52,6 +87,10 @@ |
53 | 88 | } |
54 | 89 | |
55 | 90 | $this->m_parentRelation = array_key_exists( 'relation', $params ) && strtolower( trim( $params['relation'] ) ) == 'parent'; |
| 91 | + |
| 92 | + if ( array_key_exists( 'nodeshape', $params ) && in_array( trim( $params['nodeshape'] ), self::$NODE_SHAPES ) ) { |
| 93 | + $this->m_nodeShape = trim( $params['nodeshape'] ); |
| 94 | + } |
56 | 95 | } |
57 | 96 | |
58 | 97 | protected function getResultText( /* SMWQueryResult */ $res, $outputmode ) { |
— | — | @@ -64,6 +103,7 @@ |
65 | 104 | |
66 | 105 | $graphInput = "digraph $this->m_graphName {"; |
67 | 106 | if ( $this->m_graphSize != '' ) $graphInput .= "size=\"$this->m_graphSize\";"; |
| 107 | + if ( $this->m_nodeShape ) $graphInput .= "node [shape=$this->m_nodeShape];"; |
68 | 108 | $graphInput .= "rankdir=$this->m_rankdir;"; |
69 | 109 | |
70 | 110 | while ( $row = $res->getNext() ) { |