Module: RGeo::Geos::CAPIMultiPointMethods

Included in:
CAPIMultiPointImpl
Defined in:
ext/geos_c_impl/geometry_collection.c

Instance Method Summary collapse

Instance Method Details

#coordinatesObject


277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'ext/geos_c_impl/geometry_collection.c', line 277

static VALUE method_multi_point_coordinates(VALUE self)
{
  VALUE result = Qnil;
  RGeo_GeometryData* self_data;
  const GEOSGeometry* self_geom;
  GEOSContextHandle_t context;
  const GEOSCoordSequence* coord_sequence;

  const GEOSGeometry* point;
  unsigned int count;
  unsigned int i;
  int zCoordinate;

  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  self_geom = self_data->geom;

  if(self_geom) {
    zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M;
    context = self_data->geos_context;
    count = GEOSGetNumGeometries_r(context, self_geom);
    result = rb_ary_new2(count);
    for(i = 0; i < count; ++i) {
      point = GEOSGetGeometryN_r(context, self_geom, i);
      coord_sequence = GEOSGeom_getCoordSeq_r(context, point);
      rb_ary_push(result, rb_ary_pop(extract_points_from_coordinate_sequence(context, coord_sequence, zCoordinate)));
    }
  }

  return result;
}

#geometry_typeObject


248
249
250
251
252
253
254
255
256
257
258
259
# File 'ext/geos_c_impl/geometry_collection.c', line 248

static VALUE method_multi_point_geometry_type(VALUE self)
{
  VALUE result;
  RGeo_GeometryData* self_data;

  result = Qnil;
  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  if (self_data->geom) {
    result = rgeo_feature_multi_point_module;
  }
  return result;
}

#hashObject


262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'ext/geos_c_impl/geometry_collection.c', line 262

static VALUE method_multi_point_hash(VALUE self)
{
  st_index_t hash;
  RGeo_GeometryData* self_data;
  VALUE factory;

  self_data = RGEO_GEOMETRY_DATA_PTR(self);
  factory = self_data->factory;
  hash = rb_hash_start(0);
  hash = rgeo_geos_objbase_hash(factory, rgeo_feature_multi_point_module, hash);
  hash = rgeo_geos_geometry_collection_hash(self_data->geos_context, self_data->geom, hash);
  return LONG2FIX(rb_hash_end(hash));
}