r64990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64989‎ | r64990 | r64991 >
Date:15:16, 13 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - refactored a bunch of stuff and did some work on the distance query
Modified paths:
  • /trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoords.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValueDescription.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsQP.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsQP.php
@@ -73,8 +73,8 @@
7474 function() {
7575 initializeYahooMap(
7676 '$this->mapName',
77 - $this->centre_lat,
78 - $this->centre_lon,
 77+ $this->centreLat,
 78+ $this->centreLon,
7979 $this->zoom,
8080 $this->type,
8181 [$this->types],
Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
@@ -85,8 +85,8 @@
8686 makeFormInputYahooMap(
8787 '$this->mapName',
8888 '$this->coordsFieldName',
89 - $this->centre_lat,
90 - $this->centre_lon,
 89+ $this->centreLat,
 90+ $this->centreLon,
9191 $this->zoom,
9292 $this->type,
9393 [$this->types],
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersQP.php
@@ -75,8 +75,8 @@
7676 function() {
7777 initOpenLayer(
7878 '$this->mapName',
79 - $this->centre_lat,
80 - $this->centre_lon,
 79+ $this->centreLat,
 80+ $this->centreLon,
8181 $this->zoom,
8282 [$layerItems],
8383 [$this->controls],
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php
@@ -86,8 +86,8 @@
8787 makeFormInputOpenLayer(
8888 '$this->mapName',
8989 '$this->coordsFieldName',
90 - $this->centre_lat,
91 - $this->centre_lon,
 90+ $this->centreLat,
 91+ $this->centreLon,
9292 $this->zoom,
9393 $this->marker_lat,
9494 $this->marker_lon,
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoords.php
@@ -43,7 +43,7 @@
4444 *
4545 * @return true
4646 */
47 - public static function getGeoProximitySQLCondition( &$whereSQL, SMGeoCoordsValueDescription $description, $tablename, $fieldname, Database $dbs ) {
 47+ public static function getGeoProximitySQLCondition( &$whereSQL, SMGeoCoordsValueDescription $description, $tablename, $fieldname, DatabaseBase $dbs ) {
4848 // If the MapsGeoFunctions class is not loaded, we can not create the bounding box, so don't add any conditions.
4949 if ( !self::geoFunctionsAreAvailable() ) {
5050 return true;
@@ -78,7 +78,7 @@
7979 $south = $dbs->addQuotes( $boundingBox['south'] );
8080 $west = $dbs->addQuotes( $boundingBox['west'] );
8181
82 - $whereSQL .= "{$tablename}lat < $north && {$tablename}lat > $south && {$tablename}lon < $east && {$tablename}lon > $west";
 82+ $whereSQL .= "{$tablename}.lat < $north && {$tablename}.lat > $south && {$tablename}.lon < $east && {$tablename}.lon > $west";
8383
8484 return true;
8585 }
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValueDescription.php
@@ -19,6 +19,8 @@
2020 * @author Jeroen De Dauw
2121 *
2222 * @ingroup SemanticMaps
 23+ *
 24+ * TODO: storing the distance here does not seem quite right
2325 */
2426 class SMGeoCoordsValueDescription extends SMWValueDescription {
2527 protected $m_distance;
Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php
@@ -184,20 +184,20 @@
185185 private function setCentre() {
186186 if ( empty( $this->centre ) ) {
187187 if ( isset( $this->coordinates ) ) {
188 - $this->centre_lat = $this->marker_lat;
189 - $this->centre_lon = $this->marker_lon;
 188+ $this->centreLat = $this->marker_lat;
 189+ $this->centreLon = $this->marker_lon;
190190 }
191191 else {
192 - $this->centre_lat = '0';
193 - $this->centre_lon = '0';
 192+ $this->centreLat = '0';
 193+ $this->centreLon = '0';
194194 }
195195 }
196196 else {
197197 // Geocode and convert if required.
198198 $centre = MapsGeocoder::attemptToGeocode( $this->centre, $this->geoservice, $this->serviceName );
199199
200 - $this->centre_lat = Xml::escapeJsString( $centre['lat'] );
201 - $this->centre_lon = Xml::escapeJsString( $centre['lon'] );
 200+ $this->centreLat = Xml::escapeJsString( $centre['lat'] );
 201+ $this->centreLon = Xml::escapeJsString( $centre['lon'] );
202202 }
203203 }
204204
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMQP.php
@@ -64,8 +64,8 @@
6565 mode: 'osm-wm',
6666 layer: 'osm-like',
6767 locale: '$this->lang',
68 - lat: $this->centre_lat,
69 - lon: $this->centre_lon,
 68+ lat: $this->centreLat,
 69+ lon: $this->centreLon,
7070 zoom: $this->zoom,
7171 width: $this->width,
7272 height: $this->height,
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php
@@ -80,8 +80,8 @@
8181 mode: 'osm-wm',
8282 layer: 'osm-like',
8383 locale: '$this->lang',
84 - lat: $this->centre_lat,
85 - lon: $this->centre_lon,
 84+ lat: $this->centreLat,
 85+ lon: $this->centreLon,
8686 zoom: $this->zoom,
8787 width: $this->width,
8888 height: $this->height,
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -35,7 +35,7 @@
3636
3737 // Only initialize the extension when all dependencies are present.
3838 if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
39 - define( 'SM_VERSION', '0.6 a12' );
 39+ define( 'SM_VERSION', '0.6 a13' );
4040
4141 $smgScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps';
4242 $smgDir = dirname( __FILE__ ) . '/';
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -29,6 +29,8 @@
3030 * ideally should be inherited. Since SMWResultPrinter already gets inherited,
3131 * this is not possible. Finding a better solution to this code redundancy
3232 * would be nice, cause now changes to MapsMapFeature need to be copied here.
 33+ *
 34+ * The adaptor pattern could be used to prevent this.
3335 */
3436 abstract class SMMapPrinter extends SMWResultPrinter {
3537
@@ -57,8 +59,8 @@
5860
5961 protected $mapName;
6062
61 - protected $centre_lat;
62 - protected $centre_lon;
 63+ protected $centreLat;
 64+ protected $centreLon;
6365
6466 protected $output = '';
6567 protected $errorList;
@@ -313,24 +315,24 @@
314316 // Geocode and convert if required.
315317 $centre = MapsGeocoder::attemptToGeocode( $this->centre, $this->geoservice, $this->serviceName );
316318
317 - $this->centre_lat = $centre['lat'];
318 - $this->centre_lon = $centre['lon'];
 319+ $this->centreLat = $centre['lat'];
 320+ $this->centreLon = $centre['lon'];
319321 }
320322 elseif ( count( $this->m_locations ) > 1 ) {
321323 // If centre is not set, and there are multiple points, set the values to null, to be auto determined by the JS of the mapping API.
322 - $this->centre_lat = 'null';
323 - $this->centre_lon = 'null';
 324+ $this->centreLat = 'null';
 325+ $this->centreLon = 'null';
324326 }
325327 elseif ( count( $this->m_locations ) == 1 ) {
326328 // If centre is not set and there is exactelly one marker, use it's coordinates.
327 - $this->centre_lat = Xml::escapeJsString( $this->m_locations[0][0] );
328 - $this->centre_lon = Xml::escapeJsString( $this->m_locations[0][1] );
 329+ $this->centreLat = Xml::escapeJsString( $this->m_locations[0][0] );
 330+ $this->centreLon = Xml::escapeJsString( $this->m_locations[0][1] );
329331 }
330332 else {
331333 // If centre is not set and there are no results, centre on the default coordinates.
332334 global $egMapsMapLat, $egMapsMapLon;
333 - $this->centre_lat = $egMapsMapLat;
334 - $this->centre_lon = $egMapsMapLon;
 335+ $this->centreLat = $egMapsMapLat;
 336+ $this->centreLon = $egMapsMapLon;
335337 }
336338 }
337339
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php
@@ -92,8 +92,8 @@
9393 function() {
9494 initializeGoogleMap('$this->mapName',
9595 {
96 - lat: $this->centre_lat,
97 - lon: $this->centre_lon,
 96+ lat: $this->centreLat,
 97+ lon: $this->centreLon,
9898 zoom: $this->zoom,
9999 type: $this->type,
100100 types: [$this->types],
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -94,8 +94,8 @@
9595 '$this->mapName',
9696 '$this->coordsFieldName',
9797 {
98 - lat: $this->centre_lat,
99 - lon: $this->centre_lon,
 98+ lat: $this->centreLat,
 99+ lon: $this->centreLon,
100100 zoom: $this->zoom,
101101 type: $this->type,
102102 types: [$this->types],

Status & tagging log