Index: trunk/extensions/geo/geo.php |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | var $max_x = -1000000 ; |
11 | 11 | var $min_y = 1000000 ; |
12 | 12 | var $max_y = -1000000 ; |
| 13 | + var $draw = array () ; # What to draw |
13 | 14 | var $labels = array () ; # The text labels |
14 | 15 | var $languages = array ( "en" ) ; # Default language |
15 | 16 | var $styles = array ( "default" => "fill:#EEEEEE;" ) ; # All the styles |
— | — | @@ -32,27 +33,23 @@ |
33 | 34 | { |
34 | 35 | $this->languages = explode ( ";" , str_replace ( "," , ";" , $value ) ) ; # "," and ";" are valid separators |
35 | 36 | } |
36 | | - else if ( $key == "style" || $key == "label" ) |
| 37 | + else if ( $key == "style" || $key == "label" || $key == "draw" ) |
37 | 38 | { |
38 | 39 | $a = explode ( "=" , $value , 2 ) ; |
39 | | - if ( count ( $a ) == 2 ) |
| 40 | + if ( count ( $a ) == 1 ) $a[] = "1" ; |
| 41 | + $b = explode ( ";" , str_replace ( "," , ";" , $a[0] ) ) ; |
| 42 | + foreach ( $b AS $c ) |
40 | 43 | { |
41 | | - $b = explode ( ";" , str_replace ( "," , ";" , $a[0] ) ) ; |
42 | | - foreach ( $b AS $c ) |
| 44 | + $d = explode ( ";" , str_replace ( "," , ";" , $a[1] ) ) ; |
| 45 | + foreach ( $d AS $e ) |
43 | 46 | { |
44 | | -# if ( $key == "style" ) |
45 | | - { |
46 | | - $d = explode ( ";" , str_replace ( "," , ";" , $a[1] ) ) ; |
47 | | - foreach ( $d AS $e ) |
48 | | - { |
49 | | - $e = explode ( ":" , $e ) ; |
50 | | - $va = trim ( strtolower ( $e[0] ) ) ; |
51 | | - if ( count ( $e ) < 2 ) $vb = "" ; #/*$this->styles*/$kv[$c][$e[0]] = "" ; |
52 | | - else $vb = trim ( strtolower ( $e[1] ) ) ;# /*$this->styles*/$kv[$c][$e[0]] = trim ( strtolower ( $e[1] ) ) ; |
53 | | - if ( $key == "style" ) $this->styles[$c][$va] = $vb ; |
54 | | - else $this->label_styles[$c][$va] = $vb ; |
55 | | - } |
56 | | - } |
| 47 | + $e = explode ( ":" , $e ) ; |
| 48 | + $va = trim ( strtolower ( $e[0] ) ) ; |
| 49 | + if ( count ( $e ) < 2 ) $vb = "" ; #/*$this->styles*/$kv[$c][$e[0]] = "" ; |
| 50 | + else $vb = trim ( strtolower ( $e[1] ) ) ;# /*$this->styles*/$kv[$c][$e[0]] = trim ( strtolower ( $e[1] ) ) ; |
| 51 | + if ( $key == "style" ) $this->styles[$c][$va] = $vb ; |
| 52 | + else if ( $key == "label" ) $this->label_styles[$c][$va] = $vb ; |
| 53 | + else if ( $key == "draw" ) $this->draw[$c][$va] = $vb ; |
57 | 54 | } |
58 | 55 | } |
59 | 56 | } |
— | — | @@ -437,7 +434,7 @@ |
438 | 435 | if ( !$this->label_this ( $params ) ) return ; |
439 | 436 | $text = $this->get_specs ( "name" , $params->languages ) ; |
440 | 437 | if ( $text == "" ) return "" ; # No label found |
441 | | - $text = $this->data[$text][0] ; |
| 438 | + $text = trim ( $this->data[$text][0] ) ; |
442 | 439 | if ( $text == "" ) return "" ; # No point in showing an empty label |
443 | 440 | $x = floor ( $x ) ; |
444 | 441 | $y = floor ( $y ) ; |
— | — | @@ -464,7 +461,9 @@ |
465 | 462 | { |
466 | 463 | $b = $this->get_data ( $params ) ; |
467 | 464 | $b = $b[0] ; # Only one point for cities... |
468 | | - $r = 300 ; |
| 465 | + if ( isset ( $this->data['magnitude'] ) ) $r = $this->data['magnitude'] * 100 ; |
| 466 | + else $r = 300 ; |
| 467 | + $params->data_to_real ( $b[0] , $b[1] ) ; |
469 | 468 | $ret .= "<circle cx=\"{$b[0]}\" cy=\"{$b[1]}\" r=\"{$r}\" fill=\"red\" style=\"fill-opacity:0.5\"/>\n" ; |
470 | 469 | $this->add_label ( $b[0] , $b[1] , $params ) ; |
471 | 470 | } |
— | — | @@ -487,7 +486,9 @@ |
488 | 487 | |
489 | 488 | function draw_this ( &$params ) |
490 | 489 | { |
491 | | - return true ; |
| 490 | + $a = $this->my_matches ( $params->draw , $params ) ; |
| 491 | + if ( count ( $a ) > 0 ) return true ; |
| 492 | + return false ; |
492 | 493 | } |
493 | 494 | |
494 | 495 | function label_this ( &$params ) |
Index: trunk/extensions/geo/index.php |
— | — | @@ -13,11 +13,11 @@ |
14 | 14 | languages:de,en |
15 | 15 | show:germany |
16 | 16 | fit:germany |
| 17 | +draw:germany[state],germany.bavaria[city] |
17 | 18 | draw:germany.sh.cities#kiel |
18 | | -draw:germany.bavaria.cities#munich |
19 | 19 | style:germany[state],germany[isle]=fill:#CCCCCC; stroke:black; stroke-width:10 |
20 | 20 | style:germany.hamburg=fill:red |
21 | | -label:germany.bavaria.cities#munich=font-size:medium;fill-opacity:1.0;clickable:yes |
| 21 | +label:germany.bavaria[city]=font-size:medium;fill-opacity:1.0;clickable:yes |
22 | 22 | label:germany[state]=font-size:medium;fill-opacity:0.7 |
23 | 23 | " ) ; |
24 | 24 | |