r66283 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66282‎ | r66283 | r66284 >
Date:19:33, 12 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - small fix
Modified paths:
  • /trunk/extensions/Maps/ParserFunctions/Coordinates/Maps_Coordinates.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/GeoFunctions/Maps_GeoFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/ParserFunctions/GeoFunctions/Maps_GeoFunctions.php
@@ -279,10 +279,10 @@
280280 * @return array The desitination coordinates, as non-directional floats in an array with lat and lon keys.
281281 */
282282 public static function findDestination( array $startingCoordinates, $bearing, $distance ) {
283 - $startingCoordinates['lat'] = (float)$startingCoordinates['lat'];
284 - $startingCoordinates['lon'] = (float)$startingCoordinates['lon'];
 283+ $startingCoordinates['lat'] = deg2rad( (float)$startingCoordinates['lat'] );
 284+ $startingCoordinates['lon'] = deg2rad( (float)$startingCoordinates['lon'] );
285285
286 - $angularDistance = $distance / Maps_EARTH_RADIUS;
 286+ $angularDistance = deg2rad( $distance / Maps_EARTH_RADIUS );
287287
288288 $lat = asin(
289289 sin( $startingCoordinates['lat'] ) * cos( $angularDistance ) +
@@ -290,10 +290,10 @@
291291 );
292292
293293 return array(
294 - 'lat' => $lat,
295 - 'lon' => $startingCoordinates['lon'] + atan2(
 294+ 'lat' => rad2deg( $lat ),
 295+ 'lon' => rad2deg( $startingCoordinates['lon'] + atan2(
296296 sin( $bearing ) * sin( $angularDistance ) * cos( $startingCoordinates['lat'] ),
297 - cos( $angularDistance ) - sin( $startingCoordinates['lat'] ) * sin( $lat )
 297+ cos( $angularDistance ) - sin( $startingCoordinates['lat'] ) * sin( $lat ) )
298298 )
299299 );
300300 }
Index: trunk/extensions/Maps/ParserFunctions/Coordinates/Maps_Coordinates.php
@@ -80,12 +80,16 @@
8181 $parsedCoords = MapsCoordinateParser::parseCoordinates( $parameters['location'] );
8282
8383 if ( $parsedCoords ) {
84 - $output = MapsCoordinateParser::formatCoordinates( $parsedCoords, $parameters['format'], $parameters['directional'] ) .
85 - '<br />' . $manager->getErrorList();
 84+ $output = MapsCoordinateParser::formatCoordinates( $parsedCoords, $parameters['format'], $parameters['directional'] );
8685 } else {
87 - $output = htmlspecialchars( wfMsgExt( 'maps-invalid-coordinates', 'parsemag', $parameters['location'] ) ) .
88 - '<br />' . $manager->getErrorList();
 86+ $output = htmlspecialchars( wfMsgExt( 'maps-invalid-coordinates', 'parsemag', $parameters['location'] ) );
8987 }
 88+
 89+ $errorList = $manager->getErrorList();
 90+
 91+ if ( $errorList != '' ) {
 92+ $output .= $errorList;
 93+ }
9094 } else {
9195 $output = $manager->getErrorList();
9296 }

Status & tagging log