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.



29
30
31
# File 'lib/ctioga2/graphics/types/boxes.rb', line 29

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.



37
38
39
# File 'lib/ctioga2/graphics/types/boxes.rb', line 37

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.



43
44
45
46
# File 'lib/ctioga2/graphics/types/boxes.rb', line 43

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