r89438 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89437‎ | r89438 | r89439 >
Date:20:12, 3 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixes related to DV/DI changes in SMW 1.6
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php
@@ -120,9 +120,9 @@
121121 case !$this->isValid() :
122122 return new SMWThingDescription();
123123 case $distance !== false :
124 - return new SMAreaValueDescription( $this, $comparator, $distance );
 124+ return new SMAreaValueDescription( $this->getDataItem(), $comparator, $distance );
125125 default :
126 - return new SMGeoCoordsValueDescription( $this, $comparator );
 126+ return new SMGeoCoordsValueDescription( $this->getDataItem(), $comparator );
127127 }
128128 }
129129 }
Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php
@@ -14,12 +14,12 @@
1515 /**
1616 * Constructor.
1717 *
18 - * @since 0.6
 18+ * @since 0.8
1919 *
20 - * @param SMGeoCoordsValue $dataValue
 20+ * @param SMWDataItem $dataItem
2121 */
22 - public function __construct( SMGeoCoordsValue $dataValue, $comparator ) {
23 - parent::__construct( $dataValue, $comparator );
 22+ public function __construct( SMWDataItem $dataItem, $comparator ) {
 23+ parent::__construct( $dataItem, $comparator );
2424 }
2525
2626 /**
@@ -30,8 +30,8 @@
3131 * @param Boolean $asvalue
3232 */
3333 public function getQueryString( $asValue = false ) {
34 - if ( $this->m_datavalue !== null ) {
35 - $queryString = $this->m_datavalue->getWikiValue();
 34+ if ( $this->m_dataItem !== null ) {
 35+ $queryString = SMWDataValueFactory::newDataItemValue( $this->m_dataItem, $this->m_property )->getWikiValue();
3636 return $asValue ? $queryString : "[[$queryString]]";
3737 } else {
3838 return $asValue ? '+' : '';
@@ -50,11 +50,11 @@
5151 * @return true
5252 */
5353 public function getSQLCondition( $tableName, array $fieldNames, $dbs ) {
54 - $dataValue = $this->getDatavalue();
 54+ $dataItem = $this->getDataItem();
5555
5656 // Only execute the query when the description's type is geographical coordinates,
5757 // the description is valid, and the near comparator is used.
58 - if ( $dataValue->getTypeID() != '_geo' || !$dataValue->isValid() ) return false;
 58+ if ( $dataItem->getDIType() != SMWDataItem::TYPE_GEO ) return false;
5959
6060 $comparator = false;
6161
@@ -66,11 +66,9 @@
6767 }
6868
6969 if ( $comparator ) {
70 - $coordinates = $dataValue->getCoordinateSet();
 70+ $lat = $dbs->addQuotes( $dataItem->getLatitude() );
 71+ $lon = $dbs->addQuotes( $dataItem->getLongitude() );
7172
72 - $lat = $dbs->addQuotes( $coordinates['lat'] );
73 - $lon = $dbs->addQuotes( $coordinates['lon'] );
74 -
7573 $conditions = array();
7674
7775 $conditions[] = "{$tableName}.$fieldNames[0] $comparator $lat";
Index: trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php
@@ -28,13 +28,13 @@
2929 /**
3030 * Constructor.
3131 *
32 - * @since 0.6
 32+ * @since 0.8
3333 *
34 - * @param SMGeoCoordsValue $dataValue
 34+ * @param SMWDataItem $dataItem
3535 * @param string $comparator
3636 * @param string $radius
3737 */
38 - public function __construct( SMGeoCoordsValue $dataValue, $comparator, $radius ) {
 38+ public function __construct( SMWDataItem $dataItem, $comparator, $radius ) {
3939 parent::__construct( $dataValue, $comparator );
4040
4141 // Only if the MapsGeoFunctions class is loaded, we can create the bounding box.

Follow-up revisions

RevisionCommit summaryAuthorDate
r89439follow up to r89438jeroendedauw20:25, 3 June 2011

Status & tagging log