changeset 3:83818224c332

Added untagged_wkt to Multi*
author Nicolas Évrard <nicoe@b2ck.com>
date Tue, 14 Feb 2012 17:48:16 +0100
parents 82c4d16dc9d6
children e0fe5418a764
files add_wkt
diffstat 1 files changed, 49 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/add_wkt	Tue Jan 31 17:37:25 2012 +0100
+++ b/add_wkt	Tue Feb 14 17:48:16 2012 +0100
@@ -1,9 +1,9 @@
 # HG changeset patch
-# Parent 4041ab91f5eea3311373b82b5e2e418dc787d17f
+# Parent 6d8119f42543c095d313bcf98aae4c2764e9061a
 
-diff -r 4041ab91f5ee src/ppygis.py
---- a/src/ppygis.py	Thu Dec 22 17:31:38 2011 +0100
-+++ b/src/ppygis.py	Thu Dec 22 17:36:31 2011 +0100
+diff -r 6d8119f42543 src/ppygis.py
+--- a/src/ppygis.py	Tue Jan 31 17:36:49 2012 +0100
++++ b/src/ppygis.py	Tue Feb 14 17:46:51 2012 +0100
 @@ -159,6 +159,8 @@
  
  class Geometry(object):
@@ -69,8 +69,8 @@
 +
      def __init__(self, points, srid=None):
          self.points = list(points)
-         if srid:
-@@ -266,6 +297,10 @@
+         self.srid = srid
+@@ -265,6 +296,10 @@
      def has_m(self):
          return self.points[0].has_m
  
@@ -81,7 +81,7 @@
      @classmethod
      def _read_ewkb_body(cls, reader, srid=None):
          return cls([Point._read_ewkb_body(reader) for index in
-@@ -286,6 +321,8 @@
+@@ -285,6 +320,8 @@
  
  class Polygon(Geometry):
  
@@ -90,7 +90,7 @@
      def __init__(self, rings, srid=None):
          self.rings = list(rings)
          self.srid = srid
-@@ -298,6 +335,10 @@
+@@ -297,6 +334,10 @@
      def has_m(self):
          return self.rings[0].has_m
  
@@ -101,7 +101,7 @@
      @classmethod
      def _read_ewkb_body(cls, reader, srid=None):
          return cls([LineString._read_ewkb_body(reader) for index in
-@@ -318,6 +359,8 @@
+@@ -317,6 +358,8 @@
  
  class GeometryCollection(Geometry):
  
@@ -110,7 +110,18 @@
      def __init__(self, geometries, srid=None):
          self.geometries = list(geometries)
          self.srid = srid
-@@ -347,6 +390,8 @@
+@@ -329,6 +372,10 @@
+     def has_m(self):
+         return self.geometries[0].has_m
+ 
++    @property
++    def untagged_wkt(self):
++        return '(' + ', '.join(g.untagged_wkt for g in self.geometries) + ')'
++
+     @classmethod
+     def _read_ewkb_body(cls, reader, srid=None):
+         return cls([reader.child_reader().read_geometry() for index in
+@@ -346,6 +393,8 @@
  
  class MultiPoint(GeometryCollection):
  
@@ -119,7 +130,7 @@
      def __init__(self, points, srid=None):
          self.points = list(points)
          self.srid = srid
-@@ -359,6 +404,10 @@
+@@ -358,6 +407,10 @@
      def has_m(self):
          return self.points[0].has_m
  
@@ -130,7 +141,7 @@
      @classmethod
      def _read_ewkb_body(cls, reader, srid=None):
          points = []
-@@ -384,6 +433,8 @@
+@@ -383,6 +436,8 @@
  
  class MultiLineString(GeometryCollection):
  
@@ -139,7 +150,18 @@
      def __init__(self, lines, srid=None):
          self.lines = list(lines)
          self.srid = srid
-@@ -421,6 +472,8 @@
+@@ -395,6 +450,10 @@
+     def has_m(self):
+         return self.lines[0].has_m
+ 
++    @property
++    def untagged_wkt(self):
++        return '(' + ', '.join(l.untagged_wkt for l in self.lines) + ')'
++
+     @classmethod
+     def _read_ewkb_body(cls, reader, srid=None):
+         lines = []
+@@ -420,6 +479,8 @@
  
  class MultiPolygon(GeometryCollection):
  
@@ -148,9 +170,20 @@
      def __init__(self, polygons, srid=None):
          self.polygons = list(polygons)
          self.srid = srid
-diff -r 4041ab91f5ee src/tests/test_ppygis.py
---- a/src/tests/test_ppygis.py	Thu Dec 22 17:31:38 2011 +0100
-+++ b/src/tests/test_ppygis.py	Thu Dec 22 17:36:31 2011 +0100
+@@ -432,6 +493,10 @@
+     def has_m(self):
+         return self.polygons[0].has_m
+ 
++    @property
++    def untagged_wkt(self):
++        return '(' + ', '.join(p.untagged_wkt for p in self.polygons) + ')'
++
+     @classmethod
+     def _read_ewkb_body(cls, reader, srid=None):
+         polygons = []
+diff -r 6d8119f42543 src/tests/test_ppygis.py
+--- a/src/tests/test_ppygis.py	Tue Jan 31 17:36:49 2012 +0100
++++ b/src/tests/test_ppygis.py	Tue Feb 14 17:46:51 2012 +0100
 @@ -2,7 +2,38 @@
  import binascii