Ticket #11854: django-trunk-rev16840-azimuth-version1.diff

File django-trunk-rev16840-azimuth-version1.diff, 2.6 KB (added by Christian Karrié, 13 years ago)

first diff, THIS is just a proof of concept

  • django/contrib/gis/db/backends/postgis/operations.py

    ### Eclipse Workspace Patch 1.0
    #P django-trunk
     
    163163            'overlaps' : PostGISFunction(prefix, 'Overlaps'),
    164164            'contains' : PostGISFunction(prefix, 'Contains'),
    165165            'intersects' : PostGISFunction(prefix, 'Intersects'),
     166            'azimuth' : PostGISFunction(prefix, 'Azimuth'),
    166167            'relate' : (PostGISRelate, basestring),
    167168            }
    168169
     
    242243        self.gis_terms = dict([(term, None) for term in gis_terms])
    243244
    244245        self.area = prefix + 'Area'
     246        self.azimuth = prefix + 'Azimuth'
    245247        self.bounding_circle = BOUNDINGCIRCLE
    246248        self.centroid = prefix + 'Centroid'
    247249        self.collect = prefix + 'Collect'
  • django/contrib/gis/db/models/query.py

     
    5858                # TODO: Do we want to support raw number areas for geodetic fields?
    5959                raise Exception('Area on geodetic coordinate systems not supported.')
    6060        return self._spatial_attribute('area', s, **kwargs)
     61   
     62    def azimuth(self, geom, **kwargs):
     63        return self._geomset_attribute('azimuth', geom, **kwargs)
    6164
    6265    def centroid(self, **kwargs):
    6366        """
     
    565568        # Finally, setting the extra selection attribute with
    566569        # the format string expanded with the stored procedure
    567570        # arguments.
     571       
     572        #print settings
     573        #print "model_att:", fmt % settings['procedure_args']
     574        #print "select_params:", settings['select_params']
    568575        return self.extra(select={model_att : fmt % settings['procedure_args']},
    569576                          select_params=settings['select_params'])
    570577
  • django/contrib/gis/db/models/manager.py

     
    1414
    1515    def area(self, *args, **kwargs):
    1616        return self.get_query_set().area(*args, **kwargs)
     17   
     18    def azimuth(self, *args, **kwargs):
     19        return self.get_query_set().azimuth(*args, **kwargs)
    1720
    1821    def centroid(self, *args, **kwargs):
    1922        return self.get_query_set().centroid(*args, **kwargs)
Back to Top