Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php |
— | — | @@ -73,11 +73,17 @@ |
74 | 74 | * Parses the value into the coordinates and any meta data provided, such as distance. |
75 | 75 | */ |
76 | 76 | protected function parseUserValueOrQuery( $value, $asQuery = false ) { |
| 77 | + $comparator = SMW_CMP_EQ; |
| 78 | + |
77 | 79 | if ( $value == '' ) { |
78 | 80 | $this->addError( wfMsg( 'smw_novalues' ) ); |
79 | 81 | } else { |
80 | 82 | // TODO: parse the parts here |
| 83 | + SMWDataValue::prepareValue( $value, $comparator ); |
| 84 | + |
81 | 85 | //$parts = preg_split( '', $value ); |
| 86 | + // preg_match( '/(.*)\((.*)\)/', $user_input, $matches ); |
| 87 | + |
82 | 88 | $distance = 5; |
83 | 89 | $hasDistance = false; |
84 | 90 | |
— | — | @@ -105,7 +111,7 @@ |
106 | 112 | return new SMAreaValueDescription( $this, $distance ); |
107 | 113 | break; |
108 | 114 | default : |
109 | | - return new SMGeoCoordsValueDescription( $this ); |
| 115 | + return new SMGeoCoordsValueDescription( $this, $comparator ); |
110 | 116 | break; |
111 | 117 | } |
112 | 118 | } |
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoords.php |
— | — | @@ -34,4 +34,4 @@ |
35 | 35 | // Hook for initializing the Geographical Proximity query support. |
36 | 36 | $wgHooks['smwGetSQLConditionForValue'][] = 'SMGeoCoordsValueDescription::getSQLCondition'; |
37 | 37 | |
38 | | -// define( 'SM_CMP_NEAR', 101 ); // Define the near comparator for proximity queries. |
\ No newline at end of file |
| 38 | +define( 'SM_CMP_NEAR', 101 ); // Define the near comparator for proximity queries. |
\ No newline at end of file |
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValueDescription.php |
— | — | @@ -27,8 +27,8 @@ |
28 | 28 | * |
29 | 29 | * @param SMGeoCoordsValue $dataValue |
30 | 30 | */ |
31 | | - public function __construct( SMGeoCoordsValue $dataValue ) { |
32 | | - parent::__construct( $dataValue ); |
| 31 | + public function __construct( SMGeoCoordsValue $dataValue, $comparator ) { |
| 32 | + parent::__construct( $dataValue, $comparator ); |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
— | — | @@ -64,14 +64,18 @@ |
65 | 65 | if ( $dataValue->getTypeID() != '_geo' |
66 | 66 | || !$dataValue->isValid() |
67 | 67 | || !$description instanceof SMGeoCoordsValueDescription |
| 68 | + //|| ( $description->getComparator() != SMW_CMP_EQ && $description->getComparator() != SMW_CMP_NEQ ) |
68 | 69 | ) return true; |
69 | 70 | |
70 | 71 | $coordinates = $dataValue->getCoordinateSet(); |
71 | | - |
| 72 | + |
| 73 | + $comparator = $description->getComparator() == SMW_CMP_EQ ? '=' : '!='; |
| 74 | + //var_dump($comparator);exit; |
| 75 | + |
72 | 76 | // TODO: The field names are hardcoded in, since SMW offers no support for selection based on multiple fields. |
73 | 77 | // Ideally SMW's setup should be changed to allow for this. Now the query can break when other extensions |
74 | 78 | // add their own semantic tables with similar signatures. |
75 | | - $whereSQL .= "{$tablename}.lat = {$coordinates['lat']} && {$tablename}.lon = {$coordinates['lon']}"; |
| 79 | + $whereSQL .= "{$tablename}.lat {$comparator} {$coordinates['lat']} && {$tablename}.lon {$comparator} {$coordinates['lon']}"; |
76 | 80 | |
77 | 81 | return true; |
78 | 82 | } |
Index: trunk/extensions/SemanticMaps/GeoCoords/SM_DistanceValue.php |
— | — | @@ -0,0 +1 @@ |
| 2 | +<?php |
Property changes on: trunk/extensions/SemanticMaps/GeoCoords/SM_DistanceValue.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 3 | + native |