Index: trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php |
— | — | @@ -28,32 +28,32 @@ |
29 | 29 | /** |
30 | 30 | * Constructor. |
31 | 31 | * |
32 | | - * @since 0.8 |
| 32 | + * @since 0.6 |
33 | 33 | * |
34 | 34 | * @param SMWDataItem $dataItem |
35 | 35 | * @param string $comparator |
36 | 36 | * @param string $radius |
37 | 37 | */ |
38 | 38 | public function __construct( SMWDataItem $dataItem, $comparator, $radius ) { |
39 | | - parent::__construct( $dataValue, $comparator ); |
| 39 | + parent::__construct( $dataItem, $comparator ); |
40 | 40 | |
41 | 41 | // Only if the MapsGeoFunctions class is loaded, we can create the bounding box. |
42 | 42 | if ( self::geoFunctionsAreAvailable() ) { |
43 | | - $this->calculateBounds( $dataValue, $radius ); |
| 43 | + $this->calculateBounds( $dataItem, $radius ); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | | - * Sets the mBounds fields to an array returned by SMAreaValueDescription::getBoundingBox. |
| 48 | + * Sets the bounds fields to an array returned by SMAreaValueDescription::getBoundingBox. |
49 | 49 | * |
50 | 50 | * @since 0.6 |
51 | 51 | * |
52 | | - * @param SMGeoCoordsValue $dataValue |
| 52 | + * @param SMWDIGeoCoord $dataItem |
53 | 53 | * @param string $radius |
54 | 54 | */ |
55 | | - protected function calculateBounds( SMGeoCoordsValue $dataValue, $radius ) { |
| 55 | + protected function calculateBounds( SMWDIGeoCoord $dataItem, $radius ) { |
56 | 56 | $this->bounds = self::getBoundingBox( |
57 | | - $dataValue->getCoordinateSet(), |
| 57 | + array( 'lat' => $dataItem->getLatitude(), 'lon' => $dataItem->getLongitude() ), |
58 | 58 | MapsDistanceParser::parseDistance( $radius ) |
59 | 59 | ); |
60 | 60 | } |
— | — | @@ -66,8 +66,8 @@ |
67 | 67 | * @param Boolean $asvalue |
68 | 68 | */ |
69 | 69 | public function getQueryString( $asValue = false ) { |
70 | | - if ( $this->m_datavalue !== null ) { |
71 | | - $queryString = $this->m_datavalue->getWikiValue(); |
| 70 | + if ( $this->getDataItem() !== null ) { |
| 71 | + $queryString = SMWDataValueFactory::newDataItemValue( $this->getDataItem() )->getWikiValue(); |
72 | 72 | return $asValue ? $queryString : "[[$queryString]]"; |
73 | 73 | } else { |
74 | 74 | return $asValue ? '+' : ''; |
— | — | @@ -117,12 +117,9 @@ |
118 | 118 | * @return string or false |
119 | 119 | */ |
120 | 120 | public function getSQLCondition( $tableName, array $fieldNames, $dbs ) { |
121 | | - $dataValue = $this->getDatavalue(); |
122 | | - |
123 | 121 | // Only execute the query when the description's type is geographical coordinates, |
124 | 122 | // the description is valid, and the near comparator is used. |
125 | | - if ( $dataValue->getTypeID() != '_geo' |
126 | | - || !$dataValue->isValid() |
| 123 | + if ( $this->getDataItem()->getDIType() != SMWDataItem::TYPE_GEO |
127 | 124 | || ( $this->getComparator() != SMW_CMP_EQ && $this->getComparator() != SMW_CMP_NEQ ) |
128 | 125 | ) { |
129 | 126 | return false; |