Changeset 83
- Timestamp:
- Jun 22, 2008, 11:23:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/is/topologie-gen.php
r82 r83 2 2 // Skript pro generování grafu stromové struktury sítě do PNG obrázku 3 3 include('../global2.php'); 4 global $Database ;4 global $Database, $debug; 5 5 6 6 if(array_key_exists('debug', $_GET)) $debug = $_GET['debug']; 7 7 else $debug = 0; 8 //$debug = 0;8 $debug = 0; 9 9 10 10 class treeitem { … … 35 35 function getFirst() { 36 36 if (count($this->children)>0) { 37 if (count($this->order)>0) { 38 if (count($this->children[0]->children)>0) return $this->order[$this->children[0]->index]; 39 } 37 40 return $this->children[0]; 38 41 } else return null; … … 41 44 function getLast() { 42 45 if (count($this->children)>0) { 46 if (count($this->order)>0) { 47 if (count($this->children[count($this->children)-1]->children)>0) return $this->order[$this->children[count($this->children)-1]->index]; 48 } 43 49 return $this->children[count($this->children)-1]; 44 50 } else return null; … … 142 148 143 149 function reorder($node) { 150 global $debug; 144 151 $node->pos = $this->border[$node->level]; 145 152 $this->border[$node->level]++; … … 160 167 } 161 168 } 162 if ($node->forkcnt > 0) echo $node->index.':'.$node->forkcnt."\n";163 169 for($i=0;$i<$node->forkcnt-1;$i++) { 164 170 for($j=0;$j<count($forkmap);$j++) { … … 197 203 } 198 204 $order[$target]=$forkmap[$bestfit]; 199 echo 'ORDER: '.$target.' > '.$forkmap[$bestfit]->index."\n";205 if ($debug) echo 'ORDER: '.$target.' > '.$forkmap[$bestfit]->index."\n"; 200 206 array_splice($forkmap, $bestfit, 1); 201 207 } 202 208 $order[$lastindex]=$forkmap[0]; 203 echo 'ORDER: '.$lastindex.' > '.$forkmap[0]->index."\n"; 209 if ($debug) echo 'ORDER: '.$lastindex.' > '.$forkmap[0]->index."\n"; 210 if ($debug) echo 'ORDERSTORE: '.$node->index."\n"; 204 211 $node->order = $order; 205 212 $this->border = $preborder; … … 213 220 foreach($node->children as $key => $value) { 214 221 if ((count($value->children)>0) && count($order)>0) { 215 echo $node->index.' '.$value->index."\n";216 222 $value = $order[$value->index]; 217 223 }
Note:
See TracChangeset
for help on using the changeset viewer.