shapely 1.2.9__py2.7-win32.egg → 1.2.10__py2.7-win32.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
EGG-INFO/PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: Shapely
3
- Version: 1.2.9
3
+ Version: 1.2.10
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: http://trac.gispython.org/lab/wiki/Shapely
6
6
  Author: Sean Gillies
@@ -166,6 +166,13 @@ Description: ======
166
166
  CHANGES
167
167
  =======
168
168
 
169
+ 1.2.10 (2011-05-09)
170
+ -------------------
171
+ - Add optional Cython speedups.
172
+ - Add is_cww predicate to LinearRing.
173
+ - Add function that forces orientation of Polygons.
174
+ - Disable build of speedups on Windows pending packaging work.
175
+
169
176
  1.2.9 (2011-03-31)
170
177
  ------------------
171
178
  - Remove extra glob import.
File without changes
Binary file
@@ -0,0 +1,17 @@
1
+ from itertools import islice, izip
2
+
3
+ def signed_area(ring):
4
+ """Return the signed area enclosed by a ring in linear time using the
5
+ algorithm at: http://www.cgafaq.info/wiki/Polygon_Area.
6
+ """
7
+ xs, ys = ring.coords.xy
8
+ xs.append(xs[1])
9
+ ys.append(ys[1])
10
+ return sum(xs[i]*(ys[i+1]-ys[i-1]) for i in range(1, len(ring.coords)))/2.0
11
+
12
+ def is_ccw_impl(name):
13
+ """Predicate implementation"""
14
+ def is_ccw_op(ring):
15
+ return signed_area(ring) >= 0.0
16
+ return is_ccw_op
17
+
Binary file
@@ -4,6 +4,8 @@
4
4
  from ctypes import c_double, c_void_p, cast, POINTER
5
5
  from ctypes import ArgumentError
6
6
  import weakref
7
+
8
+ from shapely.algorithms.cga import signed_area
7
9
  from shapely.geos import lgeos
8
10
  from shapely.geometry.base import BaseGeometry
9
11
  from shapely.geometry.linestring import LineString, LineStringAdapter
@@ -61,6 +63,11 @@ class LinearRing(LineString):
61
63
 
62
64
  coords = property(_get_coords, _set_coords)
63
65
 
66
+ @property
67
+ def is_ccw(self):
68
+ """Brand new"""
69
+ return bool(self.impl['is_ccw'](self))
70
+
64
71
 
65
72
  class LinearRingAdapter(LineStringAdapter):
66
73
 
@@ -277,6 +284,20 @@ def asPolygon(shell, holes=None):
277
284
  """Adapt objects to the Polygon interface"""
278
285
  return PolygonAdapter(shell, holes)
279
286
 
287
+ def orient(polygon, sign=1.0):
288
+ s = float(sign)
289
+ rings = []
290
+ ring = polygon.exterior
291
+ if signed_area(ring)/s >= 0.0:
292
+ rings.append(ring)
293
+ else:
294
+ rings.append(list(ring.coords)[::-1])
295
+ for ring in polygon.interiors:
296
+ if signed_area(ring)/s <= 0.0:
297
+ rings.append(ring)
298
+ else:
299
+ rings.append(list(ring.coords)[::-1])
300
+ return Polygon(rings[0], rings[1:])
280
301
 
281
302
  def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
282
303
  try:
Binary file
shapely/impl.py CHANGED
@@ -13,6 +13,7 @@ Shapely 1.2 includes a GEOS backend and it is the default.
13
13
 
14
14
  from ftools import wraps
15
15
 
16
+ from shapely.algorithms import cga
16
17
  from shapely.coords import BoundsOp
17
18
  from shapely.geos import lgeos
18
19
  from shapely.linref import ProjectOp, InterpolateOp
@@ -81,6 +82,9 @@ IMPL14 = {
81
82
  'touches': (BinaryPredicate, 'touches'),
82
83
  'within': (BinaryPredicate, 'within'),
83
84
  'equals_exact': (BinaryPredicate, 'equals_exact'),
85
+
86
+ # First pure Python implementation
87
+ 'is_ccw': (cga.is_ccw_impl, 'is_ccw'),
84
88
  }
85
89
 
86
90
  IMPL15 = {
shapely/impl.pyc CHANGED
Binary file