.doc/ext/reflex/ellipse_shape.cpp in reflexion-0.1.12 vs .doc/ext/reflex/ellipse_shape.cpp in reflexion-0.1.13

- old
+ new

@@ -1,78 +1,105 @@ -#include "reflex/ruby/shape_view.h" +#include "reflex/ruby/shape.h" -#include <rucy.h> +#include "defs.h" -using namespace Rucy; - -using Reflex::coord; - - RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::EllipseShape) #define THIS to<Reflex::EllipseShape*>(self) -#define CHECK RUCY_CHECK_OBJECT(Reflex::EllipseShape, self) +#define CHECK RUCY_CHECK_OBJ(Reflex::EllipseShape, self) -#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::EllipseShape, THIS, fun) +#define CALL(fun) RUCY_CALL_SUPER(THIS, fun) static VALUE alloc(VALUE klass) { - return value(new Reflex::RubyShapeView<Reflex::EllipseShape>, klass); + return value(new Reflex::RubyShape<Reflex::EllipseShape>, klass); } static -VALUE set_radius_min(VALUE self, VALUE radius) +VALUE set_angle_from(VALUE self, VALUE degree) { CHECK; - THIS->set_radius_min(radius.as_f(true)); - return radius; + THIS->set_angle_from(to<float>(degree)); + return self; } static -VALUE get_radius_min(VALUE self) +VALUE get_angle_from(VALUE self) { CHECK; - return value(THIS->radius_min()); + return value(THIS->angle_from()); } static +VALUE set_angle_to(VALUE self, VALUE degree) +{ + CHECK; + THIS->set_angle_to(to<float>(degree)); + return self; +} + +static +VALUE get_angle_to(VALUE self) +{ + CHECK; + return value(THIS->angle_to()); +} + +static +VALUE set_hole_size(VALUE self) +{ + CHECK; + check_arg_count(__FILE__, __LINE__, "EllipseShape#set_hole_size", argc, 1, 2, 3); + + THIS->set_hole_size(to<Rays::Point>(argc, argv)); + return value(THIS->hole_size()); +} + +static +VALUE get_hole_size(VALUE self) +{ + CHECK; + return value(THIS->hole_size()); +} + +static VALUE set_nsegment(VALUE self, VALUE nsegment) { CHECK; - THIS->set_nsegment(nsegment.as_i(true)); + THIS->set_nsegment(to<uint>(nsegment)); return nsegment; } static VALUE get_nsegment(VALUE self) { CHECK; return value(THIS->nsegment()); } -static -RUCY_DEF_clear_override_flags(cof, Reflex::EllipseShape); - static Class cEllipseShape; void Init_ellipse_shape () { Module mReflex = rb_define_module("Reflex"); - cEllipseShape = mReflex.define_class("EllipseShape", Reflex::shape_view_class()); + cEllipseShape = mReflex.define_class("EllipseShape", Reflex::shape_class()); rb_define_alloc_func(cEllipseShape, alloc); - rb_define_private_method(cEllipseShape, "radius_min=", RUBY_METHOD_FUNC(set_radius_min), 1); - rb_define_method(cEllipseShape, "radius_min", RUBY_METHOD_FUNC(get_radius_min), 0); - rb_define_private_method(cEllipseShape, "nsegment=", RUBY_METHOD_FUNC(set_nsegment), 1); + rb_define_method(cEllipseShape, "angle_from=", RUBY_METHOD_FUNC(set_angle_from), 1); + rb_define_method(cEllipseShape, "angle_from", RUBY_METHOD_FUNC(get_angle_from), 0); + rb_define_method(cEllipseShape, "angle_to=", RUBY_METHOD_FUNC(set_angle_to), 1); + rb_define_method(cEllipseShape, "angle_to", RUBY_METHOD_FUNC(get_angle_to), 0); + rb_define_method(cEllipseShape, "hole_size=", RUBY_METHOD_FUNC(set_hole_size), -1); + rb_define_method(cEllipseShape, "hole_size", RUBY_METHOD_FUNC(get_hole_size), 0); + rb_define_method(cEllipseShape, "nsegment=", RUBY_METHOD_FUNC(set_nsegment), 1); rb_define_method(cEllipseShape, "nsegment", RUBY_METHOD_FUNC(get_nsegment), 0); - } namespace Reflex {