Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php |
— | — | @@ -120,9 +120,9 @@ |
121 | 121 | case !$this->isValid() : |
122 | 122 | return new SMWThingDescription(); |
123 | 123 | case $distance !== false : |
124 | | - return new SMAreaValueDescription( $this, $comparator, $distance ); |
| 124 | + return new SMAreaValueDescription( $this->getDataItem(), $comparator, $distance ); |
125 | 125 | default : |
126 | | - return new SMGeoCoordsValueDescription( $this, $comparator ); |
| 126 | + return new SMGeoCoordsValueDescription( $this->getDataItem(), $comparator ); |
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php |
— | — | @@ -14,12 +14,12 @@ |
15 | 15 | /** |
16 | 16 | * Constructor. |
17 | 17 | * |
18 | | - * @since 0.6 |
| 18 | + * @since 0.8 |
19 | 19 | * |
20 | | - * @param SMGeoCoordsValue $dataValue |
| 20 | + * @param SMWDataItem $dataItem |
21 | 21 | */ |
22 | | - public function __construct( SMGeoCoordsValue $dataValue, $comparator ) { |
23 | | - parent::__construct( $dataValue, $comparator ); |
| 22 | + public function __construct( SMWDataItem $dataItem, $comparator ) { |
| 23 | + parent::__construct( $dataItem, $comparator ); |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | * @param Boolean $asvalue |
32 | 32 | */ |
33 | 33 | 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(); |
36 | 36 | return $asValue ? $queryString : "[[$queryString]]"; |
37 | 37 | } else { |
38 | 38 | return $asValue ? '+' : ''; |
— | — | @@ -50,11 +50,11 @@ |
51 | 51 | * @return true |
52 | 52 | */ |
53 | 53 | public function getSQLCondition( $tableName, array $fieldNames, $dbs ) { |
54 | | - $dataValue = $this->getDatavalue(); |
| 54 | + $dataItem = $this->getDataItem(); |
55 | 55 | |
56 | 56 | // Only execute the query when the description's type is geographical coordinates, |
57 | 57 | // 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; |
59 | 59 | |
60 | 60 | $comparator = false; |
61 | 61 | |
— | — | @@ -66,11 +66,9 @@ |
67 | 67 | } |
68 | 68 | |
69 | 69 | if ( $comparator ) { |
70 | | - $coordinates = $dataValue->getCoordinateSet(); |
| 70 | + $lat = $dbs->addQuotes( $dataItem->getLatitude() ); |
| 71 | + $lon = $dbs->addQuotes( $dataItem->getLongitude() ); |
71 | 72 | |
72 | | - $lat = $dbs->addQuotes( $coordinates['lat'] ); |
73 | | - $lon = $dbs->addQuotes( $coordinates['lon'] ); |
74 | | - |
75 | 73 | $conditions = array(); |
76 | 74 | |
77 | 75 | $conditions[] = "{$tableName}.$fieldNames[0] $comparator $lat"; |
Index: trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php |
— | — | @@ -28,13 +28,13 @@ |
29 | 29 | /** |
30 | 30 | * Constructor. |
31 | 31 | * |
32 | | - * @since 0.6 |
| 32 | + * @since 0.8 |
33 | 33 | * |
34 | | - * @param SMGeoCoordsValue $dataValue |
| 34 | + * @param SMWDataItem $dataItem |
35 | 35 | * @param string $comparator |
36 | 36 | * @param string $radius |
37 | 37 | */ |
38 | | - public function __construct( SMGeoCoordsValue $dataValue, $comparator, $radius ) { |
| 38 | + public function __construct( SMWDataItem $dataItem, $comparator, $radius ) { |
39 | 39 | parent::__construct( $dataValue, $comparator ); |
40 | 40 | |
41 | 41 | // Only if the MapsGeoFunctions class is loaded, we can create the bounding box. |