r84959 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84958‎ | r84959 | r84960 >
Date:14:42, 29 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added nodeshape param
Modified paths:
  • /trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/GraphViz/SRF_Graph.php
@@ -14,6 +14,40 @@
1515 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1616 */
1717 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+
1852 protected $m_graphName = 'QueryResult';
1953 protected $m_graphLabel;
2054 protected $m_graphColor;
@@ -24,6 +58,7 @@
2559 protected $m_labelArray = array();
2660 protected $m_graphColors = array( 'black', 'red', 'green', 'blue', 'darkviolet', 'gold', 'deeppink', 'brown', 'bisque', 'darkgreen', 'yellow', 'darkblue', 'magenta', 'steelblue2' );
2761 protected $m_nameProperty = false;
 62+ protected $m_nodeShape = false;
2863 protected $m_parentRelation;
2964
3065 protected function readParameters( $params, $outputmode ) {
@@ -52,6 +87,10 @@
5388 }
5489
5590 $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+ }
5695 }
5796
5897 protected function getResultText( /* SMWQueryResult */ $res, $outputmode ) {
@@ -64,6 +103,7 @@
65104
66105 $graphInput = "digraph $this->m_graphName {";
67106 if ( $this->m_graphSize != '' ) $graphInput .= "size=\"$this->m_graphSize\";";
 107+ if ( $this->m_nodeShape ) $graphInput .= "node [shape=$this->m_nodeShape];";
68108 $graphInput .= "rankdir=$this->m_rankdir;";
69109
70110 while ( $row = $res->getNext() ) {

Status & tagging log