Method: RGeo::Geos::CAPIGeometryMethods#prepare!

Defined in:
ext/geos_c_impl/geometry.c

#prepare!Object



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'ext/geos_c_impl/geometry.c', line 137

static VALUE
method_geometry_prepare(VALUE self)
{
  RGeo_GeometryData* self_data;
  const GEOSPreparedGeometry* prep;

  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  if (self_data->geom) {
    prep = self_data->prep;
    if (!prep || prep == (const GEOSPreparedGeometry*)1 ||
        prep == (const GEOSPreparedGeometry*)2) {
      prep = GEOSPrepare(self_data->geom);
      if (prep) {
        self_data->prep = prep;
      } else {
        self_data->prep = (const GEOSPreparedGeometry*)3;
      }
    }
  }
  return self;
}