Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # This file is part of trytond_backend_gis. The COPYRIGHT file at the top | 1 # This file is part of trytond_backend_gis. The COPYRIGHT file at the top |
2 # level of this repository contains the full copyright notices and license | 2 # level of this repository contains the full copyright notices and license |
3 # terms. | 3 # terms. |
4 from trytond.model import fields | 4 from trytond.model import fields |
5 | 5 |
6 | 6 |
7 class Geometry(fields.Field): | 7 class Geometry(fields.Field): |
8 _type = 'geometry' | 8 _type = 'geometry' |
9 _geometry_type = 'GEOMETRY' | 9 _geometry_type = 'GEOMETRY' |
10 | 10 |
11 def __init__(self, string='', srid=4326, dimension=2, **kwargs): | 11 def __init__(self, string='', srid=4326, dimension=2, loading='lazy', |
12 kwargs['string'] = string | 12 **kwargs): |
13 if 'loading' not in kwargs: | 13 super(Geometry, self).__init__( |
ced
2017/05/19 16:23:24
Why not having loading defined in __init__ signatu
nicoe
2017/06/25 19:58:36
Done.
| |
14 kwargs['loading'] = 'lazy' | 14 string=string, loading=loading, **kwargs) |
15 super(Geometry, self).__init__(**kwargs) | |
ced
2017/05/19 16:23:24
is it not possible to have: __init__(string=string
nicoe
2017/06/25 19:58:36
Done.
| |
16 self.srid = srid | 15 self.srid = srid |
17 self.dimension = dimension | 16 self.dimension = dimension |
18 | 17 |
19 @property | 18 @property |
20 def _sql_type(self): | 19 def _sql_type(self): |
21 return 'GIS_%s(%s, %s)' % ( | 20 return 'GIS_%s(%s, %s)' % ( |
22 self._geometry_type, self.srid, self.dimension) | 21 self._geometry_type, self.srid, self.dimension) |
23 | 22 |
24 | 23 |
25 class Point(Geometry): | 24 class Point(Geometry): |
(...skipping 15 matching lines...) Expand all Loading... | |
41 class MultiLineString(Geometry): | 40 class MultiLineString(Geometry): |
42 _geometry_type = 'MULTILINESTRING' | 41 _geometry_type = 'MULTILINESTRING' |
43 | 42 |
44 | 43 |
45 class MultiPolygon(Geometry): | 44 class MultiPolygon(Geometry): |
46 _geometry_type = 'MULTIPOLYGON' | 45 _geometry_type = 'MULTIPOLYGON' |
47 | 46 |
48 | 47 |
49 class GeometryCollection(Geometry): | 48 class GeometryCollection(Geometry): |
50 _geometry_type = 'GEOMETRYCOLLECTION' | 49 _geometry_type = 'GEOMETRYCOLLECTION' |
LEFT | RIGHT |