]>
Commit | Line | Data |
---|---|---|
8fe8b560 | 1 | diff -Naur geos-2.2.1.orig/swig/geos.i geos-2.2.1/swig/geos.i |
2 | --- geos-2.2.1.orig/swig/geos.i 2005-12-21 09:09:28.000000000 +0100 | |
3 | +++ geos-2.2.1/swig/geos.i 2005-12-21 09:15:35.000000000 +0100 | |
4 | @@ -1,5 +1,5 @@ | |
5 | /* ========================================================================= | |
6 | - * $Id$ | |
7 | + * $Id$ | |
8 | * | |
9 | * geos.i | |
10 | * | |
11 | @@ -16,15 +16,34 @@ | |
12 | ||
13 | %module geos | |
14 | %include "std_string.i" | |
15 | +%include "std_vector.i" | |
16 | %include "exception.i" | |
17 | ||
18 | %{ | |
19 | #include "../../source/headers/geos.h" | |
20 | +#include "../../source/headers/geos/opLinemerge.h" | |
21 | +#include "../../source/headers/geos/opPolygonize.h" | |
22 | %} | |
23 | ||
24 | // Following methods are prototypes but unimplemented and are to be ignored | |
25 | %ignore geos::MultiPoint::isClosed; | |
26 | ||
27 | +%apply SWIGTYPE *DISOWN { geos::CoordinateSequence * }; | |
28 | +%apply SWIGTYPE *DISOWN { geos::LinearRing * }; | |
29 | +%apply SWIGTYPE *DISOWN { std::vector<geos::Geometry * > * }; | |
30 | + | |
31 | +// no transfer of ownership | |
32 | +%ignore geos::GeometryFactory::createPoint(CoordinateSequence *) const; | |
33 | +%rename(createLineStringP) geos::GeometryFactory::createLineString(CoordinateSequence *) const; | |
34 | +%rename(createLinearRingP) geos::GeometryFactory::createLinearRing(CoordinateSequence *) const; | |
35 | +%rename(createPolygonPP) geos::GeometryFactory::createPolygon(LinearRing *,vector<Geometry * > *) const; | |
36 | +%ignore geos::GeometryFactory::createGeometryCollection(vector<Geometry * > *) const; | |
37 | +%ignore geos::GeometryFactory::buildGeometry(vector<Geometry * > *) const; | |
38 | +%ignore geos::GeometryFactory::createMultiPoint(vector<Geometry * > *) const; | |
39 | +%ignore geos::GeometryFactory::createMultiLineString(vector<Geometry * > *) const; | |
40 | +%ignore geos::GeometryFactory::createMultiLinearRing(vector<Geometry * > *) const; | |
41 | +%ignore geos::GeometryFactory::createMultiPolygon(vector<Geometry * > *) const; | |
42 | + | |
43 | // Required renaming | |
44 | %rename(Coordinate_Coordinate) Coordinate::Coordinate; | |
45 | ||
46 | @@ -43,3 +62,25 @@ | |
47 | %include "../../source/headers/geos/util.h" | |
48 | %include "../../source/headers/geos/io.h" | |
49 | ||
50 | + | |
51 | +%ignore geos::LineMergeDirectedEdge; | |
52 | +%ignore geos::PolygonizeEdge; | |
53 | +%ignore geos::polygonizeEdgeRing; | |
54 | +%ignore geos::PolygonizeDirectedEdge; | |
55 | +%ignore geos::PolygonizeGraph; | |
56 | + | |
57 | +%include "../../source/headers/geos/opLinemerge.h" | |
58 | +%include "../../source/headers/geos/opPolygonize.h" | |
59 | + | |
60 | +//~ template<class T> | |
61 | +//~ class vector { | |
62 | +//~ public: | |
63 | + //~ vector(); | |
64 | + //~ ~vector(); | |
65 | + //~ void push_back(const T obj); | |
66 | + //~ void reserve(size_t n); | |
67 | +//~ }; | |
68 | + | |
69 | +%template(vector_GeometryP) std::vector<geos::Geometry *>; | |
70 | +%template(vector_LineStringP) std::vector<geos::LineString *>; | |
71 | +%template(vector_PolygonP) std::vector<geos::Polygon *>; | |
72 | diff -Naur geos-2.2.1.orig/swig/Makefile.in geos-2.2.1/swig/Makefile.in | |
73 | --- geos-2.2.1.orig/swig/Makefile.in 2005-12-21 09:09:28.000000000 +0100 | |
74 | +++ geos-2.2.1/swig/Makefile.in 2005-12-21 09:15:35.000000000 +0100 | |
75 | @@ -1,8 +1,8 @@ | |
76 | -# Makefile.in generated by automake 1.9.2 from Makefile.am. | |
77 | +# Makefile.in generated by automake 1.9.6 from Makefile.am. | |
78 | # @configure_input@ | |
79 | ||
80 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | |
81 | -# 2003, 2004 Free Software Foundation, Inc. | |
82 | +# 2003, 2004, 2005 Free Software Foundation, Inc. | |
83 | # This Makefile.in is free software; the Free Software Foundation | |
84 | # gives unlimited permission to copy and/or distribute it, | |
85 | # with or without modifications, as long as this notice is preserved. | |
86 | @@ -220,7 +220,13 @@ | |
87 | # (which will cause the Makefiles to be regenerated when you run `make'); | |
88 | # (2) otherwise, pass the desired values on the `make' command line. | |
89 | $(RECURSIVE_TARGETS): | |
90 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
91 | + @failcom='exit 1'; \ | |
92 | + for f in x $$MAKEFLAGS; do \ | |
93 | + case $$f in \ | |
94 | + *=* | --[!k]*);; \ | |
95 | + *k*) failcom='fail=yes';; \ | |
96 | + esac; \ | |
97 | + done; \ | |
98 | dot_seen=no; \ | |
99 | target=`echo $@ | sed s/-recursive//`; \ | |
100 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
101 | @@ -232,7 +238,7 @@ | |
102 | local_target="$$target"; \ | |
103 | fi; \ | |
104 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
105 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
106 | + || eval $$failcom; \ | |
107 | done; \ | |
108 | if test "$$dot_seen" = "no"; then \ | |
109 | $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ | |
110 | @@ -240,7 +246,13 @@ | |
111 | ||
112 | mostlyclean-recursive clean-recursive distclean-recursive \ | |
113 | maintainer-clean-recursive: | |
114 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
115 | + @failcom='exit 1'; \ | |
116 | + for f in x $$MAKEFLAGS; do \ | |
117 | + case $$f in \ | |
118 | + *=* | --[!k]*);; \ | |
119 | + *k*) failcom='fail=yes';; \ | |
120 | + esac; \ | |
121 | + done; \ | |
122 | dot_seen=no; \ | |
123 | case "$@" in \ | |
124 | distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ | |
125 | @@ -261,7 +273,7 @@ | |
126 | local_target="$$target"; \ | |
127 | fi; \ | |
128 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
129 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
130 | + || eval $$failcom; \ | |
131 | done && test -z "$$fail" | |
132 | tags-recursive: | |
133 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
134 | diff -Naur geos-2.2.1.orig/swig/python/example.py geos-2.2.1/swig/python/example.py | |
135 | --- geos-2.2.1.orig/swig/python/example.py 1970-01-01 01:00:00.000000000 +0100 | |
136 | +++ geos-2.2.1/swig/python/example.py 2005-12-21 09:15:35.000000000 +0100 | |
137 | @@ -0,0 +1,532 @@ | |
138 | +import os | |
139 | +import sys | |
140 | +import distutils.util | |
141 | +import math | |
142 | + | |
143 | +# Put local build directory on head of python path | |
144 | +platformdir = '-'.join((distutils.util.get_platform(), | |
145 | + '.'.join(map(str, sys.version_info[0:2])))) | |
146 | +sys.path.insert(0, os.path.join('build', 'lib.' + platformdir)) | |
147 | + | |
148 | +# import geos from the local build directory | |
149 | +import geos | |
150 | + | |
151 | +pm = geos.PrecisionModel(2.0,0,0) | |
152 | +global_factory = geos.GeometryFactory(pm,-1) | |
153 | + | |
154 | +def wkt_print_geoms(geoms): | |
155 | + wkt = geos.WKTWriter() | |
156 | + size = len(geoms) | |
157 | + for i in range(size): | |
158 | + tmp = wkt.write(geoms[i]) | |
159 | + print "[%d]" % i, tmp | |
160 | + | |
161 | +def create_point(x,y): | |
162 | + c = geos.Coordinate(x,y) | |
163 | + p = global_factory.createPoint(c) | |
164 | + | |
165 | + return p | |
166 | + | |
167 | +def create_ushaped_linestring(xoffset, yoffset, side): | |
168 | + cl = geos.DefaultCoordinateSequence() | |
169 | + | |
170 | + cl.add(geos.Coordinate(xoffset, yoffset)) | |
171 | + cl.add(geos.Coordinate(xoffset, yoffset+side)) | |
172 | + cl.add(geos.Coordinate(xoffset+side, yoffset+side)) | |
173 | + cl.add(geos.Coordinate(xoffset+side, yoffset)) | |
174 | + | |
175 | + ls = global_factory.createLineString(cl) | |
176 | + return ls | |
177 | + | |
178 | +def create_square_linearring(xoffset,yoffset,side): | |
179 | + cl = geos.DefaultCoordinateSequence() | |
180 | + | |
181 | + cl.add(geos.Coordinate(xoffset,yoffset)) | |
182 | + cl.add(geos.Coordinate(xoffset,yoffset+side)) | |
183 | + cl.add(geos.Coordinate(xoffset+side,yoffset+side)) | |
184 | + cl.add(geos.Coordinate(xoffset+side,yoffset)) | |
185 | + cl.add(geos.Coordinate(xoffset,yoffset)) | |
186 | + | |
187 | + lr = global_factory.createLinearRing(cl) | |
188 | + return lr | |
189 | + | |
190 | +def create_square_polygon(xoffset,yoffset,side): | |
191 | + outer = create_square_linearring(xoffset,yoffset,side) | |
192 | + inner = create_square_linearring(xoffset+(side/3.),yoffset+(side/3.),(side/3.)) | |
193 | + | |
194 | + holes = geos.vector_GeometryP() | |
195 | + holes.push_back(inner) | |
196 | + | |
197 | + poly = global_factory.createPolygonPP(outer,holes) | |
198 | + assert outer.thisown == 0 | |
199 | + assert holes.thisown == 0 | |
200 | + inner.thisown = 0 | |
201 | + return poly | |
202 | + | |
203 | +def create_simple_collection(geoms): | |
204 | + collect = geos.vector_GeometryP() | |
205 | + for i in geoms: | |
206 | + collect.push_back(i) | |
207 | + return global_factory.createGeometryCollection(collect) | |
208 | + | |
209 | +def create_circle(centerX,centerY,radius): | |
210 | + shapefactory = geos.GeometricShapeFactory(global_factory) | |
211 | + shapefactory.setCentre(geos.Coordinate(centerX, centerY)) | |
212 | + shapefactory.setSize(radius) | |
213 | + return shapefactory.createCircle() | |
214 | + | |
215 | +def create_ellipse(centerX,centerY,width,height): | |
216 | + shapefactory = geos.GeometricShapeFactory(global_factory) | |
217 | + shapefactory.setCentre(geos.Coordinate(centerX, centerY)) | |
218 | + shapefactory.setHeight(height) | |
219 | + shapefactory.setWidth(width) | |
220 | + return shapefactory.createCircle() | |
221 | + | |
222 | +def create_rectangle(llX,llY,width,height): | |
223 | + shapefactory = geos.GeometricShapeFactory(global_factory) | |
224 | + shapefactory.setBase(geos.Coordinate(llX, llY)) | |
225 | + shapefactory.setHeight(height) | |
226 | + shapefactory.setWidth(width) | |
227 | + shapefactory.setNumPoints(4) | |
228 | + return shapefactory.createRectangle() | |
229 | + | |
230 | +def create_arc(llX,llY,width,height,startang,endang): | |
231 | + shapefactory = geos.GeometricShapeFactory(global_factory) | |
232 | + shapefactory.setBase(geos.Coordinate(llX, llY)) | |
233 | + shapefactory.setHeight(height) | |
234 | + shapefactory.setWidth(width) | |
235 | + #shapefactory.setNumPoints(100) #the default (100 pts) | |
236 | + return shapefactory.createArc(startang, endang) | |
237 | + | |
238 | +def do_all(): | |
239 | + geoms = [] | |
240 | + | |
241 | + geoms.append(create_point(150, 350)) | |
242 | + geoms.append(create_ushaped_linestring(60,60,100)) | |
243 | + geoms.append(create_square_linearring(0,0,100)) | |
244 | + geoms.append(create_square_polygon(0,200,300)) | |
245 | + geoms.append(create_square_polygon(0,250,300)) | |
246 | + geoms.append(create_simple_collection(geoms)) | |
247 | + | |
248 | + # These ones use a GeometricShapeFactory | |
249 | + geoms.append(create_circle(0, 0, 10)) | |
250 | + geoms.append(create_ellipse(0, 0, 8, 12)) | |
251 | + geoms.append(create_rectangle(-5, -5, 10, 10)) # a square | |
252 | + geoms.append(create_rectangle(-5, -5, 10, 20)) # a rectangle | |
253 | + | |
254 | + # The upper-right quarter of a vertical ellipse | |
255 | + geoms.append(create_arc(0, 0, 10, 20, 0, math.pi/2)) | |
256 | + | |
257 | + print "--------HERE ARE THE BASE GEOMS ----------" | |
258 | + wkt_print_geoms(geoms) | |
259 | + | |
260 | + | |
261 | +#################### | |
262 | +# UNARY OPERATIONS # | |
263 | +#################### | |
264 | + | |
265 | + ################ | |
266 | + #CENTROID # | |
267 | + ################ | |
268 | + # Find centroid of each base geometry | |
269 | + newgeoms = [] | |
270 | + for i in range(len(geoms)): | |
271 | + newgeoms.append(geoms[i].getCentroid()) | |
272 | + | |
273 | + print "\n","------- AND HERE ARE THEIR CENTROIDS -----" | |
274 | + wkt_print_geoms(newgeoms) | |
275 | + | |
276 | + ################ | |
277 | + # BUFFER # | |
278 | + ################ | |
279 | + newgeoms = [] | |
280 | + for i in range(len(geoms)): | |
281 | + try: | |
282 | + newgeoms.append(geoms[i].buffer(10)) | |
283 | + except geos.GEOSException(): | |
284 | + exc = geos.GEOSException() | |
285 | + print "GEOS Exception: geometry ",geoms[i],"->buffer(10): ",exc.toString() | |
286 | + | |
287 | + print "\n","--------HERE COMES THE BUFFERED GEOMS ----------" | |
288 | + wkt_print_geoms(newgeoms) | |
289 | + | |
290 | + ################ | |
291 | + # CONVEX HULL # | |
292 | + ################ | |
293 | + newgeoms = [] | |
294 | + for i in range(len(geoms)): | |
295 | + newgeoms.append(geoms[i].convexHull()) | |
296 | + | |
297 | + print "\n","--------HERE COMES THE HULLS----------" | |
298 | + wkt_print_geoms(newgeoms) | |
299 | + | |
300 | +#################### | |
301 | +# RELATIONAL OPERATORS # | |
302 | +#################### | |
303 | + | |
304 | + print "-------------------------------------------------------------------------------" | |
305 | + print "RELATIONAL OPERATORS" | |
306 | + print "-------------------------------------------------------------------------------" | |
307 | + | |
308 | + size = len(geoms) | |
309 | + ################ | |
310 | + # DISJOINT # | |
311 | + ################ | |
312 | + | |
313 | ||
314 | + print "\t".join([" DISJOINT "]+["[%d]" % i for i in range(size)]) | |
315 | + | |
316 | + for i in range(size): | |
317 | + print " [%d]\t" % i, | |
318 | + for j in range(size): | |
319 | + try: | |
320 | + if geoms[i].disjoint(geoms[j]): | |
321 | + print " 1\t", | |
322 | + else: | |
323 | + print " 0\t", | |
324 | + except geos.GEOSException(): | |
325 | + exc = geos.GEOSException() | |
326 | + print exc.toString() | |
327 | + except: | |
328 | + print " X\t", | |
329 | ||
330 | + | |
331 | + ################ | |
332 | + # TOUCHES # | |
333 | + ################ | |
334 | + | |
335 | ||
336 | + print "\t".join([" TOUCHES "]+["[%d]" % i for i in range(size)]) | |
337 | + | |
338 | + for i in range(size): | |
339 | + print " [%d]\t" % i, | |
340 | + for j in range(size): | |
341 | + try: | |
342 | + if geoms[i].touches(geoms[j]): | |
343 | + print " 1\t", | |
344 | + else: | |
345 | + print " 0\t", | |
346 | + except geos.GEOSException(): | |
347 | + exc = geos.GEOSException() | |
348 | + print exc.toString() | |
349 | + except: | |
350 | + print " X\t", | |
351 | ||
352 | + | |
353 | + ################ | |
354 | + # INTERSECTS # | |
355 | + ################ | |
356 | + | |
357 | ||
358 | + print "\t".join([" INTERSECTS "]+["[%d]" % i for i in range(size)]) | |
359 | + | |
360 | + for i in range(size): | |
361 | + print " [%d]\t" % i, | |
362 | + for j in range(size): | |
363 | + try: | |
364 | + if geoms[i].intersects(geoms[j]): | |
365 | + print " 1\t", | |
366 | + else: | |
367 | + print " 0\t", | |
368 | + except geos.GEOSException(): | |
369 | + exc = geos.GEOSException() | |
370 | + print exc.toString() | |
371 | + except: | |
372 | + print " X\t", | |
373 | ||
374 | + | |
375 | + ################ | |
376 | + # CROSSES # | |
377 | + ################ | |
378 | + | |
379 | ||
380 | + print "\t".join([" CROSSES "]+["[%d]" % i for i in range(size)]) | |
381 | + | |
382 | + for i in range(size): | |
383 | + print " [%d]\t" % i, | |
384 | + for j in range(size): | |
385 | + try: | |
386 | + if geoms[i].crosses(geoms[j]): | |
387 | + print " 1\t", | |
388 | + else: | |
389 | + print " 0\t", | |
390 | + except geos.GEOSException(): | |
391 | + exc = geos.GEOSException() | |
392 | + print exc.toString() | |
393 | + except: | |
394 | + print " X\t", | |
395 | ||
396 | + | |
397 | + ################ | |
398 | + # WITHIN # | |
399 | + ################ | |
400 | + | |
401 | ||
402 | + print "\t".join([" WITHIN "]+["[%d]" % i for i in range(size)]) | |
403 | + | |
404 | + for i in range(size): | |
405 | + print " [%d]\t" % i, | |
406 | + for j in range(size): | |
407 | + try: | |
408 | + if geoms[i].within(geoms[j]): | |
409 | + print " 1\t", | |
410 | + else: | |
411 | + print " 0\t", | |
412 | + except geos.GEOSException(): | |
413 | + exc = geos.GEOSException() | |
414 | + print exc.toString() | |
415 | + except: | |
416 | + print " X\t", | |
417 | ||
418 | + | |
419 | + ################ | |
420 | + # CONTAINS # | |
421 | + ################ | |
422 | + | |
423 | ||
424 | + print "\t".join([" CONTAINS "]+["[%d]" % i for i in range(size)]) | |
425 | + | |
426 | + for i in range(size): | |
427 | + print " [%d]\t" % i, | |
428 | + for j in range(size): | |
429 | + try: | |
430 | + if geoms[i].contains(geoms[j]): | |
431 | + print " 1\t", | |
432 | + else: | |
433 | + print " 0\t", | |
434 | + except geos.GEOSException(): | |
435 | + exc = geos.GEOSException() | |
436 | + print exc.toString() | |
437 | + except: | |
438 | + print " X\t", | |
439 | ||
440 | + | |
441 | + ################ | |
442 | + # OVERLAPS # | |
443 | + ################ | |
444 | + | |
445 | ||
446 | + print "\t".join([" OVERLAPS "]+["[%d]" % i for i in range(size)]) | |
447 | + | |
448 | + for i in range(size): | |
449 | + print " [%d]\t" % i, | |
450 | + for j in range(size): | |
451 | + try: | |
452 | + if geoms[i].overlaps(geoms[j]): | |
453 | + print " 1\t", | |
454 | + else: | |
455 | + print " 0\t", | |
456 | + except geos.GEOSException(): | |
457 | + exc = geos.GEOSException() | |
458 | + print exc.toString() | |
459 | + except: | |
460 | + print " X\t", | |
461 | ||
462 | + | |
463 | + ################ | |
464 | + # RELATE # | |
465 | + ################ | |
466 | + | |
467 | ||
468 | + print "\t".join([" RELATE "]+["[%d]" % i for i in range(size)]) | |
469 | + | |
470 | + for i in range(size): | |
471 | + print " [%d]\t" % i, | |
472 | + for j in range(size): | |
473 | + im = geos.IntersectionMatrix('') | |
474 | + try: | |
475 | + if geoms[i].relate(geoms[j],"212101212"): | |
476 | + print " 1\t", | |
477 | + else: | |
478 | + print " 0\t", | |
479 | + im=geoms[i].relate(geoms[j]) | |
480 | + except geos.GEOSException(): | |
481 | + exc = geos.GEOSException() | |
482 | + print exc.toString() | |
483 | + except: | |
484 | + print " X\t", | |
485 | ||
486 | + | |
487 | + ################ | |
488 | + # EQUALS # | |
489 | + ################ | |
490 | + | |
491 | ||
492 | + print "\t".join([" EQUALS "]+["[%d]" % i for i in range(size)]) | |
493 | + | |
494 | + for i in range(size): | |
495 | + print " [%d]\t" % i, | |
496 | + for j in range(size): | |
497 | + try: | |
498 | + if geoms[i].equals(geoms[j]): | |
499 | + print " 1\t", | |
500 | + else: | |
501 | + print " 0\t", | |
502 | + except geos.GEOSException(): | |
503 | + exc = geos.GEOSException() | |
504 | + print exc.toString() | |
505 | + except: | |
506 | + print " X\t", | |
507 | ||
508 | + | |
509 | + ################ | |
510 | + # EQUALS_EXACT # | |
511 | + ################ | |
512 | + | |
513 | ||
514 | + print "\t".join(["EQUALS_EXACT "]+["[%d]" % i for i in range(size)]) | |
515 | + | |
516 | + for i in range(size): | |
517 | + print " [%d]\t" % i, | |
518 | + for j in range(size): | |
519 | + try: | |
520 | + if geoms[i].equalsExact(geoms[j],0.5): | |
521 | + print " 1\t", | |
522 | + else: | |
523 | + print " 0\t", | |
524 | + except geos.GEOSException(): | |
525 | + exc = geos.GEOSException() | |
526 | + print exc.toString() | |
527 | + except: | |
528 | + print " X\t", | |
529 | ||
530 | + | |
531 | + ################ | |
532 | + # IS_WITHIN_DISTANCE # | |
533 | + ################ | |
534 | + | |
535 | ||
536 | + print "\t".join(["IS_WITHIN_DIST"]+["[%d]" % i for i in range(size)]) | |
537 | + | |
538 | + for i in range(size): | |
539 | + print " [%d]\t" % i, | |
540 | + for j in range(size): | |
541 | + try: | |
542 | + if geoms[i].isWithinDistance(geoms[j],2): | |
543 | + print " 1\t", | |
544 | + else: | |
545 | + print " 0\t", | |
546 | + except geos.GEOSException(): | |
547 | + exc = geos.GEOSException() | |
548 | + print exc.toString() | |
549 | + except: | |
550 | + print " X\t", | |
551 | ||
552 | + | |
553 | +#################### | |
554 | +# COMBINATIONS | |
555 | +#################### | |
556 | + | |
557 | ||
558 | + print "-------------------------------------------------------------------------------" | |
559 | + print "COMBINATIONS" | |
560 | + print "-------------------------------------------------------------------------------" | |
561 | + | |
562 | + ################ | |
563 | + # UNION | |
564 | + ################ | |
565 | + | |
566 | + newgeoms = [] | |
567 | + for i in range(size-1): | |
568 | + for j in range(i+1,size): | |
569 | + try: | |
570 | + newgeoms.append(geoms[i].Union(geoms[j])) | |
571 | + except geos.GEOSException(): | |
572 | + exc = geos.GEOSException() | |
573 | + print exc.toString() | |
574 | + except: | |
575 | + pass | |
576 | + | |
577 | + print "\n", "----- AND HERE ARE SOME UNION COMBINATIONS ------" | |
578 | + wkt_print_geoms(newgeoms) | |
579 | + | |
580 | + ################ | |
581 | + # INTERSECTION | |
582 | + ################ | |
583 | + | |
584 | + newgeoms = [] | |
585 | + for i in range(size-1): | |
586 | + for j in range(i+1,size): | |
587 | + try: | |
588 | + newgeoms.append(geoms[i].intersection(geoms[j])) | |
589 | + except geos.GEOSException(): | |
590 | + exc = geos.GEOSException() | |
591 | + print exc.toString() | |
592 | + except: | |
593 | + pass | |
594 | + | |
595 | + print "\n", "----- HERE ARE SOME INTERSECTIONS COMBINATIONS ------" | |
596 | + wkt_print_geoms(newgeoms) | |
597 | + | |
598 | + ################ | |
599 | + # DIFFERENCE | |
600 | + ################ | |
601 | + | |
602 | + newgeoms = [] | |
603 | + for i in range(size-1): | |
604 | + for j in range(i+1,size): | |
605 | + try: | |
606 | + newgeoms.append(geoms[i].difference(geoms[j])) | |
607 | + except geos.GEOSException(): | |
608 | + exc = geos.GEOSException() | |
609 | + print exc.toString() | |
610 | + except: | |
611 | + pass | |
612 | + | |
613 | + print "\n", "----- HERE ARE SOME DIFFERENCE COMBINATIONS ------" | |
614 | + wkt_print_geoms(newgeoms) | |
615 | + | |
616 | + ################ | |
617 | + # SYMMETRIC DIFFERENCE | |
618 | + ################ | |
619 | + | |
620 | + newgeoms = [] | |
621 | + for i in range(size-1): | |
622 | + for j in range(i+1,size): | |
623 | + try: | |
624 | + newgeoms.append(geoms[i].symDifference(geoms[j])) | |
625 | + except geos.GEOSException(): | |
626 | + exc = geos.GEOSException() | |
627 | + print exc.toString() | |
628 | + except: | |
629 | + pass | |
630 | + | |
631 | + print "\n", "----- HERE ARE SYMMETRIC DIFFERENCES ------" | |
632 | + wkt_print_geoms(newgeoms) | |
633 | + | |
634 | + ################ | |
635 | + # LINEMERGE | |
636 | + ################ | |
637 | + temp = geos.vector_GeometryP() | |
638 | + for g in geoms: | |
639 | + temp.push_back(g) | |
640 | + lm = geos.LineMerger() | |
641 | + lm.add(temp) | |
642 | + mls = lm.getMergedLineStrings() | |
643 | + newgeoms = [] | |
644 | + for i in range(mls.size()): | |
645 | + newgeoms.append(mls[i]) | |
646 | + del mls | |
647 | + | |
648 | + print "\n", "----- HERE IS THE LINEMERGE OUTPUT ------" | |
649 | + wkt_print_geoms(newgeoms) | |
650 | + | |
651 | + ################ | |
652 | + # POLYGONIZE | |
653 | + ################ | |
654 | + temp = geos.vector_GeometryP() | |
655 | + for g in geoms: | |
656 | + temp.push_back(g) | |
657 | + plgnzr = geos.Polygonizer() | |
658 | + plgnzr.add(temp) | |
659 | + polys = plgnzr.getPolygons() | |
660 | + newgeoms = [] | |
661 | + for i in range(polys.size()): | |
662 | + newgeoms.append(polys[i]) | |
663 | + del polys | |
664 | + | |
665 | + print "\n", "----- HERE IS POLYGONIZE OUTPUT ------" | |
666 | + wkt_print_geoms(newgeoms) | |
667 | + | |
668 | +print "GEOS", geos.geosversion(), "ported from JTS", geos.jtsport() | |
669 | +do_all() | |
670 | diff -Naur geos-2.2.1.orig/swig/python/Makefile.in geos-2.2.1/swig/python/Makefile.in | |
671 | --- geos-2.2.1.orig/swig/python/Makefile.in 2005-12-21 09:09:28.000000000 +0100 | |
672 | +++ geos-2.2.1/swig/python/Makefile.in 2005-12-21 09:15:35.000000000 +0100 | |
673 | @@ -1,8 +1,8 @@ | |
674 | -# Makefile.in generated by automake 1.9.2 from Makefile.am. | |
675 | +# Makefile.in generated by automake 1.9.6 from Makefile.am. | |
676 | # @configure_input@ | |
677 | ||
678 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | |
679 | -# 2003, 2004 Free Software Foundation, Inc. | |
680 | +# 2003, 2004, 2005 Free Software Foundation, Inc. | |
681 | # This Makefile.in is free software; the Free Software Foundation | |
682 | # gives unlimited permission to copy and/or distribute it, | |
683 | # with or without modifications, as long as this notice is preserved. | |
684 | @@ -222,7 +222,13 @@ | |
685 | # (which will cause the Makefiles to be regenerated when you run `make'); | |
686 | # (2) otherwise, pass the desired values on the `make' command line. | |
687 | $(RECURSIVE_TARGETS): | |
688 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
689 | + @failcom='exit 1'; \ | |
690 | + for f in x $$MAKEFLAGS; do \ | |
691 | + case $$f in \ | |
692 | + *=* | --[!k]*);; \ | |
693 | + *k*) failcom='fail=yes';; \ | |
694 | + esac; \ | |
695 | + done; \ | |
696 | dot_seen=no; \ | |
697 | target=`echo $@ | sed s/-recursive//`; \ | |
698 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
699 | @@ -234,7 +240,7 @@ | |
700 | local_target="$$target"; \ | |
701 | fi; \ | |
702 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
703 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
704 | + || eval $$failcom; \ | |
705 | done; \ | |
706 | if test "$$dot_seen" = "no"; then \ | |
707 | $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ | |
708 | @@ -242,7 +248,13 @@ | |
709 | ||
710 | mostlyclean-recursive clean-recursive distclean-recursive \ | |
711 | maintainer-clean-recursive: | |
712 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
713 | + @failcom='exit 1'; \ | |
714 | + for f in x $$MAKEFLAGS; do \ | |
715 | + case $$f in \ | |
716 | + *=* | --[!k]*);; \ | |
717 | + *k*) failcom='fail=yes';; \ | |
718 | + esac; \ | |
719 | + done; \ | |
720 | dot_seen=no; \ | |
721 | case "$@" in \ | |
722 | distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ | |
723 | @@ -263,7 +275,7 @@ | |
724 | local_target="$$target"; \ | |
725 | fi; \ | |
726 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
727 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
728 | + || eval $$failcom; \ | |
729 | done && test -z "$$fail" | |
730 | tags-recursive: | |
731 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
732 | diff -Naur geos-2.2.1.orig/swig/python/setup.py geos-2.2.1/swig/python/setup.py | |
733 | --- geos-2.2.1.orig/swig/python/setup.py 2005-12-21 09:09:28.000000000 +0100 | |
734 | +++ geos-2.2.1/swig/python/setup.py 2005-12-21 09:15:35.000000000 +0100 | |
735 | @@ -1,4 +1,4 @@ | |
736 | -# $Id$ | |
737 | +# $Id$ | |
738 | # | |
739 | # PyGEOS distutils setup script | |
740 | # | |
741 | @@ -20,22 +20,35 @@ | |
742 | # =========================================================================== | |
743 | ||
744 | from distutils.core import setup, Extension | |
745 | - | |
746 | -# We're skipping the metadata for now | |
747 | +import sys | |
748 | ||
749 | # the extension module, source was generated by SWIG from geos.i | |
750 | # | |
751 | # Note that until geos is ready to be installed, we're linking against | |
752 | # the pre-installed library in source/geom/.libs. | |
753 | -extmod = Extension("_geos", ["geos_wrap.cxx"], | |
754 | - include_dirs = ["../../source/headers", | |
755 | - "../../source/headers/geos"], | |
756 | - libraries = ["stdc++"], | |
757 | - extra_objects = ["../../source/geom/.libs/libgeos.a"]) | |
758 | + | |
759 | +if sys.platform=='win32': | |
760 | + extmod = Extension('_geos', ['geos_wrap.cxx'], | |
761 | + include_dirs = ['../../source/headers', | |
762 | + '../../source/headers/geos'], | |
763 | + libraries = ['geos'], | |
764 | + library_dirs=['../../source'],) | |
765 | + | |
766 | +else: | |
767 | + extmod = Extension('_geos', ['geos_wrap.cxx'], | |
768 | + include_dirs = ['../../source/headers', | |
769 | + '../../source/headers/geos'], | |
770 | + libraries = ['stdc++'], | |
771 | + extra_objects = ['../../source/geom/.libs/libgeos.a']) | |
772 | ||
773 | # the python module, generated by SWIG from geos.i | |
774 | -pymod = "geos" | |
775 | +pymod = 'geos' | |
776 | ||
777 | # The setup function | |
778 | -setup(name = "PyGEOS", ext_modules = [extmod], py_modules = [pymod]) | |
779 | +setup(name = 'PyGEOS', | |
780 | + version = '2.1.1', | |
781 | + description = 'Python SWIG interface for GEOS', | |
782 | + url='http://geos.refractions.net', | |
783 | + ext_modules = [extmod], | |
784 | + py_modules = [pymod]) | |
785 | ||
786 | diff -Naur geos-2.2.1.orig/swig/python/tests/cases/Makefile.in geos-2.2.1/swig/python/tests/cases/Makefile.in | |
787 | --- geos-2.2.1.orig/swig/python/tests/cases/Makefile.in 2005-12-21 09:09:28.000000000 +0100 | |
788 | +++ geos-2.2.1/swig/python/tests/cases/Makefile.in 2005-12-21 09:15:35.000000000 +0100 | |
789 | @@ -1,8 +1,8 @@ | |
790 | -# Makefile.in generated by automake 1.9.2 from Makefile.am. | |
791 | +# Makefile.in generated by automake 1.9.6 from Makefile.am. | |
792 | # @configure_input@ | |
793 | ||
794 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | |
795 | -# 2003, 2004 Free Software Foundation, Inc. | |
796 | +# 2003, 2004, 2005 Free Software Foundation, Inc. | |
797 | # This Makefile.in is free software; the Free Software Foundation | |
798 | # gives unlimited permission to copy and/or distribute it, | |
799 | # with or without modifications, as long as this notice is preserved. | |
800 | diff -Naur geos-2.2.1.orig/swig/python/tests/Makefile.in geos-2.2.1/swig/python/tests/Makefile.in | |
801 | --- geos-2.2.1.orig/swig/python/tests/Makefile.in 2005-12-21 09:09:28.000000000 +0100 | |
802 | +++ geos-2.2.1/swig/python/tests/Makefile.in 2005-12-21 09:15:35.000000000 +0100 | |
803 | @@ -1,8 +1,8 @@ | |
804 | -# Makefile.in generated by automake 1.9.2 from Makefile.am. | |
805 | +# Makefile.in generated by automake 1.9.6 from Makefile.am. | |
806 | # @configure_input@ | |
807 | ||
808 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | |
809 | -# 2003, 2004 Free Software Foundation, Inc. | |
810 | +# 2003, 2004, 2005 Free Software Foundation, Inc. | |
811 | # This Makefile.in is free software; the Free Software Foundation | |
812 | # gives unlimited permission to copy and/or distribute it, | |
813 | # with or without modifications, as long as this notice is preserved. | |
814 | @@ -222,7 +222,13 @@ | |
815 | # (which will cause the Makefiles to be regenerated when you run `make'); | |
816 | # (2) otherwise, pass the desired values on the `make' command line. | |
817 | $(RECURSIVE_TARGETS): | |
818 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
819 | + @failcom='exit 1'; \ | |
820 | + for f in x $$MAKEFLAGS; do \ | |
821 | + case $$f in \ | |
822 | + *=* | --[!k]*);; \ | |
823 | + *k*) failcom='fail=yes';; \ | |
824 | + esac; \ | |
825 | + done; \ | |
826 | dot_seen=no; \ | |
827 | target=`echo $@ | sed s/-recursive//`; \ | |
828 | list='$(SUBDIRS)'; for subdir in $$list; do \ | |
829 | @@ -234,7 +240,7 @@ | |
830 | local_target="$$target"; \ | |
831 | fi; \ | |
832 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
833 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
834 | + || eval $$failcom; \ | |
835 | done; \ | |
836 | if test "$$dot_seen" = "no"; then \ | |
837 | $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ | |
838 | @@ -242,7 +248,13 @@ | |
839 | ||
840 | mostlyclean-recursive clean-recursive distclean-recursive \ | |
841 | maintainer-clean-recursive: | |
842 | - @set fnord $$MAKEFLAGS; amf=$$2; \ | |
843 | + @failcom='exit 1'; \ | |
844 | + for f in x $$MAKEFLAGS; do \ | |
845 | + case $$f in \ | |
846 | + *=* | --[!k]*);; \ | |
847 | + *k*) failcom='fail=yes';; \ | |
848 | + esac; \ | |
849 | + done; \ | |
850 | dot_seen=no; \ | |
851 | case "$@" in \ | |
852 | distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ | |
853 | @@ -263,7 +275,7 @@ | |
854 | local_target="$$target"; \ | |
855 | fi; \ | |
856 | (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | |
857 | - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ | |
858 | + || eval $$failcom; \ | |
859 | done && test -z "$$fail" | |
860 | tags-recursive: | |
861 | list='$(SUBDIRS)'; for subdir in $$list; do \ |