Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValueDescription.php |
— | — | @@ -50,8 +50,6 @@ |
51 | 51 | * @return true |
52 | 52 | */ |
53 | 53 | public function getSQLCondition( $tableName, array $fieldNames, $dbs ) { |
54 | | - global $smgUseSpatialExtensions; |
55 | | - |
56 | 54 | $dataValue = $this->getDatavalue(); |
57 | 55 | |
58 | 56 | // Only execute the query when the description's type is geographical coordinates, |
— | — | @@ -74,15 +72,10 @@ |
75 | 73 | $lon = $dbs->addQuotes( $coordinates['lon'] ); |
76 | 74 | |
77 | 75 | $conditions = array(); |
| 76 | + |
| 77 | + $conditions[] = "{$tableName}.$fieldNames[0] $comparator $lat"; |
| 78 | + $conditions[] = "{$tableName}.$fieldNames[1] $comparator $lon"; |
78 | 79 | |
79 | | - if ( $smgUseSpatialExtensions ) { |
80 | | - // TODO |
81 | | - } |
82 | | - else { |
83 | | - $conditions[] = "{$tableName}.$fieldNames[0] $comparator $lat"; |
84 | | - $conditions[] = "{$tableName}.$fieldNames[1] $comparator $lon"; |
85 | | - } |
86 | | - |
87 | 80 | return implode( ' && ', $conditions ); |
88 | 81 | } |
89 | 82 | else { |
Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsHooks.php |
— | — | @@ -78,26 +78,6 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | | - * Defines the signature for geographical fields needed for the smw_coords table. |
83 | | - * |
84 | | - * @since 0.8 |
85 | | - * |
86 | | - * @param array $fieldTypes The field types defined by SMW, passed by reference. |
87 | | - * |
88 | | - * @return true |
89 | | - */ |
90 | | - public static function initGeoCoordsFieldTypes( array $fieldTypes ) { |
91 | | - global $smgUseSpatialExtensions; |
92 | | - |
93 | | - // Only add the table when the SQL store is not a postgres database, and it has not been added by SMW itself. |
94 | | - if ( $smgUseSpatialExtensions && !array_key_exists( 'c', $fieldTypes ) ) { |
95 | | - $fieldTypes['c'] = 'Point NOT NULL'; |
96 | | - } |
97 | | - |
98 | | - return true; |
99 | | - } |
100 | | - |
101 | | - /** |
102 | 82 | * Defines the layout for the smw_coords table which is used to store value of the GeoCoords type. |
103 | 83 | * |
104 | 84 | * @since 0.8 |
— | — | @@ -105,11 +85,9 @@ |
106 | 86 | * @param array $propertyTables The property tables defined by SMW, passed by reference. |
107 | 87 | */ |
108 | 88 | public static function initGeoCoordsTable( array $propertyTables ) { |
109 | | - global $smgUseSpatialExtensions; |
110 | | - |
111 | 89 | // No spatial extensions support for postgres yet, so just store as 2 float fields. |
112 | | - $signature = $smgUseSpatialExtensions ? array( 'point' => 'c' ) : array( 'lat' => 'f', 'lon' => 'f' ); |
113 | | - $indexes = $smgUseSpatialExtensions ? array( array( 'point', 'SPATIAL INDEX' ) ) : array_keys( $signature ); |
| 90 | + $signature = array( 'lat' => 'f', 'lon' => 'f' ); |
| 91 | + $indexes = array_keys( $signature ); |
114 | 92 | |
115 | 93 | $propertyTables['smw_coords'] = new SMWSQLStore2Table( |
116 | 94 | 'sm_coords', |
Index: trunk/extensions/SemanticMaps/includes/SM_AreaValueDescription.php |
— | — | @@ -117,8 +117,6 @@ |
118 | 118 | * @return string or false |
119 | 119 | */ |
120 | 120 | public function getSQLCondition( $tableName, array $fieldNames, $dbs ) { |
121 | | - global $smgUseSpatialExtensions; |
122 | | - |
123 | 121 | $dataValue = $this->getDatavalue(); |
124 | 122 | |
125 | 123 | // Only execute the query when the description's type is geographical coordinates, |
— | — | @@ -137,25 +135,19 @@ |
138 | 136 | |
139 | 137 | $isEq = $this->getComparator() == SMW_CMP_EQ; |
140 | 138 | |
141 | | - if ( $smgUseSpatialExtensions ) { |
142 | | - // TODO |
143 | | - $sql = ''; |
144 | | - } |
145 | | - else { |
146 | | - $conditions = array(); |
147 | | - |
148 | | - $smallerThen = $isEq ? '<' : '>='; |
149 | | - $biggerThen = $isEq ? '>' : '<='; |
150 | | - $joinCond = $isEq ? '&&' : '||'; |
151 | | - |
152 | | - $conditions[] = "{$tableName}.$fieldNames[0] $smallerThen $north"; |
153 | | - $conditions[] = "{$tableName}.$fieldNames[0] $biggerThen $south"; |
154 | | - $conditions[] = "{$tableName}.$fieldNames[1] $smallerThen $east"; |
155 | | - $conditions[] = "{$tableName}.$fieldNames[1] $biggerThen $west"; |
| 139 | + $conditions = array(); |
156 | 140 | |
157 | | - $sql = implode( " $joinCond ", $conditions ); |
158 | | - } |
159 | | - |
| 141 | + $smallerThen = $isEq ? '<' : '>='; |
| 142 | + $biggerThen = $isEq ? '>' : '<='; |
| 143 | + $joinCond = $isEq ? '&&' : '||'; |
| 144 | + |
| 145 | + $conditions[] = "{$tableName}.$fieldNames[0] $smallerThen $north"; |
| 146 | + $conditions[] = "{$tableName}.$fieldNames[0] $biggerThen $south"; |
| 147 | + $conditions[] = "{$tableName}.$fieldNames[1] $smallerThen $east"; |
| 148 | + $conditions[] = "{$tableName}.$fieldNames[1] $biggerThen $west"; |
| 149 | + |
| 150 | + $sql = implode( " $joinCond ", $conditions ); |
| 151 | + |
160 | 152 | return $sql; |
161 | 153 | } |
162 | 154 | |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -104,9 +104,6 @@ |
105 | 105 | // Hook for initializing the Geographical Coordinate type. |
106 | 106 | $wgHooks['smwInitDatatypes'][] = 'SMGeoCoordsHooks::initGeoCoordsType'; |
107 | 107 | |
108 | | -// Hook for initializing the field types needed by Geographical Coordinates. |
109 | | -$wgHooks['SMWCustomSQLStoreFieldType'][] = 'SMGeoCoordsHooks::initGeoCoordsFieldTypes'; |
110 | | - |
111 | 108 | // Hook for defining a table to store geographical coordinates in. |
112 | 109 | $wgHooks['SMWPropertyTables'][] = 'SMGeoCoordsHooks::initGeoCoordsTable'; |
113 | 110 | |