Class: CTioga2::Graphics::Types::Box

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/graphics/types/boxes.rb

Overview

The base class for different kind of boxes

Direct Known Subclasses

GridBox, MarginsBox, PointBasedBox

Instance Method Summary collapse

Constructor Details

#initializeBox

Returns a new instance of Box.



31
32
33
# File 'lib/ctioga2/graphics/types/boxes.rb', line 31

def initialize
  raise "Use a derived class !"
end

Instance Method Details

#to_frame_coordinates(t) ⇒ Object

This function returns the frame coordinates of the box, in the form:

[ xl, yt, xr, yb ]

This function must be reimplemented in children.



39
40
41
# File 'lib/ctioga2/graphics/types/boxes.rb', line 39

def to_frame_coordinates(t)
  raise "Reimplement this in children !"
end

#to_frame_margins(t) ⇒ Object

Converts this object into an array suitable for use with FigureMaker#set_sub_frame.



45
46
47
48
# File 'lib/ctioga2/graphics/types/boxes.rb', line 45

def to_frame_margins(t)
  xl, yt, xr, yb = self.to_frame_coordinates(t)
  return [xl, 1 - xr, 1 - yt, yb]
end