Index: trunk/extensions/Maps/OpenLayers/OpenLayerFunctions.js |
— | — | @@ -108,127 +108,23 @@ |
109 | 109 | /** |
110 | 110 | * Adds all map type base layers to a map, and returns it. |
111 | 111 | */ |
112 | | -function addMapBaseLayers(map, mapTypes) { |
| 112 | +function addMapBaseLayers(map, layers) { |
113 | 113 | // Variables for whowing an error when the Google Maps API is not loaded |
114 | 114 | var googleAPILoaded = typeof(G_NORMAL_MAP) != 'undefined'; |
115 | 115 | var shownApiError = false; |
116 | 116 | |
117 | | - // Variables to prevent double adding of a base layer |
118 | | - var usedNor = false; var usedSat = false; var usedHyb = false; var usedPhy = false; // Google types |
119 | | - var usedBingNor = false; var usedBingHyb = false; var usedBingSat = false; // Bing types |
120 | | - var usedYahooNor = false; var usedYahooHyb = false; var usedYahooSat = false; // Yahoo types |
121 | | - var usedOLWMS = false; // OL types |
122 | | - var usedOSMnik = false; var usedOSMcycle = false; var usedOSMarender = false; // OSM types |
123 | | - var usedNasa = false; // Others |
124 | | - |
125 | 117 | var isDefaultBaseLayer = false; |
126 | 118 | |
127 | 119 | // Add the base layers |
128 | | - for (i in mapTypes) { |
129 | | - //if (mapTypes[i].substring(0, 1) == '+') { |
130 | | - // mapTypes[i] = mapTypes[i].substring(1); |
131 | | - // isDefaultBaseLayer = true; |
132 | | - //} |
133 | | - |
134 | | - var newLayer = null; |
135 | | - |
136 | | - // TODO: allow adding of custom layers somehow |
137 | | - // TODO: layer name alliasing system? php or js based? |
138 | | - switch(mapTypes[i]) { |
139 | | - case 'google' : case 'google-normal' : case 'google-satellite' : case 'google-hybrid' : case 'google-physical' : |
140 | | - if (googleAPILoaded) { |
141 | | - switch(mapTypes[i]) { |
142 | | - case 'google-normal' : |
143 | | - if (!usedNor){ newLayer = new OpenLayers.Layer.Google( 'Google Streets', {'sphericalMercator':true} ); usedNor = true; } |
144 | | - break; |
145 | | - case 'google-satellite' : |
146 | | - if (!usedSat){ newLayer = new OpenLayers.Layer.Google( 'Google Satellite' , {type: G_SATELLITE_MAP , 'sphericalMercator':true}); usedSat = true; } |
147 | | - break; |
148 | | - case 'google-hybrid' : |
149 | | - if (!usedHyb){ newLayer = new OpenLayers.Layer.Google( 'Google Hybrid' , {type: G_HYBRID_MAP , 'sphericalMercator':true}); usedHyb = true; } |
150 | | - break; |
151 | | - case 'google-physical' : |
152 | | - if (!usedPhy){ newLayer = new OpenLayers.Layer.Google( 'Google Physical' , {type: G_PHYSICAL_MAP , 'sphericalMercator':true}); usedPhy = true; } |
153 | | - break; |
154 | | - case 'google' : |
155 | | - if (!usedNor){ map.addLayer(new OpenLayers.Layer.Google( 'Google Streets' , {'sphericalMercator':true})); usedNor = true; } |
156 | | - if (!usedSat){ map.addLayer(new OpenLayers.Layer.Google( 'Google Satellite' , {type: G_SATELLITE_MAP , 'sphericalMercator':true})); usedSat = true; } |
157 | | - if (!usedHyb){ map.addLayer(new OpenLayers.Layer.Google( 'Google Hybrid' , {type: G_HYBRID_MAP , 'sphericalMercator':true})); usedHyb = true; } |
158 | | - if (!usedPhy){ map.addLayer(new OpenLayers.Layer.Google( 'Google Physical' , {type: G_PHYSICAL_MAP , 'sphericalMercator':true})); usedPhy = true; } |
159 | | - break; |
160 | | - } |
161 | | - } |
162 | | - else { |
163 | | - if (!shownApiError) { window.alert('Please enter your Google Maps API key to use the Google Maps layers'); shownApiError = true; } |
164 | | - } |
165 | | - break; |
166 | | - case 'bing' : case 'virtual-earth' : |
167 | | - if (!usedBingNor){ map.addLayer(new OpenLayers.Layer.VirtualEarth( 'Bing Streets' , {type: VEMapStyle.Shaded, 'sphericalMercator':true} )); usedBingNor = true; } |
168 | | - if (!usedBingSat){ map.addLayer(new OpenLayers.Layer.VirtualEarth( 'Bing Satellite' , {type: VEMapStyle.Aerial, 'sphericalMercator':true} )); usedBingSat = true; } |
169 | | - if (!usedBingHyb){ map.addLayer(new OpenLayers.Layer.VirtualEarth( 'Bing Hybrid' , {type: VEMapStyle.Hybrid, 'sphericalMercator':true} )); usedBingHyb = true; } |
170 | | - break; |
171 | | - case 'bing-normal' : |
172 | | - if (!usedBingNor){ newLayer = new OpenLayers.Layer.VirtualEarth( 'Bing Streets' , {type: VEMapStyle.Shaded, 'sphericalMercator':true} ); usedBingNor = true; } |
173 | | - case 'bing-satellite' : |
174 | | - if (!usedBingSat){ newLayer = new OpenLayers.Layer.VirtualEarth( 'Bing Satellite' , {type: VEMapStyle.Aerial, 'sphericalMercator':true} ); usedBingSat = true; } |
175 | | - case 'bing-hybrid' : |
176 | | - if (!usedBingHyb){ newLayer = new OpenLayers.Layer.VirtualEarth( 'Bing Hybrid' , {type: VEMapStyle.Hybrid, 'sphericalMercator':true} ); usedBingHyb = true; } |
177 | | - case 'yahoo' : |
178 | | - if (!usedYahooNor){ map.addLayer(new OpenLayers.Layer.Yahoo( 'Yahoo! Streets' ), {'sphericalMercator':true}); usedYahooNor = true; } |
179 | | - if (!usedYahooSat){ map.addLayer(new OpenLayers.Layer.Yahoo( 'Yahoo! Satellite', {'type': YAHOO_MAP_SAT, 'sphericalMercator':true} )); usedYahooSat = true; } |
180 | | - if (!usedYahooHyb){ map.addLayer(new OpenLayers.Layer.Yahoo( 'Yahoo! Hybrid', {'type': YAHOO_MAP_HYB, 'sphericalMercator':true} )); usedYahooHyb = true; } |
181 | | - break; |
182 | | - case 'yahoo-normal' : |
183 | | - if (!usedYahooNor){ newLayer = new OpenLayers.Layer.Yahoo( 'Yahoo! Streets', {'sphericalMercator':true} ); usedYahooNor = true; } |
184 | | - break; |
185 | | - case 'yahoo-satellite' : |
186 | | - if (!usedYahooSat){ newLayer = new OpenLayers.Layer.Yahoo( 'Yahoo! Satellite', {'type': YAHOO_MAP_SAT, 'sphericalMercator':true} ); usedYahooSat = true; } |
187 | | - break; |
188 | | - case 'yahoo-hybrid' : |
189 | | - if (!usedYahooHyb){ newLayer = new OpenLayers.Layer.Yahoo( 'Yahoo! Hybrid', {'type': YAHOO_MAP_HYB, 'sphericalMercator':true} ); usedYahooHyb = true; } |
190 | | - break; |
191 | | - case 'openlayers' : case 'open-layers' : |
192 | | - if (!usedOLWMS){ newLayer = new OpenLayers.Layer.WMS( 'OpenLayers WMS', 'http://labs.metacarta.com/wms/vmap0', {layers: 'basic', 'sphericalMercator':true} ); usedOLWMS = true; } |
193 | | - break; |
194 | | - case 'nasa' : |
195 | | - if (!usedNasa){ newLayer = new OpenLayers.Layer.WMS("NASA Global Mosaic", "http://t1.hypercube.telascience.org/cgi-bin/landsat7", {layers: "landsat7", 'sphericalMercator':true} ); usedNasa = true; } |
196 | | - break; |
197 | | - case 'osm' : case 'openstreetmap' : |
198 | | - if (!usedOSMarender){ map.addLayer(new OpenLayers.Layer.OSM.Osmarender("OSM arender")); usedOSMarender = true; } |
199 | | - if (!usedOSMnik){ map.addLayer(new OpenLayers.Layer.OSM.Mapnik("OSM Mapnik"), {'sphericalMercator':true}); usedOSMnik = true; } |
200 | | - if (!usedOSMcycle){ map.addLayer(new OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map"), {'sphericalMercator':true}); usedOSMcycle = true; } |
201 | | - break; |
202 | | - case 'osmarender' : |
203 | | - if (!usedOSMarender){ newLayer = new OpenLayers.Layer.OSM.Osmarender("OSM arender"); usedOSMarender = true; } |
204 | | - break; |
205 | | - case 'osm-nik' : case 'osm-mapnik' : |
206 | | - if (!usedOSMnik){ newLayer = new OpenLayers.Layer.OSM.Mapnik("OSM Mapnik"); usedOSMnik = true; } |
207 | | - break; |
208 | | - case 'osm-cycle' : case 'osm-cyclemap' : |
209 | | - if (!usedOSMcycle){ newLayer = new OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map"); usedOSMcycle = true; } |
210 | | - break; |
211 | | - } |
212 | | - |
213 | | - if (newLayer != null) { |
214 | | - map.addLayer(newLayer); |
215 | | - |
216 | | - /* |
217 | | - if (isDefaultBaseLayer) { |
218 | | - // FIXME: This messes up the layer for some reason |
219 | | - // Probably fixed by adding this code to an onload event (problem that other layer gets loaded first?) |
220 | | - map.setBaseLayer(newLayer); |
221 | | - isDefaultBaseLayer = false; |
222 | | - } |
223 | | - */ |
224 | | - } |
225 | | - } |
| 120 | + for (i in layers) map.addLayer(layers[i]); |
| 121 | + |
226 | 122 | return map; |
227 | 123 | } |
228 | 124 | |
229 | 125 | function getOLMarker(markerLayer, markerData, projectionObject) { |
230 | 126 | var marker; |
231 | 127 | |
232 | | - if (markerData.icon != '') { |
| 128 | + if (markerData.icon != "") { |
233 | 129 | //var iconSize = new OpenLayers.Size(10,17); |
234 | 130 | //var iconOffset = new OpenLayers.Pixel(-(iconSize.w/2), -iconSize.h); |
235 | 131 | marker = new OpenLayers.Marker(markerData.lonlat, new OpenLayers.Icon(markerData.icon)); // , iconSize, iconOffset |
— | — | @@ -239,12 +135,12 @@ |
240 | 136 | if (markerData.title.length + markerData.label.length > 0 ) { |
241 | 137 | |
242 | 138 | // This is the handler for the mousedown event on the marker, and displays the popup |
243 | | - marker.events.register('mousedown', marker, |
| 139 | + marker.events.register("mousedown", marker, |
244 | 140 | function(evt) { |
245 | 141 | var popup = new OpenLayers.Feature(markerLayer, markerData.lonlat).createPopup(true); |
246 | 142 | |
247 | 143 | if (markerData.title.length > 0 && markerData.label.length > 0) { // Add the title and label to the popup text |
248 | | - popup.setContentHTML('<b>' + markerData.title + "</b><hr />" + markerData.label); |
| 144 | + popup.setContentHTML("<b>" + markerData.title + "</b><hr />" + markerData.label); |
249 | 145 | } |
250 | 146 | else { |
251 | 147 | popup.setContentHTML(markerData.title + markerData.label); |
— | — | @@ -274,6 +170,6 @@ |
275 | 171 | function initOLSettings(minWidth, minHeight) { |
276 | 172 | OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; |
277 | 173 | OpenLayers.Util.onImageLoadErrorColor = "transparent"; |
278 | | - OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true, 'minSize': new OpenLayers.Size(minWidth, minHeight)}); |
| 174 | + OpenLayers.Feature.prototype.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {"autoSize": true, "minSize": new OpenLayers.Size(minWidth, minHeight)}); |
279 | 175 | } |
280 | 176 | |
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -48,12 +48,13 @@ |
49 | 49 | |
50 | 50 | public static function initialize() { |
51 | 51 | self::initializeParams(); |
| 52 | + Validator::addOutputFormat('olgroups', array(__CLASS__, 'unpackLayerGroups')); |
52 | 53 | } |
53 | 54 | |
54 | 55 | private static function initializeParams() { |
55 | 56 | global $egMapsServices, $egMapsOLLayers, $egMapsOLControls, $egMapsOpenLayersZoom; |
56 | 57 | |
57 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['default'] = $egMapsOpenLayersZoom; |
| 58 | + $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsOpenLayersZoom; |
58 | 59 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array(0, 19); |
59 | 60 | |
60 | 61 | $egMapsServices[self::SERVICE_NAME]['parameters'] = array( |
— | — | @@ -62,17 +63,21 @@ |
63 | 64 | 'criteria' => array( |
64 | 65 | 'in_array' => self::getControlNames() |
65 | 66 | ), |
66 | | - 'default' => $egMapsOLControls , |
| 67 | + 'default' => $egMapsOLControls, |
67 | 68 | 'output-type' => array('list', ',', '\'') |
68 | 69 | ), |
69 | | - 'layers' => array( |
| 70 | + 'layers' => array( |
70 | 71 | 'type' => array('string', 'list'), |
71 | 72 | 'criteria' => array( |
72 | | - 'in_array' => self::getLayerNames() |
| 73 | + 'in_array' => self::getLayerNames(true) |
73 | 74 | ), |
74 | | - 'default' => $egMapsOLLayers |
| 75 | + 'default' => $egMapsOLLayers, |
| 76 | + 'output-types' => array( |
| 77 | + 'unique_items', |
| 78 | + 'olgroups', |
| 79 | + array('filtered_array', self::getLayerNames()), |
| 80 | + ) |
75 | 81 | ), |
76 | | - /* 'baselayer' => array(), */ |
77 | 82 | ); |
78 | 83 | } |
79 | 84 | |
— | — | @@ -97,20 +102,15 @@ |
98 | 103 | } |
99 | 104 | |
100 | 105 | /** |
101 | | - * Returns the names of all supported layers. |
102 | | - * This data is a copy of the one used to actually translate the names |
103 | | - * into the layers, since this resides client side, in OpenLayerFunctions.js. |
| 106 | + * Returns the names of all supported layers. |
104 | 107 | * |
105 | 108 | * @return array |
106 | 109 | */ |
107 | | - public static function getLayerNames() { |
108 | | - return array( |
109 | | - 'google', 'google-normal', 'google-satellite', 'google-hybrid', 'google-hybrid', 'google-physical', |
110 | | - 'bing', 'virtual-earth', 'bing-normal', 'bing-satellite', 'bing-hybrid', |
111 | | - 'yahoo', 'yahoo-normal', 'yahoo-satellite', 'yahoo-hybrid', |
112 | | - 'openlayers', 'open-layers', 'nasa', |
113 | | - 'openstreetmap', 'osm', 'osmarender', 'osm-nik', 'osm-mapnik', 'osm-cycle', 'osm-cyclemap' |
114 | | - ); |
| 110 | + public static function getLayerNames($includeGroups = false) { |
| 111 | + global $egMapsOLAvailableLayers, $egMapsOLLayerGroups; |
| 112 | + $keys = array_keys($egMapsOLAvailableLayers); |
| 113 | + if ($includeGroups) $keys = array_merge($keys, array_keys($egMapsOLLayerGroups)); |
| 114 | + return $keys; |
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
— | — | @@ -124,22 +124,22 @@ |
125 | 125 | global $egGoogleMapsOnThisPage, $egMapsScriptPath, $egMapsStyleVersion; |
126 | 126 | |
127 | 127 | switch ($layer) { |
128 | | - case 'google' : case 'google-normal' : case 'google-sattelite' : case 'google-hybrid' : case 'google-physical' : |
| 128 | + case 'google-normal' : case 'google-sattelite' : case 'google-hybrid' : case 'google-physical' : |
129 | 129 | if (empty($egGoogleMapsOnThisPage)) { |
130 | 130 | $egGoogleMapsOnThisPage = 0; |
131 | 131 | MapsGoogleMaps::addGMapDependencies($output); |
132 | 132 | } |
133 | 133 | break; |
134 | | - case 'bing' : case 'virtual-earth' : |
| 134 | + case 'bing-normal' : case 'bing-satellite' : case 'bing-hybrid' : |
135 | 135 | if (!self::$loadedBing) { $output .= "<script type='$wgJsMimeType' src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script>\n"; self::$loadedBing = true; } |
136 | 136 | break; |
137 | | - case 'yahoo' : case 'yahoo-maps' : |
| 137 | + case 'yahoo-normal' : case 'yahoo-satellite' : case 'yahoo-hybrid' : |
138 | 138 | if (!self::$loadedYahoo) { $output .= "<style type='text/css'> #controls {width: 512px;}</style><script src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers'></script>\n"; self::$loadedYahoo = true; } |
139 | 139 | break; |
140 | | - case 'openlayers' : case 'open-layers' : |
| 140 | + case 'openlayers-wms' : |
141 | 141 | if (!self::$loadedOL) { $output .= "<script type='$wgJsMimeType' src='http://clients.multimap.com/API/maps/1.1/metacarta_04'></script>\n"; self::$loadedOL = true; } |
142 | 142 | break; |
143 | | - case 'osm' : case 'openstreetmap' : |
| 143 | + case 'osmarender' : case 'osm-mapnik' : case 'osm-cyclemap' : |
144 | 144 | if (!self::$loadedOSM) { $output .= "<script type='$wgJsMimeType' src='$egMapsScriptPath/OpenLayers/OSM/OpenStreetMap.js?$egMapsStyleVersion'></script>\n"; self::$loadedOSM = true; } |
145 | 145 | break; |
146 | 146 | } |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | |
161 | 161 | $output .="<link rel='stylesheet' href='$egMapsScriptPath/OpenLayers/OpenLayers/theme/default/style.css' type='text/css' /> |
162 | 162 | <script type='$wgJsMimeType' src='$egMapsScriptPath/OpenLayers/OpenLayers/OpenLayers.js'></script> |
163 | | - <script type='$wgJsMimeType' src='$egMapsScriptPath/OpenLayers/OpenLayerFunctions.min.js?$egMapsStyleVersion'></script> |
| 163 | + <script type='$wgJsMimeType' src='$egMapsScriptPath/OpenLayers/OpenLayerFunctions.js?$egMapsStyleVersion'></script> |
164 | 164 | <script type='$wgJsMimeType'>initOLSettings(200, 100);</script>\n"; |
165 | 165 | } |
166 | 166 | } |
— | — | @@ -172,9 +172,33 @@ |
173 | 173 | * @return csv string |
174 | 174 | */ |
175 | 175 | public static function createLayersStringAndLoadDependencies(&$output, array $layers) { |
176 | | - foreach ($layers as $layer) self::loadDependencyWhenNeeded($output, $layer); |
177 | | - return "'" . implode("','", $layers) . "'"; |
178 | | - } |
| 176 | + global $egMapsOLAvailableLayers; |
| 177 | + $layerStr = array(); |
| 178 | + |
| 179 | + foreach ($layers as $layer) { |
| 180 | + self::loadDependencyWhenNeeded($output, $layer); |
| 181 | + $layerStr[] = $egMapsOLAvailableLayers[$layer]; |
| 182 | + } |
| 183 | + |
| 184 | + return 'new ' . implode(',new ', $layerStr); |
| 185 | + } |
179 | 186 | |
| 187 | + public static function unpackLayerGroups(&$layers) { |
| 188 | + global $egMapsOLLayerGroups; |
| 189 | + |
| 190 | + $unpacked = array(); |
| 191 | + |
| 192 | + foreach($layers as $layerOrGroup) { |
| 193 | + if (array_key_exists($layerOrGroup, $egMapsOLLayerGroups)) { |
| 194 | + $unpacked = array_merge($unpacked, $egMapsOLLayerGroups[$layerOrGroup]); |
| 195 | + } |
| 196 | + else { |
| 197 | + $unpacked[] = $layerOrGroup; |
| 198 | + } |
| 199 | + } |
| 200 | + |
| 201 | + $layers = $unpacked; |
| 202 | + } |
| 203 | + |
180 | 204 | } |
181 | 205 | |
\ No newline at end of file |
Index: trunk/extensions/Maps/Maps.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.'; |
35 | 35 | } |
36 | 36 | else { |
37 | | - define('Maps_VERSION', '0.5.3'); |
| 37 | + define('Maps_VERSION', '0.5.4 a2'); |
38 | 38 | |
39 | 39 | $egMapsScriptPath = $wgScriptPath . '/extensions/Maps'; |
40 | 40 | $egMapsIP = $IP . '/extensions/Maps'; |
Index: trunk/extensions/Maps/OpenStreetMap/Maps_OSM.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | global $wgLang; |
53 | 53 | global $egMapsServices, $egMapsOSMZoom, $egMapsOSMControls; |
54 | 54 | |
55 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['default'] = $egMapsOSMZoom; |
| 55 | + $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsOSMZoom; |
56 | 56 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array(0, 19); |
57 | 57 | |
58 | 58 | $egMapsServices[self::SERVICE_NAME]['parameters'] = array( |
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -44,9 +44,9 @@ |
45 | 45 | |
46 | 46 | public static function initialize() { |
47 | 47 | self::initializeParams(); |
48 | | - Validator::addOutputFormat('gmaptype', array('MapsGoogleMaps', 'setGMapType')); |
49 | | - Validator::addOutputFormat('gmaptypes', array('MapsGoogleMaps', 'setGMapTypes')); |
50 | | - Validator::addValidationFunction('is_google_overlay', array('MapsGoogleMaps', 'isGOverlay')); |
| 48 | + Validator::addOutputFormat('gmaptype', array(__CLASS__, 'setGMapType')); |
| 49 | + Validator::addOutputFormat('gmaptypes', array(__CLASS__, 'setGMapTypes')); |
| 50 | + Validator::addValidationFunction('is_google_overlay', array(__CLASS__, 'isGOverlay')); |
51 | 51 | } |
52 | 52 | |
53 | 53 | private static function initializeParams() { |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | $allowedTypes = self::getTypeNames(); |
57 | 57 | |
58 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['default'] = $egMapsGoogleMapsZoom; |
| 58 | + $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsGoogleMapsZoom; |
59 | 59 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array(0, 20); |
60 | 60 | |
61 | 61 | $egMapsServices[self::SERVICE_NAME]['parameters'] = array( |
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -44,8 +44,8 @@ |
45 | 45 | |
46 | 46 | public static function initialize() { |
47 | 47 | self::initializeParams(); |
48 | | - Validator::addOutputFormat('ymaptype', array('MapsYahooMaps', 'setYMapType')); |
49 | | - Validator::addOutputFormat('ymaptypes', array('MapsYahooMaps', 'setYMapTypes')); |
| 48 | + Validator::addOutputFormat('ymaptype', array(__CLASS__, 'setYMapType')); |
| 49 | + Validator::addOutputFormat('ymaptypes', array(__CLASS__, 'setYMapTypes')); |
50 | 50 | } |
51 | 51 | |
52 | 52 | private static function initializeParams() { |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | |
55 | 55 | $allowedTypes = MapsYahooMaps::getTypeNames(); |
56 | 56 | |
57 | | - $egMapsServices[self::SERVICE_NAME]['parameters']['default'] = $egMapsYahooMapsZoom; |
| 57 | + $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsYahooMapsZoom; |
58 | 58 | $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array(1, 13); |
59 | 59 | |
60 | 60 | $egMapsServices[self::SERVICE_NAME]['parameters'] = array( |
Index: trunk/extensions/Maps/Maps_Settings.php |
— | — | @@ -245,10 +245,41 @@ |
246 | 246 | |
247 | 247 | # Array of String. The default layers for Open Layers. This value will only be used when the user does not provide one. |
248 | 248 | # Available values: google, bing, yahoo, openlayers, nasa |
249 | | -$egMapsOLLayers = array('openlayers'); |
| 249 | +$egMapsOLLayers = array('openlayers-wms'); |
250 | 250 | |
| 251 | +# The difinitions for the layers that should be available for the user. |
| 252 | +$egMapsOLAvailableLayers = array( |
| 253 | + 'google-normal' => 'OpenLayers.Layer.Google( "Google Streets", {"sphericalMercator":true} )', |
| 254 | + 'google-satellite' => 'OpenLayers.Layer.Google( "Google Satellite", {type: G_SATELLITE_MAP , "sphericalMercator":true} )', |
| 255 | + 'google-hybrid' => 'OpenLayers.Layer.Google( "Google Hybrid", {type: G_HYBRID_MAP , "sphericalMercator":true} )', |
| 256 | + 'google-physical' => 'OpenLayers.Layer.Google( "Google Physical", {type: G_PHYSICAL_MAP , "sphericalMercator":true} )', |
251 | 257 | |
| 258 | + 'bing-normal' => 'OpenLayers.Layer.VirtualEarth( "Bing Streets", {type: VEMapStyle.Shaded, "sphericalMercator":true} )', |
| 259 | + 'bing-satellite' => 'OpenLayers.Layer.VirtualEarth( "Bing Satellite", {type: VEMapStyle.Aerial, "sphericalMercator":true} )', |
| 260 | + 'bing-hybrid' => 'OpenLayers.Layer.VirtualEarth( "Bing Hybrid", {type: VEMapStyle.Hybrid, "sphericalMercator":true} )', |
252 | 261 | |
| 262 | + 'yahoo-normal' => 'OpenLayers.Layer.Yahoo( "Yahoo! Streets", {"sphericalMercator":true} )', |
| 263 | + 'yahoo-hybrid' => 'OpenLayers.Layer.Yahoo( "Yahoo! Hybrid", {"type": YAHOO_MAP_HYB, "sphericalMercator":true} )', |
| 264 | + 'yahoo-satellite' => 'OpenLayers.Layer.Yahoo( "Yahoo! Satellite", {"type": YAHOO_MAP_SAT, "sphericalMercator":true} )', |
| 265 | + |
| 266 | + 'osmarender' => 'OpenLayers.Layer.OSM.Osmarender("OSM arender")', |
| 267 | + 'osm-mapnik' => 'OpenLayers.Layer.OSM.Mapnik("OSM Mapnik")', |
| 268 | + 'osm-cyclemap' => 'OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map")', |
| 269 | + |
| 270 | + 'openlayers-wms' => 'OpenLayers.Layer.WMS( "OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0", {layers: "basic", "sphericalMercator":true} )', |
| 271 | + |
| 272 | + 'nasa' => 'OpenLayers.Layer.WMS("NASA Global Mosaic", "http://t1.hypercube.telascience.org/cgi-bin/landsat7", {layers: "landsat7", "sphericalMercator":true} )', |
| 273 | +); |
| 274 | + |
| 275 | +# Layer group definitions. Group names must be different from layer names, and must only contain layers that are present in $egMapsOLAvailableLayers. |
| 276 | +$egMapsOLLayerGroups = array( |
| 277 | + 'google' => array('google-normal', 'google-satellite', 'google-hybrid', 'google-physical'), |
| 278 | + 'yahoo' => array('yahoo-normal', 'yahoo-satellite', 'yahoo-hybrid'), |
| 279 | + 'bing' => array('bing-normal', 'bing-satellite', 'bing-hybrid'), |
| 280 | + 'osm' => array('osmarender', 'osm-mapnik', 'osm-cyclemap'), |
| 281 | +); |
| 282 | + |
| 283 | + |
253 | 284 | # OpenStreetMap (OpenLayers optimized for OSM) |
254 | 285 | |
255 | 286 | # String. The OSM map name prefix. It can not be identical to the one of another mapping service. |