Ticket #9745: snaptogrid_corrected.diff
File snaptogrid_corrected.diff, 3.0 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/db/models/manager.py
63 63 def scale(self, *args, **kwargs): 64 64 return self.get_query_set().scale(*args, **kwargs) 65 65 66 def snaptogrid(self, *args, **kwargs): 67 return self.get_query_set().snaptogrid(*args, **kwargs) 68 66 69 def svg(self, *args, **kwargs): 67 70 return self.get_query_set().svg(*args, **kwargs) 68 71 -
django/contrib/gis/db/models/query.py
217 217 } 218 218 return self._spatial_attribute('scale', s, **kwargs) 219 219 220 def snaptogrid(self, size=0.01, **kwargs): 221 """ 222 Snap all points of the input geometry to the grid defined by 223 cell size. 224 """ 225 if SpatialBackend.version[0]<1: 226 raise "Postgis version doesn't support SnapToGrid" 227 if not isinstance(size, (float, int)): 228 raise TypeError('Size of the grid must be float or int.') 229 230 field_name = kwargs.get('field_name', None) 231 tmp, geo_field = self._spatial_setup('snaptogrid', field_name=field_name) 232 field_col = self._geocol_select(geo_field, field_name) 233 geo_col = self.query.custom_select.get(geo_field, field_col) 234 custom_sel = '%s(%s, %s)' % (SpatialBackend.snaptogrid, geo_col, size) 235 self.query.custom_select[geo_field] = custom_sel 236 return self._clone() 237 220 238 def svg(self, **kwargs): 221 239 """ 222 240 Returns SVG representation of the geographic field in a `svg` -
django/contrib/gis/db/backend/postgis/__init__.py
30 30 point_on_surface=POINT_ON_SURFACE, 31 31 scale=SCALE, 32 32 select=GEOM_SELECT, 33 snaptogrid=SNAP_TO_GRID, 33 34 svg=ASSVG, 34 35 sym_difference=SYM_DIFFERENCE, 35 36 transform=TRANSFORM, -
django/contrib/gis/db/backend/postgis/query.py
60 60 PERIMETER = get_func('Perimeter') 61 61 POINT_ON_SURFACE = get_func('PointOnSurface') 62 62 SCALE = get_func('Scale') 63 SNAP_TO_GRID = get_func('SnapToGrid') 63 64 SYM_DIFFERENCE = get_func('SymDifference') 64 65 TRANSFORM = get_func('Transform') 65 66 TRANSLATE = get_func('Translate')