class CTioga2::Graphics::Types::Box

The base class for different kind of boxes

Public Class Methods

new() click to toggle source
# File lib/ctioga2/graphics/types/boxes.rb, line 29
def initialize
  raise "Use a derived class !"
end

Public Instance Methods

classes() click to toggle source

The classes enumerated here get added to the class list of the subwindow

# File lib/ctioga2/graphics/types/boxes.rb, line 62
def classes
  return []
end
to_frame_coordinates(t) click to toggle source

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

[ xl, yt, xr, yb ]

This function must be reimplemented in children.

# File lib/ctioga2/graphics/types/boxes.rb, line 37
def to_frame_coordinates(t)
  raise "Reimplement this in children !"
end
to_frame_margins(t) click to toggle source

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

# 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
within_frames(t, frame_coords = true) { || ... } click to toggle source

Runs the block within the context of the box.

# File lib/ctioga2/graphics/types/boxes.rb, line 49
def within_frames(t, frame_coords = true)
  t.context do
    t.subfigure(self.to_frame_margins(t)) do
      if frame_coords
        t.set_bounds([0, 1, 1, 0])
      end
      yield
    end
  end
end