Index: trunk/extensions/Maps/includes/services/GoogleMaps3/jquery.googlemap.js |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | |
87 | 87 | var mapOptions = { |
88 | 88 | disableDefaultUI: true, |
89 | | - mapTypeId: eval( 'google.maps.MapTypeId.' + options.type ) |
| 89 | + mapTypeId: options.type == 'earth' ? google.maps.MapTypeId.SATELLITE : eval( 'google.maps.MapTypeId.' + options.type ) |
90 | 90 | }; |
91 | 91 | this.options = options; |
92 | 92 | |
— | — | @@ -119,14 +119,58 @@ |
120 | 120 | } |
121 | 121 | |
122 | 122 | // If there are any non-Google KML/KMZ layers, load the geoxml library and use it to add these layers. |
123 | | - mw.loader.using( 'ext.maps.gm3.geoxml', function() { |
124 | | - var geoXml = new geoXML3.parser( { map: map } ); |
| 123 | + if ( options.kml.length != 0 ) { |
| 124 | + mw.loader.using( 'ext.maps.gm3.geoxml', function() { |
| 125 | + var geoXml = new geoXML3.parser( { map: map } ); |
| 126 | + |
| 127 | + for ( i = options.kml.length - 1; i >= 0; i-- ) { |
| 128 | + geoXml.parse( options.kml[i] ); |
| 129 | + } |
| 130 | + } ); |
| 131 | + } |
| 132 | + |
| 133 | + // If there are any non-Google KML/KMZ layers, load the geoxml library and use it to add these layers. |
| 134 | + if ( $.inArray( 'earth', options.types ) ) { |
| 135 | + mw.loader.using( 'ext.maps.gm3.earth', function() { |
| 136 | + var ge = new GoogleEarth( map ); |
| 137 | + } ); |
125 | 138 | |
126 | | - for ( i = options.kml.length - 1; i >= 0; i-- ) { |
127 | | - geoXml.parse( options.kml[i] ); |
| 139 | + // Yay, IE seriously fails. Compat code for IE < 9. |
| 140 | + if (!Array.prototype.filter) |
| 141 | + { |
| 142 | + Array.prototype.filter = function(fun /*, thisp */) |
| 143 | + { |
| 144 | + "use strict"; |
| 145 | + |
| 146 | + if (this === void 0 || this === null) |
| 147 | + throw new TypeError(); |
| 148 | + |
| 149 | + var t = Object(this); |
| 150 | + var len = t.length >>> 0; |
| 151 | + if (typeof fun !== "function") |
| 152 | + throw new TypeError(); |
| 153 | + |
| 154 | + var res = []; |
| 155 | + var thisp = arguments[1]; |
| 156 | + for (var i = 0; i < len; i++) |
| 157 | + { |
| 158 | + if (i in t) |
| 159 | + { |
| 160 | + var val = t[i]; // in case fun mutates this |
| 161 | + if (fun.call(thisp, val, i, t)) |
| 162 | + res.push(val); |
| 163 | + } |
| 164 | + } |
| 165 | + |
| 166 | + return res; |
| 167 | + }; |
128 | 168 | } |
129 | | - } ); |
| 169 | + |
| 170 | + options.types.filter( function( element, index, array ) { return element != 'earth'; } ); |
| 171 | + } |
130 | 172 | |
| 173 | + // TODO: map types |
| 174 | + |
131 | 175 | for ( i = options.fusiontables.length - 1; i >= 0; i-- ) { |
132 | 176 | var ftLayer = new google.maps.FusionTablesLayer( options.fusiontables[i], { map: map } ); |
133 | 177 | } |
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php |
— | — | @@ -43,6 +43,15 @@ |
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | |
| 47 | +$wgResourceModules['ext.maps.gm3.earth'] = array( |
| 48 | + 'localBasePath' => dirname( __FILE__ ) . '/earth', |
| 49 | + 'remoteBasePath' => $egMapsScriptPath . '/includes/services/GoogleMaps3/earth', |
| 50 | + 'group' => 'ext.maps', |
| 51 | + 'scripts' => array( |
| 52 | + 'googleearth-compiled.js', |
| 53 | + ), |
| 54 | +); |
| 55 | + |
47 | 56 | $wgHooks['MappingServiceLoad'][] = 'efMapsInitGoogleMaps3'; |
48 | 57 | |
49 | 58 | /** |
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php |
— | — | @@ -26,7 +26,8 @@ |
27 | 27 | 'satellite' => 'SATELLITE', |
28 | 28 | 'hybrid' => 'HYBRID', |
29 | 29 | 'terrain' => 'TERRAIN', |
30 | | - 'physical' => 'TERRAIN' |
| 30 | + 'physical' => 'TERRAIN', |
| 31 | + 'earth' => 'earth' |
31 | 32 | ); |
32 | 33 | |
33 | 34 | /** |