[geos-devel] geos in Pythoon
strk at refractions.net
strk at refractions.net
Thu Dec 16 03:59:22 EST 2004
On Wed, Dec 15, 2004 at 07:51:07PM +0200, Niki Spahiev wrote:
> 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.
I have more then a single one (with current geos CVS)
../../source/headers/geos/geom.h:613: Warning(509): Overloaded add(geos::CoordinateSequence const *,bool,bool) is shadowed by add(geos::CoordinateSequence *,bool,bool) at ../../source/headers/geos/geom.h:603.
../../source/headers/geos/geom.h:662: Warning(509): Overloaded geos::CoordinateSequence::hasRepeatedPoints(geos::CoordinateSequence const *) is shadowed by hasRepeatedPoints() const at ../../source/headers/geos/geom.h:649.
../../source/headers/geos/geom.h:675: Warning(509): Overloaded geos::CoordinateSequence::minCoordinate(geos::CoordinateSequence *) is shadowed by minCoordinate() const at ../../source/headers/geos/geom.h:652.
../../source/headers/geos/geom.h:2373: Warning(509): Overloaded createPolygon(geos::LinearRing const &,std::vector<geos::Geometry * > const &) const is shadowed by createPolygon(geos::LinearRing *,std::vector<geos::Geometry * > *) const at ../../source/headers/geos/geom.h:2370.
All warnings refer to functions in the form:
func(Object *);
func(const Object &);
It seems that swith does not distinguish by the two, while C++ have
actually 2 distinction: const/non-const and pointer/ref.
Is it safe to ignore all ?
--strk;
> /* =========================================================================
> * $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 *>;
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list