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

ACCESSOR If you implement new accessor on a scene element you should add it here



16
17
18
# File 'lib/rubyvis/sceneelement.rb', line 16

def _g
  @_g
end

#_gridObject

Returns the value of attribute _grid.



17
18
19
# File 'lib/rubyvis/sceneelement.rb', line 17

def _grid
  @_grid
end

#_idObject

Returns the value of attribute _id.



18
19
20
# File 'lib/rubyvis/sceneelement.rb', line 18

def _id
  @_id
end

#_matrixObject

Returns the value of attribute _matrix.



19
20
21
# File 'lib/rubyvis/sceneelement.rb', line 19

def _matrix
  @_matrix
end

#angleObject

Returns the value of attribute angle.



20
21
22
# File 'lib/rubyvis/sceneelement.rb', line 20

def angle
  @angle
end

#antialiasObject

Returns the value of attribute antialias.



21
22
23
# File 'lib/rubyvis/sceneelement.rb', line 21

def antialias
  @antialias
end

#background_styleObject

Returns the value of attribute background_style.



22
23
24
# File 'lib/rubyvis/sceneelement.rb', line 22

def background_style
  @background_style
end

#bandsObject

Returns the value of attribute bands.



23
24
25
# File 'lib/rubyvis/sceneelement.rb', line 23

def bands
  @bands
end

#bottomObject

Returns the value of attribute bottom.



24
25
26
# File 'lib/rubyvis/sceneelement.rb', line 24

def bottom
  @bottom
end

#breadthObject

Returns the value of attribute breadth.



25
26
27
# File 'lib/rubyvis/sceneelement.rb', line 25

def breadth
  @breadth
end

#canvasObject

Returns the value of attribute canvas.



26
27
28
# File 'lib/rubyvis/sceneelement.rb', line 26

def canvas
  @canvas
end

#child_indexObject

Returns the value of attribute child_index.



27
28
29
# File 'lib/rubyvis/sceneelement.rb', line 27

def child_index
  @child_index
end

#childrenObject

Returns the value of attribute children.



28
29
30
# File 'lib/rubyvis/sceneelement.rb', line 28

def children
  @children
end

#colsObject

Returns the value of attribute cols.



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

def cols
  @cols
end

#cursorObject

Returns the value of attribute cursor.



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

def cursor
  @cursor
end

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#defsObject

Returns the value of attribute defs.



32
33
34
# File 'lib/rubyvis/sceneelement.rb', line 32

def defs
  @defs
end

#depthObject

Returns the value of attribute depth.



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

def depth
  @depth
end

#directedObject

Returns the value of attribute directed.



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

def directed
  @directed
end

#eccentricityObject

Returns the value of attribute eccentricity.



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

def eccentricity
  @eccentricity
end

#end_angleObject

Returns the value of attribute end_angle.



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

def end_angle
  @end_angle
end

#eventsObject

Returns the value of attribute events.



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

def events
  @events
end

#fill_styleObject

Returns the value of attribute fill_style.



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

def fill_style
  @fill_style
end

#fontObject

Returns the value of attribute font.



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

def font
  @font
end

#font_familyObject

Returns the value of attribute font_family.



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

def font_family
  @font_family
end

#font_sizeObject

Returns the value of attribute font_size.



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

def font_size
  @font_size
end

#font_styleObject

Returns the value of attribute font_style.



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

def font_style
  @font_style
end

#font_variantObject

Returns the value of attribute font_variant.



43
44
45
# File 'lib/rubyvis/sceneelement.rb', line 43

def font_variant
  @font_variant
end

#font_weightObject

Returns the value of attribute font_weight.



44
45
46
# File 'lib/rubyvis/sceneelement.rb', line 44

def font_weight
  @font_weight
end

#groupObject

Returns the value of attribute group.



45
46
47
# File 'lib/rubyvis/sceneelement.rb', line 45

def group
  @group
end

#heightObject

Returns the value of attribute height.



46
47
48
# File 'lib/rubyvis/sceneelement.rb', line 46

def height
  @height
end

#idObject

Returns the value of attribute id.



47
48
49
# File 'lib/rubyvis/sceneelement.rb', line 47

def id
  @id
end

#imageObject

Returns the value of attribute image.



48
49
50
# File 'lib/rubyvis/sceneelement.rb', line 48

def image
  @image
end

#image_heightObject

Returns the value of attribute image_height.



49
50
51
# File 'lib/rubyvis/sceneelement.rb', line 49

def image_height
  @image_height
end

#image_widthObject

Returns the value of attribute image_width.



50
51
52
# File 'lib/rubyvis/sceneelement.rb', line 50

def image_width
  @image_width
end

#inner_radiusObject

Returns the value of attribute inner_radius.



51
52
53
# File 'lib/rubyvis/sceneelement.rb', line 51

def inner_radius
  @inner_radius
end

#interpolateObject

Returns the value of attribute interpolate.



52
53
54
# File 'lib/rubyvis/sceneelement.rb', line 52

def interpolate
  @interpolate
end

#layersObject

Returns the value of attribute layers.



53
54
55
# File 'lib/rubyvis/sceneelement.rb', line 53

def layers
  @layers
end

#leftObject

Returns the value of attribute left.



54
55
56
# File 'lib/rubyvis/sceneelement.rb', line 54

def left
  @left
end

#line_joinObject

Returns the value of attribute line_join.



55
56
57
# File 'lib/rubyvis/sceneelement.rb', line 55

def line_join
  @line_join
end

#line_widthObject

Returns the value of attribute line_width.



56
57
58
# File 'lib/rubyvis/sceneelement.rb', line 56

def line_width
  @line_width
end

Returns the value of attribute links.



57
58
59
# File 'lib/rubyvis/sceneelement.rb', line 57

def links
  @links
end

#markObject

Returns the value of attribute mark.



58
59
60
# File 'lib/rubyvis/sceneelement.rb', line 58

def mark
  @mark
end

#modeObject

Returns the value of attribute mode.



59
60
61
# File 'lib/rubyvis/sceneelement.rb', line 59

def mode
  @mode
end

#nameObject

Returns the value of attribute name.



60
61
62
# File 'lib/rubyvis/sceneelement.rb', line 60

def name
  @name
end

#negative_styleObject

Returns the value of attribute negative_style.



61
62
63
# File 'lib/rubyvis/sceneelement.rb', line 61

def negative_style
  @negative_style
end

#nodesObject

Returns the value of attribute nodes.



62
63
64
# File 'lib/rubyvis/sceneelement.rb', line 62

def nodes
  @nodes
end

#offsetObject

Returns the value of attribute offset.



63
64
65
# File 'lib/rubyvis/sceneelement.rb', line 63

def offset
  @offset
end

#orderObject

Returns the value of attribute order.



64
65
66
# File 'lib/rubyvis/sceneelement.rb', line 64

def order
  @order
end

#orientObject

Returns the value of attribute orient.



65
66
67
# File 'lib/rubyvis/sceneelement.rb', line 65

def orient
  @orient
end

#outer_radiusObject

Returns the value of attribute outer_radius.



66
67
68
# File 'lib/rubyvis/sceneelement.rb', line 66

def outer_radius
  @outer_radius
end

#overflowObject

Returns the value of attribute overflow.



67
68
69
# File 'lib/rubyvis/sceneelement.rb', line 67

def overflow
  @overflow
end

#padding_bottomObject

Returns the value of attribute padding_bottom.



68
69
70
# File 'lib/rubyvis/sceneelement.rb', line 68

def padding_bottom
  @padding_bottom
end

#padding_leftObject

Returns the value of attribute padding_left.



69
70
71
# File 'lib/rubyvis/sceneelement.rb', line 69

def padding_left
  @padding_left
end

#padding_rightObject

Returns the value of attribute padding_right.



70
71
72
# File 'lib/rubyvis/sceneelement.rb', line 70

def padding_right
  @padding_right
end

#padding_topObject

Returns the value of attribute padding_top.



71
72
73
# File 'lib/rubyvis/sceneelement.rb', line 71

def padding_top
  @padding_top
end

#parentObject

Returns the value of attribute parent.



72
73
74
# File 'lib/rubyvis/sceneelement.rb', line 72

def parent
  @parent
end

#parent_indexObject

Returns the value of attribute parent_index.



73
74
75
# File 'lib/rubyvis/sceneelement.rb', line 73

def parent_index
  @parent_index
end

#positive_styleObject

Returns the value of attribute positive_style.



74
75
76
# File 'lib/rubyvis/sceneelement.rb', line 74

def positive_style
  @positive_style
end

#reverseObject

Returns the value of attribute reverse.



75
76
77
# File 'lib/rubyvis/sceneelement.rb', line 75

def reverse
  @reverse
end

#rightObject

Returns the value of attribute right.



76
77
78
# File 'lib/rubyvis/sceneelement.rb', line 76

def right
  @right
end

#roundObject

Returns the value of attribute round.



77
78
79
# File 'lib/rubyvis/sceneelement.rb', line 77

def round
  @round
end

#rowsObject

Returns the value of attribute rows.



78
79
80
# File 'lib/rubyvis/sceneelement.rb', line 78

def rows
  @rows
end

#segmentedObject

Returns the value of attribute segmented.



79
80
81
# File 'lib/rubyvis/sceneelement.rb', line 79

def segmented
  @segmented
end

#shapeObject

Returns the value of attribute shape.



80
81
82
# File 'lib/rubyvis/sceneelement.rb', line 80

def shape
  @shape
end

#shape_angleObject

Returns the value of attribute shape_angle.



81
82
83
# File 'lib/rubyvis/sceneelement.rb', line 81

def shape_angle
  @shape_angle
end

#shape_radiusObject

Returns the value of attribute shape_radius.



82
83
84
# File 'lib/rubyvis/sceneelement.rb', line 82

def shape_radius
  @shape_radius
end

#shape_sizeObject

Returns the value of attribute shape_size.



83
84
85
# File 'lib/rubyvis/sceneelement.rb', line 83

def shape_size
  @shape_size
end

#spacingObject

Returns the value of attribute spacing.



84
85
86
# File 'lib/rubyvis/sceneelement.rb', line 84

def spacing
  @spacing
end

#start_angleObject

Returns the value of attribute start_angle.



85
86
87
# File 'lib/rubyvis/sceneelement.rb', line 85

def start_angle
  @start_angle
end

#stroke_dasharrayObject

Returns the value of attribute stroke_dasharray.



86
87
88
# File 'lib/rubyvis/sceneelement.rb', line 86

def stroke_dasharray
  @stroke_dasharray
end

#stroke_styleObject

Returns the value of attribute stroke_style.



87
88
89
# File 'lib/rubyvis/sceneelement.rb', line 87

def stroke_style
  @stroke_style
end

#targetObject

Returns the value of attribute target.



88
89
90
# File 'lib/rubyvis/sceneelement.rb', line 88

def target
  @target
end

#tensionObject

Returns the value of attribute tension.



89
90
91
# File 'lib/rubyvis/sceneelement.rb', line 89

def tension
  @tension
end

#textObject

Returns the value of attribute text.



90
91
92
# File 'lib/rubyvis/sceneelement.rb', line 90

def text
  @text
end

#text_alignObject

Returns the value of attribute text_align.



91
92
93
# File 'lib/rubyvis/sceneelement.rb', line 91

def text_align
  @text_align
end

#text_angleObject

Returns the value of attribute text_angle.



92
93
94
# File 'lib/rubyvis/sceneelement.rb', line 92

def text_angle
  @text_angle
end

#text_baselineObject

Returns the value of attribute text_baseline.



93
94
95
# File 'lib/rubyvis/sceneelement.rb', line 93

def text_baseline
  @text_baseline
end

#text_decorationObject

Returns the value of attribute text_decoration.



94
95
96
# File 'lib/rubyvis/sceneelement.rb', line 94

def text_decoration
  @text_decoration
end

#text_marginObject

Returns the value of attribute text_margin.



95
96
97
# File 'lib/rubyvis/sceneelement.rb', line 95

def text_margin
  @text_margin
end

#text_shadowObject

Returns the value of attribute text_shadow.



96
97
98
# File 'lib/rubyvis/sceneelement.rb', line 96

def text_shadow
  @text_shadow
end

#text_styleObject

Returns the value of attribute text_style.



97
98
99
# File 'lib/rubyvis/sceneelement.rb', line 97

def text_style
  @text_style
end

#titleObject

Returns the value of attribute title.



98
99
100
# File 'lib/rubyvis/sceneelement.rb', line 98

def title
  @title
end

#topObject

Returns the value of attribute top.



99
100
101
# File 'lib/rubyvis/sceneelement.rb', line 99

def top
  @top
end

#transformObject

Returns the value of attribute transform.



100
101
102
# File 'lib/rubyvis/sceneelement.rb', line 100

def transform
  @transform
end

#typeObject

Returns the value of attribute type.



101
102
103
# File 'lib/rubyvis/sceneelement.rb', line 101

def type
  @type
end

#urlObject

Returns the value of attribute url.



102
103
104
# File 'lib/rubyvis/sceneelement.rb', line 102

def url
  @url
end

#view_boxObject

Returns the value of attribute view_box.



104
105
106
# File 'lib/rubyvis/sceneelement.rb', line 104

def view_box
  @view_box
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.



103
104
105
# File 'lib/rubyvis/sceneelement.rb', line 103

def width
  @width
end

Instance Method Details

#[](v) ⇒ Object



113
114
115
116
117
118
119
120
121
# File 'lib/rubyvis/sceneelement.rb', line 113

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



106
107
108
109
110
111
112
# File 'lib/rubyvis/sceneelement.rb', line 106

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



122
123
124
125
126
# File 'lib/rubyvis/sceneelement.rb', line 122

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

#inspectObject



133
134
135
136
# File 'lib/rubyvis/sceneelement.rb', line 133

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



127
128
129
# File 'lib/rubyvis/sceneelement.rb', line 127

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

#sizeObject



130
131
132
# File 'lib/rubyvis/sceneelement.rb', line 130

def size
  @scenes.size
end

#size=(v) ⇒ Object



137
138
139
140
141
142
143
144
145
# File 'lib/rubyvis/sceneelement.rb', line 137

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