Sha256: 60446b05323898de6e26f41c097a89f2c8693edbd065ebbad2d1ec581f32fb51

Contents?: true

Size: 1.01 KB

Versions: 22

Compression:

Stored size: 1.01 KB

Contents

# -----------------------------------------------------------------------------
# Draws a circle with ticks
#
# Author:: Fernand Galiana
# -----------------------------------------------------------------------------
require 'ziya/gauges/support/radial_base'

module Ziya::Gauges::Support
  class RadialTicks < RadialBase  
    has_attribute :length, :thickness

    # overrides flatten to generate a series of radial tick marks
    def flatten( xml )
      i = start_angle   
      while( i <= end_angle ) do
        angle = deg2rad( i )
        hash = { :x1        => (x + Math::sin( angle ) * radius).to_i,
                 :y1        => (y - Math::cos( angle ) * radius).to_i,
                 :x2        => (x + Math::sin( angle ) * (radius + length)).to_i,
                 :y2        => (y - Math::cos( angle ) * (radius + length)).to_i,
                 :thickness => thickness,
                 :color     => color }
        xml.line( hash )
        i += (end_angle-start_angle)/(ticks-1)
      end
    end
    
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
derailed-ziya-2.0.4 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.0.6 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.0.8 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.0 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.1 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.2 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.3 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.4 lib/ziya/gauges/support/radial_ticks.rb
derailed-ziya-2.1.5 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.3.0 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.1.9 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.1.8 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.1.7 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.1.6 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.0 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.2 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.1 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.5 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.4 lib/ziya/gauges/support/radial_ticks.rb
ziya-2.0.3 lib/ziya/gauges/support/radial_ticks.rb