Class: CTioga2::Graphics::Legends::LegendItem

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/graphics/legends/items.rb

Overview

All items that can be displayed in a legend derive from this one.

Direct Known Subclasses

CurveLegend, LegendLine, MultiColumnLegend

Constant Summary collapse

@@legend_item_numbering =

This class-wide variable is used to number text in a unique fashion

0

Instance Method Summary collapse

Constructor Details

#initializeLegendItem

Initializes the LegendItem. Children must call super to make sure the numbering is dealt with properly.



35
36
37
38
# File 'lib/ctioga2/graphics/legends/items.rb', line 35

def initialize
  @legend_number = @@legend_item_numbering
  @@legend_item_numbering += 1
end

Instance Method Details

#draw(t, legend_style, x, y) ⇒ Object

Draws the legend at the given top left position (x,y) in figure coordinates.



51
52
# File 'lib/ctioga2/graphics/legends/items.rb', line 51

def draw(t, legend_style, x, y)
end

#size(t, legend_style) ⇒ Object

Returns the (width, height) in figure coordinates of the legend element with the given Styles::LegendStyle and FigureMaker reference objects.

The returned values can be inaccurate to some extent.



45
46
47
# File 'lib/ctioga2/graphics/legends/items.rb', line 45

def size(t, legend_style)
  return [0, 0]
end