Class: Geos::GeometryCollection
- Includes:
- Enumerable
- Defined in:
- lib/ffi-geos/geometry_collection.rb
Direct Known Subclasses
Constant Summary
Constants included from GeomTypes
Geos::GeomTypes::GEOS_GEOMETRYCOLLECTION, Geos::GeomTypes::GEOS_LINEARRING, Geos::GeomTypes::GEOS_LINESTRING, Geos::GeomTypes::GEOS_MULTILINESTRING, Geos::GeomTypes::GEOS_MULTIPOINT, Geos::GeomTypes::GEOS_MULTIPOLYGON, Geos::GeomTypes::GEOS_POINT, Geos::GeomTypes::GEOS_POLYGON
Instance Attribute Summary
Attributes inherited from Geometry
Instance Method Summary collapse
- #[](*args) ⇒ Object (also: #slice, #at)
- #dump_points(cur_path = []) ⇒ Object
-
#each ⇒ Object
Yields each Geometry in the GeometryCollection.
- #get_geometry_n(n) ⇒ Object (also: #geometry_n)
Methods inherited from Geometry
#==, #area, #boundary, #buffer, #build_area, #centroid, #clip_by_rect, #constrained_delaunay_triangulation, #contains?, #convex_hull, #coord_seq, #coverage_union, #covered_by?, #covers?, #crosses?, #delaunay_triangulation, #difference, #dimensions, #disjoint?, #distance, #distance_indexed, #empty?, #end_point, #envelope, #eql?, #eql_almost?, #eql_exact?, #extract_unique_points, #frechet_distance, #geom_type, #has_z?, #hausdorff_distance, #initialize, #initialize_copy, #interpolate, #interpolate_normalized, #intersection, #intersects?, #largest_empty_circle, #length, #line_merge, #make_valid, #maximum_inscribed_circle, #minimum_bounding_circle, #minimum_clearance, #minimum_clearance_line, #minimum_rotated_rectangle, #minimum_width, #nearest_points, #node, #normalize!, #num_coordinates, #num_geometries, #overlaps?, #point_on_surface, #polygonize, #polygonize_cut_edges, #polygonize_full, #polygonize_valid, #precision, #project, #project_normalized, #relate, #relate_boundary_node_rule, #relate_pattern, release, #reverse, #ring?, #shared_paths, #simple?, #simplify, #snap, #srid, #srid=, #start_point, #sym_difference, #to_prepared, #to_s, #topology_preserve_simplify, #touches?, #type_id, #unary_union, #union, #union_cascaded, #valid?, #valid_detail, #valid_reason, #voronoi_diagram, #with_precision, #within?
Methods included from Tools
#bool_result, #bool_to_int, #cast_geometry_ptr, #check_enum_value, #check_geometry, #extract_options!, #pick_srid_according_to_policy, #pick_srid_from_geoms, #symbol_for_enum
Constructor Details
This class inherits a constructor from Geos::Geometry
Instance Method Details
#[](*args) ⇒ Object Also known as: slice, at
30 31 32 33 34 35 36 |
# File 'lib/ffi-geos/geometry_collection.rb', line 30 def [](*args) if args.length == 1 && args.first.is_a?(Numeric) && args.first >= 0 get_geometry_n(args.first) else to_a[*args] end end |
#dump_points(cur_path = []) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/ffi-geos/geometry_collection.rb', line 40 def dump_points(cur_path = []) each do |geom| cur_path << geom.dump_points end cur_path end |
#each ⇒ Object
Yields each Geometry in the GeometryCollection.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ffi-geos/geometry_collection.rb', line 8 def each if block_given? num_geometries.times do |n| yield get_geometry_n(n) end self else num_geometries.times.collect { |n| get_geometry_n(n) }.to_enum end end |
#get_geometry_n(n) ⇒ Object Also known as: geometry_n
21 22 23 24 25 26 27 |
# File 'lib/ffi-geos/geometry_collection.rb', line 21 def get_geometry_n(n) if n.negative? || n >= num_geometries nil else cast_geometry_ptr(FFIGeos.GEOSGetGeometryN_r(Geos.current_handle_pointer, ptr, n), auto_free: false) end end |