[geos-devel] geos in Pythoon
Niki Spahiev
niki.spahiev at gmail.com
Wed Dec 15 12:51:07 EST 2004
Proposed changes to swig module. Attached is translation of
example.cpp which generates exact same output.
There are some problems with createPolygon() overloading. Uncommenting
%ignore line in geos.i:33 throws strange exception.
-------------- next part --------------
/* =========================================================================
* $Id: geos.i,v 1.3 2004/07/26 18:53:38 sgillies Exp $
*
* geos.i
*
* Copyright 2004 Sean Gillies, sgillies at frii.com
*
* Interface for a SWIG generated geos module.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
* ========================================================================= */
%module geos
%include "std_string.i"
%include "std_vector.i"
%include "exception.i"
%{
#include "../../source/headers/geos.h"
%}
// Following methods are prototypes but unimplemented and are to be ignored
%ignore geos::MultiPoint::isClosed;
// no transfer of ownership
%ignore geos::GeometryFactory::createPoint(CoordinateSequence *) const;
%ignore geos::GeometryFactory::createLineString(CoordinateSequence *) const;
%ignore geos::GeometryFactory::createLinearRing(CoordinateSequence *) const;
//~ %ignore geos::GeometryFactory::createPolygon(LinearRing *,vector<Geometry * > *) const;
%ignore geos::GeometryFactory::createGeometryCollection(vector<Geometry * > *) const;
%ignore geos::GeometryFactory::buildGeometry(vector<Geometry * > *) const;
%ignore geos::GeometryFactory::createMultiPoint(vector<Geometry * > *) const;
%ignore geos::GeometryFactory::createMultiLineString(vector<Geometry * > *) const;
%ignore geos::GeometryFactory::createMultiLinearRing(vector<Geometry * > *) const;
%ignore geos::GeometryFactory::createMultiPolygon(vector<Geometry * > *) const;
// Required renaming
%rename(Coordinate_Coordinate) Coordinate::Coordinate;
%exception {
try {
$action
}
catch (geos::GEOSException *e) {
SWIG_exception(SWIG_RuntimeError, e->toString().data());
}
}
// Now include the headers to be wrapped
%include "../../source/headers/geos/geom.h"
%include "../../source/headers/geos/util.h"
%include "../../source/headers/geos/io.h"
//~ template<class T>
//~ class vector {
//~ public:
//~ vector();
//~ ~vector();
//~ void push_back(const T obj);
//~ void reserve(size_t n);
//~ };
%template(vector_GeometryP) vector<geos::Geometry *>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.py
Type: application/x-python
Size: 14499 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20041215/995961f5/example.bin
More information about the geos-devel
mailing list