Class: Wx::SF::CircleArrow
- Inherits:
-
FilledArrow
- Object
- ArrowBase
- LineArrow
- FilledArrow
- Wx::SF::CircleArrow
- Defined in:
- lib/wx/shapes/arrows/circle_arrow.rb
Overview
Class extends the Wx::FilledArrow class and encapsulates circle arrow shapes.
Direct Known Subclasses
Constant Summary collapse
- RADIUS =
Default circle radius.
6
Instance Method Summary collapse
-
#draw(from, to, dc) ⇒ Object
Draw arrow shape at the end of a virtual line.
-
#get_radius ⇒ Object
(also: #radius)
Get the circle radius.
-
#initialize(parent = nil) ⇒ CircleArrow
constructor
Constructor.
- #scale ⇒ Object protected
Methods inherited from FilledArrow
Methods inherited from LineArrow
#get_pen, #get_pen_width, #set_parent_shape, #set_pen
Methods inherited from ArrowBase
#get_parent_shape, #set_parent_shape, #translate_arrow
Constructor Details
#initialize(parent = nil) ⇒ CircleArrow
Constructor
17 18 19 20 |
# File 'lib/wx/shapes/arrows/circle_arrow.rb', line 17 def initialize(parent=nil) super scale end |
Instance Method Details
#draw(from, to, dc) ⇒ Object
Draw arrow shape at the end of a virtual line.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wx/shapes/arrows/circle_arrow.rb', line 37 def draw(from, to, dc) r = radius centre, cp = translate_arrow([Wx::RealPoint.new(r, 0), Wx::RealPoint.new(2*r, 0)], from, to) dc.with_pen(pen) do |dc| dc.with_brush(fill) do |dc| dc.draw_circle(centre, r) end end cp end |
#get_radius ⇒ Object Also known as: radius
Get the circle radius
23 24 25 |
# File 'lib/wx/shapes/arrows/circle_arrow.rb', line 23 def get_radius (RADIUS * @ratio).to_i end |
#scale ⇒ Object (protected)
28 29 30 |
# File 'lib/wx/shapes/arrows/circle_arrow.rb', line 28 def scale @ratio = 1 + (pen_width / 2) * 0.5 end |