Module: RGeo::Geos::CAPIMultiPointMethods

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

Instance Method Summary collapse

Instance Method Details

#coordinatesObject



276
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
307
308
# File 'ext/geos_c_impl/geometry_collection.c', line 276

static VALUE
method_multi_point_coordinates(VALUE self)
{
  VALUE result = Qnil;
  RGeo_GeometryData* self_data;
  const GEOSGeometry* self_geom;
  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;

    count = GEOSGetNumGeometries(self_geom);
    result = rb_ary_new2(count);
    for (i = 0; i < count; ++i) {
      point = GEOSGetGeometryN(self_geom, i);
      coord_sequence = GEOSGeom_getCoordSeq(point);
      rb_ary_push(result,
                  rb_ary_pop(extract_points_from_coordinate_sequence(
                    coord_sequence, zCoordinate)));
    }
  }

  return result;
}

#geometry_typeObject



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

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



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

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->geom, hash);
  return LONG2FIX(rb_hash_end(hash));
}