Method: RGeo::Geos::CAPIGeometryMethods#difference

Defined in:
ext/geos_c_impl/geometry.c

#difference(rhs) ⇒ Object



921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
# File 'ext/geos_c_impl/geometry.c', line 921

static VALUE
method_geometry_difference(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, GEOSDifference(self_geom, rhs_geom), Qnil);
  }
  return result;
}