Index: branches/Maps0.8/Maps_Settings.php |
— | — | @@ -199,6 +199,7 @@ |
200 | 200 | |
201 | 201 | $egMapsGMaps3AutoInfoWindows = false; |
202 | 202 | |
| 203 | + $egMapsGMaps3Layers = array(); |
203 | 204 | |
204 | 205 | |
205 | 206 | |
— | — | @@ -254,9 +255,9 @@ |
255 | 256 | 'wikipedia', |
256 | 257 | 'webcams' |
257 | 258 | ); |
| 259 | + |
258 | 260 | |
259 | 261 | |
260 | | - |
261 | 262 | # Yahoo! Maps |
262 | 263 | |
263 | 264 | # Your Yahoo! Maps API key. Required for displaying Yahoo! Maps. |
Index: branches/Maps0.8/includes/services/GoogleMaps3/jquery.googlemap.js |
— | — | @@ -62,6 +62,20 @@ |
63 | 63 | markers.push( marker ); |
64 | 64 | } |
65 | 65 | |
| 66 | + // Code to add KML files. |
| 67 | + for ( i = options.kml.length - 1; i >= 0; i-- ) { |
| 68 | + var kmlLayer = new google.maps.KmlLayer( options.kml[i], { map: map } ); |
| 69 | + } |
| 70 | + |
| 71 | + var layerMapping = { |
| 72 | + 'traffic': 'new google.maps.TrafficLayer()', |
| 73 | + 'bicycling': 'new google.maps.BicyclingLayer()' |
| 74 | + }; |
| 75 | + |
| 76 | + for ( i = options.layers.length - 1; i >= 0; i-- ) { |
| 77 | + var layer = eval( layerMapping[options.layers[i]] ); |
| 78 | + } |
| 79 | + |
66 | 80 | var bounds; |
67 | 81 | |
68 | 82 | if ( ( options.centre === false || options.zoom === false ) && options.locations.length > 1 ) { |
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3.php |
— | — | @@ -29,6 +29,18 @@ |
30 | 30 | 'physical' => 'TERRAIN' |
31 | 31 | ); |
32 | 32 | |
| 33 | + /** |
| 34 | + * List of supported map layers. |
| 35 | + * |
| 36 | + * @since 0.8 |
| 37 | + * |
| 38 | + * @var array |
| 39 | + */ |
| 40 | + protected static $mapLayers = array( |
| 41 | + 'traffic', |
| 42 | + 'bicyling' |
| 43 | + ); |
| 44 | + |
33 | 45 | public static $tyepControlStyles = array( |
34 | 46 | 'default' => 'DEFAULT', |
35 | 47 | 'horizontal' => 'HORIZONTAL_BAR', |
— | — | @@ -68,7 +80,7 @@ |
69 | 81 | * @since 0.7 |
70 | 82 | */ |
71 | 83 | public function addParameterInfo( array &$params ) { |
72 | | - global $egMapsGMaps3Type, $egMapsGMaps3Types, $egMapsGMaps3Controls; |
| 84 | + global $egMapsGMaps3Type, $egMapsGMaps3Types, $egMapsGMaps3Controls, $egMapsGMaps3Layers; |
73 | 85 | global $egMapsGMaps3DefTypeStyle, $egMapsGMaps3DefZoomStyle, $egMapsGMaps3AutoInfoWindows; |
74 | 86 | |
75 | 87 | $params['zoom']->addCriteria( new CriterionInRange( 0, 20 ) ); |
— | — | @@ -84,6 +96,10 @@ |
85 | 97 | $params['types']->addCriteria( new CriterionInArray( self::getTypeNames() ) ); |
86 | 98 | $params['types']->addManipulations( new MapsParamGMap3Type() ); |
87 | 99 | |
| 100 | + $params['layers'] = new ListParameter( 'layers' ); |
| 101 | + $params['layers']->setDefault( $egMapsGMaps3Layers ); |
| 102 | + $params['layers']->addCriteria( new CriterionInArray( self::getLayerNames() ) ); |
| 103 | + |
88 | 104 | $params['controls'] = new ListParameter( 'controls' ); |
89 | 105 | $params['controls']->setDefault( $egMapsGMaps3Controls ); |
90 | 106 | $params['controls']->addCriteria( new CriterionInArray( self::$controlNames ) ); |
— | — | @@ -101,6 +117,10 @@ |
102 | 118 | |
103 | 119 | $params['autoinfowindows'] = new Parameter( 'autoinfowindows', Parameter::TYPE_BOOLEAN ); |
104 | 120 | $params['autoinfowindows']->setDefault( $egMapsGMaps3AutoInfoWindows ); |
| 121 | + |
| 122 | + $params['kml'] = new ListParameter( 'kml' ); |
| 123 | + $params['kml']->setDefault( array() ); |
| 124 | + //$params['kml']->addManipulations( new MapsParamFile() ); |
105 | 125 | } |
106 | 126 | |
107 | 127 | /** |
— | — | @@ -138,6 +158,17 @@ |
139 | 159 | } |
140 | 160 | |
141 | 161 | /** |
| 162 | + * Returns the names of all supported map layers. |
| 163 | + * |
| 164 | + * @since 0.8 |
| 165 | + * |
| 166 | + * @return array |
| 167 | + */ |
| 168 | + public static function getLayerNames() { |
| 169 | + return array_keys( self::$mapLayers ); |
| 170 | + } |
| 171 | + |
| 172 | + /** |
142 | 173 | * @see MapsMappingService::getDependencies |
143 | 174 | * |
144 | 175 | * @return array |
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | |
87 | 87 | $params['kml'] = new ListParameter( 'kml' ); |
88 | 88 | $params['kml']->setDefault( array() ); |
89 | | - $params['kml']->addManipulations( new MapsParamFile() ); |
| 89 | + //$params['kml']->addManipulations( new MapsParamFile() ); |
90 | 90 | |
91 | 91 | $params['overlays'] = new ListParameter( 'overlays' ); |
92 | 92 | $params['overlays']->setDefault( $egMapsGMapOverlays ); |
Index: branches/Maps0.8/includes/services/GoogleMaps/jquery.googlemap2.js |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | if ( !options.locations ) { |
88 | 88 | options.locations = []; |
89 | 89 | } |
90 | | - |
| 90 | + |
91 | 91 | var bounds = ( ( options.zoom === false || options.centre === false ) && options.locations.length > 1 ) ? new GLatLngBounds() : null; |
92 | 92 | |
93 | 93 | for ( i = options.locations.length - 1; i >= 0; i-- ) { |
— | — | @@ -115,13 +115,9 @@ |
116 | 116 | map.enableContinuousZoom(); |
117 | 117 | |
118 | 118 | // Code to add KML files. |
119 | | - /* |
120 | | - var kmlOverlays = []; |
121 | | - for ( i = args.kml.length - 1; i >= 0; i-- ) { |
122 | | - kmlOverlays[i] = new GGeoXml( args.kml[i] ); |
123 | | - map.addOverlay( kmlOverlays[i] ); |
| 119 | + for ( i = options.kml.length - 1; i >= 0; i-- ) { |
| 120 | + map.addOverlay( new GGeoXml( options.kml[i] ) ); |
124 | 121 | } |
125 | | - */ |
126 | 122 | |
127 | 123 | function ensureTypeIsSelectable( type, types ) { |
128 | 124 | var typesContainType = false; |