Class: Geos::Polygon
Constant Summary
Constants included from GeomTypes
GeomTypes::GEOS_GEOMETRYCOLLECTION, GeomTypes::GEOS_LINEARRING, GeomTypes::GEOS_LINESTRING, GeomTypes::GEOS_MULTILINESTRING, GeomTypes::GEOS_MULTIPOINT, GeomTypes::GEOS_MULTIPOLYGON, GeomTypes::GEOS_POINT, GeomTypes::GEOS_POLYGON
Instance Attribute Summary
Attributes inherited from Geometry
Instance Method Summary collapse
- #exterior_ring ⇒ Object
- #interior_ring_n(n) ⇒ Object (also: #interior_ring)
- #interior_rings ⇒ Object
- #num_interior_rings ⇒ Object
Methods inherited from Geometry
#==, #area, #boundary, #buffer, #centroid, #contains?, #convex_hull, #coord_seq, #covered_by?, #covers?, #crosses?, #delaunay_triangulation, #difference, #dimensions, #disjoint?, #distance, #empty?, #end_point, #envelope, #eql?, #eql_almost?, #eql_exact?, #extract_unique_points, #geom_type, #has_z?, #hausdorff_distance, #initialize, #initialize_copy, #interpolate, #interpolate_normalized, #intersection, #intersects?, #length, #line_merge, #nearest_points, #node, #normalize!, #num_coordinates, #num_geometries, #overlaps?, #point_on_surface, #polygonize, #polygonize_cut_edges, #polygonize_full, #project, #project_normalized, #relate, #relate_boundary_node_rule, #relate_pattern, release, #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, #within?
Methods included from Tools
#bool_result, #cast_geometry_ptr, #check_enum_value, #check_geometry, #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
#exterior_ring ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/ffi-geos/polygon.rb', line 24 def exterior_ring cast_geometry_ptr( FFIGeos.GEOSGetExteriorRing_r(Geos.current_handle, self.ptr), { :auto_free => false, :srid_copy => self.srid, :parent => self } ) end |
#interior_ring_n(n) ⇒ Object Also known as: interior_ring
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ffi-geos/polygon.rb', line 9 def interior_ring_n(n) if n < 0 || n >= self.num_interior_rings raise RuntimeError.new("Index out of bounds") else cast_geometry_ptr( FFIGeos.GEOSGetInteriorRingN_r(Geos.current_handle, self.ptr, n), { :auto_free => false, :srid_copy => self.srid, :parent => self } ) end end |
#interior_rings ⇒ Object
34 35 36 37 38 |
# File 'lib/ffi-geos/polygon.rb', line 34 def interior_rings self.num_interior_rings.times.collect do |n| self.interior_ring_n(n) end end |
#num_interior_rings ⇒ Object
5 6 7 |
# File 'lib/ffi-geos/polygon.rb', line 5 def num_interior_rings FFIGeos.GEOSGetNumInteriorRings_r(Geos.current_handle, self.ptr) end |