rgeo 2.3.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.yardopts +6 -0
 - data/README.md +23 -14
 - data/ext/geos_c_impl/analysis.c +30 -25
 - data/ext/geos_c_impl/analysis.h +8 -7
 - data/ext/geos_c_impl/coordinates.c +27 -21
 - data/ext/geos_c_impl/coordinates.h +5 -2
 - data/ext/geos_c_impl/errors.c +19 -10
 - data/ext/geos_c_impl/errors.h +11 -4
 - data/ext/geos_c_impl/extconf.rb +42 -28
 - data/ext/geos_c_impl/factory.c +540 -451
 - data/ext/geos_c_impl/factory.h +105 -95
 - data/ext/geos_c_impl/geometry.c +593 -387
 - data/ext/geos_c_impl/geometry.h +10 -5
 - data/ext/geos_c_impl/geometry_collection.c +306 -339
 - data/ext/geos_c_impl/geometry_collection.h +6 -20
 - data/ext/geos_c_impl/globals.c +169 -0
 - data/ext/geos_c_impl/globals.h +46 -0
 - data/ext/geos_c_impl/line_string.c +271 -231
 - data/ext/geos_c_impl/line_string.h +5 -8
 - data/ext/geos_c_impl/main.c +16 -16
 - data/ext/geos_c_impl/point.c +65 -67
 - data/ext/geos_c_impl/point.h +4 -7
 - data/ext/geos_c_impl/polygon.c +137 -135
 - data/ext/geos_c_impl/polygon.h +11 -11
 - data/ext/geos_c_impl/preface.h +16 -10
 - data/ext/geos_c_impl/ruby_more.c +67 -0
 - data/ext/geos_c_impl/ruby_more.h +25 -0
 - data/lib/rgeo/cartesian/analysis.rb +5 -3
 - data/lib/rgeo/cartesian/bounding_box.rb +74 -79
 - data/lib/rgeo/cartesian/calculations.rb +64 -33
 - data/lib/rgeo/cartesian/factory.rb +57 -102
 - data/lib/rgeo/cartesian/feature_classes.rb +68 -46
 - data/lib/rgeo/cartesian/feature_methods.rb +67 -25
 - data/lib/rgeo/cartesian/interface.rb +6 -41
 - data/lib/rgeo/cartesian/planar_graph.rb +373 -0
 - data/lib/rgeo/cartesian/sweepline_intersector.rb +147 -0
 - data/lib/rgeo/cartesian/valid_op.rb +69 -0
 - data/lib/rgeo/cartesian.rb +3 -0
 - data/lib/rgeo/coord_sys/cs/entities.rb +303 -99
 - data/lib/rgeo/coord_sys/cs/factories.rb +0 -2
 - data/lib/rgeo/coord_sys/cs/wkt_parser.rb +90 -42
 - data/lib/rgeo/coord_sys.rb +1 -20
 - data/lib/rgeo/error.rb +15 -0
 - data/lib/rgeo/feature/curve.rb +0 -11
 - data/lib/rgeo/feature/factory.rb +26 -36
 - data/lib/rgeo/feature/factory_generator.rb +6 -14
 - data/lib/rgeo/feature/geometry.rb +146 -66
 - data/lib/rgeo/feature/geometry_collection.rb +16 -9
 - data/lib/rgeo/feature/line_string.rb +4 -5
 - data/lib/rgeo/feature/linear_ring.rb +0 -1
 - data/lib/rgeo/feature/multi_curve.rb +0 -6
 - data/lib/rgeo/feature/multi_surface.rb +3 -4
 - data/lib/rgeo/feature/point.rb +4 -5
 - data/lib/rgeo/feature/polygon.rb +1 -2
 - data/lib/rgeo/feature/surface.rb +3 -4
 - data/lib/rgeo/feature/types.rb +69 -85
 - data/lib/rgeo/geographic/factory.rb +98 -125
 - data/lib/rgeo/geographic/interface.rb +69 -166
 - data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
 - data/lib/rgeo/geographic/projected_feature_methods.rb +67 -42
 - data/lib/rgeo/geographic/projected_window.rb +36 -22
 - data/lib/rgeo/geographic/{proj4_projector.rb → projector.rb} +3 -5
 - data/lib/rgeo/geographic/simple_mercator_projector.rb +26 -25
 - data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
 - data/lib/rgeo/geographic/spherical_feature_methods.rb +86 -9
 - data/lib/rgeo/geographic/spherical_math.rb +17 -20
 - data/lib/rgeo/geographic.rb +1 -1
 - data/lib/rgeo/geos/capi_factory.rb +87 -158
 - data/lib/rgeo/geos/capi_feature_classes.rb +50 -36
 - data/lib/rgeo/geos/ffi_factory.rb +105 -173
 - data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
 - data/lib/rgeo/geos/ffi_feature_methods.rb +105 -127
 - data/lib/rgeo/geos/interface.rb +20 -59
 - data/lib/rgeo/geos/utils.rb +5 -5
 - data/lib/rgeo/geos/zm_factory.rb +53 -95
 - data/lib/rgeo/geos/zm_feature_methods.rb +30 -33
 - data/lib/rgeo/geos.rb +8 -8
 - data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +9 -22
 - data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -2
 - data/lib/rgeo/impl_helper/basic_line_string_methods.rb +28 -56
 - data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -14
 - data/lib/rgeo/impl_helper/basic_polygon_methods.rb +17 -26
 - data/lib/rgeo/impl_helper/utils.rb +21 -0
 - data/lib/rgeo/impl_helper/valid_op.rb +350 -0
 - data/lib/rgeo/impl_helper/validity_check.rb +139 -0
 - data/lib/rgeo/impl_helper.rb +1 -0
 - data/lib/rgeo/version.rb +1 -1
 - data/lib/rgeo/wkrep/wkb_generator.rb +73 -63
 - data/lib/rgeo/wkrep/wkb_parser.rb +33 -31
 - data/lib/rgeo/wkrep/wkt_generator.rb +52 -45
 - data/lib/rgeo/wkrep/wkt_parser.rb +48 -35
 - data/lib/rgeo.rb +1 -3
 - metadata +50 -13
 - data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
 - data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
 - data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
 
| 
         @@ -2,38 +2,35 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
              Geometry collection methods for GEOS wrapper
         
     | 
| 
       3 
3 
     | 
    
         
             
            */
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
5 
     | 
    
         
             
            #include "preface.h"
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
            #ifdef RGEO_GEOS_SUPPORTED
         
     | 
| 
       9 
8 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            #include <ruby.h>
         
     | 
| 
       11 
9 
     | 
    
         
             
            #include <geos_c.h>
         
     | 
| 
      
 10 
     | 
    
         
            +
            #include <ruby.h>
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            #include "coordinates.h"
         
     | 
| 
      
 13 
     | 
    
         
            +
            #include "errors.h"
         
     | 
| 
       13 
14 
     | 
    
         
             
            #include "factory.h"
         
     | 
| 
       14 
15 
     | 
    
         
             
            #include "geometry.h"
         
     | 
| 
      
 16 
     | 
    
         
            +
            #include "geometry_collection.h"
         
     | 
| 
      
 17 
     | 
    
         
            +
            #include "globals.h"
         
     | 
| 
       15 
18 
     | 
    
         
             
            #include "line_string.h"
         
     | 
| 
       16 
19 
     | 
    
         
             
            #include "polygon.h"
         
     | 
| 
       17 
     | 
    
         
            -
            #include "geometry_collection.h"
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            #include "coordinates.h"
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
            RGEO_BEGIN_C
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
23 
     | 
    
         
             
            /**** INTERNAL IMPLEMENTATION OF CREATE ****/
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
25 
     | 
    
         
             
            // Main implementation of the "create" class method for geometry collections.
         
     | 
| 
       28 
26 
     | 
    
         
             
            // You must pass in the correct GEOS geometry type ID.
         
     | 
| 
       29 
27 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 28 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 29 
     | 
    
         
            +
            create_geometry_collection(VALUE module, int type, VALUE factory, VALUE array)
         
     | 
| 
       31 
30 
     | 
    
         
             
            {
         
     | 
| 
       32 
31 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       33 
32 
     | 
    
         
             
              unsigned int len;
         
     | 
| 
       34 
33 
     | 
    
         
             
              GEOSGeometry** geoms;
         
     | 
| 
       35 
     | 
    
         
            -
              RGeo_FactoryData* factory_data;
         
     | 
| 
       36 
     | 
    
         
            -
              GEOSContextHandle_t geos_context;
         
     | 
| 
       37 
34 
     | 
    
         
             
              VALUE klass;
         
     | 
| 
       38 
35 
     | 
    
         
             
              unsigned int i;
         
     | 
| 
       39 
36 
     | 
    
         
             
              unsigned int j;
         
     | 
| 
         @@ -41,99 +38,73 @@ static VALUE create_geometry_collection(VALUE module, int type, VALUE factory, V 
     | 
|
| 
       41 
38 
     | 
    
         
             
              VALUE cast_type;
         
     | 
| 
       42 
39 
     | 
    
         
             
              GEOSGeometry* geom;
         
     | 
| 
       43 
40 
     | 
    
         
             
              GEOSGeometry* collection;
         
     | 
| 
       44 
     | 
    
         
            -
               
     | 
| 
       45 
     | 
    
         
            -
              GEOSGeometry* igeom;
         
     | 
| 
       46 
     | 
    
         
            -
              GEOSGeometry* jgeom;
         
     | 
| 
      
 41 
     | 
    
         
            +
              int state = 0;
         
     | 
| 
       47 
42 
     | 
    
         | 
| 
       48 
43 
     | 
    
         
             
              result = Qnil;
         
     | 
| 
       49 
44 
     | 
    
         
             
              Check_Type(array, T_ARRAY);
         
     | 
| 
       50 
45 
     | 
    
         
             
              len = (unsigned int)RARRAY_LEN(array);
         
     | 
| 
       51 
46 
     | 
    
         
             
              geoms = ALLOC_N(GEOSGeometry*, len == 0 ? 1 : len);
         
     | 
| 
       52 
     | 
    
         
            -
              if (geoms) {
         
     | 
| 
       53 
     | 
    
         
            -
                 
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
              if (!geoms) {
         
     | 
| 
      
 48 
     | 
    
         
            +
                rb_raise(rb_eRGeoError, "not enough memory available");
         
     | 
| 
      
 49 
     | 
    
         
            +
              }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              klasses = Qnil;
         
     | 
| 
      
 52 
     | 
    
         
            +
              cast_type = Qnil;
         
     | 
| 
      
 53 
     | 
    
         
            +
              switch (type) {
         
     | 
| 
       58 
54 
     | 
    
         
             
                case GEOS_MULTIPOINT:
         
     | 
| 
       59 
     | 
    
         
            -
                  cast_type =  
     | 
| 
      
 55 
     | 
    
         
            +
                  cast_type = rgeo_feature_point_module;
         
     | 
| 
       60 
56 
     | 
    
         
             
                  break;
         
     | 
| 
       61 
57 
     | 
    
         
             
                case GEOS_MULTILINESTRING:
         
     | 
| 
       62 
     | 
    
         
            -
                  cast_type =  
     | 
| 
      
 58 
     | 
    
         
            +
                  cast_type = rgeo_feature_line_string_module;
         
     | 
| 
       63 
59 
     | 
    
         
             
                  break;
         
     | 
| 
       64 
60 
     | 
    
         
             
                case GEOS_MULTIPOLYGON:
         
     | 
| 
       65 
     | 
    
         
            -
                  cast_type =  
     | 
| 
      
 61 
     | 
    
         
            +
                  cast_type = rgeo_feature_polygon_module;
         
     | 
| 
       66 
62 
     | 
    
         
             
                  break;
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                   
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                  if (!NIL_P(klass) && NIL_P(klasses)) {
         
     | 
| 
       75 
     | 
    
         
            -
                    klasses = rb_ary_new2(len);
         
     | 
| 
       76 
     | 
    
         
            -
                    for (j=0; j<i; ++j) {
         
     | 
| 
       77 
     | 
    
         
            -
                      rb_ary_push(klasses, Qnil);
         
     | 
| 
       78 
     | 
    
         
            -
                    }
         
     | 
| 
       79 
     | 
    
         
            -
                  }
         
     | 
| 
       80 
     | 
    
         
            -
                  if (!NIL_P(klasses)) {
         
     | 
| 
       81 
     | 
    
         
            -
                    rb_ary_push(klasses, klass);
         
     | 
| 
      
 63 
     | 
    
         
            +
              }
         
     | 
| 
      
 64 
     | 
    
         
            +
              for (i = 0; i < len; ++i) {
         
     | 
| 
      
 65 
     | 
    
         
            +
                geom = rgeo_convert_to_detached_geos_geometry(
         
     | 
| 
      
 66 
     | 
    
         
            +
                  rb_ary_entry(array, i), factory, cast_type, &klass, &state);
         
     | 
| 
      
 67 
     | 
    
         
            +
                if (state) {
         
     | 
| 
      
 68 
     | 
    
         
            +
                  for (j = 0; j < i; j++) {
         
     | 
| 
      
 69 
     | 
    
         
            +
                    GEOSGeom_destroy(geoms[j]);
         
     | 
| 
       82 
70 
     | 
    
         
             
                  }
         
     | 
| 
      
 71 
     | 
    
         
            +
                  FREE(geoms);
         
     | 
| 
      
 72 
     | 
    
         
            +
                  rb_jump_tag(state);
         
     | 
| 
       83 
73 
     | 
    
         
             
                }
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                geoms[i] = geom;
         
     | 
| 
      
 76 
     | 
    
         
            +
                if (!NIL_P(klass) && NIL_P(klasses)) {
         
     | 
| 
      
 77 
     | 
    
         
            +
                  klasses = rb_ary_new2(len);
         
     | 
| 
      
 78 
     | 
    
         
            +
                  for (j = 0; j < i; ++j) {
         
     | 
| 
      
 79 
     | 
    
         
            +
                    rb_ary_push(klasses, Qnil);
         
     | 
| 
       87 
80 
     | 
    
         
             
                  }
         
     | 
| 
       88 
81 
     | 
    
         
             
                }
         
     | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
                   
     | 
| 
       91 
     | 
    
         
            -
                  // Due to a limitation of GEOS, the MultiPolygon assertions are not checked.
         
     | 
| 
       92 
     | 
    
         
            -
                  // We do that manually here.
         
     | 
| 
       93 
     | 
    
         
            -
                  if (collection && type == GEOS_MULTIPOLYGON && (factory_data->flags & 1) == 0) {
         
     | 
| 
       94 
     | 
    
         
            -
                    problem = 0;
         
     | 
| 
       95 
     | 
    
         
            -
                    for (i=1; i<len; ++i) {
         
     | 
| 
       96 
     | 
    
         
            -
                      for (j=0; j<i; ++j) {
         
     | 
| 
       97 
     | 
    
         
            -
                        igeom = geoms[i];
         
     | 
| 
       98 
     | 
    
         
            -
                        jgeom = geoms[j];
         
     | 
| 
       99 
     | 
    
         
            -
                        problem = GEOSRelatePattern_r(geos_context, igeom, jgeom, "2********");
         
     | 
| 
       100 
     | 
    
         
            -
                        if (problem) {
         
     | 
| 
       101 
     | 
    
         
            -
                          break;
         
     | 
| 
       102 
     | 
    
         
            -
                        }
         
     | 
| 
       103 
     | 
    
         
            -
                        problem = GEOSRelatePattern_r(geos_context, igeom, jgeom, "****1****");
         
     | 
| 
       104 
     | 
    
         
            -
                        if (problem) {
         
     | 
| 
       105 
     | 
    
         
            -
                          break;
         
     | 
| 
       106 
     | 
    
         
            -
                        }
         
     | 
| 
       107 
     | 
    
         
            -
                      }
         
     | 
| 
       108 
     | 
    
         
            -
                      if (problem) {
         
     | 
| 
       109 
     | 
    
         
            -
                        break;
         
     | 
| 
       110 
     | 
    
         
            -
                      }
         
     | 
| 
       111 
     | 
    
         
            -
                    }
         
     | 
| 
       112 
     | 
    
         
            -
                    if (problem) {
         
     | 
| 
       113 
     | 
    
         
            -
                      GEOSGeom_destroy_r(geos_context, collection);
         
     | 
| 
       114 
     | 
    
         
            -
                      collection = NULL;
         
     | 
| 
       115 
     | 
    
         
            -
                    }
         
     | 
| 
       116 
     | 
    
         
            -
                  }
         
     | 
| 
       117 
     | 
    
         
            -
                  if (collection) {
         
     | 
| 
       118 
     | 
    
         
            -
                    result = rgeo_wrap_geos_geometry(factory, collection, module);
         
     | 
| 
       119 
     | 
    
         
            -
                    RGEO_GEOMETRY_DATA_PTR(result)->klasses = klasses;
         
     | 
| 
       120 
     | 
    
         
            -
                  }
         
     | 
| 
       121 
     | 
    
         
            -
                  // NOTE: We are assuming that GEOS will do its own cleanup of the
         
     | 
| 
       122 
     | 
    
         
            -
                  // element geometries if it fails to create the collection, so we
         
     | 
| 
       123 
     | 
    
         
            -
                  // are not doing that ourselves. If that turns out not to be the
         
     | 
| 
       124 
     | 
    
         
            -
                  // case, this will be a memory leak.
         
     | 
| 
      
 82 
     | 
    
         
            +
                if (!NIL_P(klasses)) {
         
     | 
| 
      
 83 
     | 
    
         
            +
                  rb_ary_push(klasses, klass);
         
     | 
| 
       125 
84 
     | 
    
         
             
                }
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
              }
         
     | 
| 
      
 86 
     | 
    
         
            +
              collection = GEOSGeom_createCollection(type, geoms, len);
         
     | 
| 
      
 87 
     | 
    
         
            +
              if (collection) {
         
     | 
| 
      
 88 
     | 
    
         
            +
                result = rgeo_wrap_geos_geometry(factory, collection, module);
         
     | 
| 
      
 89 
     | 
    
         
            +
                RGEO_GEOMETRY_DATA_PTR(result)->klasses = klasses;
         
     | 
| 
      
 90 
     | 
    
         
            +
              }
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              // NOTE: We are assuming that GEOS will do its own cleanup of the
         
     | 
| 
      
 93 
     | 
    
         
            +
              // element geometries if it fails to create the collection, so we
         
     | 
| 
      
 94 
     | 
    
         
            +
              // are not doing that ourselves. If that turns out not to be the
         
     | 
| 
      
 95 
     | 
    
         
            +
              // case, this will be a memory leak.
         
     | 
| 
      
 96 
     | 
    
         
            +
              FREE(geoms);
         
     | 
| 
      
 97 
     | 
    
         
            +
              if (state) {
         
     | 
| 
      
 98 
     | 
    
         
            +
                rb_jump_tag(state);
         
     | 
| 
       127 
99 
     | 
    
         
             
              }
         
     | 
| 
       128 
100 
     | 
    
         | 
| 
       129 
101 
     | 
    
         
             
              return result;
         
     | 
| 
       130 
102 
     | 
    
         
             
            }
         
     | 
| 
       131 
103 
     | 
    
         | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
104 
     | 
    
         
             
            /**** RUBY METHOD DEFINITIONS ****/
         
     | 
| 
       134 
105 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 107 
     | 
    
         
            +
            method_geometry_collection_eql(VALUE self, VALUE rhs)
         
     | 
| 
       137 
108 
     | 
    
         
             
            {
         
     | 
| 
       138 
109 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       139 
110 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -141,13 +112,14 @@ static VALUE method_geometry_collection_eql(VALUE self, VALUE rhs) 
     | 
|
| 
       141 
112 
     | 
    
         
             
              result = rgeo_geos_klasses_and_factories_eql(self, rhs);
         
     | 
| 
       142 
113 
     | 
    
         
             
              if (RTEST(result)) {
         
     | 
| 
       143 
114 
     | 
    
         
             
                self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       144 
     | 
    
         
            -
                result =  
     | 
| 
      
 115 
     | 
    
         
            +
                result = rgeo_geos_geometries_strict_eql(self_data->geom,
         
     | 
| 
      
 116 
     | 
    
         
            +
                                                         RGEO_GEOMETRY_DATA_PTR(rhs)->geom);
         
     | 
| 
       145 
117 
     | 
    
         
             
              }
         
     | 
| 
       146 
118 
     | 
    
         
             
              return result;
         
     | 
| 
       147 
119 
     | 
    
         
             
            }
         
     | 
| 
       148 
120 
     | 
    
         | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
      
 121 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 122 
     | 
    
         
            +
            method_geometry_collection_hash(VALUE self)
         
     | 
| 
       151 
123 
     | 
    
         
             
            {
         
     | 
| 
       152 
124 
     | 
    
         
             
              st_index_t hash;
         
     | 
| 
       153 
125 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -156,14 +128,14 @@ static VALUE method_geometry_collection_hash(VALUE self) 
     | 
|
| 
       156 
128 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       157 
129 
     | 
    
         
             
              factory = self_data->factory;
         
     | 
| 
       158 
130 
     | 
    
         
             
              hash = rb_hash_start(0);
         
     | 
| 
       159 
     | 
    
         
            -
              hash = rgeo_geos_objbase_hash( 
     | 
| 
       160 
     | 
    
         
            -
                 
     | 
| 
       161 
     | 
    
         
            -
              hash = rgeo_geos_geometry_collection_hash(self_data-> 
     | 
| 
      
 131 
     | 
    
         
            +
              hash = rgeo_geos_objbase_hash(
         
     | 
| 
      
 132 
     | 
    
         
            +
                factory, rgeo_feature_geometry_collection_module, hash);
         
     | 
| 
      
 133 
     | 
    
         
            +
              hash = rgeo_geos_geometry_collection_hash(self_data->geom, hash);
         
     | 
| 
       162 
134 
     | 
    
         
             
              return LONG2FIX(rb_hash_end(hash));
         
     | 
| 
       163 
135 
     | 
    
         
             
            }
         
     | 
| 
       164 
136 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
      
 137 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 138 
     | 
    
         
            +
            method_geometry_collection_geometry_type(VALUE self)
         
     | 
| 
       167 
139 
     | 
    
         
             
            {
         
     | 
| 
       168 
140 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       169 
141 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -171,13 +143,13 @@ static VALUE method_geometry_collection_geometry_type(VALUE self) 
     | 
|
| 
       171 
143 
     | 
    
         
             
              result = Qnil;
         
     | 
| 
       172 
144 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       173 
145 
     | 
    
         
             
              if (self_data->geom) {
         
     | 
| 
       174 
     | 
    
         
            -
                result =  
     | 
| 
      
 146 
     | 
    
         
            +
                result = rgeo_feature_geometry_collection_module;
         
     | 
| 
       175 
147 
     | 
    
         
             
              }
         
     | 
| 
       176 
148 
     | 
    
         
             
              return result;
         
     | 
| 
       177 
149 
     | 
    
         
             
            }
         
     | 
| 
       178 
150 
     | 
    
         | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
      
 151 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 152 
     | 
    
         
            +
            method_geometry_collection_num_geometries(VALUE self)
         
     | 
| 
       181 
153 
     | 
    
         
             
            {
         
     | 
| 
       182 
154 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       183 
155 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -187,13 +159,13 @@ static VALUE method_geometry_collection_num_geometries(VALUE self) 
     | 
|
| 
       187 
159 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       188 
160 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       189 
161 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       190 
     | 
    
         
            -
                result = INT2NUM( 
     | 
| 
      
 162 
     | 
    
         
            +
                result = INT2NUM(GEOSGetNumGeometries(self_geom));
         
     | 
| 
       191 
163 
     | 
    
         
             
              }
         
     | 
| 
       192 
164 
     | 
    
         
             
              return result;
         
     | 
| 
       193 
165 
     | 
    
         
             
            }
         
     | 
| 
       194 
166 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
      
 167 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 168 
     | 
    
         
            +
            impl_geometry_n(VALUE self, VALUE n, char allow_negatives)
         
     | 
| 
       197 
169 
     | 
    
         
             
            {
         
     | 
| 
       198 
170 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       199 
171 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -207,16 +179,16 @@ static VALUE impl_geometry_n(VALUE self, VALUE n, char allow_negatives) 
     | 
|
| 
       207 
179 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       208 
180 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       209 
181 
     | 
    
         
             
                klasses = self_data->klasses;
         
     | 
| 
       210 
     | 
    
         
            -
                i =  
     | 
| 
      
 182 
     | 
    
         
            +
                i = RB_NUM2INT(n);
         
     | 
| 
       211 
183 
     | 
    
         
             
                if (allow_negatives || i >= 0) {
         
     | 
| 
       212 
     | 
    
         
            -
                   
     | 
| 
       213 
     | 
    
         
            -
                  len = GEOSGetNumGeometries_r(self_context, self_geom);
         
     | 
| 
      
 184 
     | 
    
         
            +
                  len = GEOSGetNumGeometries(self_geom);
         
     | 
| 
       214 
185 
     | 
    
         
             
                  if (i < 0) {
         
     | 
| 
       215 
186 
     | 
    
         
             
                    i += len;
         
     | 
| 
       216 
187 
     | 
    
         
             
                  }
         
     | 
| 
       217 
188 
     | 
    
         
             
                  if (i >= 0 && i < len) {
         
     | 
| 
       218 
     | 
    
         
            -
                    result = rgeo_wrap_geos_geometry_clone( 
     | 
| 
       219 
     | 
    
         
            -
                       
     | 
| 
      
 189 
     | 
    
         
            +
                    result = rgeo_wrap_geos_geometry_clone(
         
     | 
| 
      
 190 
     | 
    
         
            +
                      self_data->factory,
         
     | 
| 
      
 191 
     | 
    
         
            +
                      GEOSGetGeometryN(self_geom, i),
         
     | 
| 
       220 
192 
     | 
    
         
             
                      NIL_P(klasses) ? Qnil : rb_ary_entry(klasses, i));
         
     | 
| 
       221 
193 
     | 
    
         
             
                  }
         
     | 
| 
       222 
194 
     | 
    
         
             
                }
         
     | 
| 
         @@ -224,21 +196,24 @@ static VALUE impl_geometry_n(VALUE self, VALUE n, char allow_negatives) 
     | 
|
| 
       224 
196 
     | 
    
         
             
              return result;
         
     | 
| 
       225 
197 
     | 
    
         
             
            }
         
     | 
| 
       226 
198 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
      
 199 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 200 
     | 
    
         
            +
            method_geometry_collection_geometry_n(VALUE self, VALUE n)
         
     | 
| 
       229 
201 
     | 
    
         
             
            {
         
     | 
| 
       230 
202 
     | 
    
         
             
              return impl_geometry_n(self, n, 0);
         
     | 
| 
       231 
203 
     | 
    
         
             
            }
         
     | 
| 
       232 
204 
     | 
    
         | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
      
 205 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 206 
     | 
    
         
            +
            method_geometry_collection_brackets(VALUE self, VALUE n)
         
     | 
| 
       235 
207 
     | 
    
         
             
            {
         
     | 
| 
       236 
208 
     | 
    
         
             
              return impl_geometry_n(self, n, 1);
         
     | 
| 
       237 
209 
     | 
    
         
             
            }
         
     | 
| 
       238 
210 
     | 
    
         | 
| 
       239 
     | 
    
         
            -
             
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
      
 211 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 212 
     | 
    
         
            +
            method_geometry_collection_each(VALUE self)
         
     | 
| 
       241 
213 
     | 
    
         
             
            {
         
     | 
| 
      
 214 
     | 
    
         
            +
              RETURN_ENUMERATOR(
         
     | 
| 
      
 215 
     | 
    
         
            +
                self, 0, 0); /* return enum_for(__callee__) unless block_given? */
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
       242 
217 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       243 
218 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       244 
219 
     | 
    
         
             
              int len;
         
     | 
| 
         @@ -249,30 +224,28 @@ static VALUE method_geometry_collection_each(VALUE self) 
     | 
|
| 
       249 
224 
     | 
    
         | 
| 
       250 
225 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       251 
226 
     | 
    
         | 
| 
       252 
     | 
    
         
            -
               
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
                 
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
                   
     | 
| 
       257 
     | 
    
         
            -
                   
     | 
| 
       258 
     | 
    
         
            -
                     
     | 
| 
       259 
     | 
    
         
            -
                     
     | 
| 
       260 
     | 
    
         
            -
                       
     | 
| 
       261 
     | 
    
         
            -
                       
     | 
| 
       262 
     | 
    
         
            -
                       
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
                       
     | 
| 
      
 227 
     | 
    
         
            +
              self_geom = self_data->geom;
         
     | 
| 
      
 228 
     | 
    
         
            +
              if (self_geom) {
         
     | 
| 
      
 229 
     | 
    
         
            +
                len = GEOSGetNumGeometries(self_geom);
         
     | 
| 
      
 230 
     | 
    
         
            +
                if (len > 0) {
         
     | 
| 
      
 231 
     | 
    
         
            +
                  klasses = self_data->klasses;
         
     | 
| 
      
 232 
     | 
    
         
            +
                  for (i = 0; i < len; ++i) {
         
     | 
| 
      
 233 
     | 
    
         
            +
                    elem_geom = GEOSGetGeometryN(self_geom, i);
         
     | 
| 
      
 234 
     | 
    
         
            +
                    elem = rgeo_wrap_geos_geometry_clone(
         
     | 
| 
      
 235 
     | 
    
         
            +
                      self_data->factory,
         
     | 
| 
      
 236 
     | 
    
         
            +
                      elem_geom,
         
     | 
| 
      
 237 
     | 
    
         
            +
                      NIL_P(klasses) ? Qnil : rb_ary_entry(klasses, i));
         
     | 
| 
      
 238 
     | 
    
         
            +
                    if (!NIL_P(elem)) {
         
     | 
| 
      
 239 
     | 
    
         
            +
                      rb_yield(elem);
         
     | 
| 
       265 
240 
     | 
    
         
             
                    }
         
     | 
| 
       266 
241 
     | 
    
         
             
                  }
         
     | 
| 
       267 
242 
     | 
    
         
             
                }
         
     | 
| 
       268 
     | 
    
         
            -
                return self;
         
     | 
| 
       269 
     | 
    
         
            -
              }
         
     | 
| 
       270 
     | 
    
         
            -
              else {
         
     | 
| 
       271 
     | 
    
         
            -
                return rb_funcall(self, RGEO_FACTORY_DATA_PTR(self_data->factory)->globals->id_enum_for, 0);
         
     | 
| 
       272 
243 
     | 
    
         
             
              }
         
     | 
| 
      
 244 
     | 
    
         
            +
              return self;
         
     | 
| 
       273 
245 
     | 
    
         
             
            }
         
     | 
| 
       274 
246 
     | 
    
         | 
| 
       275 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 247 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 248 
     | 
    
         
            +
            method_multi_point_geometry_type(VALUE self)
         
     | 
| 
       276 
249 
     | 
    
         
             
            {
         
     | 
| 
       277 
250 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       278 
251 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -280,13 +253,13 @@ static VALUE method_multi_point_geometry_type(VALUE self) 
     | 
|
| 
       280 
253 
     | 
    
         
             
              result = Qnil;
         
     | 
| 
       281 
254 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       282 
255 
     | 
    
         
             
              if (self_data->geom) {
         
     | 
| 
       283 
     | 
    
         
            -
                result =  
     | 
| 
      
 256 
     | 
    
         
            +
                result = rgeo_feature_multi_point_module;
         
     | 
| 
       284 
257 
     | 
    
         
             
              }
         
     | 
| 
       285 
258 
     | 
    
         
             
              return result;
         
     | 
| 
       286 
259 
     | 
    
         
             
            }
         
     | 
| 
       287 
260 
     | 
    
         | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
      
 261 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 262 
     | 
    
         
            +
            method_multi_point_hash(VALUE self)
         
     | 
| 
       290 
263 
     | 
    
         
             
            {
         
     | 
| 
       291 
264 
     | 
    
         
             
              st_index_t hash;
         
     | 
| 
       292 
265 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -295,19 +268,17 @@ static VALUE method_multi_point_hash(VALUE self) 
     | 
|
| 
       295 
268 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       296 
269 
     | 
    
         
             
              factory = self_data->factory;
         
     | 
| 
       297 
270 
     | 
    
         
             
              hash = rb_hash_start(0);
         
     | 
| 
       298 
     | 
    
         
            -
              hash = rgeo_geos_objbase_hash(factory,
         
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
       300 
     | 
    
         
            -
              hash = rgeo_geos_geometry_collection_hash(self_data->geos_context, self_data->geom, hash);
         
     | 
| 
      
 271 
     | 
    
         
            +
              hash = rgeo_geos_objbase_hash(factory, rgeo_feature_multi_point_module, hash);
         
     | 
| 
      
 272 
     | 
    
         
            +
              hash = rgeo_geos_geometry_collection_hash(self_data->geom, hash);
         
     | 
| 
       301 
273 
     | 
    
         
             
              return LONG2FIX(rb_hash_end(hash));
         
     | 
| 
       302 
274 
     | 
    
         
             
            }
         
     | 
| 
       303 
275 
     | 
    
         | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
      
 276 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 277 
     | 
    
         
            +
            method_multi_point_coordinates(VALUE self)
         
     | 
| 
       306 
278 
     | 
    
         
             
            {
         
     | 
| 
       307 
279 
     | 
    
         
             
              VALUE result = Qnil;
         
     | 
| 
       308 
280 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       309 
281 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       310 
     | 
    
         
            -
              GEOSContextHandle_t context;
         
     | 
| 
       311 
282 
     | 
    
         
             
              const GEOSCoordSequence* coord_sequence;
         
     | 
| 
       312 
283 
     | 
    
         | 
| 
       313 
284 
     | 
    
         
             
              const GEOSGeometry* point;
         
     | 
| 
         @@ -318,23 +289,26 @@ static VALUE method_multi_point_coordinates(VALUE self) 
     | 
|
| 
       318 
289 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       319 
290 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       320 
291 
     | 
    
         | 
| 
       321 
     | 
    
         
            -
              if(self_geom) {
         
     | 
| 
       322 
     | 
    
         
            -
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & 
     | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
             
     | 
| 
      
 292 
     | 
    
         
            +
              if (self_geom) {
         
     | 
| 
      
 293 
     | 
    
         
            +
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags &
         
     | 
| 
      
 294 
     | 
    
         
            +
                              RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M;
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
                count = GEOSGetNumGeometries(self_geom);
         
     | 
| 
       325 
297 
     | 
    
         
             
                result = rb_ary_new2(count);
         
     | 
| 
       326 
     | 
    
         
            -
                for(i = 0; i < count; ++i) {
         
     | 
| 
       327 
     | 
    
         
            -
                  point =  
     | 
| 
       328 
     | 
    
         
            -
                  coord_sequence =  
     | 
| 
       329 
     | 
    
         
            -
                  rb_ary_push(result, 
     | 
| 
      
 298 
     | 
    
         
            +
                for (i = 0; i < count; ++i) {
         
     | 
| 
      
 299 
     | 
    
         
            +
                  point = GEOSGetGeometryN(self_geom, i);
         
     | 
| 
      
 300 
     | 
    
         
            +
                  coord_sequence = GEOSGeom_getCoordSeq(point);
         
     | 
| 
      
 301 
     | 
    
         
            +
                  rb_ary_push(result,
         
     | 
| 
      
 302 
     | 
    
         
            +
                              rb_ary_pop(extract_points_from_coordinate_sequence(
         
     | 
| 
      
 303 
     | 
    
         
            +
                                coord_sequence, zCoordinate)));
         
     | 
| 
       330 
304 
     | 
    
         
             
                }
         
     | 
| 
       331 
305 
     | 
    
         
             
              }
         
     | 
| 
       332 
306 
     | 
    
         | 
| 
       333 
307 
     | 
    
         
             
              return result;
         
     | 
| 
       334 
308 
     | 
    
         
             
            }
         
     | 
| 
       335 
309 
     | 
    
         | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
      
 310 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 311 
     | 
    
         
            +
            method_multi_line_string_geometry_type(VALUE self)
         
     | 
| 
       338 
312 
     | 
    
         
             
            {
         
     | 
| 
       339 
313 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       340 
314 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -342,13 +316,13 @@ static VALUE method_multi_line_string_geometry_type(VALUE self) 
     | 
|
| 
       342 
316 
     | 
    
         
             
              result = Qnil;
         
     | 
| 
       343 
317 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       344 
318 
     | 
    
         
             
              if (self_data->geom) {
         
     | 
| 
       345 
     | 
    
         
            -
                result =  
     | 
| 
      
 319 
     | 
    
         
            +
                result = rgeo_feature_multi_line_string_module;
         
     | 
| 
       346 
320 
     | 
    
         
             
              }
         
     | 
| 
       347 
321 
     | 
    
         
             
              return result;
         
     | 
| 
       348 
322 
     | 
    
         
             
            }
         
     | 
| 
       349 
323 
     | 
    
         | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
      
 324 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 325 
     | 
    
         
            +
            method_multi_line_string_hash(VALUE self)
         
     | 
| 
       352 
326 
     | 
    
         
             
            {
         
     | 
| 
       353 
327 
     | 
    
         
             
              st_index_t hash;
         
     | 
| 
       354 
328 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -357,36 +331,35 @@ static VALUE method_multi_line_string_hash(VALUE self) 
     | 
|
| 
       357 
331 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       358 
332 
     | 
    
         
             
              factory = self_data->factory;
         
     | 
| 
       359 
333 
     | 
    
         
             
              hash = rb_hash_start(0);
         
     | 
| 
       360 
     | 
    
         
            -
              hash = rgeo_geos_objbase_hash( 
     | 
| 
       361 
     | 
    
         
            -
                 
     | 
| 
       362 
     | 
    
         
            -
              hash = rgeo_geos_geometry_collection_hash(self_data-> 
     | 
| 
      
 334 
     | 
    
         
            +
              hash = rgeo_geos_objbase_hash(
         
     | 
| 
      
 335 
     | 
    
         
            +
                factory, rgeo_feature_multi_line_string_module, hash);
         
     | 
| 
      
 336 
     | 
    
         
            +
              hash = rgeo_geos_geometry_collection_hash(self_data->geom, hash);
         
     | 
| 
       363 
337 
     | 
    
         
             
              return LONG2FIX(rb_hash_end(hash));
         
     | 
| 
       364 
338 
     | 
    
         
             
            }
         
     | 
| 
       365 
339 
     | 
    
         | 
| 
       366 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 340 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 341 
     | 
    
         
            +
            method_geometry_collection_node(VALUE self)
         
     | 
| 
       367 
342 
     | 
    
         
             
            {
         
     | 
| 
       368 
343 
     | 
    
         
             
              VALUE result = Qnil;
         
     | 
| 
       369 
344 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       370 
345 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       371 
346 
     | 
    
         
             
              GEOSGeometry* noded;
         
     | 
| 
       372 
     | 
    
         
            -
              GEOSContextHandle_t context;
         
     | 
| 
       373 
347 
     | 
    
         | 
| 
       374 
348 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       375 
349 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       376 
     | 
    
         
            -
              context = self_data->geos_context;
         
     | 
| 
       377 
350 
     | 
    
         | 
| 
       378 
     | 
    
         
            -
              noded =  
     | 
| 
      
 351 
     | 
    
         
            +
              noded = GEOSNode(self_geom);
         
     | 
| 
       379 
352 
     | 
    
         
             
              result = rgeo_wrap_geos_geometry(self_data->factory, noded, Qnil);
         
     | 
| 
       380 
353 
     | 
    
         | 
| 
       381 
354 
     | 
    
         
             
              return result;
         
     | 
| 
       382 
355 
     | 
    
         
             
            }
         
     | 
| 
       383 
356 
     | 
    
         | 
| 
       384 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 357 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 358 
     | 
    
         
            +
            method_multi_line_string_coordinates(VALUE self)
         
     | 
| 
       385 
359 
     | 
    
         
             
            {
         
     | 
| 
       386 
360 
     | 
    
         
             
              VALUE result = Qnil;
         
     | 
| 
       387 
361 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       388 
362 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       389 
     | 
    
         
            -
              GEOSContextHandle_t context;
         
     | 
| 
       390 
363 
     | 
    
         
             
              const GEOSCoordSequence* coord_sequence;
         
     | 
| 
       391 
364 
     | 
    
         | 
| 
       392 
365 
     | 
    
         
             
              const GEOSGeometry* line_string;
         
     | 
| 
         @@ -396,23 +369,26 @@ static VALUE method_multi_line_string_coordinates(VALUE self) 
     | 
|
| 
       396 
369 
     | 
    
         | 
| 
       397 
370 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       398 
371 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       399 
     | 
    
         
            -
             
     | 
| 
       400 
     | 
    
         
            -
              if(self_geom) {
         
     | 
| 
       401 
     | 
    
         
            -
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & 
     | 
| 
       402 
     | 
    
         
            -
             
     | 
| 
       403 
     | 
    
         
            -
                count =  
     | 
| 
      
 372 
     | 
    
         
            +
             
     | 
| 
      
 373 
     | 
    
         
            +
              if (self_geom) {
         
     | 
| 
      
 374 
     | 
    
         
            +
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags &
         
     | 
| 
      
 375 
     | 
    
         
            +
                              RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M;
         
     | 
| 
      
 376 
     | 
    
         
            +
                count = GEOSGetNumGeometries(self_geom);
         
     | 
| 
       404 
377 
     | 
    
         
             
                result = rb_ary_new2(count);
         
     | 
| 
       405 
     | 
    
         
            -
                for(i = 0; i < count; ++i) {
         
     | 
| 
       406 
     | 
    
         
            -
                  line_string =  
     | 
| 
       407 
     | 
    
         
            -
                  coord_sequence =  
     | 
| 
       408 
     | 
    
         
            -
                  rb_ary_push( 
     | 
| 
      
 378 
     | 
    
         
            +
                for (i = 0; i < count; ++i) {
         
     | 
| 
      
 379 
     | 
    
         
            +
                  line_string = GEOSGetGeometryN(self_geom, i);
         
     | 
| 
      
 380 
     | 
    
         
            +
                  coord_sequence = GEOSGeom_getCoordSeq(line_string);
         
     | 
| 
      
 381 
     | 
    
         
            +
                  rb_ary_push(
         
     | 
| 
      
 382 
     | 
    
         
            +
                    result,
         
     | 
| 
      
 383 
     | 
    
         
            +
                    extract_points_from_coordinate_sequence(coord_sequence, zCoordinate));
         
     | 
| 
       409 
384 
     | 
    
         
             
                }
         
     | 
| 
       410 
385 
     | 
    
         
             
              }
         
     | 
| 
       411 
386 
     | 
    
         | 
| 
       412 
387 
     | 
    
         
             
              return result;
         
     | 
| 
       413 
388 
     | 
    
         
             
            }
         
     | 
| 
       414 
389 
     | 
    
         | 
| 
       415 
     | 
    
         
            -
            static VALUE 
     | 
| 
      
 390 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 391 
     | 
    
         
            +
            method_multi_line_string_length(VALUE self)
         
     | 
| 
       416 
392 
     | 
    
         
             
            {
         
     | 
| 
       417 
393 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       418 
394 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -423,20 +399,19 @@ static VALUE method_multi_line_string_length(VALUE self) 
     | 
|
| 
       423 
399 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       424 
400 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       425 
401 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       426 
     | 
    
         
            -
                if ( 
     | 
| 
      
 402 
     | 
    
         
            +
                if (GEOSLength(self_geom, &len)) {
         
     | 
| 
       427 
403 
     | 
    
         
             
                  result = rb_float_new(len);
         
     | 
| 
       428 
404 
     | 
    
         
             
                }
         
     | 
| 
       429 
405 
     | 
    
         
             
              }
         
     | 
| 
       430 
406 
     | 
    
         
             
              return result;
         
     | 
| 
       431 
407 
     | 
    
         
             
            }
         
     | 
| 
       432 
408 
     | 
    
         | 
| 
       433 
     | 
    
         
            -
             
     | 
| 
       434 
     | 
    
         
            -
             
     | 
| 
      
 409 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 410 
     | 
    
         
            +
            method_multi_line_string_is_closed(VALUE self)
         
     | 
| 
       435 
411 
     | 
    
         
             
            {
         
     | 
| 
       436 
412 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       437 
413 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       438 
414 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       439 
     | 
    
         
            -
              GEOSContextHandle_t self_context;
         
     | 
| 
       440 
415 
     | 
    
         
             
              int len;
         
     | 
| 
       441 
416 
     | 
    
         
             
              int i;
         
     | 
| 
       442 
417 
     | 
    
         
             
              const GEOSGeometry* geom;
         
     | 
| 
         @@ -445,14 +420,13 @@ static VALUE method_multi_line_string_is_closed(VALUE self) 
     | 
|
| 
       445 
420 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       446 
421 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       447 
422 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       448 
     | 
    
         
            -
                self_context = self_data->geos_context;
         
     | 
| 
       449 
423 
     | 
    
         
             
                result = Qtrue;
         
     | 
| 
       450 
     | 
    
         
            -
                len =  
     | 
| 
      
 424 
     | 
    
         
            +
                len = GEOSGetNumGeometries(self_geom);
         
     | 
| 
       451 
425 
     | 
    
         
             
                if (len > 0) {
         
     | 
| 
       452 
     | 
    
         
            -
                  for (i=0; i<len; ++i) {
         
     | 
| 
       453 
     | 
    
         
            -
                    geom =  
     | 
| 
      
 426 
     | 
    
         
            +
                  for (i = 0; i < len; ++i) {
         
     | 
| 
      
 427 
     | 
    
         
            +
                    geom = GEOSGetGeometryN(self_geom, i);
         
     | 
| 
       454 
428 
     | 
    
         
             
                    if (geom) {
         
     | 
| 
       455 
     | 
    
         
            -
                      result = rgeo_is_geos_line_string_closed( 
     | 
| 
      
 429 
     | 
    
         
            +
                      result = rgeo_is_geos_line_string_closed(self_geom);
         
     | 
| 
       456 
430 
     | 
    
         
             
                      if (result != Qtrue) {
         
     | 
| 
       457 
431 
     | 
    
         
             
                        break;
         
     | 
| 
       458 
432 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -463,8 +437,8 @@ static VALUE method_multi_line_string_is_closed(VALUE self) 
     | 
|
| 
       463 
437 
     | 
    
         
             
              return result;
         
     | 
| 
       464 
438 
     | 
    
         
             
            }
         
     | 
| 
       465 
439 
     | 
    
         | 
| 
       466 
     | 
    
         
            -
             
     | 
| 
       467 
     | 
    
         
            -
             
     | 
| 
      
 440 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 441 
     | 
    
         
            +
            method_multi_polygon_geometry_type(VALUE self)
         
     | 
| 
       468 
442 
     | 
    
         
             
            {
         
     | 
| 
       469 
443 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       470 
444 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -472,13 +446,13 @@ static VALUE method_multi_polygon_geometry_type(VALUE self) 
     | 
|
| 
       472 
446 
     | 
    
         
             
              result = Qnil;
         
     | 
| 
       473 
447 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       474 
448 
     | 
    
         
             
              if (self_data->geom) {
         
     | 
| 
       475 
     | 
    
         
            -
                result =  
     | 
| 
      
 449 
     | 
    
         
            +
                result = rgeo_feature_multi_polygon_module;
         
     | 
| 
       476 
450 
     | 
    
         
             
              }
         
     | 
| 
       477 
451 
     | 
    
         
             
              return result;
         
     | 
| 
       478 
452 
     | 
    
         
             
            }
         
     | 
| 
       479 
453 
     | 
    
         | 
| 
       480 
     | 
    
         
            -
             
     | 
| 
       481 
     | 
    
         
            -
             
     | 
| 
      
 454 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 455 
     | 
    
         
            +
            method_multi_polygon_hash(VALUE self)
         
     | 
| 
       482 
456 
     | 
    
         
             
            {
         
     | 
| 
       483 
457 
     | 
    
         
             
              st_index_t hash;
         
     | 
| 
       484 
458 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -487,19 +461,18 @@ static VALUE method_multi_polygon_hash(VALUE self) 
     | 
|
| 
       487 
461 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       488 
462 
     | 
    
         
             
              factory = self_data->factory;
         
     | 
| 
       489 
463 
     | 
    
         
             
              hash = rb_hash_start(0);
         
     | 
| 
       490 
     | 
    
         
            -
              hash = 
     | 
| 
       491 
     | 
    
         
            -
                 
     | 
| 
       492 
     | 
    
         
            -
              hash = rgeo_geos_geometry_collection_hash(self_data-> 
     | 
| 
      
 464 
     | 
    
         
            +
              hash =
         
     | 
| 
      
 465 
     | 
    
         
            +
                rgeo_geos_objbase_hash(factory, rgeo_feature_multi_polygon_module, hash);
         
     | 
| 
      
 466 
     | 
    
         
            +
              hash = rgeo_geos_geometry_collection_hash(self_data->geom, hash);
         
     | 
| 
       493 
467 
     | 
    
         
             
              return LONG2FIX(rb_hash_end(hash));
         
     | 
| 
       494 
468 
     | 
    
         
             
            }
         
     | 
| 
       495 
469 
     | 
    
         | 
| 
       496 
     | 
    
         
            -
             
     | 
| 
       497 
     | 
    
         
            -
             
     | 
| 
      
 470 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 471 
     | 
    
         
            +
            method_multi_polygon_coordinates(VALUE self)
         
     | 
| 
       498 
472 
     | 
    
         
             
            {
         
     | 
| 
       499 
473 
     | 
    
         
             
              VALUE result = Qnil;
         
     | 
| 
       500 
474 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
       501 
475 
     | 
    
         
             
              const GEOSGeometry* self_geom;
         
     | 
| 
       502 
     | 
    
         
            -
              GEOSContextHandle_t context;
         
     | 
| 
       503 
476 
     | 
    
         | 
| 
       504 
477 
     | 
    
         
             
              const GEOSGeometry* poly;
         
     | 
| 
       505 
478 
     | 
    
         
             
              unsigned int count;
         
     | 
| 
         @@ -508,23 +481,23 @@ static VALUE method_multi_polygon_coordinates(VALUE self) 
     | 
|
| 
       508 
481 
     | 
    
         | 
| 
       509 
482 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       510 
483 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       511 
     | 
    
         
            -
             
     | 
| 
       512 
     | 
    
         
            -
              if(self_geom) {
         
     | 
| 
       513 
     | 
    
         
            -
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & 
     | 
| 
       514 
     | 
    
         
            -
             
     | 
| 
       515 
     | 
    
         
            -
                count =  
     | 
| 
      
 484 
     | 
    
         
            +
             
     | 
| 
      
 485 
     | 
    
         
            +
              if (self_geom) {
         
     | 
| 
      
 486 
     | 
    
         
            +
                zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags &
         
     | 
| 
      
 487 
     | 
    
         
            +
                              RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M;
         
     | 
| 
      
 488 
     | 
    
         
            +
                count = GEOSGetNumGeometries(self_geom);
         
     | 
| 
       516 
489 
     | 
    
         
             
                result = rb_ary_new2(count);
         
     | 
| 
       517 
     | 
    
         
            -
                for(i = 0; i < count; ++i) {
         
     | 
| 
       518 
     | 
    
         
            -
                  poly =  
     | 
| 
       519 
     | 
    
         
            -
                  rb_ary_push(result, extract_points_from_polygon( 
     | 
| 
      
 490 
     | 
    
         
            +
                for (i = 0; i < count; ++i) {
         
     | 
| 
      
 491 
     | 
    
         
            +
                  poly = GEOSGetGeometryN(self_geom, i);
         
     | 
| 
      
 492 
     | 
    
         
            +
                  rb_ary_push(result, extract_points_from_polygon(poly, zCoordinate));
         
     | 
| 
       520 
493 
     | 
    
         
             
                }
         
     | 
| 
       521 
494 
     | 
    
         
             
              }
         
     | 
| 
       522 
495 
     | 
    
         | 
| 
       523 
496 
     | 
    
         
             
              return result;
         
     | 
| 
       524 
497 
     | 
    
         
             
            }
         
     | 
| 
       525 
498 
     | 
    
         | 
| 
       526 
     | 
    
         
            -
             
     | 
| 
       527 
     | 
    
         
            -
             
     | 
| 
      
 499 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 500 
     | 
    
         
            +
            method_multi_polygon_area(VALUE self)
         
     | 
| 
       528 
501 
     | 
    
         
             
            {
         
     | 
| 
       529 
502 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       530 
503 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -535,15 +508,15 @@ static VALUE method_multi_polygon_area(VALUE self) 
     | 
|
| 
       535 
508 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       536 
509 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       537 
510 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       538 
     | 
    
         
            -
                if ( 
     | 
| 
      
 511 
     | 
    
         
            +
                if (GEOSArea(self_geom, &area)) {
         
     | 
| 
       539 
512 
     | 
    
         
             
                  result = rb_float_new(area);
         
     | 
| 
       540 
513 
     | 
    
         
             
                }
         
     | 
| 
       541 
514 
     | 
    
         
             
              }
         
     | 
| 
       542 
515 
     | 
    
         
             
              return result;
         
     | 
| 
       543 
516 
     | 
    
         
             
            }
         
     | 
| 
       544 
517 
     | 
    
         | 
| 
       545 
     | 
    
         
            -
             
     | 
| 
       546 
     | 
    
         
            -
             
     | 
| 
      
 518 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 519 
     | 
    
         
            +
            method_multi_polygon_centroid(VALUE self)
         
     | 
| 
       547 
520 
     | 
    
         
             
            {
         
     | 
| 
       548 
521 
     | 
    
         
             
              VALUE result;
         
     | 
| 
       549 
522 
     | 
    
         
             
              RGeo_GeometryData* self_data;
         
     | 
| 
         @@ -553,40 +526,42 @@ static VALUE method_multi_polygon_centroid(VALUE self) 
     | 
|
| 
       553 
526 
     | 
    
         
             
              self_data = RGEO_GEOMETRY_DATA_PTR(self);
         
     | 
| 
       554 
527 
     | 
    
         
             
              self_geom = self_data->geom;
         
     | 
| 
       555 
528 
     | 
    
         
             
              if (self_geom) {
         
     | 
| 
       556 
     | 
    
         
            -
                result = rgeo_wrap_geos_geometry( 
     | 
| 
      
 529 
     | 
    
         
            +
                result = rgeo_wrap_geos_geometry(
         
     | 
| 
      
 530 
     | 
    
         
            +
                  self_data->factory, GEOSGetCentroid(self_geom), Qnil);
         
     | 
| 
       557 
531 
     | 
    
         
             
              }
         
     | 
| 
       558 
532 
     | 
    
         
             
              return result;
         
     | 
| 
       559 
533 
     | 
    
         
             
            }
         
     | 
| 
       560 
534 
     | 
    
         | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
       562 
     | 
    
         
            -
             
     | 
| 
      
 535 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 536 
     | 
    
         
            +
            cmethod_geometry_collection_create(VALUE module, VALUE factory, VALUE array)
         
     | 
| 
       563 
537 
     | 
    
         
             
            {
         
     | 
| 
       564 
     | 
    
         
            -
              return create_geometry_collection( 
     | 
| 
      
 538 
     | 
    
         
            +
              return create_geometry_collection(
         
     | 
| 
      
 539 
     | 
    
         
            +
                module, GEOS_GEOMETRYCOLLECTION, factory, array);
         
     | 
| 
       565 
540 
     | 
    
         
             
            }
         
     | 
| 
       566 
541 
     | 
    
         | 
| 
       567 
     | 
    
         
            -
             
     | 
| 
       568 
     | 
    
         
            -
             
     | 
| 
      
 542 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 543 
     | 
    
         
            +
            cmethod_multi_point_create(VALUE module, VALUE factory, VALUE array)
         
     | 
| 
       569 
544 
     | 
    
         
             
            {
         
     | 
| 
       570 
545 
     | 
    
         
             
              return create_geometry_collection(module, GEOS_MULTIPOINT, factory, array);
         
     | 
| 
       571 
546 
     | 
    
         
             
            }
         
     | 
| 
       572 
547 
     | 
    
         | 
| 
       573 
     | 
    
         
            -
             
     | 
| 
       574 
     | 
    
         
            -
             
     | 
| 
      
 548 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 549 
     | 
    
         
            +
            cmethod_multi_line_string_create(VALUE module, VALUE factory, VALUE array)
         
     | 
| 
       575 
550 
     | 
    
         
             
            {
         
     | 
| 
       576 
     | 
    
         
            -
              return create_geometry_collection( 
     | 
| 
      
 551 
     | 
    
         
            +
              return create_geometry_collection(
         
     | 
| 
      
 552 
     | 
    
         
            +
                module, GEOS_MULTILINESTRING, factory, array);
         
     | 
| 
       577 
553 
     | 
    
         
             
            }
         
     | 
| 
       578 
554 
     | 
    
         | 
| 
       579 
     | 
    
         
            -
             
     | 
| 
       580 
     | 
    
         
            -
             
     | 
| 
      
 555 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 556 
     | 
    
         
            +
            cmethod_multi_polygon_create(VALUE module, VALUE factory, VALUE array)
         
     | 
| 
       581 
557 
     | 
    
         
             
            {
         
     | 
| 
       582 
558 
     | 
    
         
             
              return create_geometry_collection(module, GEOS_MULTIPOLYGON, factory, array);
         
     | 
| 
       583 
559 
     | 
    
         
             
            }
         
     | 
| 
       584 
560 
     | 
    
         | 
| 
       585 
     | 
    
         
            -
             
     | 
| 
       586 
561 
     | 
    
         
             
            /**** INITIALIZATION FUNCTION ****/
         
     | 
| 
       587 
562 
     | 
    
         | 
| 
       588 
     | 
    
         
            -
             
     | 
| 
       589 
     | 
    
         
            -
             
     | 
| 
      
 563 
     | 
    
         
            +
            void
         
     | 
| 
      
 564 
     | 
    
         
            +
            rgeo_init_geos_geometry_collection()
         
     | 
| 
       590 
565 
     | 
    
         
             
            {
         
     | 
| 
       591 
566 
     | 
    
         
             
              VALUE geos_geometry_collection_methods;
         
     | 
| 
       592 
567 
     | 
    
         
             
              VALUE geos_multi_point_methods;
         
     | 
| 
         @@ -594,127 +569,120 @@ void rgeo_init_geos_geometry_collection(RGeo_Globals* globals) 
     | 
|
| 
       594 
569 
     | 
    
         
             
              VALUE geos_multi_polygon_methods;
         
     | 
| 
       595 
570 
     | 
    
         | 
| 
       596 
571 
     | 
    
         
             
              // Class methods for geometry collection classes
         
     | 
| 
       597 
     | 
    
         
            -
              rb_define_module_function( 
     | 
| 
       598 
     | 
    
         
            -
             
     | 
| 
       599 
     | 
    
         
            -
             
     | 
| 
       600 
     | 
    
         
            -
             
     | 
| 
      
 572 
     | 
    
         
            +
              rb_define_module_function(rgeo_geos_geometry_collection_class,
         
     | 
| 
      
 573 
     | 
    
         
            +
                                        "create",
         
     | 
| 
      
 574 
     | 
    
         
            +
                                        cmethod_geometry_collection_create,
         
     | 
| 
      
 575 
     | 
    
         
            +
                                        2);
         
     | 
| 
      
 576 
     | 
    
         
            +
              rb_define_module_function(
         
     | 
| 
      
 577 
     | 
    
         
            +
                rgeo_geos_multi_point_class, "create", cmethod_multi_point_create, 2);
         
     | 
| 
      
 578 
     | 
    
         
            +
              rb_define_module_function(rgeo_geos_multi_line_string_class,
         
     | 
| 
      
 579 
     | 
    
         
            +
                                        "create",
         
     | 
| 
      
 580 
     | 
    
         
            +
                                        cmethod_multi_line_string_create,
         
     | 
| 
      
 581 
     | 
    
         
            +
                                        2);
         
     | 
| 
      
 582 
     | 
    
         
            +
              rb_define_module_function(
         
     | 
| 
      
 583 
     | 
    
         
            +
                rgeo_geos_multi_polygon_class, "create", cmethod_multi_polygon_create, 2);
         
     | 
| 
       601 
584 
     | 
    
         | 
| 
       602 
585 
     | 
    
         
             
              // Methods for GeometryCollectionImpl
         
     | 
| 
       603 
     | 
    
         
            -
              geos_geometry_collection_methods = 
     | 
| 
       604 
     | 
    
         
            -
             
     | 
| 
       605 
     | 
    
         
            -
              rb_define_method(geos_geometry_collection_methods, 
     | 
| 
       606 
     | 
    
         
            -
             
     | 
| 
       607 
     | 
    
         
            -
             
     | 
| 
       608 
     | 
    
         
            -
             
     | 
| 
       609 
     | 
    
         
            -
              rb_define_method(geos_geometry_collection_methods, 
     | 
| 
       610 
     | 
    
         
            -
             
     | 
| 
       611 
     | 
    
         
            -
             
     | 
| 
       612 
     | 
    
         
            -
             
     | 
| 
       613 
     | 
    
         
            -
              rb_define_method(geos_geometry_collection_methods, 
     | 
| 
       614 
     | 
    
         
            -
             
     | 
| 
      
 586 
     | 
    
         
            +
              geos_geometry_collection_methods =
         
     | 
| 
      
 587 
     | 
    
         
            +
                rb_define_module_under(rgeo_geos_module, "CAPIGeometryCollectionMethods");
         
     | 
| 
      
 588 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 589 
     | 
    
         
            +
                               "rep_equals?",
         
     | 
| 
      
 590 
     | 
    
         
            +
                               method_geometry_collection_eql,
         
     | 
| 
      
 591 
     | 
    
         
            +
                               1);
         
     | 
| 
      
 592 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 593 
     | 
    
         
            +
                               "eql?",
         
     | 
| 
      
 594 
     | 
    
         
            +
                               method_geometry_collection_eql,
         
     | 
| 
      
 595 
     | 
    
         
            +
                               1);
         
     | 
| 
      
 596 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 597 
     | 
    
         
            +
                               "hash",
         
     | 
| 
      
 598 
     | 
    
         
            +
                               method_geometry_collection_hash,
         
     | 
| 
      
 599 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 600 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 601 
     | 
    
         
            +
                               "geometry_type",
         
     | 
| 
      
 602 
     | 
    
         
            +
                               method_geometry_collection_geometry_type,
         
     | 
| 
      
 603 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 604 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 605 
     | 
    
         
            +
                               "num_geometries",
         
     | 
| 
      
 606 
     | 
    
         
            +
                               method_geometry_collection_num_geometries,
         
     | 
| 
      
 607 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 608 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 609 
     | 
    
         
            +
                               "size",
         
     | 
| 
      
 610 
     | 
    
         
            +
                               method_geometry_collection_num_geometries,
         
     | 
| 
      
 611 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 612 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 613 
     | 
    
         
            +
                               "geometry_n",
         
     | 
| 
      
 614 
     | 
    
         
            +
                               method_geometry_collection_geometry_n,
         
     | 
| 
      
 615 
     | 
    
         
            +
                               1);
         
     | 
| 
      
 616 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 617 
     | 
    
         
            +
                               "[]",
         
     | 
| 
      
 618 
     | 
    
         
            +
                               method_geometry_collection_brackets,
         
     | 
| 
      
 619 
     | 
    
         
            +
                               1);
         
     | 
| 
      
 620 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 621 
     | 
    
         
            +
                               "each",
         
     | 
| 
      
 622 
     | 
    
         
            +
                               method_geometry_collection_each,
         
     | 
| 
      
 623 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 624 
     | 
    
         
            +
              rb_define_method(geos_geometry_collection_methods,
         
     | 
| 
      
 625 
     | 
    
         
            +
                               "node",
         
     | 
| 
      
 626 
     | 
    
         
            +
                               method_geometry_collection_node,
         
     | 
| 
      
 627 
     | 
    
         
            +
                               0);
         
     | 
| 
       615 
628 
     | 
    
         | 
| 
       616 
629 
     | 
    
         
             
              // Methods for MultiPointImpl
         
     | 
| 
       617 
     | 
    
         
            -
              geos_multi_point_methods = 
     | 
| 
       618 
     | 
    
         
            -
             
     | 
| 
       619 
     | 
    
         
            -
              rb_define_method(geos_multi_point_methods, 
     | 
| 
       620 
     | 
    
         
            -
             
     | 
| 
      
 630 
     | 
    
         
            +
              geos_multi_point_methods =
         
     | 
| 
      
 631 
     | 
    
         
            +
                rb_define_module_under(rgeo_geos_module, "CAPIMultiPointMethods");
         
     | 
| 
      
 632 
     | 
    
         
            +
              rb_define_method(geos_multi_point_methods,
         
     | 
| 
      
 633 
     | 
    
         
            +
                               "geometry_type",
         
     | 
| 
      
 634 
     | 
    
         
            +
                               method_multi_point_geometry_type,
         
     | 
| 
      
 635 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 636 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 637 
     | 
    
         
            +
                geos_multi_point_methods, "hash", method_multi_point_hash, 0);
         
     | 
| 
      
 638 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 639 
     | 
    
         
            +
                geos_multi_point_methods, "coordinates", method_multi_point_coordinates, 0);
         
     | 
| 
       621 
640 
     | 
    
         | 
| 
       622 
641 
     | 
    
         
             
              // Methods for MultiLineStringImpl
         
     | 
| 
       623 
     | 
    
         
            -
              geos_multi_line_string_methods = 
     | 
| 
       624 
     | 
    
         
            -
             
     | 
| 
       625 
     | 
    
         
            -
              rb_define_method(geos_multi_line_string_methods, 
     | 
| 
       626 
     | 
    
         
            -
             
     | 
| 
       627 
     | 
    
         
            -
             
     | 
| 
       628 
     | 
    
         
            -
             
     | 
| 
      
 642 
     | 
    
         
            +
              geos_multi_line_string_methods =
         
     | 
| 
      
 643 
     | 
    
         
            +
                rb_define_module_under(rgeo_geos_module, "CAPIMultiLineStringMethods");
         
     | 
| 
      
 644 
     | 
    
         
            +
              rb_define_method(geos_multi_line_string_methods,
         
     | 
| 
      
 645 
     | 
    
         
            +
                               "geometry_type",
         
     | 
| 
      
 646 
     | 
    
         
            +
                               method_multi_line_string_geometry_type,
         
     | 
| 
      
 647 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 648 
     | 
    
         
            +
              rb_define_method(geos_multi_line_string_methods,
         
     | 
| 
      
 649 
     | 
    
         
            +
                               "length",
         
     | 
| 
      
 650 
     | 
    
         
            +
                               method_multi_line_string_length,
         
     | 
| 
      
 651 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 652 
     | 
    
         
            +
              rb_define_method(geos_multi_line_string_methods,
         
     | 
| 
      
 653 
     | 
    
         
            +
                               "closed?",
         
     | 
| 
      
 654 
     | 
    
         
            +
                               method_multi_line_string_is_closed,
         
     | 
| 
      
 655 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 656 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 657 
     | 
    
         
            +
                geos_multi_line_string_methods, "hash", method_multi_line_string_hash, 0);
         
     | 
| 
      
 658 
     | 
    
         
            +
              rb_define_method(geos_multi_line_string_methods,
         
     | 
| 
      
 659 
     | 
    
         
            +
                               "coordinates",
         
     | 
| 
      
 660 
     | 
    
         
            +
                               method_multi_line_string_coordinates,
         
     | 
| 
      
 661 
     | 
    
         
            +
                               0);
         
     | 
| 
       629 
662 
     | 
    
         | 
| 
       630 
663 
     | 
    
         
             
              // Methods for MultiPolygonImpl
         
     | 
| 
       631 
     | 
    
         
            -
              geos_multi_polygon_methods = 
     | 
| 
       632 
     | 
    
         
            -
             
     | 
| 
       633 
     | 
    
         
            -
              rb_define_method(geos_multi_polygon_methods, 
     | 
| 
       634 
     | 
    
         
            -
             
     | 
| 
       635 
     | 
    
         
            -
             
     | 
| 
       636 
     | 
    
         
            -
             
     | 
| 
      
 664 
     | 
    
         
            +
              geos_multi_polygon_methods =
         
     | 
| 
      
 665 
     | 
    
         
            +
                rb_define_module_under(rgeo_geos_module, "CAPIMultiPolygonMethods");
         
     | 
| 
      
 666 
     | 
    
         
            +
              rb_define_method(geos_multi_polygon_methods,
         
     | 
| 
      
 667 
     | 
    
         
            +
                               "geometry_type",
         
     | 
| 
      
 668 
     | 
    
         
            +
                               method_multi_polygon_geometry_type,
         
     | 
| 
      
 669 
     | 
    
         
            +
                               0);
         
     | 
| 
      
 670 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 671 
     | 
    
         
            +
                geos_multi_polygon_methods, "area", method_multi_polygon_area, 0);
         
     | 
| 
      
 672 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 673 
     | 
    
         
            +
                geos_multi_polygon_methods, "centroid", method_multi_polygon_centroid, 0);
         
     | 
| 
      
 674 
     | 
    
         
            +
              rb_define_method(
         
     | 
| 
      
 675 
     | 
    
         
            +
                geos_multi_polygon_methods, "hash", method_multi_polygon_hash, 0);
         
     | 
| 
      
 676 
     | 
    
         
            +
              rb_define_method(geos_multi_polygon_methods,
         
     | 
| 
      
 677 
     | 
    
         
            +
                               "coordinates",
         
     | 
| 
      
 678 
     | 
    
         
            +
                               method_multi_polygon_coordinates,
         
     | 
| 
      
 679 
     | 
    
         
            +
                               0);
         
     | 
| 
       637 
680 
     | 
    
         
             
            }
         
     | 
| 
       638 
681 
     | 
    
         | 
| 
       639 
     | 
    
         
            -
             
     | 
| 
       640 
682 
     | 
    
         
             
            /**** OTHER PUBLIC FUNCTIONS ****/
         
     | 
| 
       641 
683 
     | 
    
         | 
| 
       642 
     | 
    
         
            -
             
     | 
| 
       643 
     | 
    
         
            -
             
     | 
| 
       644 
     | 
    
         
            -
            {
         
     | 
| 
       645 
     | 
    
         
            -
              VALUE result;
         
     | 
| 
       646 
     | 
    
         
            -
              int len1;
         
     | 
| 
       647 
     | 
    
         
            -
              int len2;
         
     | 
| 
       648 
     | 
    
         
            -
              int i;
         
     | 
| 
       649 
     | 
    
         
            -
              const GEOSGeometry* sub_geom1;
         
     | 
| 
       650 
     | 
    
         
            -
              const GEOSGeometry* sub_geom2;
         
     | 
| 
       651 
     | 
    
         
            -
              int type1;
         
     | 
| 
       652 
     | 
    
         
            -
              int type2;
         
     | 
| 
       653 
     | 
    
         
            -
             
     | 
| 
       654 
     | 
    
         
            -
              result = Qnil;
         
     | 
| 
       655 
     | 
    
         
            -
              if (geom1 && geom2) {
         
     | 
| 
       656 
     | 
    
         
            -
                len1 = GEOSGetNumGeometries_r(context, geom1);
         
     | 
| 
       657 
     | 
    
         
            -
                len2 = GEOSGetNumGeometries_r(context, geom2);
         
     | 
| 
       658 
     | 
    
         
            -
                if (len1 >= 0 && len2 >= 0) {
         
     | 
| 
       659 
     | 
    
         
            -
                  if (len1 == len2) {
         
     | 
| 
       660 
     | 
    
         
            -
                    result = Qtrue;
         
     | 
| 
       661 
     | 
    
         
            -
                    for (i=0; i<len1; ++i) {
         
     | 
| 
       662 
     | 
    
         
            -
                      sub_geom1 = GEOSGetGeometryN_r(context, geom1, i);
         
     | 
| 
       663 
     | 
    
         
            -
                      sub_geom2 = GEOSGetGeometryN_r(context, geom2, i);
         
     | 
| 
       664 
     | 
    
         
            -
                      if (sub_geom1 && sub_geom2) {
         
     | 
| 
       665 
     | 
    
         
            -
                        type1 = GEOSGeomTypeId_r(context, sub_geom1);
         
     | 
| 
       666 
     | 
    
         
            -
                        type2 = GEOSGeomTypeId_r(context, sub_geom2);
         
     | 
| 
       667 
     | 
    
         
            -
                        if (type1 >= 0 && type2 >= 0) {
         
     | 
| 
       668 
     | 
    
         
            -
                          if (type1 == type2) {
         
     | 
| 
       669 
     | 
    
         
            -
                            switch (type1) {
         
     | 
| 
       670 
     | 
    
         
            -
                            case GEOS_POINT:
         
     | 
| 
       671 
     | 
    
         
            -
                            case GEOS_LINESTRING:
         
     | 
| 
       672 
     | 
    
         
            -
                            case GEOS_LINEARRING:
         
     | 
| 
       673 
     | 
    
         
            -
                              result = rgeo_geos_coordseqs_eql(context, sub_geom1, sub_geom2, check_z);
         
     | 
| 
       674 
     | 
    
         
            -
                              break;
         
     | 
| 
       675 
     | 
    
         
            -
                            case GEOS_POLYGON:
         
     | 
| 
       676 
     | 
    
         
            -
                              result = rgeo_geos_polygons_eql(context, sub_geom1, sub_geom2, check_z);
         
     | 
| 
       677 
     | 
    
         
            -
                              break;
         
     | 
| 
       678 
     | 
    
         
            -
                            case GEOS_GEOMETRYCOLLECTION:
         
     | 
| 
       679 
     | 
    
         
            -
                            case GEOS_MULTIPOINT:
         
     | 
| 
       680 
     | 
    
         
            -
                            case GEOS_MULTILINESTRING:
         
     | 
| 
       681 
     | 
    
         
            -
                            case GEOS_MULTIPOLYGON:
         
     | 
| 
       682 
     | 
    
         
            -
                              result = rgeo_geos_geometry_collections_eql(context, sub_geom1, sub_geom2, check_z);
         
     | 
| 
       683 
     | 
    
         
            -
                              break;
         
     | 
| 
       684 
     | 
    
         
            -
                            default:
         
     | 
| 
       685 
     | 
    
         
            -
                              result = Qnil;
         
     | 
| 
       686 
     | 
    
         
            -
                              break;
         
     | 
| 
       687 
     | 
    
         
            -
                            }
         
     | 
| 
       688 
     | 
    
         
            -
                            if (!RTEST(result)) {
         
     | 
| 
       689 
     | 
    
         
            -
                              break;
         
     | 
| 
       690 
     | 
    
         
            -
                            }
         
     | 
| 
       691 
     | 
    
         
            -
                          }
         
     | 
| 
       692 
     | 
    
         
            -
                          else {
         
     | 
| 
       693 
     | 
    
         
            -
                            result = Qfalse;
         
     | 
| 
       694 
     | 
    
         
            -
                            break;
         
     | 
| 
       695 
     | 
    
         
            -
                          }
         
     | 
| 
       696 
     | 
    
         
            -
                        }
         
     | 
| 
       697 
     | 
    
         
            -
                        else {
         
     | 
| 
       698 
     | 
    
         
            -
                          result = Qnil;
         
     | 
| 
       699 
     | 
    
         
            -
                          break;
         
     | 
| 
       700 
     | 
    
         
            -
                        }
         
     | 
| 
       701 
     | 
    
         
            -
                      }
         
     | 
| 
       702 
     | 
    
         
            -
                      else {
         
     | 
| 
       703 
     | 
    
         
            -
                        result = Qnil;
         
     | 
| 
       704 
     | 
    
         
            -
                        break;
         
     | 
| 
       705 
     | 
    
         
            -
                      }
         
     | 
| 
       706 
     | 
    
         
            -
                    }
         
     | 
| 
       707 
     | 
    
         
            -
                  }
         
     | 
| 
       708 
     | 
    
         
            -
                  else {
         
     | 
| 
       709 
     | 
    
         
            -
                    result = Qfalse;
         
     | 
| 
       710 
     | 
    
         
            -
                  }
         
     | 
| 
       711 
     | 
    
         
            -
                }
         
     | 
| 
       712 
     | 
    
         
            -
              }
         
     | 
| 
       713 
     | 
    
         
            -
              return result;
         
     | 
| 
       714 
     | 
    
         
            -
            }
         
     | 
| 
       715 
     | 
    
         
            -
             
     | 
| 
       716 
     | 
    
         
            -
             
     | 
| 
       717 
     | 
    
         
            -
            st_index_t rgeo_geos_geometry_collection_hash(GEOSContextHandle_t context, const GEOSGeometry* geom, st_index_t hash)
         
     | 
| 
      
 684 
     | 
    
         
            +
            st_index_t
         
     | 
| 
      
 685 
     | 
    
         
            +
            rgeo_geos_geometry_collection_hash(const GEOSGeometry* geom, st_index_t hash)
         
     | 
| 
       718 
686 
     | 
    
         
             
            {
         
     | 
| 
       719 
687 
     | 
    
         
             
              const GEOSGeometry* sub_geom;
         
     | 
| 
       720 
688 
     | 
    
         
             
              int type;
         
     | 
| 
         @@ -722,28 +690,28 @@ st_index_t rgeo_geos_geometry_collection_hash(GEOSContextHandle_t context, const 
     | 
|
| 
       722 
690 
     | 
    
         
             
              unsigned int i;
         
     | 
| 
       723 
691 
     | 
    
         | 
| 
       724 
692 
     | 
    
         
             
              if (geom) {
         
     | 
| 
       725 
     | 
    
         
            -
                len =  
     | 
| 
       726 
     | 
    
         
            -
                for (i=0; i<len; ++i) {
         
     | 
| 
       727 
     | 
    
         
            -
                  sub_geom =  
     | 
| 
      
 693 
     | 
    
         
            +
                len = GEOSGetNumGeometries(geom);
         
     | 
| 
      
 694 
     | 
    
         
            +
                for (i = 0; i < len; ++i) {
         
     | 
| 
      
 695 
     | 
    
         
            +
                  sub_geom = GEOSGetGeometryN(geom, i);
         
     | 
| 
       728 
696 
     | 
    
         
             
                  if (sub_geom) {
         
     | 
| 
       729 
     | 
    
         
            -
                    type =  
     | 
| 
      
 697 
     | 
    
         
            +
                    type = GEOSGeomTypeId(sub_geom);
         
     | 
| 
       730 
698 
     | 
    
         
             
                    if (type >= 0) {
         
     | 
| 
       731 
699 
     | 
    
         
             
                      hash = hash ^ type;
         
     | 
| 
       732 
700 
     | 
    
         
             
                      switch (type) {
         
     | 
| 
       733 
     | 
    
         
            -
             
     | 
| 
       734 
     | 
    
         
            -
             
     | 
| 
       735 
     | 
    
         
            -
             
     | 
| 
       736 
     | 
    
         
            -
             
     | 
| 
       737 
     | 
    
         
            -
             
     | 
| 
       738 
     | 
    
         
            -
             
     | 
| 
       739 
     | 
    
         
            -
             
     | 
| 
       740 
     | 
    
         
            -
             
     | 
| 
       741 
     | 
    
         
            -
             
     | 
| 
       742 
     | 
    
         
            -
             
     | 
| 
       743 
     | 
    
         
            -
             
     | 
| 
       744 
     | 
    
         
            -
             
     | 
| 
       745 
     | 
    
         
            -
             
     | 
| 
       746 
     | 
    
         
            -
             
     | 
| 
      
 701 
     | 
    
         
            +
                        case GEOS_POINT:
         
     | 
| 
      
 702 
     | 
    
         
            +
                        case GEOS_LINESTRING:
         
     | 
| 
      
 703 
     | 
    
         
            +
                        case GEOS_LINEARRING:
         
     | 
| 
      
 704 
     | 
    
         
            +
                          hash = rgeo_geos_coordseq_hash(sub_geom, hash);
         
     | 
| 
      
 705 
     | 
    
         
            +
                          break;
         
     | 
| 
      
 706 
     | 
    
         
            +
                        case GEOS_POLYGON:
         
     | 
| 
      
 707 
     | 
    
         
            +
                          hash = rgeo_geos_polygon_hash(sub_geom, hash);
         
     | 
| 
      
 708 
     | 
    
         
            +
                          break;
         
     | 
| 
      
 709 
     | 
    
         
            +
                        case GEOS_GEOMETRYCOLLECTION:
         
     | 
| 
      
 710 
     | 
    
         
            +
                        case GEOS_MULTIPOINT:
         
     | 
| 
      
 711 
     | 
    
         
            +
                        case GEOS_MULTILINESTRING:
         
     | 
| 
      
 712 
     | 
    
         
            +
                        case GEOS_MULTIPOLYGON:
         
     | 
| 
      
 713 
     | 
    
         
            +
                          hash = rgeo_geos_geometry_collection_hash(sub_geom, hash);
         
     | 
| 
      
 714 
     | 
    
         
            +
                          break;
         
     | 
| 
       747 
715 
     | 
    
         
             
                      }
         
     | 
| 
       748 
716 
     | 
    
         
             
                    }
         
     | 
| 
       749 
717 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -752,7 +720,6 @@ st_index_t rgeo_geos_geometry_collection_hash(GEOSContextHandle_t context, const 
     | 
|
| 
       752 
720 
     | 
    
         
             
              return hash;
         
     | 
| 
       753 
721 
     | 
    
         
             
            }
         
     | 
| 
       754 
722 
     | 
    
         | 
| 
       755 
     | 
    
         
            -
             
     | 
| 
       756 
723 
     | 
    
         
             
            RGEO_END_C
         
     | 
| 
       757 
724 
     | 
    
         | 
| 
       758 
725 
     | 
    
         
             
            #endif
         
     |