Class: Rubyvis::SceneElement

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rubyvis/sceneelement.rb

Overview

Scene element Store information about each scene. On javascript, is an Array with custom properties.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSceneElement

:nodoc:



6
7
8
# File 'lib/rubyvis/sceneelement.rb', line 6

def initialize
  @scenes=Array.new
end

Instance Attribute Details

#_gObject

Returns the value of attribute _g.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def _g
  @_g
end

#_idObject

Returns the value of attribute _id.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def _id
  @_id
end

#angleObject

Returns the value of attribute angle.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def angle
  @angle
end

#antialiasObject

Returns the value of attribute antialias.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def antialias
  @antialias
end

#bottomObject

Returns the value of attribute bottom.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def bottom
  @bottom
end

#canvasObject

Returns the value of attribute canvas.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def canvas
  @canvas
end

#child_indexObject

Returns the value of attribute child_index.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def child_index
  @child_index
end

#childrenObject

Returns the value of attribute children.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def children
  @children
end

#cursorObject

Returns the value of attribute cursor.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def cursor
  @cursor
end

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def data
  @data
end

#defsObject

Returns the value of attribute defs.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def defs
  @defs
end

#eccentricityObject

Returns the value of attribute eccentricity.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def eccentricity
  @eccentricity
end

#end_angleObject

Returns the value of attribute end_angle.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def end_angle
  @end_angle
end

#eventsObject

Returns the value of attribute events.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def events
  @events
end

#fill_styleObject

Returns the value of attribute fill_style.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def fill_style
  @fill_style
end

#fontObject

Returns the value of attribute font.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def font
  @font
end

#heightObject

Returns the value of attribute height.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def height
  @height
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def id
  @id
end

#imageObject

Returns the value of attribute image.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def image
  @image
end

#image_heightObject

Returns the value of attribute image_height.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def image_height
  @image_height
end

#image_widthObject

Returns the value of attribute image_width.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def image_width
  @image_width
end

#inner_radiusObject

Returns the value of attribute inner_radius.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def inner_radius
  @inner_radius
end

#interpolateObject

Returns the value of attribute interpolate.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def interpolate
  @interpolate
end

#layersObject

Returns the value of attribute layers.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def layers
  @layers
end

#leftObject

Returns the value of attribute left.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def left
  @left
end

#line_joinObject

Returns the value of attribute line_join.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def line_join
  @line_join
end

#line_widthObject

Returns the value of attribute line_width.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def line_width
  @line_width
end

Returns the value of attribute links.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def links
  @links
end

#markObject

Returns the value of attribute mark.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def mark
  @mark
end

#modeObject

Returns the value of attribute mode.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def mode
  @mode
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def name
  @name
end

#nodesObject

Returns the value of attribute nodes.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def nodes
  @nodes
end

#offsetObject

Returns the value of attribute offset.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def offset
  @offset
end

#orderObject

Returns the value of attribute order.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def order
  @order
end

#orientObject

Returns the value of attribute orient.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def orient
  @orient
end

#outer_radiusObject

Returns the value of attribute outer_radius.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def outer_radius
  @outer_radius
end

#overflowObject

Returns the value of attribute overflow.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def overflow
  @overflow
end

#padding_bottomObject

Returns the value of attribute padding_bottom.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def padding_bottom
  @padding_bottom
end

#padding_leftObject

Returns the value of attribute padding_left.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def padding_left
  @padding_left
end

#padding_rightObject

Returns the value of attribute padding_right.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def padding_right
  @padding_right
end

#padding_topObject

Returns the value of attribute padding_top.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def padding_top
  @padding_top
end

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def parent
  @parent
end

#parent_indexObject

Returns the value of attribute parent_index.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def parent_index
  @parent_index
end

#reverseObject

Returns the value of attribute reverse.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def reverse
  @reverse
end

#rightObject

Returns the value of attribute right.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def right
  @right
end

#roundObject

Returns the value of attribute round.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def round
  @round
end

#segmentedObject

Returns the value of attribute segmented.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def segmented
  @segmented
end

#shapeObject

Returns the value of attribute shape.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def shape
  @shape
end

#shape_angleObject

Returns the value of attribute shape_angle.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def shape_angle
  @shape_angle
end

#shape_radiusObject

Returns the value of attribute shape_radius.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def shape_radius
  @shape_radius
end

#shape_sizeObject

Returns the value of attribute shape_size.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def shape_size
  @shape_size
end

#start_angleObject

Returns the value of attribute start_angle.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def start_angle
  @start_angle
end

#stroke_styleObject

Returns the value of attribute stroke_style.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def stroke_style
  @stroke_style
end

#targetObject

Returns the value of attribute target.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def target
  @target
end

#tensionObject

Returns the value of attribute tension.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def tension
  @tension
end

#textObject

Returns the value of attribute text.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text
  @text
end

#text_alignObject

Returns the value of attribute text_align.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_align
  @text_align
end

#text_angleObject

Returns the value of attribute text_angle.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_angle
  @text_angle
end

#text_baselineObject

Returns the value of attribute text_baseline.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_baseline
  @text_baseline
end

#text_decorationObject

Returns the value of attribute text_decoration.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_decoration
  @text_decoration
end

#text_marginObject

Returns the value of attribute text_margin.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_margin
  @text_margin
end

#text_shadowObject

Returns the value of attribute text_shadow.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_shadow
  @text_shadow
end

#text_styleObject

Returns the value of attribute text_style.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def text_style
  @text_style
end

#titleObject

Returns the value of attribute title.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def title
  @title
end

#topObject

Returns the value of attribute top.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def top
  @top
end

#transformObject

Returns the value of attribute transform.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def transform
  @transform
end

#typeObject

Returns the value of attribute type.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def type
  @type
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def url
  @url
end

#visibleObject

Returns the value of attribute visible.



10
11
12
# File 'lib/rubyvis/sceneelement.rb', line 10

def visible
  @visible
end

#widthObject

Returns the value of attribute width.



11
12
13
# File 'lib/rubyvis/sceneelement.rb', line 11

def width
  @width
end

Instance Method Details

#[](v) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/rubyvis/sceneelement.rb', line 20

def [](v)
  if v.is_a? Numeric
    @scenes[v]
  elsif v.nil?
    nil
  elsif self.respond_to? v
    self.send(v)
  end
end

#[]=(v, i) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rubyvis/sceneelement.rb', line 13

def []=(v,i)
  if v.is_a? Numeric
    @scenes[v]=i
  elsif self.respond_to?(v.to_s+"=")
    self.send(v.to_s+"=",i)
  end
end

#eachObject



29
30
31
32
33
# File 'lib/rubyvis/sceneelement.rb', line 29

def each
  @scenes.each do |v|
    yield v
  end
end

#inspectObject



40
41
42
43
# File 'lib/rubyvis/sceneelement.rb', line 40

def inspect
  elements_id=@scenes.map{|e| '<'+ e.object_id.to_s(16)+'>'}.join(", ")
  "<SE #{object_id.to_s(16)} (#{type}), elements: #{self.size} (#{elements_id}), children: #{children ? children.size : '0'}, data: #{data ? data.to_s: ''}>"
end

#push(v) ⇒ Object



34
35
36
# File 'lib/rubyvis/sceneelement.rb', line 34

def push(v)
  @scenes.push(v)
end

#sizeObject



37
38
39
# File 'lib/rubyvis/sceneelement.rb', line 37

def size
  @scenes.size
end

#size=(v) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/rubyvis/sceneelement.rb', line 44

def size=(v)
  if self.size==v
    return true
  elsif self.size<v
    (v-self.size).times {push(nil)}
  else
    self.slice!(0,v)
  end
end