Class: TG::Geometry::Polygon
- Inherits:
-
Object
- Object
- TG::Geometry::Polygon
- Defined in:
- ext/tg_geometry/tg_geometry_ext.c
Instance Method Summary collapse
- #bbox ⇒ Object
- #clockwise? ⇒ Boolean
- #exterior_ring ⇒ Object
- #hole_at(index_value) ⇒ Object
- #holes ⇒ Object
- #num_holes ⇒ Object
Instance Method Details
#bbox ⇒ Object
2627 2628 2629 2630 2631 2632 2633 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2627 static VALUE rb_tg_geometry_polygon_bbox(VALUE self) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); VALUE rect = rect_from_tg_rect(tg_poly_rect(w->poly)); RB_GC_GUARD(self); return rect; } |
#clockwise? ⇒ Boolean
2671 2672 2673 2674 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2671 static VALUE rb_tg_geometry_polygon_clockwise_p(VALUE self) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); return tg_poly_clockwise(w->poly) ? Qtrue : Qfalse; } |
#exterior_ring ⇒ Object
2635 2636 2637 2638 2639 2640 2641 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2635 static VALUE rb_tg_geometry_polygon_exterior_ring(VALUE self) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); VALUE ring = ring_wrap_borrowed(w->geom_owner, tg_poly_exterior(w->poly)); RB_GC_GUARD(self); return ring; } |
#hole_at(index_value) ⇒ Object
2648 2649 2650 2651 2652 2653 2654 2655 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2648 static VALUE rb_tg_geometry_polygon_hole_at(VALUE self, VALUE index_value) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); int index = checked_child_index(index_value, tg_poly_num_holes(w->poly), "polygon hole"); VALUE ring = ring_wrap_borrowed(w->geom_owner, tg_poly_hole_at(w->poly, index)); RB_GC_GUARD(self); return ring; } |
#holes ⇒ Object
2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2657 static VALUE rb_tg_geometry_polygon_holes(VALUE self) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); int count = tg_poly_num_holes(w->poly); VALUE holes = rb_ary_new_capa(count); for (int i = 0; i < count; i++) { rb_ary_push(holes, ring_wrap_borrowed(w->geom_owner, tg_poly_hole_at(w->poly, i))); } RB_GC_GUARD(self); RB_GC_GUARD(holes); return holes; } |
#num_holes ⇒ Object
2643 2644 2645 2646 |
# File 'ext/tg_geometry/tg_geometry_ext.c', line 2643 static VALUE rb_tg_geometry_polygon_num_holes(VALUE self) { tg_polygon_wrapper_t *w = get_polygon_wrapper(self); return INT2NUM(tg_poly_num_holes(w->poly)); } |