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
235 236 237 238 |
# File 'ext/geos_c_impl/geometry_collection.c', line 235
static VALUE method_geometry_collection_brackets(VALUE self, VALUE n)
{
return impl_geometry_n(self, n, 1);
}
|
#each ⇒ Object
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'ext/geos_c_impl/geometry_collection.c', line 241
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) {
GEOSContextHandle_t self_context = self_data->geos_context;
len = GEOSGetNumGeometries_r(self_context, self_geom);
if (len > 0) {
klasses = self_data->klasses;
for (i=0; i<len; ++i) {
elem_geom = GEOSGetGeometryN_r(self_context, 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 ***
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'ext/geos_c_impl/geometry_collection.c', line 138
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_geometry_collections_eql(self_data->geos_context, self_data->geom, RGEO_GEOMETRY_DATA_PTR(rhs)->geom, RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M);
}
return result;
}
|
#geometry_n(n) ⇒ Object
229 230 231 232 |
# File 'ext/geos_c_impl/geometry_collection.c', line 229
static VALUE method_geometry_collection_geometry_n(VALUE self, VALUE n)
{
return impl_geometry_n(self, n, 0);
}
|
#geometry_type ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'ext/geos_c_impl/geometry_collection.c', line 167
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
152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'ext/geos_c_impl/geometry_collection.c', line 152
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->geos_context, self_data->geom, hash);
return LONG2FIX(rb_hash_end(hash));
}
|
#node ⇒ Object
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'ext/geos_c_impl/geometry_collection.c', line 362
static VALUE method_geometry_collection_node(VALUE self)
{
VALUE result = Qnil;
RGeo_GeometryData* self_data;
const GEOSGeometry* self_geom;
GEOSGeometry* noded;
GEOSContextHandle_t context;
self_data = RGEO_GEOMETRY_DATA_PTR(self);
self_geom = self_data->geom;
context = self_data->geos_context;
noded = GEOSNode_r(context, self_geom);
result = rgeo_wrap_geos_geometry(self_data->factory, noded, Qnil);
return result;
}
|
#num_geometries ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'ext/geos_c_impl/geometry_collection.c', line 181
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_r(self_data->geos_context, self_geom));
}
return result;
}
|
#rep_equals?(rhs) ⇒ Boolean
** RUBY METHOD DEFINITIONS ***
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'ext/geos_c_impl/geometry_collection.c', line 138
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_geometry_collections_eql(self_data->geos_context, self_data->geom, RGEO_GEOMETRY_DATA_PTR(rhs)->geom, RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M);
}
return result;
}
|
#size ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'ext/geos_c_impl/geometry_collection.c', line 181
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_r(self_data->geos_context, self_geom));
}
return result;
}
|