Method: RGeo::Geos::CAPIGeometryMethods#intersection

Defined in:
ext/geos_c_impl/geometry.c

#intersection(rhs) ⇒ Object


851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
# File 'ext/geos_c_impl/geometry.c', line 851

static VALUE
method_geometry_intersection(VALUE self, VALUE rhs)
{
  VALUE result;
  RGeo_GeometryData* self_data;
  const GEOSGeometry* self_geom;
  VALUE factory;
  const GEOSGeometry* rhs_geom;
  int state = 0;

  result = Qnil;
  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  self_geom = self_data->geom;
  if (self_geom) {
    factory = self_data->factory;
    rhs_geom = rgeo_convert_to_geos_geometry(factory, rhs, Qnil, &state);
    if (state) {
      rb_jump_tag(state);
    }

    result = rgeo_wrap_geos_geometry(
      factory, GEOSIntersection(self_geom, rhs_geom), Qnil);
  }
  return result;
}