Index: trunk/extensions/Maps/RELEASE-NOTES |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | * Changed minimun MediaWiki version from 1.17 to 1.18. |
16 | 16 | * Removed support for the deprecated Google Maps v2 API. |
17 | 17 | |
| 18 | +* 'display_points' locations have a fifth parameter for defining a group for the location. |
| 19 | + |
18 | 20 | === Maps 1.0.5 === |
19 | 21 | (2011-11-30) |
20 | 22 | |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker0.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker0.png |
___________________________________________________________________ |
Added: svn:mime-type |
21 | 23 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker1.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker1.png |
___________________________________________________________________ |
Added: svn:mime-type |
22 | 24 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker2.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker2.png |
___________________________________________________________________ |
Added: svn:mime-type |
23 | 25 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker3.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker3.png |
___________________________________________________________________ |
Added: svn:mime-type |
24 | 26 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker4.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker4.png |
___________________________________________________________________ |
Added: svn:mime-type |
25 | 27 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker5.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker5.png |
___________________________________________________________________ |
Added: svn:mime-type |
26 | 28 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker6.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker6.png |
___________________________________________________________________ |
Added: svn:mime-type |
27 | 29 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker7.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker7.png |
___________________________________________________________________ |
Added: svn:mime-type |
28 | 30 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker8.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker8.png |
___________________________________________________________________ |
Added: svn:mime-type |
29 | 31 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker9.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Maps/includes/services/OpenLayers/OpenLayers/img/marker9.png |
___________________________________________________________________ |
Added: svn:mime-type |
30 | 32 | + image/png |
Index: trunk/extensions/Maps/includes/services/OpenLayers/jquery.openlayers.js |
— | — | @@ -3,6 +3,7 @@ |
4 | 4 | * @see http://www.mediawiki.org/wiki/Extension:Maps |
5 | 5 | * |
6 | 6 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 7 | + * @author Daniel Werner |
7 | 8 | */ |
8 | 9 | |
9 | 10 | (function( $ ){ $.fn.openlayers = function( mapElementId, options ) { |
— | — | @@ -13,7 +14,7 @@ |
14 | 15 | if ( markerData.icon != "" ) { |
15 | 16 | marker = new OpenLayers.Marker( markerData.lonlat, new OpenLayers.Icon( markerData.icon ) ); |
16 | 17 | } else { |
17 | | - marker = new OpenLayers.Marker( markerData.lonlat ); |
| 18 | + marker = new OpenLayers.Marker( markerData.lonlat, new OpenLayers.Icon( markerLayer.defaultIcon ) ); |
18 | 19 | } |
19 | 20 | |
20 | 21 | if ( markerData.text !== '' ) { |
— | — | @@ -36,26 +37,44 @@ |
37 | 38 | options.locations = []; |
38 | 39 | } |
39 | 40 | |
| 41 | + var locations = options.locations; |
40 | 42 | var bounds = null; |
41 | | - |
42 | | - // Layer to hold the markers. |
43 | | - var markerLayer = new OpenLayers.Layer.Markers( mediaWiki.msg( 'maps-markers' ) ); |
44 | | - markerLayer.id= 'markerLayer'; |
45 | | - map.addLayer( markerLayer ); |
46 | | - |
47 | | - if ( options.locations.length > 1 && ( options.centre === false || options.zoom === false ) ) { |
| 43 | + |
| 44 | + if ( locations.length > 1 && ( options.centre === false || options.zoom === false ) ) { |
48 | 45 | bounds = new OpenLayers.Bounds(); |
49 | 46 | } |
50 | 47 | |
51 | | - for ( i = options.locations.length - 1; i >= 0; i-- ) { |
52 | | - options.locations[i].lonlat = new OpenLayers.LonLat( options.locations[i].lon, options.locations[i].lat ); |
| 48 | + var groupLayers = new Object(); |
| 49 | + var groups = 0; |
| 50 | + |
| 51 | + for ( i = locations.length - 1; i >= 0; i-- ) { |
53 | 52 | |
| 53 | + var location = locations[i]; |
| 54 | + |
| 55 | + // Create a own marker-layer for the marker group: |
| 56 | + if( ! groupLayers[ location.group ] ) { |
| 57 | + // in case no group is specified, use default marker layer: |
| 58 | + var layerName = location.group != '' ? location.group : mediaWiki.msg( 'maps-markers' ); |
| 59 | + var curLayer = new OpenLayers.Layer.Markers( layerName ); |
| 60 | + groups++; |
| 61 | + curLayer.id = 'markerLayer' + groups; |
| 62 | + // define default icon, one of ten in different colors, if more than ten layers, colors will repeat: |
| 63 | + curLayer.defaultIcon = egMapsScriptPath + '/includes/services/OpenLayers/OpenLayers/img/marker' + ( ( groups + 10 ) % 10 ) + '.png'; |
| 64 | + map.addLayer( curLayer ); |
| 65 | + groupLayers[ location.group ] = curLayer; |
| 66 | + } else { |
| 67 | + // if markers of this group exist already, they have an own layer already |
| 68 | + var curLayer = groupLayers[ location.group ]; |
| 69 | + } |
| 70 | + |
| 71 | + location.lonlat = new OpenLayers.LonLat( location.lon, location.lat ); |
| 72 | + |
54 | 73 | if ( !hasImageLayer ) { |
55 | | - options.locations[i].lonlat.transform( new OpenLayers.Projection( "EPSG:4326" ), new OpenLayers.Projection( "EPSG:900913" ) ); |
| 74 | + location.lonlat.transform( new OpenLayers.Projection( "EPSG:4326" ), new OpenLayers.Projection( "EPSG:900913" ) ); |
56 | 75 | } |
57 | 76 | |
58 | | - if ( bounds != null ) bounds.extend( options.locations[i].lonlat ); // Extend the bounds when no center is set. |
59 | | - markerLayer.addMarker( this.getOLMarker( markerLayer, options.locations[i] ) ); // Create and add the marker. |
| 77 | + if ( bounds != null ) bounds.extend( location.lonlat ); // Extend the bounds when no center is set. |
| 78 | + curLayer.addMarker( this.getOLMarker( curLayer, location ) ); // Create and add the marker. |
60 | 79 | } |
61 | 80 | |
62 | 81 | if ( bounds != null ) map.zoomToExtent( bounds ); // If a bounds object has been created, use it to set the zoom and center. |
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamLocation.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | * @ingroup ParameterManipulations |
12 | 12 | * |
13 | 13 | * @author Jeroen De Dauw |
| 14 | + * @author Daniel Werner |
14 | 15 | */ |
15 | 16 | class MapsParamLocation extends ItemParameterManipulation { |
16 | 17 | |
— | — | @@ -65,6 +66,10 @@ |
66 | 67 | $value->setIcon( $icon ); |
67 | 68 | } |
68 | 69 | |
| 70 | + if ( $group = array_shift( $parts ) ) { |
| 71 | + $value->setGroup( $group ); |
| 72 | + } |
| 73 | + |
69 | 74 | if ( $this->toJSONObj ) { |
70 | 75 | $value = $value->getJSONObject(); |
71 | 76 | } |
Index: trunk/extensions/Maps/includes/Maps_Location.php |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | * @ingroup Maps |
11 | 11 | * |
12 | 12 | * @author Jeroen De Dauw |
| 13 | + * @author Daniel Werner |
13 | 14 | */ |
14 | 15 | class MapsLocation { |
15 | 16 | |
— | — | @@ -61,6 +62,12 @@ |
62 | 63 | */ |
63 | 64 | protected $icon = ''; |
64 | 65 | |
| 66 | + /** |
| 67 | + * @since 1.1 |
| 68 | + * |
| 69 | + * @var string |
| 70 | + */ |
| 71 | + protected $group = ''; |
65 | 72 | |
66 | 73 | /** |
67 | 74 | * @since 0.7.1 |
— | — | @@ -295,7 +302,7 @@ |
296 | 303 | * @param string $title |
297 | 304 | */ |
298 | 305 | public function setTitle( $title ) { |
299 | | - $this->title = $title; |
| 306 | + $this->title = trim( $title ); |
300 | 307 | } |
301 | 308 | |
302 | 309 | /** |
— | — | @@ -306,7 +313,7 @@ |
307 | 314 | * @param string $text |
308 | 315 | */ |
309 | 316 | public function setText( $text ) { |
310 | | - $this->text = $text; |
| 317 | + $this->text = trim( $text ); |
311 | 318 | } |
312 | 319 | |
313 | 320 | /** |
— | — | @@ -328,10 +335,21 @@ |
329 | 336 | * @param string $icon |
330 | 337 | */ |
331 | 338 | public function setIcon( $icon ) { |
332 | | - $this->icon = $icon; |
333 | | - } |
| 339 | + $this->icon = trim( $icon ); |
| 340 | + } |
334 | 341 | |
335 | 342 | /** |
| 343 | + * Sets the group |
| 344 | + * |
| 345 | + * @since 1.1 |
| 346 | + * |
| 347 | + * @param string $group |
| 348 | + */ |
| 349 | + public function setGroup( $group ) { |
| 350 | + $this->group = trim( $group ); |
| 351 | + } |
| 352 | + |
| 353 | + /** |
336 | 354 | * Returns if there is any title. |
337 | 355 | * |
338 | 356 | * @since 1.0 |
— | — | @@ -387,13 +405,35 @@ |
388 | 406 | } |
389 | 407 | |
390 | 408 | /** |
| 409 | + * Returns the group. |
| 410 | + * |
| 411 | + * @since 1.1 |
| 412 | + * |
| 413 | + * @return string |
| 414 | + */ |
| 415 | + public function getGroup() { |
| 416 | + return $this->group; |
| 417 | + } |
| 418 | + |
| 419 | + /** |
| 420 | + * Returns whether Location is asigned to a group. |
| 421 | + * |
| 422 | + * @since 1.1 |
| 423 | + * |
| 424 | + * @return string |
| 425 | + */ |
| 426 | + public function hasGroup() { |
| 427 | + return $this->group != ''; |
| 428 | + } |
| 429 | + |
| 430 | + /** |
391 | 431 | * Returns an object that can directly be converted to JS using json_encode or similar. |
392 | 432 | * |
393 | 433 | * @since 1.0 |
394 | 434 | * |
395 | 435 | * @return object |
396 | 436 | */ |
397 | | - public function getJSONObject( $defText = '', $defTitle = '', $defIconUrl = '' ) { |
| 437 | + public function getJSONObject( $defText = '', $defTitle = '', $defIconUrl = '', $defGroup = '' ) { |
398 | 438 | return array( |
399 | 439 | 'lat' => $this->getLatitude(), |
400 | 440 | 'lon' => $this->getLongitude(), |
— | — | @@ -401,7 +441,8 @@ |
402 | 442 | 'text' => $this->hasText() ? $this->getText() : $defText, |
403 | 443 | 'title' => $this->hasTitle() ? $this->getTitle() : $defTitle, |
404 | 444 | 'address' => $this->getAddress( false ), |
405 | | - 'icon' => $this->hasIcon() ? MapsMapper::getFileUrl( $this->getIcon() ) : $defIconUrl |
| 445 | + 'icon' => $this->hasIcon() ? MapsMapper::getFileUrl( $this->getIcon() ) : $defIconUrl, |
| 446 | + 'group' => $this->hasGroup() ? $this->getGroup() : $defGroup |
406 | 447 | ); |
407 | 448 | } |
408 | 449 | |