Module: RGeo::Geos::CAPIGeometryCollectionMethods
- Includes:
- Enumerable
- Included in:
- CAPIGeometryCollectionImpl, CAPIMultiLineStringImpl, CAPIMultiPointImpl, CAPIMultiPolygonImpl
- Defined in:
- lib/rgeo/geos/capi_feature_classes.rb,
ext/geos_c_impl/geometry_collection.c
Overview
:nodoc:
Instance Method Summary collapse
- #[](n) ⇒ Object
- #each ⇒ Object
-
#eql?(rhs) ⇒ Boolean
** RUBY METHOD DEFINITIONS ***.
- #geometry_n(n) ⇒ Object
- #geometry_type ⇒ Object
- #hash ⇒ Object
- #node ⇒ Object
- #num_geometries ⇒ Object
-
#rep_equals?(rhs) ⇒ Boolean
** RUBY METHOD DEFINITIONS ***.
- #size ⇒ Object
Instance Method Details
#[](n) ⇒ Object
205 206 207 208 209 |
# File 'ext/geos_c_impl/geometry_collection.c', line 205
static VALUE
method_geometry_collection_brackets(VALUE self, VALUE n)
{
return impl_geometry_n(self, n, 1);
}
|
#each ⇒ Object
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'ext/geos_c_impl/geometry_collection.c', line 211
static VALUE
method_geometry_collection_each(VALUE self)
{
RETURN_ENUMERATOR(
self, 0, 0); /* return enum_for(__callee__) unless block_given? */
RGeo_GeometryData* self_data;
const GEOSGeometry* self_geom;
int len;
VALUE klasses;
int i;
VALUE elem;
const GEOSGeometry* elem_geom;
self_data = RGEO_GEOMETRY_DATA_PTR(self);
self_geom = self_data->geom;
if (self_geom) {
len = GEOSGetNumGeometries(self_geom);
if (len > 0) {
klasses = self_data->klasses;
for (i = 0; i < len; ++i) {
elem_geom = GEOSGetGeometryN(self_geom, i);
elem = rgeo_wrap_geos_geometry_clone(
self_data->factory,
elem_geom,
NIL_P(klasses) ? Qnil : rb_ary_entry(klasses, i));
if (!NIL_P(elem)) {
rb_yield(elem);
}
}
}
}
return self;
}
|
#eql?(rhs) ⇒ Boolean
** RUBY METHOD DEFINITIONS ***
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'ext/geos_c_impl/geometry_collection.c', line 106
static VALUE
method_geometry_collection_eql(VALUE self, VALUE rhs)
{
VALUE result;
RGeo_GeometryData* self_data;
result = rgeo_geos_klasses_and_factories_eql(self, rhs);
if (RTEST(result)) {
self_data = RGEO_GEOMETRY_DATA_PTR(self);
result = rgeo_geos_geometries_strict_eql(self_data->geom,
RGEO_GEOMETRY_DATA_PTR(rhs)->geom);
}
return result;
}
|
#geometry_n(n) ⇒ Object
199 200 201 202 203 |
# File 'ext/geos_c_impl/geometry_collection.c', line 199
static VALUE
method_geometry_collection_geometry_n(VALUE self, VALUE n)
{
return impl_geometry_n(self, n, 0);
}
|
#geometry_type ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'ext/geos_c_impl/geometry_collection.c', line 137
static VALUE
method_geometry_collection_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_geometry_collection_module;
}
return result;
}
|
#hash ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'ext/geos_c_impl/geometry_collection.c', line 121
static VALUE
method_geometry_collection_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_geometry_collection_module, hash);
hash = rgeo_geos_geometry_collection_hash(self_data->geom, hash);
return LONG2FIX(rb_hash_end(hash));
}
|
#node ⇒ Object
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'ext/geos_c_impl/geometry_collection.c', line 340
static VALUE
method_geometry_collection_node(VALUE self)
{
VALUE result = Qnil;
RGeo_GeometryData* self_data;
const GEOSGeometry* self_geom;
GEOSGeometry* noded;
self_data = RGEO_GEOMETRY_DATA_PTR(self);
self_geom = self_data->geom;
noded = GEOSNode(self_geom);
result = rgeo_wrap_geos_geometry(self_data->factory, noded, Qnil);
return result;
}
|
#num_geometries ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'ext/geos_c_impl/geometry_collection.c', line 151
static VALUE
method_geometry_collection_num_geometries(VALUE self)
{
VALUE result;
RGeo_GeometryData* self_data;
const GEOSGeometry* self_geom;
result = Qnil;
self_data = RGEO_GEOMETRY_DATA_PTR(self);
self_geom = self_data->geom;
if (self_geom) {
result = INT2NUM(GEOSGetNumGeometries(self_geom));
}
return result;
}
|
#rep_equals?(rhs) ⇒ Boolean
** RUBY METHOD DEFINITIONS ***
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'ext/geos_c_impl/geometry_collection.c', line 106
static VALUE
method_geometry_collection_eql(VALUE self, VALUE rhs)
{
VALUE result;
RGeo_GeometryData* self_data;
result = rgeo_geos_klasses_and_factories_eql(self, rhs);
if (RTEST(result)) {
self_data = RGEO_GEOMETRY_DATA_PTR(self);
result = rgeo_geos_geometries_strict_eql(self_data->geom,
RGEO_GEOMETRY_DATA_PTR(rhs)->geom);
}
return result;
}
|
#size ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'ext/geos_c_impl/geometry_collection.c', line 151
static VALUE
method_geometry_collection_num_geometries(VALUE self)
{
VALUE result;
RGeo_GeometryData* self_data;
const GEOSGeometry* self_geom;
result = Qnil;
self_data = RGEO_GEOMETRY_DATA_PTR(self);
self_geom = self_data->geom;
if (self_geom) {
result = INT2NUM(GEOSGetNumGeometries(self_geom));
}
return result;
}
|