http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89438

Revision: 89438
Author:   jeroendedauw
Date:     2011-06-03 20:12:10 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
fixes related to DV/DI changes in SMW 1.6

Modified Paths:
--------------
    trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php
    trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php
    trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php

Modified: trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php
===================================================================
--- trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php  
2011-06-03 20:11:37 UTC (rev 89437)
+++ trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php  
2011-06-03 20:12:10 UTC (rev 89438)
@@ -28,13 +28,13 @@
        /**
         * Constructor.
         * 
-        * @since 0.6
+        * @since 0.8
         * 
-        * @param SMGeoCoordsValue $dataValue
+        * @param SMWDataItem $dataItem
         * @param string $comparator
         * @param string $radius
         */
-       public function __construct( SMGeoCoordsValue $dataValue, $comparator, 
$radius ) {
+       public function __construct( SMWDataItem $dataItem, $comparator, 
$radius ) {
                parent::__construct( $dataValue, $comparator ); 
 
                // Only if the MapsGeoFunctions class is  loaded, we can create 
the bounding box.

Modified: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php
===================================================================
--- trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php        
2011-06-03 20:11:37 UTC (rev 89437)
+++ trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php        
2011-06-03 20:12:10 UTC (rev 89438)
@@ -120,9 +120,9 @@
                                case !$this->isValid() :
                                        return new SMWThingDescription();
                                case $distance !== false :
-                                       return new SMAreaValueDescription( 
$this, $comparator, $distance );
+                                       return new SMAreaValueDescription( 
$this->getDataItem(), $comparator, $distance );
                                default :
-                                       return new SMGeoCoordsValueDescription( 
$this, $comparator );
+                                       return new SMGeoCoordsValueDescription( 
$this->getDataItem(), $comparator );
                        }
                }
        }

Modified: 
trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php
===================================================================
--- trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php     
2011-06-03 20:11:37 UTC (rev 89437)
+++ trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php     
2011-06-03 20:12:10 UTC (rev 89438)
@@ -14,12 +14,12 @@
        /**
         * Constructor.
         * 
-        * @since 0.6
+        * @since 0.8
         * 
-        * @param SMGeoCoordsValue $dataValue
+        * @param SMWDataItem $dataItem
         */
-       public function __construct( SMGeoCoordsValue $dataValue, $comparator ) 
{
-               parent::__construct( $dataValue, $comparator ); 
+       public function __construct( SMWDataItem $dataItem, $comparator ) {
+               parent::__construct( $dataItem, $comparator );  
        }
 
        /**
@@ -30,8 +30,8 @@
         * @param Boolean $asvalue
         */
        public function getQueryString( $asValue = false ) {
-               if ( $this->m_datavalue !== null ) {
-                       $queryString = $this->m_datavalue->getWikiValue();
+               if ( $this->m_dataItem !== null ) {
+                       $queryString = SMWDataValueFactory::newDataItemValue( 
$this->m_dataItem, $this->m_property )->getWikiValue();
                        return $asValue ? $queryString : "[[$queryString]]";
                } else {
                        return $asValue ? '+' : '';
@@ -50,11 +50,11 @@
         * @return true
         */
        public function getSQLCondition( $tableName, array $fieldNames, $dbs ) {
-               $dataValue = $this->getDatavalue();
+               $dataItem = $this->getDataItem();
                
                // Only execute the query when the description's type is 
geographical coordinates,
                // the description is valid, and the near comparator is used.
-               if ( $dataValue->getTypeID() != '_geo' || 
!$dataValue->isValid() ) return false;
+               if ( $dataItem->getDIType() != SMWDataItem::TYPE_GEO ) return 
false;
 
                $comparator = false;
                
@@ -66,11 +66,9 @@
                }
                
                if ( $comparator ) {
-                       $coordinates = $dataValue->getCoordinateSet();
+                       $lat = $dbs->addQuotes( $dataItem->getLatitude() );
+                       $lon = $dbs->addQuotes( $dataItem->getLongitude() );
                        
-                       $lat = $dbs->addQuotes( $coordinates['lat'] );
-                       $lon = $dbs->addQuotes( $coordinates['lon'] );
-                       
                        $conditions = array();
                                
             $conditions[] = "{$tableName}.$fieldNames[0] $comparator $lat";


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to