/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.31
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG 
 * interface file instead. 
 * ----------------------------------------------------------------------------- */

#define SWIGRUBY

#ifdef __cplusplus
template<class T> class SwigValueWrapper {
    T *tt;
public:
    SwigValueWrapper() : tt(0) { }
    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
    SwigValueWrapper(const T& t) : tt(new T(t)) { }
    ~SwigValueWrapper() { delete tt; } 
    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
    operator T&() const { return *tt; }
    T *operator&() { return tt; }
private:
    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC)
#   if (__SUNPRO_CC <= 0x560)
#     define SWIGTEMPLATEDISAMBIGUATOR template
#   else
#     define SWIGTEMPLATEDISAMBIGUATOR 
#   endif
# else
#   define SWIGTEMPLATEDISAMBIGUATOR 
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC)
#   if (__SUNPRO_CC <= 0x560)
#     define SWIGTEMPLATEDISAMBIGUATOR template
#   else
#     define SWIGTEMPLATEDISAMBIGUATOR 
#   endif
# else
#   define SWIGTEMPLATEDISAMBIGUATOR 
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__)) 
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__)) 
# else
#   define SWIGUNUSED 
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#  ifndef GCC_HASCLASSVISIBILITY
#    define GCC_HASCLASSVISIBILITY
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif 
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic CAPI SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "3"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the swig runtime code.
  In 99.9% of the cases, swig just needs to declare them as 'static'.
  
  But only do this if is strictly necessary, ie, if you have problems
  with your compiler or so.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/* 
   Flags/methods for returning states.
   
   The swig conversion methods, as ConvertPtr, return and integer 
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).
   
   Use the following macros/flags to set or process the returning
   states.
   
   In old swig versions, you usually write code as:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit as:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   that seems to be the same, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }
    
   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   requires also to SWIG_ConvertPtr to return new result values, as

      int SWIG_ConvertPtr(obj, ptr,...) {         
        if (<obj is ok>) {			       
          if (<need new object>) {		       
            *ptr = <ptr to new allocated object>; 
            return SWIG_NEWOBJ;		       
          } else {				       
            *ptr = <ptr to old object>;	       
            return SWIG_OLDOBJ;		       
          } 				       
        } else {				       
          return SWIG_BADOBJ;		       
        }					       
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   swig errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call
 
      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()


 */
#define SWIG_OK                    (0) 
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))


/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) { 
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) { 
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
}
#else /* no cast-rank mode */
#  define SWIG_AddCast
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif




#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store inforomation on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/* 
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (l1 - f1) - (l2 - f2);
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
  int equiv = 0;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (!equiv && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    if (*ne) ++ne;
  }
  return equiv;
}


/* think of this as a c++ template<> or a scheme macro */
#define SWIG_TypeCheck_Template(comparison, ty)         \
  if (ty) {                                             \
    swig_cast_info *iter = ty->cast;                    \
    while (iter) {                                      \
      if (comparison) {                                 \
        if (iter == ty->cast) return iter;              \
        /* Move iter to the top of the linked list */   \
        iter->prev->next = iter->next;                  \
        if (iter->next)                                 \
          iter->next->prev = iter->prev;                \
        iter->next = ty->cast;                          \
        iter->prev = 0;                                 \
        if (ty->cast) ty->cast->prev = iter;            \
        ty->cast = iter;                                \
        return iter;                                    \
      }                                                 \
      iter = iter->next;                                \
    }                                                   \
  }                                                     \
  return 0

/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
}

/* Same as previous function, except strcmp is replaced with a pointer comparison */
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
  SWIG_TypeCheck_Template(iter->type == from, into);
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
}

/* 
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/* 
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;
  
  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }    
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}
  
/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start, 
                            swig_module_info *end, 
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      register size_t l = 0;
      register size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	register size_t i = (l + r) >> 1; 
	const char *iname = iter->types[i]->name;
	if (iname) {
	  register int compare = strcmp(name, iname);
	  if (compare == 0) {	    
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).
  
  We start searching at module start, and finish searching when start == end.  
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start, 
                     swig_module_info *end, 
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      register size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }
  
  /* neither found a match */
  return 0;
}

/* 
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  register const unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    register unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/* 
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  register unsigned char *u = (unsigned char *) ptr;
  register const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    register char d = *(c++);
    register unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = ((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = ((d - ('a'-10)) << 4);
    else 
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (d - ('a'-10));
    else 
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/* 
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/*  Errors in SWIG */
#define  SWIG_UnknownError    	   -1 
#define  SWIG_IOError        	   -2 
#define  SWIG_RuntimeError   	   -3 
#define  SWIG_IndexError     	   -4 
#define  SWIG_TypeError      	   -5 
#define  SWIG_DivisionByZero 	   -6 
#define  SWIG_OverflowError  	   -7 
#define  SWIG_SyntaxError    	   -8 
#define  SWIG_ValueError     	   -9 
#define  SWIG_SystemError    	   -10
#define  SWIG_AttributeError 	   -11
#define  SWIG_MemoryError    	   -12 
#define  SWIG_NullReferenceError   -13



#include <ruby.h>

/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#ifndef NUM2LL
#define NUM2LL(x) NUM2LONG((x))
#endif
#ifndef LL2NUM
#define LL2NUM(x) INT2NUM((long) (x))
#endif
#ifndef ULL2NUM
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
#endif

/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#ifndef NUM2ULL
#ifdef HAVE_LONG_LONG
#define NUM2ULL(x) rb_num2ull((x))
#else
#define NUM2ULL(x) NUM2ULONG(x)
#endif
#endif

/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
/* Define these for older versions so we can just write code the new way */
#ifndef RSTRING_LEN
# define RSTRING_LEN(x) RSTRING(x)->len
#endif
#ifndef RSTRING_PTR
# define RSTRING_PTR(x) RSTRING(x)->ptr
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(x) RARRAY(x)->len
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(x) RARRAY(x)->ptr
#endif

/*
 * Need to be very careful about how these macros are defined, especially
 * when compiling C++ code or C code with an ANSI C compiler.
 *
 * VALUEFUNC(f) is a macro used to typecast a C function that implements
 * a Ruby method so that it can be passed as an argument to API functions
 * like rb_define_method() and rb_define_singleton_method().
 *
 * VOIDFUNC(f) is a macro used to typecast a C function that implements
 * either the "mark" or "free" stuff for a Ruby Data object, so that it
 * can be passed as an argument to API functions like Data_Wrap_Struct()
 * and Data_Make_Struct().
 */
 
#ifdef __cplusplus
#  ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
#    define PROTECTFUNC(f) ((VALUE (*)()) f)
#    define VALUEFUNC(f) ((VALUE (*)()) f)
#    define VOIDFUNC(f)  ((void (*)()) f)
#  else
#    ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
#      define PROTECTFUNC(f) ((VALUE (*)()) f)
#      define VALUEFUNC(f) ((VALUE (*)()) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    else /* These definitions should work for Ruby 1.7+ */
#      define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
#      define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
#      define VOIDFUNC(f)  ((RUBY_DATA_FUNC) f)
#    endif
#  endif
#else
#  define VALUEFUNC(f) (f)
#  define VOIDFUNC(f) (f)
#endif

/* Don't use for expressions have side effect */
#ifndef RB_STRING_VALUE
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#endif
#ifndef StringValue
#define StringValue(s) RB_STRING_VALUE(s)
#endif
#ifndef StringValuePtr
#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
#endif
#ifndef StringValueLen
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
#endif
#ifndef SafeStringValue
#define SafeStringValue(v) do {\
    StringValue(v);\
    rb_check_safe_str(v);\
} while (0)
#endif

#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#endif


/* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */


/* Define some additional error types */
#define SWIG_ObjectPreviouslyDeletedError  -100


/* Define custom exceptions for errors that do not map to existing Ruby
   exceptions.  Note this only works for C++ since a global cannot be
   initialized by a funtion in C.  For C, fallback to rb_eRuntimeError.*/

SWIGINTERN VALUE 
getNullReferenceError(void) {
  static int init = 0;
  static VALUE rb_eNullReferenceError ;
  if (!init) {
    init = 1;
    rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
  }
  return rb_eNullReferenceError;
} 

SWIGINTERN VALUE 
getObjectPreviouslyDeletedError(void) {
  static int init = 0;
  static VALUE rb_eObjectPreviouslyDeleted ;
  if (!init) {
    init = 1;
    rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
  }
  return rb_eObjectPreviouslyDeleted;
} 


SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code) {
  VALUE type;
  switch (SWIG_code) {
  case SWIG_MemoryError:
    type = rb_eNoMemError;
    break;
  case SWIG_IOError:
    type = rb_eIOError;
    break;
  case SWIG_RuntimeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_IndexError:
    type = rb_eIndexError;
    break;
  case SWIG_TypeError:
    type = rb_eTypeError;
    break;
  case SWIG_DivisionByZero:
    type = rb_eZeroDivError;
    break;
  case SWIG_OverflowError:
    type = rb_eRangeError;
    break;
  case SWIG_SyntaxError:
    type = rb_eSyntaxError;
    break;
  case SWIG_ValueError:
    type = rb_eArgError;
    break;
  case SWIG_SystemError:
    type = rb_eFatal;
    break;
  case SWIG_AttributeError:
    type = rb_eRuntimeError;
    break;
  case SWIG_NullReferenceError:
    type = getNullReferenceError();
    break;
  case SWIG_ObjectPreviouslyDeletedError:
    type = getObjectPreviouslyDeletedError();
    break;
  case SWIG_UnknownError:
    type = rb_eRuntimeError;
    break;
  default:
    type = rb_eRuntimeError;
  }
  return type;
}




/* -----------------------------------------------------------------------------
 * See the LICENSE file for information on copyright, usage and redistribution
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 *
 * rubytracking.swg
 *
 * This file contains support for tracking mappings from 
 * Ruby objects to C++ objects.  This functionality is needed
 * to implement mark functions for Ruby's mark and sweep
 * garbage collector.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif


/* Global Ruby hash table to store Trackings from C/C++
   structs to Ruby Objects. */
static VALUE swig_ruby_trackings;

/* Global variable that stores a reference to the ruby
   hash table delete function. */
static ID swig_ruby_hash_delete = 0;

/* Setup a Ruby hash table to store Trackings */
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
  /* Create a ruby hash table to store Trackings from C++ 
     objects to Ruby objects.  Also make sure to tell
     the garabage collector about the hash table. */
  swig_ruby_trackings = rb_hash_new();
  rb_gc_register_address(&swig_ruby_trackings);
  
  /* Now store a reference to the hash table delete function
     so that we only have to look it up once.*/
  swig_ruby_hash_delete = rb_intern("delete");
}

/* Get a Ruby number to reference a pointer */
SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
  /* We cast the pointer to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the pointer to a Ruby number */
  unsigned long value = (unsigned long) ptr;
  return LONG2NUM(value);
}

/* Get a Ruby number to reference an object */
SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
  /* We cast the object to an unsigned long
     and then store a reference to it using
     a Ruby number object. */

  /* Convert the Object to a Ruby number */
  unsigned long value = (unsigned long) object;
  return LONG2NUM(value);
}

/* Get a Ruby object from a previously stored reference */
SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
  /* The provided Ruby number object is a reference
     to the Ruby object we want.*/

  /* First convert the Ruby number to a C number */
  unsigned long value = NUM2LONG(reference);
  return (VALUE) value;
}

/* Add a Tracking from a C/C++ struct to a Ruby object */
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
  /* In a Ruby hash table we store the pointer and
     the associated Ruby object.  The trick here is
     that we cannot store the Ruby object directly - if
     we do then it cannot be garbage collected.  So
     instead we typecast it as a unsigned long and
     convert it to a Ruby number object.*/

  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Get a reference to the Ruby object as a Ruby number */
  VALUE value = SWIG_RubyObjectToReference(object);

  /* Store the mapping to the global hash table. */
  rb_hash_aset(swig_ruby_trackings, key, value);
}

/* Get the Ruby object that owns the specified C/C++ struct */
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Now lookup the value stored in the global hash table */
  VALUE value = rb_hash_aref(swig_ruby_trackings, key);
	
  if (value == Qnil) {
    /* No object exists - return nil. */
    return Qnil;
  }
  else {
    /* Convert this value to Ruby object */
    return SWIG_RubyReferenceToObject(value);
  }
}

/* Remove a Tracking from a C/C++ struct to a Ruby object.  It
   is very important to remove objects once they are destroyed
   since the same memory address may be reused later to create
   a new object. */
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
  /* Get a reference to the pointer as a Ruby number */
  VALUE key = SWIG_RubyPtrToReference(ptr);

  /* Delete the object from the hash table by calling Ruby's
     do this we need to call the Hash.delete method.*/
  rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
}

/* This is a helper method that unlinks a Ruby object from its
   underlying C++ object.  This is needed if the lifetime of the
   Ruby object is longer than the C++ object */
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
  VALUE object = SWIG_RubyInstanceFor(ptr);

  if (object != Qnil) {
    DATA_PTR(object) = 0;
  }
}


#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * Ruby API portion that goes into the runtime
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#endif

SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
  if (NIL_P(target)) {
    target = o;
  } else {
    if (TYPE(target) != T_ARRAY) {
      VALUE o2 = target;
      target = rb_ary_new();
      rb_ary_push(target, o2);
    }
    rb_ary_push(target, o);
  }
  return target;
}

#ifdef __cplusplus
}
#endif


/* -----------------------------------------------------------------------------
 * See the LICENSE file for information on copyright, usage and redistribution
 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
 *
 * rubyrun.swg
 *
 * This file contains the runtime support for Ruby modules
 * and includes code for managing global variables and pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION  0

/* for raw pointers */
#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Ruby_NewPointerObj(ptr, type, flags)
#define SWIG_AcquirePtr(ptr, own)                       SWIG_Ruby_AcquirePtr(ptr, own)
#define swig_owntype                                    ruby_owntype

/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)

/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)

/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Ruby_NewPackedObj(ptr, sz, type)


/* Runtime API */

#define SWIG_GetModule(clientdata)                      SWIG_Ruby_GetModule()	
#define SWIG_SetModule(clientdata, pointer) 		SWIG_Ruby_SetModule(pointer)


/* Error manipulation */

#define SWIG_ErrorType(code)                            SWIG_Ruby_ErrorType(code)               
#define SWIG_Error(code, msg)            		rb_raise(SWIG_Ruby_ErrorType(code), msg)
#define SWIG_fail                        		goto fail				 


/* Ruby-specific SWIG API */

#define SWIG_InitRuntime()                              SWIG_Ruby_InitRuntime()              
#define SWIG_define_class(ty)                        	SWIG_Ruby_define_class(ty)
#define SWIG_NewClassInstance(value, ty)             	SWIG_Ruby_NewClassInstance(value, ty)
#define SWIG_MangleStr(value)                        	SWIG_Ruby_MangleStr(value)		  
#define SWIG_CheckConvert(value, ty)                 	SWIG_Ruby_CheckConvert(value, ty)	  


/* -----------------------------------------------------------------------------
 * pointers/data manipulation
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* cc-mode */
#endif
#endif

typedef struct {
  VALUE klass;
  VALUE mImpl;
  void  (*mark)(void *);
  void  (*destroy)(void *);
  int trackObjects;
} swig_class;


static VALUE _mSWIG = Qnil;
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;

SWIGRUNTIME VALUE 
getExceptionClass(void) {
  static int init = 0;
  static VALUE rubyExceptionClass ;
  if (!init) {
    init = 1;
    rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
  }
  return rubyExceptionClass;
} 

/* This code checks to see if the Ruby object being raised as part
   of an exception inherits from the Ruby class Exception.  If so,
   the object is simply returned.  If not, then a new Ruby exception
   object is created and that will be returned to Ruby.*/
SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
  VALUE exceptionClass = getExceptionClass();
  if (rb_obj_is_kind_of(obj, exceptionClass)) {
    return obj;
  }  else {
    return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
  }
}

/* Initialize Ruby runtime support */
SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)
{
  if (_mSWIG == Qnil) {
    _mSWIG = rb_define_module("SWIG");
  }
}

/* Define Ruby class for C type */
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
  VALUE klass;
  char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
  sprintf(klass_name, "TYPE%s", type->name);
  if (NIL_P(_cSWIG_Pointer)) {
    _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
    rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
  }
  klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
  free((void *) klass_name);
}

/* Create a new pointer object */
SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
{
  int own =  flags & SWIG_POINTER_OWN; 
  
  char *klass_name;
  swig_class *sklass;
  VALUE klass;
  VALUE obj;
  
  if (!ptr)
    return Qnil;
  
  if (type->clientdata) {
    sklass = (swig_class *) type->clientdata;
		
    /* Are we tracking this class and have we already returned this Ruby object? */
    if (sklass->trackObjects) {
      obj = SWIG_RubyInstanceFor(ptr);
      
      /* Check the object's type and make sure it has the correct type.
        It might not in cases where methods do things like 
        downcast methods. */
      if (obj != Qnil) {
        VALUE value = rb_iv_get(obj, "__swigtype__");
        char* type_name = RSTRING_PTR(value);
				
        if (strcmp(type->name, type_name) == 0) {
          return obj;
        }
      }
    }

    /* Create a new Ruby object */
    obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);

    /* If tracking is on for this class then track this object. */
    if (sklass->trackObjects) {
      SWIG_RubyAddTracking(ptr, obj);
    }
  } else {
    klass_name = (char *) malloc(4 + strlen(type->name) + 1);
    sprintf(klass_name, "TYPE%s", type->name);
    klass = rb_const_get(_mSWIG, rb_intern(klass_name));
    free((void *) klass_name);
    obj = Data_Wrap_Struct(klass, 0, 0, ptr);
  }
  rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
  
  return obj;
}

/* Create a new class instance (always owned) */
SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
{
  VALUE obj;
  swig_class *sklass = (swig_class *) type->clientdata;
  obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
  rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
  return obj;
}

/* Get type mangle from class name */
SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
  VALUE stype = rb_iv_get(obj, "__swigtype__");
  return StringValuePtr(stype);
}

/* Acquire a pointer value */
typedef void (*ruby_owntype)(void*);

SWIGRUNTIME ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
  if (obj) {
    ruby_owntype oldown = RDATA(obj)->dfree;
    RDATA(obj)->dfree = own;
    return oldown;
  } else {
    return 0;
  }
}

/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
{
  char *c;
  swig_cast_info *tc;
  void *vptr = 0;

  /* Grab the pointer */
  if (NIL_P(obj)) {
    *ptr = 0;
    return SWIG_OK;
  } else {
    if (TYPE(obj) != T_DATA) {
      return SWIG_ERROR;
    }
    Data_Get_Struct(obj, void, vptr);
  }
  
  if (own) *own = RDATA(obj)->dfree;
    
  /* Check to see if the input object is giving up ownership
     of the underlying C struct or C++ object.  If so then we
     need to reset the destructor since the Ruby object no 
     longer owns the underlying C++ object.*/ 
  if (flags & SWIG_POINTER_DISOWN) {
    /* Is tracking on for this class? */
    int track = 0;
    if (ty && ty->clientdata) {
      swig_class *sklass = (swig_class *) ty->clientdata;
      track = sklass->trackObjects;
    }
		
    if (track) {
      /* We are tracking objects for this class.  Thus we change the destructor
       * to SWIG_RubyRemoveTracking.  This allows us to
       * remove the mapping from the C++ to Ruby object
       * when the Ruby object is garbage collected.  If we don't
       * do this, then it is possible we will return a reference 
       * to a Ruby object that no longer exists thereby crashing Ruby. */
      RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
    } else {    
      RDATA(obj)->dfree = 0;
    }
  }

  /* Do type-checking if type info was provided */
  if (ty) {
    if (ty->clientdata) {
      if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
        if (vptr == 0) {
          /* The object has already been deleted */
          return SWIG_ObjectPreviouslyDeletedError;
        }
        *ptr = vptr;
        return SWIG_OK;
      }
    }
    if ((c = SWIG_MangleStr(obj)) == NULL) {
      return SWIG_ERROR;
    }
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) {
      return SWIG_ERROR;
    }
    *ptr = SWIG_TypeCast(tc, vptr);
  } else {
    *ptr = vptr;
  }
  
  return SWIG_OK;
}

/* Check convert */
SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
{
  char *c = SWIG_MangleStr(obj);
  if (!c) return 0;
  return SWIG_TypeCheck(c,ty) != 0;
}

SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
  char result[1024];
  char *r = result;
  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r, ptr, sz);
  strcpy(r, type->name);
  return rb_str_new2(result);
}

/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
  swig_cast_info *tc;
  const char  *c;

  if (TYPE(obj) != T_STRING) goto type_error;
  c = StringValuePtr(obj);
  /* Pointer values must start with leading underscore */
  if (*c != '_') goto type_error;
  c++;
  c = SWIG_UnpackData(c, ptr, sz);
  if (ty) {
    tc = SWIG_TypeCheck(c, ty);
    if (!tc) goto type_error;
  }
  return SWIG_OK;

 type_error:
  return SWIG_ERROR;
}

SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void)
{
  VALUE pointer;
  swig_module_info *ret = 0;
  VALUE verbose = rb_gv_get("VERBOSE");

 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
  rb_gv_set("VERBOSE", Qfalse);
  
  /* first check if pointer already created */
  pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
  if (pointer != Qnil) {
    Data_Get_Struct(pointer, swig_module_info, ret);
  }

  /* reinstate warnings */
  rb_gv_set("VERBOSE", verbose);
  return ret;
}

SWIGRUNTIME void 
SWIG_Ruby_SetModule(swig_module_info *pointer)
{
  /* register a new class */
  VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
  /* create and store the structure pointer to a global variable */
  swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
  rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
}

#ifdef __cplusplus
#if 0
{ /* cc-mode */
#endif
}
#endif



#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 

#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 



  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0) 


/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p_GeosCoordinateSequence swig_types[0]
#define SWIGTYPE_p_GeosGeometry swig_types[1]
#define SWIGTYPE_p_GeosGeometryCollection swig_types[2]
#define SWIGTYPE_p_GeosLineString swig_types[3]
#define SWIGTYPE_p_GeosLinearRing swig_types[4]
#define SWIGTYPE_p_GeosMultiLineString swig_types[5]
#define SWIGTYPE_p_GeosMultiLinearRing swig_types[6]
#define SWIGTYPE_p_GeosMultiPoint swig_types[7]
#define SWIGTYPE_p_GeosMultiPolygon swig_types[8]
#define SWIGTYPE_p_GeosPoint swig_types[9]
#define SWIGTYPE_p_GeosPolygon swig_types[10]
#define SWIGTYPE_p_GeosWkbReader swig_types[11]
#define SWIGTYPE_p_GeosWkbWriter swig_types[12]
#define SWIGTYPE_p_GeosWktReader swig_types[13]
#define SWIGTYPE_p_GeosWktWriter swig_types[14]
#define SWIGTYPE_p_char swig_types[15]
#define SWIGTYPE_p_p_GeosLinearRing swig_types[16]
#define SWIGTYPE_p_size_t swig_types[17]
#define SWIGTYPE_p_unsigned_char swig_types[18]
static swig_type_info *swig_types[20];
static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */

#define SWIG_init    Init_geos
#define SWIG_name    "Geos"

static VALUE mGeos;

#define SWIGVERSION 0x010331 
#define SWIG_VERSION SWIGVERSION


#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 


#include <stdexcept>


#include <string>


#include <stdexcept>


#include <string>

#define SWIG_FLOAT_P(x) ((TYPE(x) == T_FLOAT) || FIXNUM_P(x))

bool SWIG_BOOL_P(VALUE) {
    // dummy test, RTEST should take care of everything
    return true;
}
bool SWIG_RB2BOOL(VALUE x) {
    return RTEST(x);
}
VALUE SWIG_BOOL2RB(bool b) {
    return b ? Qtrue : Qfalse;
}
double SWIG_NUM2DBL(VALUE x) {
    return (FIXNUM_P(x) ? FIX2INT(x) : NUM2DBL(x));
}
bool SWIG_STRING_P(VALUE x) {
    return TYPE(x) == T_STRING;
}
std::string SWIG_RB2STR(VALUE x) {
    return std::string(RSTRING_PTR(x), RSTRING_LEN(x));
}
VALUE SWIG_STR2RB(const std::string& s) {
    return rb_str_new(s.data(), s.size());
}


#include <vector>
#include <algorithm>
#include <stdexcept>

 
#include "geos_c.h"
/* Needed for va_start, etc. */
#include <stdarg.h>


#include <limits.h>
#ifndef LLONG_MIN
# define LLONG_MIN	LONG_LONG_MIN
#endif
#ifndef LLONG_MAX
# define LLONG_MAX	LONG_LONG_MAX
#endif
#ifndef ULLONG_MAX
# define ULLONG_MAX	ULONG_LONG_MAX
#endif


  #define SWIG_From_long   LONG2NUM 


SWIGINTERNINLINE VALUE
SWIG_From_int  (int value)
{    
  return SWIG_From_long  (value);
}


SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
  static int init = 0;
  static swig_type_info* info = 0;
  if (!init) {
    info = SWIG_TypeQuery("_p_char");
    init = 1;
  }
  return info;
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
  if (carray) {
    if (size > LONG_MAX) {
      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
      return pchar_descriptor ? 
	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
    } else {
      return rb_str_new(carray, static_cast< long >(size));
    }
  } else {
    return Qnil;
  }
}


SWIGINTERNINLINE VALUE 
SWIG_FromCharPtr(const char *cptr)
{ 
  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}


    static const int DEFAULT_QUADRANT_SEGMENTS=8;



/* This is not thread safe ! */
static const int MESSAGE_SIZE = 1000;
static char message[MESSAGE_SIZE];

void noticeHandler(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    vsnprintf(message, sizeof(message) - 1, fmt, args);
    va_end(args);
}

void errorHandler(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    vsnprintf(message, sizeof(message) - 1, fmt, args);
    va_end(args);
}


typedef void GeosCoordinateSequence;

void checkCoordSeqBounds(const GEOSCoordSeq coordSeq, const size_t index)
{
    unsigned int size = 0;
    GEOSCoordSeq_getSize(coordSeq, &size);

    if (index < 0 || index >= size)
        throw std::runtime_error("Index out of bounds");
}


SWIGINTERN VALUE
SWIG_ruby_failed(void)
{
  return Qnil;
} 


/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  unsigned long *res = (unsigned long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) 
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    unsigned long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERNINLINE int
SWIG_AsVal_size_t (VALUE obj, size_t *val)
{
  unsigned long v;
  int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
  return res;
}

SWIGINTERN GeosCoordinateSequence *new_GeosCoordinateSequence(size_t size,size_t dims){
        return (GeosCoordinateSequence*) GEOSCoordSeq_create(size, dims);
    }
SWIGINTERN GeosCoordinateSequence *GeosCoordinateSequence_clone(GeosCoordinateSequence *self){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        return (GeosCoordinateSequence*) GEOSCoordSeq_clone(coords);
    }

/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  double *res = (double *)(args[1]);
  *res = (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj)));
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_double (VALUE obj, double *val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
    double v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}

SWIGINTERN int GeosCoordinateSequence_setX(GeosCoordinateSequence *self,size_t idx,double val){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        return GEOSCoordSeq_setX(coords, idx, val);
    }
SWIGINTERN int GeosCoordinateSequence_setY(GeosCoordinateSequence *self,size_t idx,double val){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        return GEOSCoordSeq_setY(coords, idx, val);
    }
SWIGINTERN int GeosCoordinateSequence_setZ(GeosCoordinateSequence *self,size_t idx,double val){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        return GEOSCoordSeq_setZ(coords, idx, val);
    }
SWIGINTERN int GeosCoordinateSequence_setOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim,double val){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        return GEOSCoordSeq_setOrdinate(coords, idx, dim, val);
    }
SWIGINTERN double GeosCoordinateSequence_getX(GeosCoordinateSequence *self,size_t idx){
        double result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        GEOSCoordSeq_getX(coords, idx, &result);
        return result;
    }

  #define SWIG_From_double   rb_float_new 

SWIGINTERN double GeosCoordinateSequence_getY(GeosCoordinateSequence *self,size_t idx){
        double result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        GEOSCoordSeq_getY(coords, idx, &result);
        return result;
    }
SWIGINTERN double GeosCoordinateSequence_getZ(GeosCoordinateSequence *self,size_t idx){
        double result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        GEOSCoordSeq_getZ(coords, idx, &result);
        return result;
    }
SWIGINTERN double GeosCoordinateSequence_getOrdinate(GeosCoordinateSequence *self,size_t idx,size_t dim){
        double result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        checkCoordSeqBounds(coords, idx);
        GEOSCoordSeq_getOrdinate(coords, idx, dim, &result);
        return result;
    }
SWIGINTERN unsigned int GeosCoordinateSequence_getSize(GeosCoordinateSequence *self){
        unsigned int result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        GEOSCoordSeq_getSize(coords, &result);
        return result;
    }

SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long  (unsigned long value)
{
  return ULONG2NUM(value); 
}


SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_int  (unsigned int value)
{    
  return SWIG_From_unsigned_SS_long  (value);
}

SWIGINTERN unsigned int GeosCoordinateSequence_getDimensions(GeosCoordinateSequence *self){
        unsigned int result;
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        GEOSCoordSeq_getDimensions(coords, &result);
        return result;
    }

typedef void GeosGeometry;
typedef void GeosPoint;
typedef void GeosLineString;
typedef void GeosLinearRing;
typedef void GeosPolygon;
typedef void GeosGeometryCollection;
typedef void GeosMultiPoint;
typedef void GeosMultiLineString;
typedef void GeosMultiLinearRing;
typedef void GeosMultiPolygon;

typedef void GeosWktReader;
typedef void GeosWktWriter;
typedef void GeosWkbReader;
typedef void GeosWkbWriter;


bool checkBoolResult(char result)
{
    int intResult = (int) result;

    if (intResult == 1)
        return true;
    else if (intResult == 0)
        return false;
    else
        throw std::runtime_error(message);
}

SWIGINTERN GeosGeometry *GeosGeometry_clone(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSGeom_clone(geom);
    }
SWIGINTERN char *GeosGeometry_geomType(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSGeomType(geom);
    }
SWIGINTERN int GeosGeometry_typeId(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSGeomTypeId(geom);
    }
SWIGINTERN void GeosGeometry_normalize(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        int result = GEOSNormalize(geom);

        if (result == -1)
            throw std::runtime_error(message);
    }
SWIGINTERN int GeosGeometry_getSRID(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSGetSRID(geom);
    }

/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
  VALUE obj = args[0];
  VALUE type = TYPE(obj);
  long *res = (long *)(args[1]);
  *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
  return obj;
}
/*@SWIG@*/

SWIGINTERN int
SWIG_AsVal_long (VALUE obj, long* val)
{
  VALUE type = TYPE(obj);
  if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
    long v;
    VALUE a[2];
    a[0] = obj;
    a[1] = (VALUE)(&v);
    if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
      if (val) *val = v;
      return SWIG_OK;
    }
  }
  return SWIG_TypeError;
}


SWIGINTERN int
SWIG_AsVal_int (VALUE obj, int *val)
{
  long v;
  int res = SWIG_AsVal_long (obj, &v);
  if (SWIG_IsOK(res)) {
    if ((v < INT_MIN || v > INT_MAX)) {
      return SWIG_OverflowError;
    } else {
      if (val) *val = static_cast< int >(v);
    }
  }  
  return res;
}

SWIGINTERN void GeosGeometry_setSRID(GeosGeometry *self,int SRID){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSSetSRID(geom, SRID);
    }
SWIGINTERN size_t GeosGeometry_getDimensions(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSGeom_getDimensions(geom);
    }

SWIGINTERNINLINE VALUE
SWIG_From_size_t  (size_t value)
{    
  return SWIG_From_unsigned_SS_long  (static_cast< unsigned long >(value));
}

SWIGINTERN size_t GeosGeometry_getNumGeometries(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        size_t result = GEOSGetNumGeometries(geom);
        
        if ((int)result == -1)
            throw std::runtime_error(message);

        return result;
    }
SWIGINTERN GeosGeometry *GeosGeometry_intersection(GeosGeometry *self,GeosGeometry *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return (GeosGeometry*) GEOSIntersection(geom, otherGeom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_buffer(GeosGeometry *self,double width,int quadsegs){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSBuffer(geom, width, quadsegs);
    }
SWIGINTERN GeosGeometry *GeosGeometry_convexHull(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSConvexHull(geom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_difference(GeosGeometry *self,GeosGeometry *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return (GeosGeometry*) GEOSDifference(geom, otherGeom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_symDifference(GeosGeometry *self,GeosGeometry *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return (GeosGeometry*) GEOSSymDifference(geom, otherGeom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_boundary(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSBoundary(geom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_geomUnion(GeosGeometry *self,GeosGeometry *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return (GeosGeometry*) GEOSUnion(geom, otherGeom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_pointOnSurface(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSPointOnSurface(geom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_getCentroid(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSGetCentroid(geom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_getEnvelope(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSEnvelope(geom);
    }
SWIGINTERN char *GeosGeometry_relate(GeosGeometry *self,GeosGeometry *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return GEOSRelate(geom, otherGeom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_lineMerge(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return GEOSLineMerge(geom);
    }
SWIGINTERN GeosGeometry *GeosGeometry_simplify(GeosGeometry *self,double tolerance){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSSimplify(geom, tolerance);
    }
SWIGINTERN GeosGeometry *GeosGeometry_topologyPreserveSimplify(GeosGeometry *self,double tolerance){
        GEOSGeom geom = (GEOSGeom) self;
        return (GeosGeometry*) GEOSTopologyPreserveSimplify(geom, tolerance);
    }

SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
{
  if (TYPE(obj) == T_STRING) {
    


    char *cstr = STR2CSTR(obj);
    
    size_t size = RSTRING_LEN(obj) + 1;
    if (cptr)  {
      if (alloc) {
	if (*alloc == SWIG_NEWOBJ) {
	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
	} else {
	  *cptr = cstr;
	  *alloc = SWIG_OLDOBJ;
	}
      }
    }
    if (psize) *psize = size;
    return SWIG_OK;
  } else {
    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
    if (pchar_descriptor) {
      void* vptr = 0;
      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
	if (cptr) *cptr = (char *)vptr;
	if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
	if (alloc) *alloc = SWIG_OLDOBJ;
	return SWIG_OK;
      }
    }
  }  
  return SWIG_TypeError;
}




SWIGINTERN bool GeosGeometry_relatePattern(GeosGeometry *self,GeosGeometry const *other,char const *pat){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSRelatePattern(geom, otherGeom, pat));
    }

SWIGINTERNINLINE VALUE
SWIG_From_bool  (bool value)
{
  return value ? Qtrue : Qfalse;
}

SWIGINTERN bool GeosGeometry_disjoint(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSDisjoint(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_touches(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSTouches(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_intersects(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSIntersects(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_crosses(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSCrosses(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_within(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSWithin(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_contains(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSContains(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_overlaps(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSOverlaps(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_equals(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSEquals(geom, otherGeom));
    }
SWIGINTERN bool GeosGeometry_equalsExact(GeosGeometry *self,GeosGeometry const *other,double tolerance){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        return checkBoolResult(GEOSEqualsExact(geom, otherGeom, tolerance));
    }
SWIGINTERN bool GeosGeometry_isEmpty(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return checkBoolResult(GEOSisEmpty(geom));
    }
SWIGINTERN bool GeosGeometry_isValid(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return checkBoolResult(GEOSisValid(geom));
    }
SWIGINTERN bool GeosGeometry_isSimple(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return checkBoolResult(GEOSisSimple(geom));
    }
SWIGINTERN bool GeosGeometry_isRing(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return checkBoolResult(GEOSisRing(geom));
    }
SWIGINTERN bool GeosGeometry_hasZ(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        return checkBoolResult(GEOSHasZ(geom));
    }
SWIGINTERN double GeosGeometry_area(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        double result;

        int code = GEOSArea(geom, &result);

        if (code == 0)
            throw std::runtime_error(message);

        return result;
    }
SWIGINTERN double GeosGeometry_length(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        double result;

        int code = GEOSLength(geom, &result);

        if (code == 0)
            throw std::runtime_error(message);

        return result;
    }
SWIGINTERN double GeosGeometry_distance(GeosGeometry *self,GeosGeometry const *other){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom otherGeom = (GEOSGeom) other;
        double result;

        int code = GEOSDistance(geom, otherGeom, &result);

        if (code == 0)
            throw std::runtime_error(message);

        return result;
    }
SWIGINTERN GeosCoordinateSequence const *GeosPoint_getCoordSeq(GeosPoint *self){
        GEOSGeom geom = (GEOSGeom) self;
        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosCoordinateSequence*) result;
    }
SWIGINTERN GeosCoordinateSequence const *GeosLineString_getCoordSeq(GeosLineString *self){
        GEOSGeom geom = (GEOSGeom) self;
        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosCoordinateSequence*) result;
    }
SWIGINTERN GeosCoordinateSequence const *GeosLinearRing_getCoordSeq(GeosLinearRing *self){
        GEOSGeom geom = (GEOSGeom) self;
        const GEOSCoordSeq result = (const GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosCoordinateSequence*) result;
    }
SWIGINTERN GeosGeometry const *GeosPolygon_getExteriorRing(GeosPolygon *self){
        GEOSGeom geom = (GEOSGeom) self;
        const GEOSGeom result = (const GEOSGeom) GEOSGetExteriorRing(geom);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosGeometry*) result;
    }
SWIGINTERN size_t GeosPolygon_getNumInteriorRings(GeosPolygon *self){
        GEOSGeom geom = (GEOSGeom) self;
        size_t result = GEOSGetNumInteriorRings(geom);

        if ((int)result == -1)
            throw std::runtime_error(message);

        return result;
    }
SWIGINTERN GeosGeometry const *GeosPolygon_getInteriorRingN(GeosPolygon *self,size_t n){
        GEOSGeom geom = (GEOSGeom) self;

        size_t size = GEOSGetNumInteriorRings(geom);

        if (n < 0 || n >= size)
            throw std::runtime_error("Index out of bounds");

        const GEOSGeom result = (const GEOSGeom) GEOSGetInteriorRingN(geom, n);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosGeometry*) result;
    }
SWIGINTERN GeosGeometry const *GeosGeometryCollection_getGeometryN(GeosGeometryCollection *self,size_t n){
        GEOSGeom geom = (GEOSGeom) self;
        const GEOSGeom result = (const GEOSGeom) GEOSGetGeometryN(geom, n);

        if (result == NULL)
            throw std::runtime_error(message);

        return (const GeosGeometry*) result;
    }

GeosGeometry *createPoint(GeosCoordinateSequence *s)
{
    GEOSCoordSeq coords = (GEOSCoordSeq) s;
    GEOSGeom geom = GEOSGeom_createPoint(coords);

    if(geom == NULL)
        throw std::runtime_error(message);

    return (GeosGeometry*) geom;
}

GeosGeometry *createLineString(GeosCoordinateSequence *s)
{
    GEOSCoordSeq coords = (GEOSCoordSeq) s;
    GEOSGeom geom = GEOSGeom_createLineString(coords);

    if(geom == NULL)
        throw std::runtime_error(message);

    return (GeosGeometry*) geom;
}

GeosGeometry *createLinearRing(GeosCoordinateSequence *s)
{
    GEOSCoordSeq coords = (GEOSCoordSeq) s;
    GEOSGeom geom = GEOSGeom_createLinearRing(coords);

    if(geom == NULL)
        throw std::runtime_error(message);

    return (GeosGeometry*) geom;
}

GeosGeometry *createPolygon(GeosLinearRing *shell, GeosLinearRing **holes, size_t nholes)
{
    GEOSGeom shellGeom = (GEOSGeom) shell;
    GEOSGeom* holeGeoms = (GEOSGeom*) holes;
    GEOSGeom geom = GEOSGeom_createPolygon(shellGeom, holeGeoms, nholes);

    if(geom == NULL)
        throw std::runtime_error(message);

    return (GeosGeometry*) geom;
}


SWIGINTERN GeosWktReader *new_GeosWktReader(){
        return GEOSWKTReader_create();
    }
SWIGINTERN GeosGeometry *GeosWktReader_read(GeosWktReader *self,char const *wkt){
        if(wkt == NULL)
            throw std::runtime_error("Trying to create geometry from a NULL string");
            
        GEOSWKTReader *reader = (GEOSWKTReader*) self;
        GEOSGeometry *geom = GEOSWKTReader_read(reader, wkt);

        if(geom == NULL)
            throw std::runtime_error(message);

        return (GeosGeometry*) geom;
    }
SWIGINTERN GeosWktWriter *new_GeosWktWriter(){
        return GEOSWKTWriter_create();
    }
SWIGINTERN char *GeosWktWriter_write(GeosWktWriter *self,GeosGeometry const *g){
        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
        GEOSGeom geom = (GEOSGeom) g;
        return GEOSWKTWriter_write(writer, geom);
    }
SWIGINTERN GeosWkbReader *new_GeosWkbReader(){
        return GEOSWKBReader_create();
    }
SWIGINTERN GeosGeometry *GeosWkbReader_read(GeosWkbReader *self,unsigned char const *wkb,size_t size){
        if(wkb == NULL)
          throw std::runtime_error("Trying to create geometry from a NULL string");
         
        GEOSWKBReader *reader = (GEOSWKBReader*) self;
        GEOSGeometry *geom = GEOSWKBReader_read(reader, wkb, size);
       
        if(geom == NULL)
          throw std::runtime_error(message);

        return (GeosGeometry*) geom;
    }
SWIGINTERN GeosGeometry *GeosWkbReader_readHEX(GeosWkbReader *self,unsigned char const *wkb,size_t size){
        if(wkb == NULL)
          throw std::runtime_error("Trying to create geometry from a NULL string");
         
        GEOSWKBReader *reader = (GEOSWKBReader*) self;
        GEOSGeometry *geom = GEOSWKBReader_readHEX(reader, wkb, size);
       
        if(geom == NULL)
          throw std::runtime_error(message);

        return (GeosGeometry*) geom;
    }
SWIGINTERN GeosWkbWriter *new_GeosWkbWriter(){
        return GEOSWKBWriter_create();
    }
SWIGINTERN int GeosWkbWriter_getOutputDimension(GeosWkbWriter *self){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        return GEOSWKBWriter_getOutputDimension(writer);
    }
SWIGINTERN void GeosWkbWriter_setOutputDimension(GeosWkbWriter *self,int newDimension){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        GEOSWKBWriter_setOutputDimension(writer, newDimension);
    }
SWIGINTERN int GeosWkbWriter_getByteOrder(GeosWkbWriter *self){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        return GEOSWKBWriter_getByteOrder(writer);
    }
SWIGINTERN void GeosWkbWriter_setByteOrder(GeosWkbWriter *self,int newByteOrder){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        return GEOSWKBWriter_setByteOrder(writer, newByteOrder);
    }
SWIGINTERN bool GeosWkbWriter_getIncludeSRID(GeosWkbWriter *self){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        return GEOSWKBWriter_getIncludeSRID(writer);
    }

SWIGINTERN int
SWIG_AsVal_bool (VALUE obj, bool *val)
{
  if (obj == Qtrue) {
    if (val) *val = true;
    return SWIG_OK;
  } else if (obj == Qfalse) {
    if (val) *val = false;
    return SWIG_OK;
  } else {
    int res = 0;
    if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {    
      if (val) *val = res ? true : false;
      return SWIG_OK;
    }
  }  
  return SWIG_TypeError;
}

SWIGINTERN void GeosWkbWriter_setIncludeSRID(GeosWkbWriter *self,bool newIncludeSRID){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        return GEOSWKBWriter_setIncludeSRID(writer, newIncludeSRID);
    }
SWIGINTERN unsigned char *GeosWkbWriter_write(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        GEOSGeom geom = (GEOSGeom) g;
        return GEOSWKBWriter_write(writer, geom, size);
    }
SWIGINTERN unsigned char *GeosWkbWriter_writeHEX(GeosWkbWriter *self,GeosGeometry const *g,size_t *size){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        GEOSGeom geom = (GEOSGeom) g;
        return GEOSWKBWriter_writeHEX(writer, geom, size);
    }
SWIGINTERN VALUE
_wrap_version(int argc, VALUE *argv, VALUE self) {
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (char *)GEOSversion();
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


swig_class cCoordinateSequence;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_CoordinateSequence_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_CoordinateSequence_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosCoordinateSequence);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_CoordinateSequence(int argc, VALUE *argv, VALUE self) {
  size_t arg1 ;
  size_t arg2 ;
  GeosCoordinateSequence *result = 0 ;
  size_t val1 ;
  int ecode1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
  if (!SWIG_IsOK(ecode1)) {
    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GeosCoordinateSequence" "', argument " "1"" of type '" "size_t""'");
  } 
  arg1 = static_cast< size_t >(val1);
  ecode2 = SWIG_AsVal_size_t(argv[1], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeosCoordinateSequence" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (GeosCoordinateSequence *)new_GeosCoordinateSequence(arg1,arg2);DATA_PTR(self) = result;
      
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GeosCoordinateSequence(GeosCoordinateSequence *self){
        GEOSCoordSeq coords = (GEOSCoordSeq) self;
        return GEOSCoordSeq_destroy(coords);
    }
SWIGINTERN void
free_GeosCoordinateSequence(GeosCoordinateSequence *arg1) {
    delete_GeosCoordinateSequence(arg1);
}

SWIGINTERN VALUE
_wrap_CoordinateSequence_clone(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  GeosCoordinateSequence *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clone" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  {
    try
    {
      result = (GeosCoordinateSequence *)GeosCoordinateSequence_clone(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_OWN |  0 );
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_set_x(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double arg3 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setX" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setX" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setX" "', argument " "3"" of type '" "double""'");
  } 
  arg3 = static_cast< double >(val3);
  {
    try
    {
      result = (int)GeosCoordinateSequence_setX(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_set_y(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double arg3 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setY" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setY" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setY" "', argument " "3"" of type '" "double""'");
  } 
  arg3 = static_cast< double >(val3);
  {
    try
    {
      result = (int)GeosCoordinateSequence_setY(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_set_z(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double arg3 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setZ" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setZ" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setZ" "', argument " "3"" of type '" "double""'");
  } 
  arg3 = static_cast< double >(val3);
  {
    try
    {
      result = (int)GeosCoordinateSequence_setZ(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_set_ordinate(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  size_t arg3 ;
  double arg4 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  size_t val3 ;
  int ecode3 = 0 ;
  double val4 ;
  int ecode4 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 3) || (argc > 3)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setOrdinate" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setOrdinate" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "setOrdinate" "', argument " "3"" of type '" "size_t""'");
  } 
  arg3 = static_cast< size_t >(val3);
  ecode4 = SWIG_AsVal_double(argv[2], &val4);
  if (!SWIG_IsOK(ecode4)) {
    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "setOrdinate" "', argument " "4"" of type '" "double""'");
  } 
  arg4 = static_cast< double >(val4);
  {
    try
    {
      result = (int)GeosCoordinateSequence_setOrdinate(arg1,arg2,arg3,arg4);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_get_x(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getX" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getX" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (double)GeosCoordinateSequence_getX(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_get_y(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getY" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getY" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (double)GeosCoordinateSequence_getY(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_get_z(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getZ" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getZ" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (double)GeosCoordinateSequence_getZ(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_get_ordinate(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  size_t arg2 ;
  size_t arg3 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  size_t val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getOrdinate" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getOrdinate" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  ecode3 = SWIG_AsVal_size_t(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "getOrdinate" "', argument " "3"" of type '" "size_t""'");
  } 
  arg3 = static_cast< size_t >(val3);
  {
    try
    {
      result = (double)GeosCoordinateSequence_getOrdinate(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence___len__(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  unsigned int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSize" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  {
    try
    {
      result = (unsigned int)GeosCoordinateSequence_getSize(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_CoordinateSequence_dimensions(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  unsigned int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getDimensions" "', argument " "1"" of type '" "GeosCoordinateSequence *""'"); 
  }
  arg1 = reinterpret_cast< GeosCoordinateSequence * >(argp1);
  {
    try
    {
      result = (unsigned int)GeosCoordinateSequence_getDimensions(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class cGeometry;

SWIGINTERN void delete_GeosGeometry(GeosGeometry *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosGeometry(GeosGeometry *arg1) {
    delete_GeosGeometry(arg1);
}

SWIGINTERN VALUE
_wrap_Geometry_clone(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clone" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_clone(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_geom_type(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  char *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "geomType" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (char *)GeosGeometry_geomType(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_type_id(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "typeId" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (int)GeosGeometry_typeId(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_normalize(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "normalize" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      GeosGeometry_normalize(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_srid(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSRID" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (int)GeosGeometry_getSRID(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_sride___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setSRID" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setSRID" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    try
    {
      GeosGeometry_setSRID(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_dimensions(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  size_t result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getDimensions" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = GeosGeometry_getDimensions(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_size_t(static_cast< size_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_num_geometries(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  size_t result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNumGeometries" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = GeosGeometry_getNumGeometries(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_size_t(static_cast< size_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_intersection(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intersection" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "intersection" "', argument " "2"" of type '" "GeosGeometry *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_intersection(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_buffer(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  double arg2 ;
  int arg3 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  int val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  {
    arg3 = DEFAULT_QUADRANT_SEGMENTS;
  }
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "buffer" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "buffer" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  if (argc > 1) {
    ecode3 = SWIG_AsVal_int(argv[1], &val3);
    if (!SWIG_IsOK(ecode3)) {
      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "buffer" "', argument " "3"" of type '" "int""'");
    } 
    arg3 = static_cast< int >(val3);
  }
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_buffer(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_convex_hull(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "convexHull" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_convexHull(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_difference(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "difference" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "difference" "', argument " "2"" of type '" "GeosGeometry *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_difference(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_sym_difference(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "symDifference" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "symDifference" "', argument " "2"" of type '" "GeosGeometry *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_symDifference(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_boundary(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "boundary" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_boundary(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_union(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "geomUnion" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "geomUnion" "', argument " "2"" of type '" "GeosGeometry *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_geomUnion(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_point_on_surface(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pointOnSurface" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_pointOnSurface(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_centroid(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCentroid" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_getCentroid(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_envelope(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getEnvelope" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_getEnvelope(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_relate(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  char *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "relate" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "relate" "', argument " "2"" of type '" "GeosGeometry *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (char *)GeosGeometry_relate(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  delete[] result;
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_line_merge(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lineMerge" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_lineMerge(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_simplify(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  double arg2 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "simplify" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "simplify" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_simplify(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_topology_preserve_simplify(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  double arg2 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  double val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "topologyPreserveSimplify" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  ecode2 = SWIG_AsVal_double(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "topologyPreserveSimplify" "', argument " "2"" of type '" "double""'");
  } 
  arg2 = static_cast< double >(val2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometry_topologyPreserveSimplify(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_relate_pattern(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  char *arg3 = (char *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  int res3 ;
  char *buf3 = 0 ;
  int alloc3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "relatePattern" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "relatePattern" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
  if (!SWIG_IsOK(res3)) {
    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "relatePattern" "', argument " "3"" of type '" "char const *""'");
  }
  arg3 = reinterpret_cast< char * >(buf3);
  {
    try
    {
      result = (bool)GeosGeometry_relatePattern(arg1,(GeosGeometry const *)arg2,(char const *)arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return vresult;
fail:
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_disjointq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "disjoint" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "disjoint" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_disjoint(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_touchesq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "touches" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "touches" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_touches(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_intersectsq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "intersects" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "intersects" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_intersects(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_crossesq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "crosses" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "crosses" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_crosses(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_withinq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "within" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "within" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_within(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_containsq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "contains" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "contains" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_contains(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_overlapsq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "overlaps" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "overlaps" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_overlaps(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = (result ? Qtrue : Qfalse);
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_eqlq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "equals" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equals" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (bool)GeosGeometry_equals(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_eql_exactq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  double arg3 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  double val3 ;
  int ecode3 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 2) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "equalsExact" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "equalsExact" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
  if (!SWIG_IsOK(ecode3)) {
    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "equalsExact" "', argument " "3"" of type '" "double""'");
  } 
  arg3 = static_cast< double >(val3);
  {
    try
    {
      result = (bool)GeosGeometry_equalsExact(arg1,(GeosGeometry const *)arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_emptyq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isEmpty" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (bool)GeosGeometry_isEmpty(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_validq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (bool)GeosGeometry_isValid(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_simpleq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isSimple" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (bool)GeosGeometry_isSimple(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_ringq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isRing" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (bool)GeosGeometry_isRing(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_has_zq___(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hasZ" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (bool)GeosGeometry_hasZ(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_area(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "area" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (double)GeosGeometry_area(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_length(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "length" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  {
    try
    {
      result = (double)GeosGeometry_length(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Geometry_distance(int argc, VALUE *argv, VALUE self) {
  GeosGeometry *arg1 = (GeosGeometry *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  double result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "distance" "', argument " "1"" of type '" "GeosGeometry *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometry * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "distance" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (double)GeosGeometry_distance(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_double(static_cast< double >(result));
  return vresult;
fail:
  return Qnil;
}


swig_class cPoint;

SWIGINTERN void delete_GeosPoint(GeosPoint *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosPoint(GeosPoint *arg1) {
    delete_GeosPoint(arg1);
}

SWIGINTERN VALUE
_wrap_Point_coord_seq(int argc, VALUE *argv, VALUE self) {
  GeosPoint *arg1 = (GeosPoint *) 0 ;
  GeosCoordinateSequence *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPoint, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosPoint *""'"); 
  }
  arg1 = reinterpret_cast< GeosPoint * >(argp1);
  {
    try
    {
      result = (GeosCoordinateSequence *)GeosPoint_getCoordSeq(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


swig_class cLineString;

SWIGINTERN void delete_GeosLineString(GeosLineString *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosLineString(GeosLineString *arg1) {
    delete_GeosLineString(arg1);
}

SWIGINTERN VALUE
_wrap_LineString_coord_seq(int argc, VALUE *argv, VALUE self) {
  GeosLineString *arg1 = (GeosLineString *) 0 ;
  GeosCoordinateSequence *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLineString, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosLineString *""'"); 
  }
  arg1 = reinterpret_cast< GeosLineString * >(argp1);
  {
    try
    {
      result = (GeosCoordinateSequence *)GeosLineString_getCoordSeq(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


swig_class cLinearRing;

SWIGINTERN void delete_GeosLinearRing(GeosLinearRing *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosLinearRing(GeosLinearRing *arg1) {
    delete_GeosLinearRing(arg1);
}

SWIGINTERN VALUE
_wrap_LinearRing_coord_seq(int argc, VALUE *argv, VALUE self) {
  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
  GeosCoordinateSequence *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosLinearRing, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCoordSeq" "', argument " "1"" of type '" "GeosLinearRing *""'"); 
  }
  arg1 = reinterpret_cast< GeosLinearRing * >(argp1);
  {
    try
    {
      result = (GeosCoordinateSequence *)GeosLinearRing_getCoordSeq(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosCoordinateSequence, 0 |  0 );
  return vresult;
fail:
  return Qnil;
}


swig_class cPolygon;

SWIGINTERN void delete_GeosPolygon(GeosPolygon *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosPolygon(GeosPolygon *arg1) {
    delete_GeosPolygon(arg1);
}

SWIGINTERN VALUE
_wrap_Polygon_exterior_ring(int argc, VALUE *argv, VALUE self) {
  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getExteriorRing" "', argument " "1"" of type '" "GeosPolygon *""'"); 
  }
  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
  {
    try
    {
      result = (GeosGeometry *)GeosPolygon_getExteriorRing(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Polygon_num_interior_rings(int argc, VALUE *argv, VALUE self) {
  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
  size_t result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNumInteriorRings" "', argument " "1"" of type '" "GeosPolygon *""'"); 
  }
  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
  {
    try
    {
      result = GeosPolygon_getNumInteriorRings(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_size_t(static_cast< size_t >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_Polygon_interior_ring_n(int argc, VALUE *argv, VALUE self) {
  GeosPolygon *arg1 = (GeosPolygon *) 0 ;
  size_t arg2 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosPolygon, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getInteriorRingN" "', argument " "1"" of type '" "GeosPolygon *""'"); 
  }
  arg1 = reinterpret_cast< GeosPolygon * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getInteriorRingN" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (GeosGeometry *)GeosPolygon_getInteriorRingN(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


swig_class cGeometryCollection;

SWIGINTERN void delete_GeosGeometryCollection(GeosGeometryCollection *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosGeometryCollection(GeosGeometryCollection *arg1) {
    delete_GeosGeometryCollection(arg1);
}

SWIGINTERN VALUE
_wrap_GeometryCollection_get_geometry_n(int argc, VALUE *argv, VALUE self) {
  GeosGeometryCollection *arg1 = (GeosGeometryCollection *) 0 ;
  size_t arg2 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  size_t val2 ;
  int ecode2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosGeometryCollection, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getGeometryN" "', argument " "1"" of type '" "GeosGeometryCollection *""'"); 
  }
  arg1 = reinterpret_cast< GeosGeometryCollection * >(argp1);
  ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "getGeometryN" "', argument " "2"" of type '" "size_t""'");
  } 
  arg2 = static_cast< size_t >(val2);
  {
    try
    {
      result = (GeosGeometry *)GeosGeometryCollection_getGeometryN(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | 0);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | 0);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | 0);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | 0);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | 0);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | 0);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | 0);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | 0);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


swig_class cMultiPoint;

SWIGINTERN void delete_GeosMultiPoint(GeosMultiPoint *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosMultiPoint(GeosMultiPoint *arg1) {
    delete_GeosMultiPoint(arg1);
}

swig_class cMultiLineString;

SWIGINTERN void delete_GeosMultiLineString(GeosMultiLineString *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosMultiLineString(GeosMultiLineString *arg1) {
    delete_GeosMultiLineString(arg1);
}

swig_class cMultiLinearRing;

SWIGINTERN void delete_GeosMultiLinearRing(GeosMultiLinearRing *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosMultiLinearRing(GeosMultiLinearRing *arg1) {
    delete_GeosMultiLinearRing(arg1);
}

swig_class cMultiPolygon;

SWIGINTERN void delete_GeosMultiPolygon(GeosMultiPolygon *self){
        GEOSGeom geom = (GEOSGeom) self;
        GEOSGeom_destroy(geom);
    }
SWIGINTERN void
free_GeosMultiPolygon(GeosMultiPolygon *arg1) {
    delete_GeosMultiPolygon(arg1);
}

SWIGINTERN VALUE
_wrap_create_point(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  GeosGeometry *result = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createPoint" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
  }
  {
    try
    {
      result = (GeosGeometry *)createPoint(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_create_line_string(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  GeosGeometry *result = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createLineString" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
  }
  {
    try
    {
      result = (GeosGeometry *)createLineString(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_create_linear_ring(int argc, VALUE *argv, VALUE self) {
  GeosCoordinateSequence *arg1 = (GeosCoordinateSequence *) 0 ;
  GeosGeometry *result = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosCoordinateSequence, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createLinearRing" "', argument " "1"" of type '" "GeosCoordinateSequence *""'");
  }
  {
    try
    {
      result = (GeosGeometry *)createLinearRing(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_create_polygon(int argc, VALUE *argv, VALUE self) {
  GeosLinearRing *arg1 = (GeosLinearRing *) 0 ;
  GeosLinearRing **arg2 = (GeosLinearRing **) 0 ;
  size_t arg3 ;
  GeosGeometry *result = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  {
    arg2 = NULL;
    arg3 = 0;
  }
  if ((argc < 1) || (argc > 2)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(argv[0], SWIG_as_voidptrptr(&arg1), SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "createPolygon" "', argument " "1"" of type '" "GeosLinearRing *""'");
  }
  if (argc > 1) {
    {
      if (NIL_P(argv[1]))
      {
        arg2 = NULL;
        arg3 = 0;
      }
      else
      {
        /* Make sure the input can be treated as an array. */
        Check_Type(argv[1], T_ARRAY);
        
        /* Get the length */
        arg3 = RARRAY(argv[1])->len;
        
        /* Allocate space for the C array. */
        arg2 = (GeosLinearRing**) malloc(arg3*sizeof(GeosLinearRing*));
        
        for(size_t i = 0; i<arg3; i++)
        {
          /* Get the Ruby Object */
          VALUE item = rb_ary_entry(argv[1],i);
          
          /* Get the underlying pointer and give up ownership of it. */
          GeosLinearRing *ring = NULL;
          int convertResult = SWIG_ConvertPtr(item, (void**)&ring, SWIGTYPE_p_GeosLinearRing, SWIG_POINTER_DISOWN);
          if (!SWIG_IsOK(convertResult)) {
            SWIG_exception_fail(SWIG_ArgError(convertResult), "in method '" "createPolygon" "', argument " "1"" of type '" "GeosLinearRing *""'");
          }
          
          /* Put the pointer in the array */
          arg2[i] = ring;
        }    
      }
    }
  }
  {
    try
    {
      result = (GeosGeometry *)createPolygon(arg1,arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  {
    if (arg2) {
      free((void*) arg2);
    }
  }
  return vresult;
fail:
  {
    if (arg2) {
      free((void*) arg2);
    }
  }
  return Qnil;
}


swig_class cWktReader;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_WktReader_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_WktReader_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktReader);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_WktReader(int argc, VALUE *argv, VALUE self) {
  GeosWktReader *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try
    {
      result = (GeosWktReader *)new_GeosWktReader();DATA_PTR(self) = result;
      
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GeosWktReader(GeosWktReader *self){
        GEOSWKTReader *reader = (GEOSWKTReader*) self;
        GEOSWKTReader_destroy(reader);
    }
SWIGINTERN void
free_GeosWktReader(GeosWktReader *arg1) {
    delete_GeosWktReader(arg1);
}

SWIGINTERN VALUE
_wrap_WktReader_read(int argc, VALUE *argv, VALUE self) {
  GeosWktReader *arg1 = (GeosWktReader *) 0 ;
  char *arg2 = (char *) 0 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktReader, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read" "', argument " "1"" of type '" "GeosWktReader *""'"); 
  }
  arg1 = reinterpret_cast< GeosWktReader * >(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "read" "', argument " "2"" of type '" "char const *""'");
  }
  arg2 = reinterpret_cast< char * >(buf2);
  {
    try
    {
      result = (GeosGeometry *)GeosWktReader_read(arg1,(char const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
  return Qnil;
}


swig_class cWktWriter;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_WktWriter_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_WktWriter_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWktWriter);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_WktWriter(int argc, VALUE *argv, VALUE self) {
  GeosWktWriter *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try
    {
      result = (GeosWktWriter *)new_GeosWktWriter();DATA_PTR(self) = result;
      
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GeosWktWriter(GeosWktWriter *self){
        GEOSWKTWriter *writer = (GEOSWKTWriter*) self;
        GEOSWKTWriter_destroy(writer);
    }
SWIGINTERN void
free_GeosWktWriter(GeosWktWriter *arg1) {
    delete_GeosWktWriter(arg1);
}

SWIGINTERN VALUE
_wrap_WktWriter_write(int argc, VALUE *argv, VALUE self) {
  GeosWktWriter *arg1 = (GeosWktWriter *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  char *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWktWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write" "', argument " "1"" of type '" "GeosWktWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWktWriter * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "write" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (char *)GeosWktWriter_write(arg1,(GeosGeometry const *)arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_FromCharPtr((const char *)result);
  return vresult;
fail:
  return Qnil;
}


swig_class cWkbReader;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_WkbReader_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_WkbReader_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbReader);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_WkbReader(int argc, VALUE *argv, VALUE self) {
  GeosWkbReader *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try
    {
      result = (GeosWkbReader *)new_GeosWkbReader();DATA_PTR(self) = result;
      
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GeosWkbReader(GeosWkbReader *self){
        GEOSWKBReader *reader = (GEOSWKBReader*) self;
        GEOSWKBReader_destroy(reader);
    }
SWIGINTERN void
free_GeosWkbReader(GeosWkbReader *arg1) {
    delete_GeosWkbReader(arg1);
}

SWIGINTERN VALUE
_wrap_WkbReader_read(int argc, VALUE *argv, VALUE self) {
  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
  unsigned char *arg2 = (unsigned char *) 0 ;
  size_t arg3 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int alloc2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read" "', argument " "1"" of type '" "GeosWkbReader *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
  {
    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
    /* Don't want to include last null character! */
    arg3--;
  }
  {
    try
    {
      result = (GeosGeometry *)GeosWkbReader_read(arg1,(unsigned char const *)arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbReader_read_hex(int argc, VALUE *argv, VALUE self) {
  GeosWkbReader *arg1 = (GeosWkbReader *) 0 ;
  unsigned char *arg2 = (unsigned char *) 0 ;
  size_t arg3 ;
  GeosGeometry *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int alloc2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbReader, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "readHEX" "', argument " "1"" of type '" "GeosWkbReader *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbReader * >(argp1);
  {
    /* %typemap(in) (const unsigned char* wkb, size_t size) (int alloc2 = 0) */
    if (SWIG_AsCharPtrAndSize(argv[0], (char**)&arg2, &arg3, &alloc2) != SWIG_OK)
    SWIG_exception(SWIG_RuntimeError, "Expecting a string");
    /* Don't want to include last null character! */
    arg3--;
  }
  {
    try
    {
      result = (GeosGeometry *)GeosWkbReader_readHEX(arg1,(unsigned char const *)arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) GeosGeometry */
    
    if (result == NULL)
    SWIG_exception(SWIG_RuntimeError, message);
    
    GeosGeometry *geom = result;
    GEOSGeomTypes geomId = (GEOSGeomTypes)GEOSGeomTypeId((GEOSGeom) geom);
    
    switch (geomId)
    {
    case GEOS_POINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_LINEARRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosLinearRing, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_POLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOINT:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPoint, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTILINESTRING:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiLineString, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_MULTIPOLYGON:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosMultiPolygon, 0 | SWIG_POINTER_OWN);
      break;
    case GEOS_GEOMETRYCOLLECTION:
      vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GeosGeometryCollection, 0 | SWIG_POINTER_OWN);
      break;
    }
  }
  return vresult;
fail:
  return Qnil;
}


swig_class cWkbWriter;

#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_WkbWriter_allocate(VALUE self) {
#else
  SWIGINTERN VALUE
  _wrap_WkbWriter_allocate(int argc, VALUE *argv, VALUE self) {
#endif
    
    
    VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_GeosWkbWriter);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
    rb_obj_call_init(vresult, argc, argv);
#endif
    return vresult;
  }
  

SWIGINTERN VALUE
_wrap_new_WkbWriter(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  {
    try
    {
      result = (GeosWkbWriter *)new_GeosWkbWriter();DATA_PTR(self) = result;
      
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return self;
fail:
  return Qnil;
}


SWIGINTERN void delete_GeosWkbWriter(GeosWkbWriter *self){
        GEOSWKBWriter *writer = (GEOSWKBWriter*) self;
        GEOSWKBWriter_destroy(writer);
    }
SWIGINTERN void
free_GeosWkbWriter(GeosWkbWriter *arg1) {
    delete_GeosWkbWriter(arg1);
}

SWIGINTERN VALUE
_wrap_WkbWriter_output_dimensions(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getOutputDimension" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  {
    try
    {
      result = (int)GeosWkbWriter_getOutputDimension(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_output_dimensionse___(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setOutputDimension" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setOutputDimension" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    try
    {
      GeosWkbWriter_setOutputDimension(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_byte_order(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  int result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getByteOrder" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  {
    try
    {
      result = (int)GeosWkbWriter_getByteOrder(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_int(static_cast< int >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_byte_ordere___(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  int arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setByteOrder" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  ecode2 = SWIG_AsVal_int(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setByteOrder" "', argument " "2"" of type '" "int""'");
  } 
  arg2 = static_cast< int >(val2);
  {
    try
    {
      GeosWkbWriter_setByteOrder(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_include_srid(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  bool result;
  void *argp1 = 0 ;
  int res1 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getIncludeSRID" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  {
    try
    {
      result = (bool)GeosWkbWriter_getIncludeSRID(arg1);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  vresult = SWIG_From_bool(static_cast< bool >(result));
  return vresult;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_include_sride___(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  bool arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  bool val2 ;
  int ecode2 = 0 ;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setIncludeSRID" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  ecode2 = SWIG_AsVal_bool(argv[0], &val2);
  if (!SWIG_IsOK(ecode2)) {
    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "setIncludeSRID" "', argument " "2"" of type '" "bool""'");
  } 
  arg2 = static_cast< bool >(val2);
  {
    try
    {
      GeosWkbWriter_setIncludeSRID(arg1,arg2);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  return Qnil;
fail:
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_write(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  size_t *arg3 = (size_t *) 0 ;
  unsigned char *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  size_t temp3 = 0 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
    arg3 = &temp3;
  }
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "write" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "write" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (unsigned char *)GeosWkbWriter_write(arg1,(GeosGeometry const *)arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) unsigned char* */
  }
  {
    /* %typemap(argout) size_t *size */
    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
  }
  {
    /* %typemap(freearg) size_t *size */
    std::free(result);
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) size_t *size */
    std::free(result);
  }
  return Qnil;
}


SWIGINTERN VALUE
_wrap_WkbWriter_write_hex(int argc, VALUE *argv, VALUE self) {
  GeosWkbWriter *arg1 = (GeosWkbWriter *) 0 ;
  GeosGeometry *arg2 = (GeosGeometry *) 0 ;
  size_t *arg3 = (size_t *) 0 ;
  unsigned char *result = 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  size_t temp3 = 0 ;
  VALUE vresult = Qnil;
  
  {
    /* %typemap(in, numinputs=0) size_t *size (size_t temp3 = 0) */
    arg3 = &temp3;
  }
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_GeosWkbWriter, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "writeHEX" "', argument " "1"" of type '" "GeosWkbWriter *""'"); 
  }
  arg1 = reinterpret_cast< GeosWkbWriter * >(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_GeosGeometry, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "writeHEX" "', argument " "2"" of type '" "GeosGeometry const *""'"); 
  }
  arg2 = reinterpret_cast< GeosGeometry * >(argp2);
  {
    try
    {
      result = (unsigned char *)GeosWkbWriter_writeHEX(arg1,(GeosGeometry const *)arg2,arg3);
    }
    catch (const std::exception& e)
    {
      SWIG_exception(SWIG_RuntimeError, e.what());
    }
  }
  {
    /* %typemap(out) unsigned char* */
  }
  {
    /* %typemap(argout) size_t *size */
    vresult = SWIG_FromCharPtrAndSize((const char*)result, *arg3);
  }
  {
    /* %typemap(freearg) size_t *size */
    std::free(result);
  }
  return vresult;
fail:
  {
    /* %typemap(freearg) size_t *size */
    std::free(result);
  }
  return Qnil;
}



/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static void *_p_GeosMultiPolygonTo_p_GeosGeometryCollection(void *x) {
    return (void *)((GeosGeometryCollection *)  ((GeosMultiPolygon *) x));
}
static void *_p_GeosMultiPointTo_p_GeosGeometryCollection(void *x) {
    return (void *)((GeosGeometryCollection *)  ((GeosMultiPoint *) x));
}
static void *_p_GeosMultiLineStringTo_p_GeosGeometryCollection(void *x) {
    return (void *)((GeosGeometryCollection *)  ((GeosMultiLineString *) x));
}
static void *_p_GeosMultiLinearRingTo_p_GeosGeometryCollection(void *x) {
    return (void *)((GeosGeometryCollection *)  ((GeosMultiLinearRing *) x));
}
static void *_p_GeosPolygonTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *)  ((GeosPolygon *) x));
}
static void *_p_GeosMultiPolygonTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPolygon *) x));
}
static void *_p_GeosPointTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *)  ((GeosPoint *) x));
}
static void *_p_GeosLineStringTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *)  ((GeosLineString *) x));
}
static void *_p_GeosLinearRingTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *)  ((GeosLinearRing *) x));
}
static void *_p_GeosMultiPointTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiPoint *) x));
}
static void *_p_GeosMultiLineStringTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLineString *) x));
}
static void *_p_GeosMultiLinearRingTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *) (GeosGeometryCollection *) ((GeosMultiLinearRing *) x));
}
static void *_p_GeosGeometryCollectionTo_p_GeosGeometry(void *x) {
    return (void *)((GeosGeometry *)  ((GeosGeometryCollection *) x));
}
static swig_type_info _swigt__p_GeosCoordinateSequence = {"_p_GeosCoordinateSequence", "GeosCoordinateSequence *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosGeometry = {"_p_GeosGeometry", "GeosGeometry *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosGeometryCollection = {"_p_GeosGeometryCollection", "GeosGeometryCollection *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosLineString = {"_p_GeosLineString", "GeosLineString *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosLinearRing = {"_p_GeosLinearRing", "GeosLinearRing *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosMultiLineString = {"_p_GeosMultiLineString", "GeosMultiLineString *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosMultiLinearRing = {"_p_GeosMultiLinearRing", "GeosMultiLinearRing *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosMultiPoint = {"_p_GeosMultiPoint", "GeosMultiPoint *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosMultiPolygon = {"_p_GeosMultiPolygon", "GeosMultiPolygon *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosPoint = {"_p_GeosPoint", "GeosPoint *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosPolygon = {"_p_GeosPolygon", "GeosPolygon *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosWkbReader = {"_p_GeosWkbReader", "GeosWkbReader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosWkbWriter = {"_p_GeosWkbWriter", "GeosWkbWriter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosWktReader = {"_p_GeosWktReader", "GeosWktReader *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GeosWktWriter = {"_p_GeosWktWriter", "GeosWktWriter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_GeosLinearRing = {"_p_p_GeosLinearRing", "GeosLinearRing **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_GeosCoordinateSequence,
  &_swigt__p_GeosGeometry,
  &_swigt__p_GeosGeometryCollection,
  &_swigt__p_GeosLineString,
  &_swigt__p_GeosLinearRing,
  &_swigt__p_GeosMultiLineString,
  &_swigt__p_GeosMultiLinearRing,
  &_swigt__p_GeosMultiPoint,
  &_swigt__p_GeosMultiPolygon,
  &_swigt__p_GeosPoint,
  &_swigt__p_GeosPolygon,
  &_swigt__p_GeosWkbReader,
  &_swigt__p_GeosWkbWriter,
  &_swigt__p_GeosWktReader,
  &_swigt__p_GeosWktWriter,
  &_swigt__p_char,
  &_swigt__p_p_GeosLinearRing,
  &_swigt__p_size_t,
  &_swigt__p_unsigned_char,
};

static swig_cast_info _swigc__p_GeosCoordinateSequence[] = {  {&_swigt__p_GeosCoordinateSequence, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosGeometry[] = {  {&_swigt__p_GeosPolygon, _p_GeosPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosPoint, _p_GeosPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometry, 0, 0, 0},  {&_swigt__p_GeosLineString, _p_GeosLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosLinearRing, _p_GeosLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometry, 0, 0},  {&_swigt__p_GeosGeometryCollection, _p_GeosGeometryCollectionTo_p_GeosGeometry, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosGeometryCollection[] = {  {&_swigt__p_GeosMultiPolygon, _p_GeosMultiPolygonTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiPoint, _p_GeosMultiPointTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLineString, _p_GeosMultiLineStringTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosMultiLinearRing, _p_GeosMultiLinearRingTo_p_GeosGeometryCollection, 0, 0},  {&_swigt__p_GeosGeometryCollection, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosLineString[] = {  {&_swigt__p_GeosLineString, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosLinearRing[] = {  {&_swigt__p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosMultiLineString[] = {  {&_swigt__p_GeosMultiLineString, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosMultiLinearRing[] = {  {&_swigt__p_GeosMultiLinearRing, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosMultiPoint[] = {  {&_swigt__p_GeosMultiPoint, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosMultiPolygon[] = {  {&_swigt__p_GeosMultiPolygon, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosPoint[] = {  {&_swigt__p_GeosPoint, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosPolygon[] = {  {&_swigt__p_GeosPolygon, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosWkbReader[] = {  {&_swigt__p_GeosWkbReader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosWkbWriter[] = {  {&_swigt__p_GeosWkbWriter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosWktReader[] = {  {&_swigt__p_GeosWktReader, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GeosWktWriter[] = {  {&_swigt__p_GeosWktWriter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_GeosLinearRing[] = {  {&_swigt__p_p_GeosLinearRing, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_size_t[] = {  {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_GeosCoordinateSequence,
  _swigc__p_GeosGeometry,
  _swigc__p_GeosGeometryCollection,
  _swigc__p_GeosLineString,
  _swigc__p_GeosLinearRing,
  _swigc__p_GeosMultiLineString,
  _swigc__p_GeosMultiLinearRing,
  _swigc__p_GeosMultiPoint,
  _swigc__p_GeosMultiPolygon,
  _swigc__p_GeosPoint,
  _swigc__p_GeosPolygon,
  _swigc__p_GeosWkbReader,
  _swigc__p_GeosWkbWriter,
  _swigc__p_GeosWktReader,
  _swigc__p_GeosWktWriter,
  _swigc__p_char,
  _swigc__p_p_GeosLinearRing,
  _swigc__p_size_t,
  _swigc__p_unsigned_char,
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic 
 * memory is used. Also, since swig_type_info structures store pointers to 
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization. 
 * The idea is that swig generates all the structures that are needed. 
 * The runtime then collects these partially filled structures. 
 * The SWIG_InitializeModule function takes these initial arrays out of 
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned staticly to an initial 
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it 
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded. 
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the 
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int found;

  clientdata = clientdata;

  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
  }

  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
    module_head = &swig_module;
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    found=0;
    iter=module_head;
    do {
      if (iter==&swig_module) {
        found=1;
        break;
      }
      iter=iter->next;
    } while (iter!= module_head);

    /* if the is found in the list, then all is done and we may leave */
    if (found) return;
    /* otherwise we must add out module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }

  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
  
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif

    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
	type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }

    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
    
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
	if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
	  cast->type = ret;
	  ret = 0;
	} else {
	  /* Check for casting already in the list */
	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
	  if (!ocast) ret = 0;
	}
      }

      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;

#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
  printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;

  if (init_run) return;
  init_run = 1;

  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{ /* c-mode */
#endif
}
#endif


#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void Init_geos(void) {
  size_t i;
  
  SWIG_InitRuntime();
  mGeos = rb_define_module("Geos");
  
  SWIG_InitializeModule(0);
  for (i = 0; i < swig_module.size; i++) {
    SWIG_define_class(swig_module.types[i]);
  }
  
  SWIG_RubyInitializeTrackings();
  rb_define_const(mGeos, "GEOS_VERSION_MAJOR", SWIG_From_int(static_cast< int >(3)));
  rb_define_const(mGeos, "GEOS_VERSION_MINOR", SWIG_From_int(static_cast< int >(0)));
  rb_define_const(mGeos, "GEOS_VERSION", SWIG_FromCharPtr("3.0.0rc4"));
  rb_define_const(mGeos, "GEOS_JTS_PORT", SWIG_FromCharPtr("1.7.1"));
  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MAJOR", SWIG_From_int(static_cast< int >(1)));
  rb_define_const(mGeos, "GEOS_CAPI_VERSION_MINOR", SWIG_From_int(static_cast< int >(3)));
  rb_define_const(mGeos, "GEOS_CAPI_VERSION_PATCH", SWIG_From_int(static_cast< int >(3)));
  rb_define_const(mGeos, "GEOS_CAPI_FIRST_INTERFACE", SWIG_From_int(static_cast< int >(1)));
  rb_define_const(mGeos, "GEOS_CAPI_LAST_INTERFACE", SWIG_From_int(static_cast< int >((1+3))));
  rb_define_const(mGeos, "GEOS_CAPI_VERSION", SWIG_FromCharPtr("3.0.0rc4-CAPI-1.3.3"));
  rb_define_const(mGeos, "GEOS_POINT", SWIG_From_int(static_cast< int >(GEOS_POINT)));
  rb_define_const(mGeos, "GEOS_LINESTRING", SWIG_From_int(static_cast< int >(GEOS_LINESTRING)));
  rb_define_const(mGeos, "GEOS_LINEARRING", SWIG_From_int(static_cast< int >(GEOS_LINEARRING)));
  rb_define_const(mGeos, "GEOS_POLYGON", SWIG_From_int(static_cast< int >(GEOS_POLYGON)));
  rb_define_const(mGeos, "GEOS_MULTIPOINT", SWIG_From_int(static_cast< int >(GEOS_MULTIPOINT)));
  rb_define_const(mGeos, "GEOS_MULTILINESTRING", SWIG_From_int(static_cast< int >(GEOS_MULTILINESTRING)));
  rb_define_const(mGeos, "GEOS_MULTIPOLYGON", SWIG_From_int(static_cast< int >(GEOS_MULTIPOLYGON)));
  rb_define_const(mGeos, "GEOS_GEOMETRYCOLLECTION", SWIG_From_int(static_cast< int >(GEOS_GEOMETRYCOLLECTION)));
  rb_define_const(mGeos, "GEOS_WKB_XDR", SWIG_From_int(static_cast< int >(GEOS_WKB_XDR)));
  rb_define_const(mGeos, "GEOS_WKB_NDR", SWIG_From_int(static_cast< int >(GEOS_WKB_NDR)));
  
  initGEOS(noticeHandler, errorHandler);
  
  rb_define_module_function(mGeos, "version", VALUEFUNC(_wrap_version), -1);
  
  cCoordinateSequence.klass = rb_define_class_under(mGeos, "CoordinateSequence", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosCoordinateSequence, (void *) &cCoordinateSequence);
  rb_define_alloc_func(cCoordinateSequence.klass, _wrap_CoordinateSequence_allocate);
  rb_define_method(cCoordinateSequence.klass, "initialize", VALUEFUNC(_wrap_new_CoordinateSequence), -1);
  rb_define_method(cCoordinateSequence.klass, "clone", VALUEFUNC(_wrap_CoordinateSequence_clone), -1);
  rb_define_method(cCoordinateSequence.klass, "set_x", VALUEFUNC(_wrap_CoordinateSequence_set_x), -1);
  rb_define_method(cCoordinateSequence.klass, "set_y", VALUEFUNC(_wrap_CoordinateSequence_set_y), -1);
  rb_define_method(cCoordinateSequence.klass, "set_z", VALUEFUNC(_wrap_CoordinateSequence_set_z), -1);
  rb_define_method(cCoordinateSequence.klass, "set_ordinate", VALUEFUNC(_wrap_CoordinateSequence_set_ordinate), -1);
  rb_define_method(cCoordinateSequence.klass, "get_x", VALUEFUNC(_wrap_CoordinateSequence_get_x), -1);
  rb_define_method(cCoordinateSequence.klass, "get_y", VALUEFUNC(_wrap_CoordinateSequence_get_y), -1);
  rb_define_method(cCoordinateSequence.klass, "get_z", VALUEFUNC(_wrap_CoordinateSequence_get_z), -1);
  rb_define_method(cCoordinateSequence.klass, "get_ordinate", VALUEFUNC(_wrap_CoordinateSequence_get_ordinate), -1);
  rb_define_method(cCoordinateSequence.klass, "length", VALUEFUNC(_wrap_CoordinateSequence___len__), -1);
  rb_define_method(cCoordinateSequence.klass, "dimensions", VALUEFUNC(_wrap_CoordinateSequence_dimensions), -1);
  cCoordinateSequence.mark = 0;
  cCoordinateSequence.destroy = (void (*)(void *)) free_GeosCoordinateSequence;
  cCoordinateSequence.trackObjects = 0;
  
  cGeometry.klass = rb_define_class_under(mGeos, "Geometry", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometry, (void *) &cGeometry);
  rb_undef_alloc_func(cGeometry.klass);
  rb_define_method(cGeometry.klass, "clone", VALUEFUNC(_wrap_Geometry_clone), -1);
  rb_define_method(cGeometry.klass, "geom_type", VALUEFUNC(_wrap_Geometry_geom_type), -1);
  rb_define_method(cGeometry.klass, "type_id", VALUEFUNC(_wrap_Geometry_type_id), -1);
  rb_define_method(cGeometry.klass, "normalize", VALUEFUNC(_wrap_Geometry_normalize), -1);
  rb_define_method(cGeometry.klass, "srid", VALUEFUNC(_wrap_Geometry_srid), -1);
  rb_define_method(cGeometry.klass, "srid=", VALUEFUNC(_wrap_Geometry_sride___), -1);
  rb_define_method(cGeometry.klass, "dimensions", VALUEFUNC(_wrap_Geometry_dimensions), -1);
  rb_define_method(cGeometry.klass, "num_geometries", VALUEFUNC(_wrap_Geometry_num_geometries), -1);
  rb_define_method(cGeometry.klass, "intersection", VALUEFUNC(_wrap_Geometry_intersection), -1);
  rb_define_method(cGeometry.klass, "buffer", VALUEFUNC(_wrap_Geometry_buffer), -1);
  rb_define_method(cGeometry.klass, "convex_hull", VALUEFUNC(_wrap_Geometry_convex_hull), -1);
  rb_define_method(cGeometry.klass, "difference", VALUEFUNC(_wrap_Geometry_difference), -1);
  rb_define_method(cGeometry.klass, "sym_difference", VALUEFUNC(_wrap_Geometry_sym_difference), -1);
  rb_define_method(cGeometry.klass, "boundary", VALUEFUNC(_wrap_Geometry_boundary), -1);
  rb_define_method(cGeometry.klass, "union", VALUEFUNC(_wrap_Geometry_union), -1);
  rb_define_method(cGeometry.klass, "point_on_surface", VALUEFUNC(_wrap_Geometry_point_on_surface), -1);
  rb_define_method(cGeometry.klass, "centroid", VALUEFUNC(_wrap_Geometry_centroid), -1);
  rb_define_alias(cGeometry.klass, "center", "centroid");
  rb_define_method(cGeometry.klass, "envelope", VALUEFUNC(_wrap_Geometry_envelope), -1);
  rb_define_method(cGeometry.klass, "relate", VALUEFUNC(_wrap_Geometry_relate), -1);
  rb_define_method(cGeometry.klass, "line_merge", VALUEFUNC(_wrap_Geometry_line_merge), -1);
  rb_define_method(cGeometry.klass, "simplify", VALUEFUNC(_wrap_Geometry_simplify), -1);
  rb_define_method(cGeometry.klass, "topology_preserve_simplify", VALUEFUNC(_wrap_Geometry_topology_preserve_simplify), -1);
  rb_define_method(cGeometry.klass, "relate_pattern", VALUEFUNC(_wrap_Geometry_relate_pattern), -1);
  rb_define_method(cGeometry.klass, "disjoint?", VALUEFUNC(_wrap_Geometry_disjointq___), -1);
  rb_define_method(cGeometry.klass, "touches?", VALUEFUNC(_wrap_Geometry_touchesq___), -1);
  rb_define_method(cGeometry.klass, "intersects?", VALUEFUNC(_wrap_Geometry_intersectsq___), -1);
  rb_define_method(cGeometry.klass, "crosses?", VALUEFUNC(_wrap_Geometry_crossesq___), -1);
  rb_define_method(cGeometry.klass, "within?", VALUEFUNC(_wrap_Geometry_withinq___), -1);
  rb_define_method(cGeometry.klass, "contains?", VALUEFUNC(_wrap_Geometry_containsq___), -1);
  rb_define_method(cGeometry.klass, "overlaps?", VALUEFUNC(_wrap_Geometry_overlapsq___), -1);
  rb_define_method(cGeometry.klass, "eql?", VALUEFUNC(_wrap_Geometry_eqlq___), -1);
  rb_define_alias(cGeometry.klass, "==", "eql?");
  rb_define_method(cGeometry.klass, "eql_exact?", VALUEFUNC(_wrap_Geometry_eql_exactq___), -1);
  rb_define_method(cGeometry.klass, "empty?", VALUEFUNC(_wrap_Geometry_emptyq___), -1);
  rb_define_method(cGeometry.klass, "valid?", VALUEFUNC(_wrap_Geometry_validq___), -1);
  rb_define_method(cGeometry.klass, "simple?", VALUEFUNC(_wrap_Geometry_simpleq___), -1);
  rb_define_method(cGeometry.klass, "ring?", VALUEFUNC(_wrap_Geometry_ringq___), -1);
  rb_define_method(cGeometry.klass, "has_z?", VALUEFUNC(_wrap_Geometry_has_zq___), -1);
  rb_define_method(cGeometry.klass, "area", VALUEFUNC(_wrap_Geometry_area), -1);
  rb_define_method(cGeometry.klass, "length", VALUEFUNC(_wrap_Geometry_length), -1);
  rb_define_method(cGeometry.klass, "distance", VALUEFUNC(_wrap_Geometry_distance), -1);
  cGeometry.mark = 0;
  cGeometry.destroy = (void (*)(void *)) free_GeosGeometry;
  cGeometry.trackObjects = 0;
  
  cPoint.klass = rb_define_class_under(mGeos, "Point", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosPoint, (void *) &cPoint);
  rb_undef_alloc_func(cPoint.klass);
  rb_define_method(cPoint.klass, "coord_seq", VALUEFUNC(_wrap_Point_coord_seq), -1);
  cPoint.mark = 0;
  cPoint.destroy = (void (*)(void *)) free_GeosPoint;
  cPoint.trackObjects = 0;
  
  cLineString.klass = rb_define_class_under(mGeos, "LineString", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosLineString, (void *) &cLineString);
  rb_undef_alloc_func(cLineString.klass);
  rb_define_method(cLineString.klass, "coord_seq", VALUEFUNC(_wrap_LineString_coord_seq), -1);
  cLineString.mark = 0;
  cLineString.destroy = (void (*)(void *)) free_GeosLineString;
  cLineString.trackObjects = 0;
  
  cLinearRing.klass = rb_define_class_under(mGeos, "LinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosLinearRing, (void *) &cLinearRing);
  rb_undef_alloc_func(cLinearRing.klass);
  rb_define_method(cLinearRing.klass, "coord_seq", VALUEFUNC(_wrap_LinearRing_coord_seq), -1);
  cLinearRing.mark = 0;
  cLinearRing.destroy = (void (*)(void *)) free_GeosLinearRing;
  cLinearRing.trackObjects = 0;
  
  cPolygon.klass = rb_define_class_under(mGeos, "Polygon", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosPolygon, (void *) &cPolygon);
  rb_undef_alloc_func(cPolygon.klass);
  rb_define_method(cPolygon.klass, "exterior_ring", VALUEFUNC(_wrap_Polygon_exterior_ring), -1);
  rb_define_method(cPolygon.klass, "num_interior_rings", VALUEFUNC(_wrap_Polygon_num_interior_rings), -1);
  rb_define_method(cPolygon.klass, "interior_ring_n", VALUEFUNC(_wrap_Polygon_interior_ring_n), -1);
  cPolygon.mark = 0;
  cPolygon.destroy = (void (*)(void *)) free_GeosPolygon;
  cPolygon.trackObjects = 0;
  
  cGeometryCollection.klass = rb_define_class_under(mGeos, "GeometryCollection", ((swig_class *) SWIGTYPE_p_GeosGeometry->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosGeometryCollection, (void *) &cGeometryCollection);
  rb_undef_alloc_func(cGeometryCollection.klass);
  rb_define_method(cGeometryCollection.klass, "get_geometry_n", VALUEFUNC(_wrap_GeometryCollection_get_geometry_n), -1);
  cGeometryCollection.mark = 0;
  cGeometryCollection.destroy = (void (*)(void *)) free_GeosGeometryCollection;
  cGeometryCollection.trackObjects = 0;
  
  cMultiPoint.klass = rb_define_class_under(mGeos, "MultiPoint", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPoint, (void *) &cMultiPoint);
  rb_undef_alloc_func(cMultiPoint.klass);
  cMultiPoint.mark = 0;
  cMultiPoint.destroy = (void (*)(void *)) free_GeosMultiPoint;
  cMultiPoint.trackObjects = 0;
  
  cMultiLineString.klass = rb_define_class_under(mGeos, "MultiLineString", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLineString, (void *) &cMultiLineString);
  rb_undef_alloc_func(cMultiLineString.klass);
  cMultiLineString.mark = 0;
  cMultiLineString.destroy = (void (*)(void *)) free_GeosMultiLineString;
  cMultiLineString.trackObjects = 0;
  
  cMultiLinearRing.klass = rb_define_class_under(mGeos, "MultiLinearRing", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiLinearRing, (void *) &cMultiLinearRing);
  rb_undef_alloc_func(cMultiLinearRing.klass);
  cMultiLinearRing.mark = 0;
  cMultiLinearRing.destroy = (void (*)(void *)) free_GeosMultiLinearRing;
  cMultiLinearRing.trackObjects = 0;
  
  cMultiPolygon.klass = rb_define_class_under(mGeos, "MultiPolygon", ((swig_class *) SWIGTYPE_p_GeosGeometryCollection->clientdata)->klass);
  SWIG_TypeClientData(SWIGTYPE_p_GeosMultiPolygon, (void *) &cMultiPolygon);
  rb_undef_alloc_func(cMultiPolygon.klass);
  cMultiPolygon.mark = 0;
  cMultiPolygon.destroy = (void (*)(void *)) free_GeosMultiPolygon;
  cMultiPolygon.trackObjects = 0;
  rb_define_module_function(mGeos, "create_point", VALUEFUNC(_wrap_create_point), -1);
  rb_define_module_function(mGeos, "create_line_string", VALUEFUNC(_wrap_create_line_string), -1);
  rb_define_module_function(mGeos, "create_linear_ring", VALUEFUNC(_wrap_create_linear_ring), -1);
  rb_define_module_function(mGeos, "create_polygon", VALUEFUNC(_wrap_create_polygon), -1);
  
  cWktReader.klass = rb_define_class_under(mGeos, "WktReader", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosWktReader, (void *) &cWktReader);
  rb_define_alloc_func(cWktReader.klass, _wrap_WktReader_allocate);
  rb_define_method(cWktReader.klass, "initialize", VALUEFUNC(_wrap_new_WktReader), -1);
  rb_define_method(cWktReader.klass, "read", VALUEFUNC(_wrap_WktReader_read), -1);
  cWktReader.mark = 0;
  cWktReader.destroy = (void (*)(void *)) free_GeosWktReader;
  cWktReader.trackObjects = 0;
  
  cWktWriter.klass = rb_define_class_under(mGeos, "WktWriter", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosWktWriter, (void *) &cWktWriter);
  rb_define_alloc_func(cWktWriter.klass, _wrap_WktWriter_allocate);
  rb_define_method(cWktWriter.klass, "initialize", VALUEFUNC(_wrap_new_WktWriter), -1);
  rb_define_method(cWktWriter.klass, "write", VALUEFUNC(_wrap_WktWriter_write), -1);
  cWktWriter.mark = 0;
  cWktWriter.destroy = (void (*)(void *)) free_GeosWktWriter;
  cWktWriter.trackObjects = 0;
  
  cWkbReader.klass = rb_define_class_under(mGeos, "WkbReader", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbReader, (void *) &cWkbReader);
  rb_define_alloc_func(cWkbReader.klass, _wrap_WkbReader_allocate);
  rb_define_method(cWkbReader.klass, "initialize", VALUEFUNC(_wrap_new_WkbReader), -1);
  rb_define_method(cWkbReader.klass, "read", VALUEFUNC(_wrap_WkbReader_read), -1);
  rb_define_method(cWkbReader.klass, "read_hex", VALUEFUNC(_wrap_WkbReader_read_hex), -1);
  cWkbReader.mark = 0;
  cWkbReader.destroy = (void (*)(void *)) free_GeosWkbReader;
  cWkbReader.trackObjects = 0;
  
  cWkbWriter.klass = rb_define_class_under(mGeos, "WkbWriter", rb_cObject);
  SWIG_TypeClientData(SWIGTYPE_p_GeosWkbWriter, (void *) &cWkbWriter);
  rb_define_alloc_func(cWkbWriter.klass, _wrap_WkbWriter_allocate);
  rb_define_method(cWkbWriter.klass, "initialize", VALUEFUNC(_wrap_new_WkbWriter), -1);
  rb_define_method(cWkbWriter.klass, "output_dimensions", VALUEFUNC(_wrap_WkbWriter_output_dimensions), -1);
  rb_define_method(cWkbWriter.klass, "output_dimensions=", VALUEFUNC(_wrap_WkbWriter_output_dimensionse___), -1);
  rb_define_method(cWkbWriter.klass, "byte_order", VALUEFUNC(_wrap_WkbWriter_byte_order), -1);
  rb_define_method(cWkbWriter.klass, "byte_order=", VALUEFUNC(_wrap_WkbWriter_byte_ordere___), -1);
  rb_define_method(cWkbWriter.klass, "include_srid", VALUEFUNC(_wrap_WkbWriter_include_srid), -1);
  rb_define_method(cWkbWriter.klass, "include_srid=", VALUEFUNC(_wrap_WkbWriter_include_sride___), -1);
  rb_define_method(cWkbWriter.klass, "write", VALUEFUNC(_wrap_WkbWriter_write), -1);
  rb_define_method(cWkbWriter.klass, "write_hex", VALUEFUNC(_wrap_WkbWriter_write_hex), -1);
  cWkbWriter.mark = 0;
  cWkbWriter.destroy = (void (*)(void *)) free_GeosWkbWriter;
  cWkbWriter.trackObjects = 0;
}

