class CTioga2::Graphics::Legends::LegendStorage
This class holds a series of legends for curves.
Attributes
contents[RW]
An array of LegendItem
objects, in the order in which they should get displayed.
Public Class Methods
new()
click to toggle source
# File lib/ctioga2/graphics/legends/storage.rb, line 31 def initialize @contents = [] end
Public Instance Methods
add_item(item)
click to toggle source
Adds a LegendItem
or a Container to the LegendStorage
object.
# File lib/ctioga2/graphics/legends/storage.rb, line 37 def add_item(item) @contents << item end
harvest_contents()
click to toggle source
Returns a flat array of LegendItem
that belong to the same LegendArea
as the object in which the LegendStorage
was created.
# File lib/ctioga2/graphics/legends/storage.rb, line 44 def harvest_contents retval = [] for el in @contents if el.is_a? LegendItem retval << el elsif el.is_a? Elements::Container and (not el.legend_area) if el.legend_storage retval.concat(el.legend_storage.harvest_contents) end end end return retval end